/* 《公共政策学》新形态交互教材 — design tokens & shared UI */
:root {
  --plum: #7e0c6e;
  --plum-600: #9a1f88;
  --plum-300: #c45bb0;
  --plum-50: #f7eaf4;
  --ink: #1a1520;
  --ink-2: #5c5464;
  --paper: #faf8f6;
  --surface: #ffffff;
  --line: #e8e0da;
  --gold: #b0892e;
  --ok: #1f7a4c;
  --err: #a33b3b;
  --shadow: 0 12px 40px rgba(26, 21, 32, 0.07);
  --radius-card: 12px;
  --radius-input: 10px;
  --radius-pill: 999px;
  --max: 1180px;
  --max-wide: 1280px;
  --prose: 48em;
  --prose-size: 22px;
  --prose-measure: 920px;
  --font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --font-ui: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", ui-monospace, Consolas, monospace;
  --nav-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --plum: #c45bb0;
    --plum-600: #d478c0;
    --plum-300: #e4a0d4;
    --plum-50: #2a1a28;
    --ink: #f2ecef;
    --ink-2: #b0a6b4;
    --paper: #121014;
    --surface: #1c181e;
    --line: #2e2832;
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--plum);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--plum-600);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* —— Nav —— */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}

.site-nav__inner {
  max-width: var(--max-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand__mark {
  flex: 0 0 auto;
  line-height: 0;
}

.brand__mark img {
  width: 42px;
  height: 42px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}

.brand__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  line-height: 1.15;
  min-width: 0;
}

.brand__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
}

.brand__sub {
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}

.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--ink-2);
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--plum);
  background: var(--plum-50);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: var(--plum);
  color: #fff;
}

.btn--primary:hover {
  background: var(--plum-600);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--plum);
  color: var(--plum);
}

.btn--sm {
  padding: 7px 12px;
  font-size: 12px;
}

/* —— Layout helpers —— */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: var(--max-wide);
}

.section {
  padding: 72px 0;
}

.section--tight {
  padding: 48px 0;
}

.section__head {
  margin-bottom: 28px;
}

.section__title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.section__desc {
  margin: 0;
  max-width: 42em;
  color: var(--ink-2);
  font-size: 14px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--plum);
}

/* —— Hero (photo + glass) —— */
@font-face {
  font-family: "MaoCalligraphy";
  src: url("../assets/fonts/maozedong.ttf") format("truetype");
  font-display: swap;
}

.hero {
  position: relative;
  padding: 56px 0 36px;
  overflow: hidden;
}

.hero--photo {
  padding: 0;
  /* campus panorama ~2000×508; keep hero close to image aspect so cover doesn't over-zoom */
  min-height: clamp(340px, 36vw, 520px);
  display: flex;
  align-items: center;
}

.hero--photo .container {
  width: 100%;
  padding-top: 48px;
  padding-bottom: 48px;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background:
    url("../assets/img/campus-hero.jpg") center center / cover no-repeat;
}

.hero__veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(18, 12, 22, 0.08) 0%,
      rgba(18, 12, 22, 0.14) 40%,
      rgba(26, 12, 28, 0.48) 72%,
      rgba(26, 12, 28, 0.72) 100%
    );
  z-index: 1;
}

.hero__panel {
  max-width: min(560px, 92%);
  width: min(560px, 92%);
  padding: 36px 40px 38px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 18px 48px rgba(10, 6, 16, 0.28);
}

.hero__affil {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.72);
}

.hero__title {
  margin: 0 0 18px;
  line-height: 1.1;
}

.hero__title-main {
  display: block;
  font-family: "MaoCalligraphy", "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(44px, 5.6vw, 68px);
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.06em;
  line-height: 1.12;
  white-space: nowrap;
  text-shadow: 0 2px 18px rgba(40, 8, 40, 0.35);
}

.hero__title-sub {
  display: block;
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.4em;
  white-space: nowrap;
}

.hero__lead {
  margin: 0 0 28px;
  max-width: 36em;
  color: rgba(255, 255, 255, 0.82);
  font-size: 16px;
  line-height: 1.85;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn--ghost-light {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
}

.btn--ghost-light:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.hero__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: end;
}

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

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px 16px;
}

.stat-card__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--plum);
  line-height: 1;
}

.stat-card__label {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

.hero__glow {
  position: absolute;
  inset: auto -10% -30% 40%;
  height: 55%;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--plum) 18%, transparent), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* —— Graph —— */
.graph-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.graph-toolbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: var(--radius-pill);
  gap: 2px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.segmented button.is-active {
  background: var(--surface);
  color: var(--plum);
  box-shadow: 0 1px 4px rgba(26, 21, 32, 0.08);
}

.graph-toolbar__hint {
  margin-left: auto;
  font-size: 12px;
  color: var(--ink-2);
}

.graph-stage {
  position: relative;
  height: min(72vh, 640px);
  min-height: 480px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--plum) 6%, transparent), transparent 40%),
    radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--gold) 5%, transparent), transparent 35%),
    var(--surface);
}

.graph-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.graph-stage canvas:active {
  cursor: grabbing;
}

.graph-tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ink) 92%, transparent);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.graph-tip.is-on {
  opacity: 1;
  transform: translateY(0);
}

.graph-tip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.legend-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

/* —— Q&A —— */
.qa-shell {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
  align-items: start;
}

.qa-card,
.side-card,
.toc-card,
.contribute-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
}

.qa-card {
  padding: 20px;
}

.qa-form {
  display: grid;
  gap: 12px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: var(--paper);
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--plum) 16%, transparent);
}

.qa-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qa-meta {
  font-size: 12px;
  color: var(--ink-2);
}

.qa-answer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  min-height: 88px;
}

.qa-answer__empty {
  color: var(--ink-2);
  font-size: 13px;
}

.qa-answer__body {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.qa-answer__body.is-loading {
  color: var(--ink-2);
  font-family: var(--font-ui);
}

.qa-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.chip:hover {
  border-color: var(--plum);
  color: var(--plum);
  background: var(--plum-50);
}

.side-card {
  padding: 20px;
}

.side-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 16px;
}

.side-card p {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 13px;
}

.note-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-2);
  font-size: 13px;
}

.note-list li + li {
  margin-top: 6px;
}

/* —— TOC —— */
.toc-grid {
  display: grid;
  gap: 18px;
}

.volume-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.volume-block__head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: baseline;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, var(--plum-50), transparent 55%);
}

.volume-block__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}

.volume-block__blurb {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.chapter-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-list a {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  transition: background 0.18s ease;
}

.chapter-list li:last-child a {
  border-bottom: 0;
}

.chapter-list a:hover {
  background: color-mix(in srgb, var(--plum) 4%, transparent);
}

.chapter-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--plum);
}

.chapter-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
}

.chapter-go {
  font-size: 12px;
  color: var(--ink-2);
}

/* —— Contribute —— */
.contribute-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.contribute-card {
  padding: 20px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.file-drop {
  border: 1px dashed color-mix(in srgb, var(--plum) 35%, var(--line));
  border-radius: var(--radius-input);
  padding: 16px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
  background: color-mix(in srgb, var(--plum) 3%, transparent);
  cursor: pointer;
}

.file-drop.is-drag {
  border-color: var(--plum);
  background: var(--plum-50);
}

.file-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--ink-2);
}

.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.form-status {
  min-height: 1.4em;
  font-size: 13px;
}

.form-status.is-ok {
  color: var(--ok);
}

.form-status.is-err {
  color: var(--err);
}

/* —— Footer —— */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 0 48px;
  color: var(--ink-2);
  font-size: 12px;
}

.site-footer__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: space-between;
}

.site-footer__inner--center {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
}

.site-footer__school {
  height: 34px;
  width: auto;
  max-width: min(420px, 86vw);
  display: block;
  object-fit: contain;
}

.site-footer__note {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
}

.site-footer__meta {
  margin: 0;
  color: color-mix(in srgb, var(--ink-2) 80%, transparent);
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* —— About / references —— */
.about-hero {
  padding: 48px 0 8px;
}

.about-hero h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.about-hero__lead {
  margin: 0;
  max-width: 40em;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.8;
}

.about-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

.about-side {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
}

.about-side h2 {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.about-prose {
  max-width: min(48em, var(--prose-measure));
  margin: 0;
}

.ref-grid {
  display: grid;
  gap: 18px;
}

.ref-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 22px 24px 18px;
}

.ref-card h3 {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--plum);
}

.ref-list {
  margin: 0;
  padding-left: 1.3em;
  font-family: var(--font-ui);
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--ink-2);
}

.ref-list li + li {
  margin-top: 0.55em;
}

.ref-note {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

@media (max-width: 900px) {
  .about-layout {
    grid-template-columns: 1fr;
  }

  .about-side {
    position: static;
  }
}

/* —— Reader shared —— */
.reader-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 0;
  min-height: calc(100dvh - var(--nav-h));
}

.reader-side {
  position: sticky;
  top: var(--nav-h);
  height: calc(100dvh - var(--nav-h));
  overflow: auto;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 80%, var(--paper));
  padding: 18px 14px 32px;
}

.reader-side h2 {
  margin: 0 0 12px;
  padding: 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}

.side-toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-toc a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.4;
}

.side-toc .lvl-1 {
  margin-top: 10px;
  padding: 8px 10px 6px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--plum);
  letter-spacing: 0.01em;
}

.side-toc li:first-child .lvl-1 {
  margin-top: 0;
}

.side-toc .lvl-2 {
  padding-left: 14px;
  font-size: 13px;
  color: var(--ink-2);
}

.side-toc a:hover,
.side-toc a.is-active {
  color: var(--plum);
  background: var(--plum-50);
}

.side-toc .lvl-1:hover,
.side-toc .lvl-1.is-active {
  color: var(--plum);
  background: color-mix(in srgb, var(--plum) 10%, transparent);
}

.side-toc .lvl-3 {
  padding-left: 24px;
  font-size: 12px;
  color: var(--ink-2);
}

.reader-main {
  min-width: 0;
  padding: 32px 48px 96px;
}

.prose {
  max-width: min(var(--prose), var(--prose-measure));
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: var(--prose-size);
  line-height: 1.92;
  color: var(--ink);
}

.prose h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.prose h2 {
  margin: 2.4em 0 0.8em;
  font-size: 1.35em;
  line-height: 1.35;
  padding-top: 0.4em;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.prose h3 {
  margin: 1.8em 0 0.6em;
  font-size: 1.12em;
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.prose p {
  margin: 0 0 1.1em;
}

.prose ul,
.prose ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
}

.prose li + li {
  margin-top: 0.35em;
}

.prose figure.fig {
  margin: 1.8em 0;
}

.prose figure.fig img {
  display: block;
  width: 100%;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.prose figure.fig figcaption {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--ink-2);
  text-align: center;
}

.prose .callout {
  margin: 1.6em 0;
  padding: 16px 18px;
  border-left: 3px solid var(--plum);
  background: color-mix(in srgb, var(--plum) 5%, var(--surface));
  border-radius: 0 10px 10px 0;
  font-size: 0.95em;
}

.prose .callout-label {
  display: inline-block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--plum);
}

.prose .callout-body p:last-child {
  margin-bottom: 0;
}

/* —— Footnotes / endnotes —— */
.prose .fn-ref {
  font-size: 0.7em;
  line-height: 0;
  vertical-align: super;
}

.prose .fn-ref a {
  color: var(--plum);
  text-decoration: none;
  font-weight: 600;
  padding: 0 1px;
}

.prose .fn-ref a:hover {
  text-decoration: underline;
}

.prose .fn-notes {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.prose .fn-notes-title {
  margin: 0 0 0.8em;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  border: 0;
  padding: 0;
}

.prose .fn-list {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.prose .fn-list li {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  gap: 0.35em 0.4em;
  padding: 0.45em 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--line) 80%, transparent);
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.prose .fn-list li:last-child {
  border-bottom: 0;
}

.prose .fn-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--plum);
  padding-top: 0.15em;
}

.prose .fn-text {
  min-width: 0;
  word-break: break-word;
}

.prose .fn-src {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--plum);
  border: 1px solid color-mix(in srgb, var(--plum) 25%, transparent);
  border-radius: 3px;
  padding: 0 3px;
  margin: 0 1px;
}

.prose .fn-back {
  grid-column: 2;
  justify-self: start;
  font-size: 11px;
  color: var(--plum);
  text-decoration: none;
  opacity: 0.7;
}

.prose .fn-back:hover {
  opacity: 1;
}

.prose .fn-list li:target {
  background: var(--plum-50);
  border-radius: 6px;
}

/* —— Tables —— */
.prose .table-wrap {
  margin: 1.6em 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.prose .md-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.55;
}

.prose .md-table th,
.prose .md-table td {
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.prose .md-table th {
  font-weight: 600;
  color: var(--ink);
  background: color-mix(in srgb, var(--plum) 5%, var(--surface));
  white-space: nowrap;
}

.prose .md-table tbody tr:last-child td {
  border-bottom: 0;
}

.prose .md-table tbody tr:hover td {
  background: color-mix(in srgb, var(--plum) 3%, transparent);
}

.prose .md-table code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  padding: 1px 4px;
  border-radius: 4px;
}

.lede-box {
  margin: 0 0 28px;
  padding: 18px 20px;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, var(--plum-50), color-mix(in srgb, var(--gold) 8%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--plum) 12%, var(--line));
}

.lede-box .label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--plum);
}

.goals-box {
  margin: 0 0 28px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.goals-box .label {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

.goals-box ol {
  margin: 0;
  padding-left: 1.2em;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
}

.chapter-pager {
  max-width: min(var(--prose), var(--prose-measure));
  margin: 48px auto 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pager-link {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.pager-link:hover {
  border-color: var(--plum);
  transform: translateY(-1px);
}

.pager-link span {
  display: block;
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 4px;
}

.pager-link strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.volume-intro {
  margin: 0 0 36px;
  padding: 20px 22px;
  border-radius: var(--radius-card);
  border: 1px solid var(--line);
  background: var(--surface);
}

.volume-intro h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 18px;
}

.volume-intro .body {
  font-family: var(--font-display);
  font-size: 14px;
  line-height: 1.85;
  color: var(--ink-2);
}

.volume-intro .body p {
  margin: 0 0 0.9em;
}

.volume-intro .body p:last-child {
  margin-bottom: 0;
}

.book-progress {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--plum), var(--plum-300));
  z-index: 50;
}

/* —— Reading controls (font size) —— */
.read-tools {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.read-tools button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
}

.read-tools button:hover {
  background: var(--plum-50);
  color: var(--plum);
}

.read-tools button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.read-tools .rt-a {
  font-size: 12px;
}

.read-tools .rt-a-plus {
  font-size: 18px;
}

.read-tools .rt-label {
  min-width: 2.8em;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .read-tools {
    right: 12px;
    bottom: 12px;
  }
}

/* —— Responsive —— */
@media (max-width: 960px) {
  .hero__grid,
  .qa-shell,
  .contribute-layout,
  .form-row {
    grid-template-columns: 1fr;
  }

  .hero--photo .container {
    justify-content: center;
  }

  .hero__panel {
    max-width: 100%;
    width: 100%;
  }

  .reader-layout {
    grid-template-columns: 1fr;
  }

  .reader-side {
    position: relative;
    top: 0;
    height: auto;
    max-height: 280px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .reader-main {
    padding: 28px 18px 72px;
  }

  .chapter-list a {
    grid-template-columns: 44px 1fr;
  }

  .chapter-go {
    display: none;
  }
}

@media (max-width: 640px) {
  .site-nav__inner {
    padding: 0 14px;
  }

  .nav-links a {
    padding: 7px 9px;
    font-size: 12px;
  }

  .brand__sub {
    display: none;
  }

  .container {
    padding: 0 16px;
  }

  .section {
    padding: 48px 0;
  }

  .hero {
    padding-top: 40px;
  }

  .graph-toolbar__hint {
    display: none;
  }

  .chapter-pager {
    grid-template-columns: 1fr;
  }
}
