:root {
  --paper: #f2f2f2;
  --paper-high: #fcfcfc;
  --ink: #082d4f;
  --ink-soft: #3f566c;
  --line: rgba(8, 45, 79, .24);
  --line-light: rgba(242, 242, 242, .3);
  --font-display: Marcellus, "Noto Serif CJK SC", "Songti SC", Georgia, serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 5px; }
a:hover { text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
img, svg, canvas { max-width: 100%; }
button, input { font: inherit; }
::selection { color: var(--paper-high); background: var(--ink); }
.shell { width: min(100%, 1480px); margin: 0 auto; padding: 0 32px; }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.site-header { position: sticky; top: 0; z-index: 10; background: rgba(242,242,242,.97); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 88px; display: grid; grid-template-columns: 240px 1fr auto; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 50%; font-family: var(--font-display); font-size: 25px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 17px; font-weight: 500; letter-spacing: .06em; }
.brand-text small { margin-top: 5px; font-size: 12px; letter-spacing: .16em; }
.primary-nav ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 22px; margin: 0; padding: 0; list-style: none; }
.primary-nav a { display: block; min-height: 44px; padding: 10px 0; font-size: 14px; text-decoration: none; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] { border-bottom: 1px solid var(--ink); }
.nav-cta { min-height: 44px; display: flex; align-items: center; padding: 8px 16px; border: 1px solid var(--ink); text-decoration: none; font-size: 14px; }
.nav-cta:hover { color: var(--paper-high); background: var(--ink); }
.menu-button { display: none; min-width: 48px; min-height: 44px; color: var(--ink); background: transparent; border: 1px solid var(--ink); cursor: pointer; }

.hero { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 24px; padding: 72px 0 64px; }
.hero-copy { grid-column: 1 / 8; display: flex; flex-direction: column; justify-content: center; }
.eyebrow { margin: 0 0 24px; font-family: var(--font-mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; }
h1 { margin: 0; font-size: clamp(58px,7.2vw,110px); line-height: .96; letter-spacing: -.045em; }
.hero-cn { margin: 30px 0 0; max-width: 620px; font-size: 21px; line-height: 1.65; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 36px; font-family: var(--font-mono); font-size: 12px; }
.hero-meta span { padding-top: 8px; border-top: 1px solid var(--line); }
.hero-visual { grid-column: 9 / 13; align-self: center; }
.curve-frame { padding: 14px; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); }
.curve-frame-inner { padding: 18px; border: 1px solid var(--line-light); }
.curve-frame svg { display: block; width: 100%; height: auto; }
.curve-caption { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; }

.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section-grid { display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 24px; }
.section-aside { grid-column: 1 / 4; }
.section-main { grid-column: 5 / 13; min-width: 0; }
.section-kicker { margin: 0 0 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
h2 { margin: 0; font-size: clamp(32px,3.5vw,54px); line-height: 1.12; letter-spacing: -.025em; }
h3 { margin: 0 0 12px; font-size: 25px; line-height: 1.25; }
.section-intro { max-width: 68ch; color: var(--ink-soft); }
.index-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.index-row { display: grid; grid-template-columns: 64px minmax(0,1.2fr) minmax(0,1fr) 32px; gap: 20px; align-items: center; padding: 22px 8px; border-bottom: 1px solid var(--line); text-decoration: none; }
.index-row:hover { background: var(--paper-high); }
.index-code { font-family: var(--font-mono); font-size: 12px; }
.index-title { font-family: var(--font-display); font-size: 23px; line-height: 1.3; }
.index-desc { color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.index-arrow { font-family: var(--font-mono); text-align: right; }

.page-hero { padding: 72px 0 56px; border-bottom: 1px solid var(--line); }
.page-hero h1 { max-width: 1000px; font-size: clamp(50px,6.4vw,92px); }
.page-hero .lead { max-width: 70ch; margin: 28px 0 0; font-size: 20px; color: var(--ink-soft); }
.page-content { padding: 56px 0 72px; }
.content-narrow { max-width: 78ch; }
.content-narrow p { margin: 20px 0; }
.content-narrow h2 { margin: 48px 0 20px; font-size: 36px; }
.content-narrow h3 { margin-top: 36px; }
.content-narrow ul, .content-narrow ol { padding-left: 24px; }
.content-narrow li + li { margin-top: 10px; }
.math-formula { margin: 28px 0; padding: 24px; overflow-x: auto; border: double 3px var(--ink); background: var(--paper-high); font-family: var(--font-display); font-size: 25px; text-align: center; }
.math-formula code { font-family: var(--font-mono); font-size: .75em; }
.note { padding: 20px 22px; border-left: 2px solid var(--ink); background: var(--paper-high); }
.note p { margin: 0; }

.lab-grid { display: grid; grid-template-columns: minmax(280px,4fr) minmax(0,8fr); gap: 32px; align-items: start; }
.lab-controls { padding: 24px; border: 1px solid var(--ink); background: var(--paper-high); }
.lab-controls h2 { font-size: 32px; }
.lab-controls label { display: block; margin: 24px 0 8px; font-family: var(--font-mono); font-size: 12px; }
.lab-controls input { width: 100%; min-height: 48px; padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 0; }
.lab-controls button { width: 100%; min-height: 48px; margin-top: 16px; color: var(--paper-high); background: var(--ink); border: 1px solid var(--ink); cursor: pointer; }
.lab-controls button:hover { opacity: .88; }
.lab-controls button:disabled { opacity: .55; cursor: wait; }
.lab-examples { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.lab-examples button { width: auto; min-width: 48px; margin: 0; color: var(--ink); background: transparent; }
.lab-result { min-height: 104px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.lab-result strong { display: block; font-family: var(--font-display); font-size: 34px; font-weight: 400; }
.lab-result span { display: block; font-size: 14px; color: var(--ink-soft); }
.lab-error { color: #8a2633; }
.lab-canvas-wrap { padding: 14px; color: var(--paper); background: var(--ink); }
.lab-canvas-head { display: flex; justify-content: space-between; gap: 16px; padding: 4px 4px 14px; font-family: var(--font-mono); font-size: 11px; }
#point-canvas { display: block; width: 100%; height: auto; aspect-ratio: 1.45; background: var(--paper-high); }
.count-table { width: 100%; margin-top: 28px; border-collapse: collapse; font-family: var(--font-mono); font-size: 14px; }
.count-table th, .count-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: right; }
.count-table th:first-child, .count-table td:first-child { text-align: left; }

.publication-list { margin: 0; padding: 0; list-style: none; counter-reset: paper; }
.publication-list li { position: relative; padding: 24px 0 24px 62px; border-bottom: 1px solid var(--line); counter-increment: paper; }
.publication-list li::before { content: counter(paper, decimal-leading-zero); position: absolute; left: 0; top: 28px; font-family: var(--font-mono); font-size: 12px; }
.paper-title { display: block; font-family: var(--font-display); font-size: 23px; line-height: 1.35; }
.paper-meta { display: block; margin-top: 8px; color: var(--ink-soft); font-size: 14px; }
.tag { display: inline-block; margin-left: 8px; padding: 0 6px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; }

.site-footer { color: var(--paper); background: var(--ink); }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 48px 0; }
.footer-grid a { text-underline-offset: 5px; }
.footer-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .12em; }
.footer-text { max-width: 56ch; color: #d6dee5; }
.footer-word { overflow: hidden; padding: 12px 0 30px; border-top: 1px solid var(--line-light); font-family: var(--font-display); font-size: clamp(52px,10.7vw,154px); line-height: 1; letter-spacing: -.045em; white-space: nowrap; }
.footer-bottom { display: flex; justify-content: space-between; gap: 24px; padding: 18px 0 24px; border-top: 1px solid var(--line-light); font-family: var(--font-mono); font-size: 11px; }

@media (max-width: 1100px) {
  .header-inner { grid-template-columns: 210px 1fr; }
  .nav-cta { display: none; }
  .primary-nav ul { justify-content: flex-end; gap: 4px 16px; }
  .hero-copy { grid-column: 1 / 8; }
  .hero-visual { grid-column: 8 / 13; }
  .index-row { grid-template-columns: 48px minmax(0,1fr) 28px; }
  .index-desc { grid-column: 2 / 3; }
  .index-arrow { grid-column: 3; grid-row: 1; }
}

@media (max-width: 800px) {
  html { scroll-padding-top: 76px; }
  .shell { padding: 0 18px; }
  .header-inner { min-height: 72px; display: flex; justify-content: space-between; gap: 16px; }
  .brand-mark { width: 36px; height: 36px; font-size: 22px; }
  .brand-text strong { font-size: 15px; }
  .menu-button { display: block; }
  .primary-nav { position: absolute; left: 0; right: 0; top: 72px; display: none; padding: 12px 18px 20px; background: var(--paper); border-bottom: 1px solid var(--ink); }
  .primary-nav[data-open="true"] { display: block; }
  .primary-nav ul { display: block; }
  .primary-nav a { border-bottom: 1px solid var(--line); }
  .hero { display: block; padding: 48px 0; }
  .hero-copy { display: block; }
  h1 { font-size: 58px; }
  .hero-cn { font-size: 18px; }
  .hero-visual { margin-top: 40px; }
  .section { padding: 48px 0; }
  .section-grid { display: block; }
  .section-aside { margin-bottom: 28px; }
  .index-row { grid-template-columns: 38px minmax(0,1fr) 24px; gap: 12px; padding: 18px 4px; }
  .index-title { font-size: 20px; }
  .index-desc { font-size: 13px; }
  .page-hero { padding: 48px 0 40px; }
  .page-hero h1 { font-size: 50px; }
  .page-hero .lead { font-size: 17px; }
  .lab-grid { display: block; }
  .lab-canvas-wrap { margin-top: 24px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  .footer-word { font-size: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .menu-button, .lab-controls, .site-footer { display: none; }
  body { background: var(--paper-high); }
  .section, .page-content { padding: 24px 0; }
  a { text-decoration: none; }
}


/* Slow ruler-and-compass background on the home page. */
.hero { position: relative; isolation: isolate; }
.construction-bg { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; opacity: .32; pointer-events: none; }
.hero-copy, .hero-visual { position: relative; z-index: 1; }

/* Forty-person editorial article. */
.people-tools { display: grid; grid-template-columns: auto minmax(220px,1fr) auto auto; gap: 16px; align-items: center; padding: 20px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.people-tools label { font-size: 14px; }
.people-tools input { min-height: 48px; padding: 8px 12px; color: var(--ink); background: var(--paper-high); border: 1px solid var(--ink); border-radius: 0; }
.people-tools button { min-height: 48px; padding: 8px 18px; color: var(--ink); background: transparent; border: 1px solid var(--ink); cursor: pointer; }
.people-tools button:hover { color: var(--paper-high); background: var(--ink); }
#people-count { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.people-note { margin: 24px 0 40px; }
.people-list { border-top: 1px solid var(--ink); }
.person-card { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 24px; padding: 36px 12px; border-bottom: 1px solid var(--line); }
.person-card:hover { background: var(--paper-high); }
.person-card[hidden] { display: none; }
.person-index { padding-top: 5px; font-family: var(--font-mono); font-size: 14px; }
.person-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; }
.person-heading h2 { margin: 0; font-size: 36px; }
.person-heading span { font-family: var(--font-display); font-size: 18px; color: var(--ink-soft); }
.person-meta { margin: 8px 0 16px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.person-main > p:not(.person-meta):not(.person-source) { max-width: 76ch; margin: 16px 0; }
.person-idea { display: inline-block; margin: 4px 0 12px; padding: 7px 10px; border: 1px solid var(--line); font-family: var(--font-display); font-size: 18px; }
.person-source { margin: 0; font-family: var(--font-mono); font-size: 11px; color: var(--ink-soft); }
.people-empty { padding: 48px 0; font-size: 20px; }

@media (max-width: 800px) {
  .people-tools { grid-template-columns: 1fr auto; }
  .people-tools label { grid-column: 1 / -1; }
  .people-tools input { grid-column: 1 / -1; }
  #people-count { text-align: right; }
  .person-card { grid-template-columns: 40px minmax(0,1fr); gap: 12px; padding: 28px 4px; }
  .person-heading h2 { font-size: 30px; }
  .person-heading span { font-size: 16px; }
}

@media print {
  .people-tools { display: none; }
  .person-card { break-inside: avoid; }
}

/* Standalone mathematician articles. */
.person-detail-en { margin: 20px 0 0; font-family: var(--font-display); font-size: 28px; color: var(--ink-soft); }
.story-lead { font-size: 21px; line-height: 1.85; }
.article-siblings { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin-top: 48px; padding: 20px 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.article-siblings a:last-child { text-align: right; }
.article-siblings span { font-family: var(--font-mono); font-size: 12px; }
.person-read { font-weight: 600; }
@media (max-width: 800px) { .person-detail-en { font-size: 22px; } .story-lead { font-size: 18px; } .article-siblings { grid-template-columns: 1fr 1fr; } .article-siblings span { display: none; } }

/* Interactive mathematics discipline atlas. */
.discipline-map { margin: 0 0 56px; padding: 20px; border: double 3px var(--ink); background: var(--paper-high); }
.discipline-map figcaption { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.discipline-map figcaption strong { font-family: var(--font-display); font-size: 28px; font-weight: 400; }
.discipline-map figcaption > span:last-child { color: var(--ink-soft); font-size: 13px; }
.discipline-map svg { display: block; width: 100%; height: auto; }
.map-edges line { stroke: var(--ink); stroke-opacity: .22; stroke-width: 1.3; }
.map-edges line.is-active { stroke-opacity: .95; stroke-width: 2.6; }
.map-root rect { fill: var(--ink); stroke: var(--ink); }
.map-root text { fill: var(--paper); font-family: var(--font-display); font-size: 22px; text-anchor: middle; }
.map-node { cursor: pointer; }
.map-node rect { fill: var(--paper-high); stroke: var(--ink); stroke-width: 1.2; }
.map-node text { fill: var(--ink); font-family: var(--font-display); font-size: 19px; text-anchor: middle; pointer-events: none; }
.map-node .node-en, .map-root .node-en { font-family: var(--font-mono); font-size: 9px; letter-spacing: .04em; }
.map-node:hover rect, .map-node:focus rect, .map-node.is-active rect { fill: var(--ink); }
.map-node:hover text, .map-node:focus text, .map-node.is-active text { fill: var(--paper-high); }
.map-node.is-related rect { stroke-width: 2.4; }
.map-node:focus { outline: none; }
.map-node:focus-visible rect { stroke-width: 4; }
.map-mobile { display: none; }
@media (max-width: 800px) { .discipline-map { padding: 14px; } .discipline-map svg { display: none; } .map-mobile { display: block; padding-top: 20px; } .map-mobile > strong { display: block; margin-bottom: 12px; font-family: var(--font-display); font-size: 28px; } .map-mobile div { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .map-mobile a { min-height: 44px; padding: 8px; border: 1px solid var(--line); text-decoration: none; } }


/* Construction moved below the hero, behind the research index. */
.structure-section { position: relative; isolation: isolate; overflow: hidden; }
.structure-section .construction-bg { z-index: 0; opacity: .24; }
.structure-section .section-grid { position: relative; z-index: 1; }
.structure-section .index-row:hover { background: rgba(252,252,252,.82); }

/* Castle variants for every discipline node. */
.map-root path { fill: var(--ink); stroke: var(--ink); }
.map-node .castle-body { fill: var(--paper-high); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.map-node .castle-door { fill: var(--ink); fill-opacity: .22; stroke: none; }
.map-node:hover .castle-body, .map-node:focus .castle-body, .map-node.is-active .castle-body { fill: var(--ink); }
.map-node:hover .castle-door, .map-node:focus .castle-door, .map-node.is-active .castle-door { fill: var(--paper-high); fill-opacity: .65; }
.map-node.is-related .castle-body { stroke-width: 3; }
.map-node:focus-visible .castle-body { stroke-width: 4; }

/* Separate, anchorable introductions below the map. */
.concept-entries { border-top: 1px solid var(--ink); }
.concept-entry { display: grid; grid-template-columns: 90px minmax(0,1fr); gap: 24px; padding: 48px 12px; border-bottom: 1px solid var(--line); scroll-margin-top: 108px; }
.concept-entry:target { background: var(--paper-high); }
.concept-entry-index { padding-top: 8px; font-family: var(--font-mono); font-size: 13px; }
.concept-entry-body { max-width: 78ch; }
.concept-entry-body h2 { margin-bottom: 18px; font-size: 42px; }
.concept-entry-body .section-kicker { margin-bottom: 10px; }
.concept-question { font-weight: 600; }
.concept-entry .math-formula { max-width: 680px; margin: 24px 0; font-size: 22px; text-align: left; }
.concept-back { display: inline-block; min-height: 44px; margin-top: 8px; font-size: 13px; }
@media (max-width: 800px) {
  .concept-entry { grid-template-columns: 42px minmax(0,1fr); gap: 10px; padding: 36px 2px; scroll-margin-top: 82px; }
  .concept-entry-body h2 { font-size: 32px; }
  .concept-entry .math-formula { padding: 16px; font-size: 17px; }
}


/* Pure line-art castles and curved roads; no dark node fills. */
.map-node .castle-body,
.map-node:hover .castle-body,
.map-node:focus .castle-body,
.map-node.is-active .castle-body { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.map-node .castle-door,
.map-node:hover .castle-door,
.map-node:focus .castle-door,
.map-node.is-active .castle-door { fill: none; fill-opacity: 1; stroke: var(--ink); stroke-width: 1.2; }
.map-node:hover text, .map-node:focus text, .map-node.is-active text { fill: var(--ink); }
.map-node:hover .castle-body, .map-node:focus .castle-body, .map-node.is-active .castle-body { stroke-width: 2.8; }
.map-root path { fill: none; stroke-width: 1.6; }
.map-root text { fill: var(--ink); }
.map-edges .road-base { fill: none; stroke: var(--ink); stroke-opacity: .12; stroke-width: 12; stroke-linecap: round; }
.map-edges .road-center { fill: none; stroke: var(--ink); stroke-opacity: .42; stroke-width: 1.25; stroke-dasharray: 5 8; stroke-linecap: round; }
.map-edges .road.is-active .road-base { stroke-opacity: .24; }
.map-edges .road.is-active .road-center { stroke-opacity: .95; stroke-width: 2; }

/* Full lecture catalog. */
.lecture-group { padding: 34px 0; border-bottom: 1px solid var(--line); }
.lecture-group:first-child { padding-top: 0; }
.lecture-group h2 { margin-bottom: 16px; font-size: 34px; }
.lecture-group li { padding-left: 4px; }
.lecture-group li::marker { font-family: var(--font-mono); }
.lecture-group li + li { margin-top: 12px; }
.lecture-group strong { font-weight: 600; }
@media (max-width: 800px) { .lecture-group h2 { font-size: 29px; } }

/* Roads are visual only and must never intercept castle links. */
.map-edges, .map-edges path { pointer-events: none; }

/* Transparent hit areas preserve unfilled line art without losing usability. */
.map-node { pointer-events: bounding-box; }
.map-node .castle-body,
.map-node:hover .castle-body,
.map-node:focus .castle-body,
.map-node.is-active .castle-body { fill: transparent; }

.map-root rect { fill: transparent; }


/* Visible blue-gray line art instead of near-black navy. */
:root {
  --castle-line: #527f95;
  --castle-text: #426b80;
  --road-line: #668e9f;
  --road-bed: #91adb8;
}
.map-node .castle-body,
.map-node:hover .castle-body,
.map-node:focus .castle-body,
.map-node.is-active .castle-body,
.map-node .castle-door,
.map-node:hover .castle-door,
.map-node:focus .castle-door,
.map-node.is-active .castle-door { stroke: var(--castle-line); }
.map-node text,
.map-node:hover text,
.map-node:focus text,
.map-node.is-active text { fill: var(--castle-text); }
.map-root path, .map-root rect { stroke: var(--castle-line); }
.map-root text { fill: var(--castle-text); }
.map-edges .road-base { stroke: var(--road-bed); stroke-opacity: .3; }
.map-edges .road-center { stroke: var(--road-line); stroke-opacity: .68; }
.map-edges .road.is-active .road-base { stroke-opacity: .42; }
.map-edges .road.is-active .road-center { stroke: var(--castle-line); stroke-opacity: 1; }


/* Touch devices use the readable list even when desktop-site mode is enabled. */
@media (pointer: coarse) {
  .discipline-map svg { display: none; }
  .map-mobile { display: block; padding-top: 20px; }
  .map-mobile > strong { display: block; margin-bottom: 12px; font-family: var(--font-display); font-size: 28px; }
  .map-mobile div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .map-mobile a { min-height: 44px; padding: 8px; border: 1px solid var(--line); text-decoration: none; }
}


/* Programming-class quick tools. */
.class-tools { margin: 24px 0 28px; padding: 20px; border: double 3px var(--ink); background: var(--paper-high); }
.class-tools h3 { margin: 0 0 16px; font-size: 25px; }
.class-tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.class-tool-grid a { display: flex; flex-direction: column; justify-content: center; min-height: 74px; padding: 10px 12px; border: 1px solid var(--line); text-decoration: none; }
.class-tool-grid a:hover { border-color: var(--ink); background: var(--paper); }
.class-tool-grid a strong { font-size: 15px; }
.class-tool-grid a span { margin-top: 4px; font-size: 12px; color: var(--ink-soft); }
.class-tool-grid .class-tool-primary { border-color: var(--ink); }
@media (max-width: 800px) { .class-tools { padding: 14px; } .class-tool-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } }


/* Aligned classroom-tool table with compact type tags. */
.class-tool-table { border-top: 1px solid var(--ink); }
.class-tool-head, .class-tool-row { display: grid; grid-template-columns: minmax(130px,1.1fr) minmax(100px,.75fr) minmax(180px,1.8fr) 64px; gap: 16px; align-items: center; }
.class-tool-head { padding: 10px 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .06em; color: var(--ink-soft); }
.class-tool-row { min-height: 58px; padding: 10px 12px; border-top: 1px solid var(--line); text-decoration: none; }
.class-tool-row:hover { background: var(--paper); }
.class-tool-row strong { font-size: 15px; }
.tool-tag { display: inline-block; width: fit-content; padding: 2px 7px; border: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; line-height: 1.5; white-space: nowrap; }
.tool-purpose { color: var(--ink-soft); font-size: 13px; }
.tool-open { font-family: var(--font-mono); font-size: 12px; text-align: right; }
@media (max-width: 800px) {
  .class-tool-head { display: none; }
  .class-tool-row { grid-template-columns: minmax(0,1fr) auto 44px; gap: 8px 12px; padding: 14px 8px; }
  .tool-purpose { grid-column: 1 / 4; grid-row: 2; }
  .tool-open { grid-column: 3; grid-row: 1; }
}


/* Keep the castle atlas on touch devices; pan inside a bounded viewport. */
.map-viewport { width: 100%; overflow: visible; }
.map-viewport:focus-visible { outline: 3px solid var(--castle-line); outline-offset: 3px; }
.map-pan-hint { display: none; }
@media (max-width: 800px), (pointer: coarse) {
  .map-viewport { overflow-x: auto; overflow-y: hidden; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
  .discipline-map svg { display: block; width: 760px; max-width: none; height: auto; }
  .map-mobile { display: none; }
  .map-pan-hint { display: block; margin: 0 0 12px; font-size: 12px; color: var(--ink-soft); }
}

.brand-leaf { display: block; width: 30px; height: 30px; }


/* Central, larger obtuse-roof castle for algebraic geometry. */
.castle-ag .castle-body { stroke-width: 2.2; }
.castle-ag text { font-size: 26px; }
.castle-ag .node-en { font-size: 11px; }
@media (max-width: 800px), (pointer: coarse) {
  .discipline-map svg { width: 900px; }
}


/* Unified research-and-people article index. */
.article-people { margin-top: 72px; padding-top: 48px; border-top: 1px solid var(--ink); scroll-margin-top: 24px; }
.article-people-heading { max-width: 80ch; margin-bottom: 36px; }
.article-people-heading h2 { margin: 8px 0 20px; font-size: clamp(34px, 5vw, 56px); }
.person-heading h3 { margin: 0; font-size: 36px; }
.person-story-title { font-family: var(--font-display); font-size: 23px; line-height: 1.45; }
.person-card:target { background: var(--paper-high); scroll-margin-top: 24px; }
.person-article > p { line-height: 1.95; }
@media (max-width: 800px) {
  .article-people { margin-top: 48px; padding-top: 36px; }
  .person-heading h3 { font-size: 30px; }
  .person-story-title { font-size: 20px; }
}

/* External lecture dependencies and migration status. */
.dependency-panel { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--ink); }
.dependency-panel h3 { margin: 0 0 16px; font-size: 22px; }
.dependency-panel p, .dependency-panel li { font-size: 14px; line-height: 1.75; }
.dependency-panel ul { margin: 18px 0; padding-left: 20px; }
.dependency-panel li + li { margin-top: 12px; }
.dependency-panel code { overflow-wrap: anywhere; }
.dependency-check { color: var(--ink-soft); font-family: var(--font-mono); font-size: 11px; }
.dependency-badge { display: inline-block; margin-left: 7px; padding: 1px 5px; border: 1px solid var(--line); color: var(--ink-soft); font-family: var(--font-mono); font-size: 10px; font-weight: 400; line-height: 1.5; white-space: normal; vertical-align: baseline; }
.dependency-badge.dependency-pending { border-style: dashed; color: var(--ink); }
.dependency-link-pending { text-decoration-style: dashed; }
.tool-open .dependency-badge { display: block; margin: 5px 0 0; white-space: nowrap; }
@media (max-width: 800px) {
  .dependency-badge { margin-left: 4px; }
  .tool-open .dependency-badge { white-space: normal; }
}

/* NTL.jl research project */
.research-project { margin: 24px 0 44px; padding: clamp(20px, 3vw, 32px); border: double 3px var(--ink); background: var(--paper-high); }
.project-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.project-heading h3 { margin: 0; font-family: var(--font-display); font-size: clamp(25px, 3vw, 36px); font-weight: 500; line-height: 1.2; }
.project-version { margin: 0 0 12px; font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; }
.project-badge { flex: 0 0 auto; padding: 7px 10px; border: 1px solid var(--ink); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.project-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 26px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-metrics > div { min-width: 0; padding: 18px 12px; }
.project-metrics > div + div { border-left: 1px solid var(--line); }
.project-metrics strong, .project-metrics span { display: block; }
.project-metrics strong { overflow-wrap: anywhere; font-family: var(--font-display); font-size: clamp(23px, 2.5vw, 32px); font-weight: 500; line-height: 1.1; }
.project-metrics span { margin-top: 7px; color: var(--ink-soft); font-size: 12px; }
.project-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.project-columns h4 { margin: 0; font-size: 15px; }
.project-columns p { margin: 8px 0 0; font-size: 14px; }
.project-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }
.project-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.project-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 14px; border: 1px solid var(--ink); font-size: 13px; text-decoration: none; }
.project-links a:hover { color: var(--paper-high); background: var(--ink); }
.project-links .project-link-primary { color: var(--paper-high); background: var(--ink); }
.project-links .project-link-primary:hover { opacity: .86; }
@media (max-width: 620px) {
  .project-heading { display: block; }
  .project-badge { display: inline-block; margin-top: 16px; }
  .project-metrics { grid-template-columns: 1fr; }
  .project-metrics > div { display: grid; grid-template-columns: minmax(120px, .8fr) 1fr; align-items: center; gap: 12px; padding: 14px 0; }
  .project-metrics > div + div { border-top: 1px solid var(--line); border-left: 0; }
  .project-metrics span { margin-top: 0; }
  .project-columns { grid-template-columns: 1fr; gap: 18px; }
  .project-links a { flex: 1 1 calc(50% - 10px); justify-content: center; text-align: center; }
}
