:root {
  --sysu-green: #015726;
  --sysu-green-dark: #003d1b;
  --sysu-green-soft: #dce9df;
  --kapok-red: #a31f34;
  --paper: #f4f0e6;
  --surface: #fffcf6;
  --ink: #17231c;
  --muted: #647068;
  --line: #d8d5c9;
  --gold: #b99a5e;
  --shadow: 0 18px 48px rgba(22, 35, 28, .08);
  --radius-small: 8px;
  --radius-large: 14px;
  --content-width: 1120px;
  --ease: cubic-bezier(.2, .75, .25, 1);
  --motion-duration: 280ms;
  --motion-distance: 12px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 35, 28, .025) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.72;
  text-wrap: pretty;
}

a { color: inherit; }

button,
input { font: inherit; }

:focus-visible {
  outline: 3px solid rgba(163, 31, 52, .28);
  outline-offset: 3px;
}

.chapter-header {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(216, 213, 201, .88);
  background: rgba(244, 240, 230, .94);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(calc(100% - 40px), var(--content-width));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand,
.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.brand {
  gap: 12px;
  font-family: "Songti SC", STSong, "Noto Serif CJK SC", serif;
  font-weight: 700;
  letter-spacing: .08em;
}

.brand-logo {
  width: 42px;
  height: 42px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: url("duck-university-logo.png") center / contain no-repeat;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.back-link {
  padding: 8px 12px;
  color: var(--muted);
  border-radius: var(--radius-small);
  font-size: 14px;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}

.back-link:hover {
  color: var(--sysu-green);
  background: var(--sysu-green-soft);
}

main {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding-bottom: 96px;
}

.chapter-hero {
  padding: 72px 0 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .36fr);
  align-items: end;
  gap: 64px;
  border-bottom: 1px solid var(--line);
}

.eyebrow,
.chapter-number {
  margin: 0 0 16px;
  color: var(--kapok-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-family: "Songti SC", STSong, "Noto Serif CJK SC", serif;
  line-height: 1.15;
}

h1 {
  margin-bottom: 20px;
  color: var(--sysu-green);
  font-size: clamp(56px, 8vw, 104px);
  letter-spacing: -.055em;
}

.chapter-lede {
  max-width: 720px;
  margin: 0;
  color: #3d4942;
  font-size: clamp(18px, 2vw, 22px);
}

.chapter-stat {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: rgba(255, 252, 246, .68);
}

.chapter-stat strong {
  display: block;
  color: var(--sysu-green);
  font-family: "Songti SC", STSong, serif;
  font-size: 42px;
  line-height: 1;
}

.chapter-stat span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.chapter-tools {
  position: sticky;
  top: 73px;
  z-index: 20;
  padding: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(var(--paper) 78%, transparent);
}

.chapter-search {
  flex: 1;
  min-height: 48px;
  padding: 10px 16px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface);
}

.expand-button {
  min-height: 48px;
  padding: 10px 16px;
  color: var(--surface);
  border: 1px solid var(--sysu-green);
  border-radius: var(--radius-small);
  background: var(--sysu-green);
  cursor: pointer;
}

.chapter-nav {
  padding: 0 0 24px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.chapter-nav a {
  flex: none;
  min-height: 44px;
  padding: 9px 14px;
  display: inline-flex;
  align-items: center;
  color: var(--sysu-green);
  border: 1px solid rgba(1, 87, 38, .18);
  border-radius: 999px;
  background: rgba(220, 233, 223, .55);
  text-decoration: none;
  font-size: 14px;
}

.content-section {
  padding: 48px 0 8px;
}

.section-heading {
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 24px;
  align-items: baseline;
}

.section-heading span {
  color: var(--kapok-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(34px, 4vw, 52px);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.topic-card {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: rgba(255, 252, 246, .82);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .75) inset;
  transition: transform 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.topic-card:hover {
  border-color: rgba(1, 87, 38, .36);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.topic-card summary {
  min-height: 76px;
  padding: 22px 56px 22px 24px;
  position: relative;
  display: block;
  cursor: pointer;
  list-style: none;
}

.topic-card summary::-webkit-details-marker { display: none; }

.topic-card summary::after {
  content: "+";
  position: absolute;
  top: 20px;
  right: 22px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--sysu-green);
  border: 1px solid rgba(1, 87, 38, .22);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.topic-card[open] summary::after {
  content: "−";
  color: var(--surface);
  background: var(--sysu-green);
}

.topic-card h3 {
  margin-bottom: 6px;
  font-size: 25px;
}

.card-kicker {
  color: var(--kapok-red);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

.card-body {
  padding: 0 24px 24px;
  color: #3d4942;
  border-top: 1px solid rgba(216, 213, 201, .72);
}

.card-body > :first-child { margin-top: 20px; }
.card-body > :last-child { margin-bottom: 0; }

.card-body ul,
.card-body ol {
  padding-left: 1.25em;
}

.card-body li + li { margin-top: 7px; }

.card-body a {
  color: var(--sysu-green);
  text-underline-offset: 3px;
}

.info-note,
.experience-note,
.safety-note {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius-small);
  font-size: 14px;
}

.info-note {
  color: var(--sysu-green-dark);
  border: 1px solid rgba(1, 87, 38, .22);
  background: rgba(220, 233, 223, .64);
}

.experience-note {
  color: var(--sysu-green-dark);
  border: 1px solid rgba(1, 87, 38, .24);
  background: rgba(1, 87, 38, .065);
}

.safety-note {
  color: #604718;
  border: 1px solid rgba(185, 154, 94, .4);
  background: rgba(185, 154, 94, .12);
}

.inline-link-card {
  min-height: 108px;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--surface);
  border-radius: var(--radius-large);
  background: var(--sysu-green);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.inline-link-card strong {
  display: block;
  font-family: "Songti SC", STSong, serif;
  font-size: 26px;
}

.inline-link-card span { color: rgba(255, 252, 246, .75); }

/* Digital chapter: editorial index, not a card grid. */
.digital-page .chapter-tools.digital-tools {
  grid-template-columns: 1fr;
}

.digital-page .content-section {
  padding-top: 64px;
}

.digital-page .topic-grid {
  display: block;
  border-top: 1px solid var(--ink);
}

.digital-page .topic-card {
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  transition: border-color 180ms var(--ease);
}

.digital-page .topic-card:hover {
  border-color: var(--sysu-green);
  box-shadow: none;
  transform: none;
}

.digital-page .topic-card summary {
  min-height: 0;
  padding: 28px 64px 28px 0;
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: baseline;
  gap: 24px;
}

.digital-page .topic-card summary::after {
  top: 27px;
  right: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 24px;
}

.digital-page .topic-card[open] summary::after {
  color: var(--sysu-green);
  background: transparent;
}

.digital-page .topic-card h3 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
}

.digital-page .card-kicker {
  color: var(--kapok-red);
}

.digital-page .card-body {
  max-width: 820px;
  margin-left: 152px;
  padding: 0 0 32px;
  border-top: 0;
  color: #34423a;
}

.digital-page .card-body > :first-child {
  margin-top: 0;
}

.digital-page .info-note,
.digital-page .experience-note,
.digital-page .safety-note {
  border-radius: 0;
  border-width: 0 0 0 2px;
  background: transparent;
}

.page-footer {
  margin-top: 64px;
  padding: 32px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 14px;
}

.page-footer strong {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
}

.page-footer p { margin: 0; }

.builder-mark {
  align-self: end;
  color: var(--sysu-green);
  font-family: "Songti SC", STSong, serif;
  font-weight: 700;
}

.empty-message {
  display: none;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 760px) {
  .digital-page .topic-card summary {
    padding: 22px 52px 22px 0;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .digital-page .topic-card summary::after {
    top: 20px;
  }

  .digital-page .card-body {
    margin-left: 0;
    padding-bottom: 26px;
  }
  body { font-size: 16px; }

  .header-inner,
  main { width: min(calc(100% - 28px), var(--content-width)); }

  .chapter-hero {
    padding: 48px 0 40px;
    grid-template-columns: 1fr;
    gap: 28px;
  }

  h1 { font-size: clamp(50px, 17vw, 76px); }

  .chapter-stat { max-width: 280px; }

  .chapter-tools {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .topic-grid { grid-template-columns: 1fr; }

  .topic-card:hover {
    border-color: var(--line);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .75) inset;
    transform: none;
  }

  .topic-card summary {
    touch-action: manipulation;
    transition: transform 120ms var(--ease), background 180ms var(--ease);
  }

  .topic-card summary:active {
    transform: scale(.99);
  }

  .topic-card .card-body.is-opening {
    animation: mobile-card-open 240ms var(--ease) both;
  }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .section-heading h2 { font-size: 36px; }

  .topic-card summary { min-height: 72px; }

  .page-footer { grid-template-columns: 1fr; }

  .builder-mark { justify-self: start; }

  .brand > span:not(.brand-logo) { display: none; }
}

@keyframes mobile-card-open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
