/* ============================================================ tokens */
:root {
  --bg: #f7f5f0;
  --bg-2: #efece4;
  --panel: #fffdf9;
  --panel-2: #f4f1ea;
  --ink: #1c1a16;
  --ink-2: #57534a;
  --ink-3: #777268;
  --line: #e3ded2;
  --line-2: #d4cebf;
  --shadow: none;
  --radius: 8px;
  --radius-sm: 6px;
  --font-ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: Newsreader, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --maxw: 1240px;
  --accent: var(--c-accent);
  --header-height: 68px;

  /* viz palette (read by the canvas runtime as --c-*) */
  --c-ink: #1c1a16;
  --c-muted: #6b665b;
  --c-faint: #a8a294;
  --c-grid: #ebe6db;
  --c-bg: #f7f5f0;
  --c-panel: #fffdf9;
  --c-accent: #3557d4;
  --c-blue: #2f63d9;
  --c-red: #d2344f;
  --c-green: #1f9a5a;
  --c-orange: #e07b12;
  --c-purple: #7a4cc9;
  --c-teal: #0f95a3;
  --c-pink: #cf3d8c;
  --c-gold: #bf9311;
  --c-gray: #8a8578;
  --c-pma: #3557d4;
  --c-rca: #c4442a;
  --c-fa: #0e8a6e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014; --bg-2: #13161c; --panel: #161a21; --panel-2: #1c212a;
    --ink: #ebe8e1; --ink-2: #aaa69c; --ink-3: #94938e; --line: #272c36; --line-2: #343b47;
    --shadow: none;
    --c-ink: #ebe8e1; --c-muted: #a29e94; --c-faint: #5f5c56; --c-grid: #222730; --c-bg: #0e1014; --c-panel: #161a21;
    --c-accent: #7c9bff; --c-blue: #6f9bff; --c-red: #ff6b81; --c-green: #4fd08c; --c-orange: #ffa94d; --c-purple: #b892ff;
    --c-teal: #45cfdc; --c-pink: #ff79b8; --c-gold: #f0c94e; --c-gray: #8e8a82; --c-pma: #7c9bff; --c-rca: #ff8a6b; --c-fa: #43d1a8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014; --bg-2: #13161c; --panel: #161a21; --panel-2: #1c212a;
  --ink: #ebe8e1; --ink-2: #aaa69c; --ink-3: #94938e; --line: #272c36; --line-2: #343b47;
  --shadow: none;
  --c-ink: #ebe8e1; --c-muted: #a29e94; --c-faint: #5f5c56; --c-grid: #222730; --c-bg: #0e1014; --c-panel: #161a21;
  --c-accent: #7c9bff; --c-blue: #6f9bff; --c-red: #ff6b81; --c-green: #4fd08c; --c-orange: #ffa94d; --c-purple: #b892ff;
  --c-teal: #45cfdc; --c-pink: #ff79b8; --c-gold: #f0c94e; --c-gray: #8e8a82; --c-pma: #7c9bff; --c-rca: #ff8a6b; --c-fa: #43d1a8;
  color-scheme: dark;
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 var(--font-ui); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--c-accent); }
button, input, select { font: inherit; color: inherit; }
button, a, input, summary { -webkit-tap-highlight-color: transparent; }
button, .btn, .chip, .icon-btn { touch-action: manipulation; }
button, a, summary, input { transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s; }
input[type="checkbox"] { accent-color: var(--c-accent); }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
p { margin: 0 0 .8em; }
.mono { font-family: var(--font-mono); font-size: .88em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }
::selection { background: color-mix(in srgb, var(--c-accent) 25%, transparent); }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: 4px; }

/* ============================================================ header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: calc(var(--header-height) - 1px); }
.brand { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-serif); font-size: 21px; white-space: nowrap; }
.brand b { font-weight: 600; }
.brand i { color: var(--ink-2); font-style: italic; }
.brand-mark { width: 22px; height: 22px; align-self: center; }
.nav { display: flex; gap: 2px; margin-left: 2px; }
.nav > a { padding: 8px 9px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 13px; }
.nav > a:hover { background: var(--panel-2); color: var(--ink); }
.nav > a.on { color: var(--ink); background: var(--panel-2); }
.nav-menu { position: relative; }
.nav-menu summary { list-style: none; padding: 8px 9px; border-radius: 8px; color: var(--ink-2); font-weight: 500; font-size: 13px; cursor: pointer; user-select: none; }
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu summary::after { content: ""; display: inline-block; margin-left: 6px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-3px) rotate(45deg); opacity: .6; }
.nav-menu summary:hover, .nav-menu[open] summary, .nav-menu summary.on { background: var(--panel-2); color: var(--ink); }
.fields-menu { position: absolute; left: -170px; top: 46px; width: min(880px, calc(100vw - 40px)); max-height: calc(100vh - 80px); overflow: auto; padding: 16px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 20px; z-index: 70; }
.fm-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.fm-cols { display: flex; flex-direction: column; }
.fm-cols a { font-size: 13px; color: var(--ink-2); padding: 4px 0 4px 16px; line-height: 1.45; }
.fm-cols a:hover { color: var(--bc); }
.fm-cols a.soon { color: var(--ink-3); }
.fm-cols .c { font: 11px var(--font-mono); color: var(--ink-3); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search { position: relative; }
.search input {
  width: 210px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 0 32px 0 34px; font: inherit; font-size: 14px;
}
.search input::placeholder { color: var(--ink-3); }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--ink-3); }
.search kbd { position: absolute; right: 8px; top: 8px; font: 11px var(--font-mono); color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.search-results {
  position: absolute; right: 0; top: 42px; width: min(480px, 92vw); max-height: 70vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; display: none;
}
.search-results.open { display: block; }
.sr-item { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.sr-item.sel, .sr-item:hover { background: var(--panel-2); }
.sr-item .sr-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); padding-top: 2px; }
.sr-item .sr-name { font-weight: 500; }
.sr-item .sr-sub { grid-column: 2; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 38px; height: 38px; flex: none; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
@media (max-width: 1100px) {
  .brand i { display: none; }
  .site-header .wrap { gap: 12px; }
  .search input { width: 180px; }
  .fields-menu { left: -110px; }
}
@media (max-width: 960px) {
  :root { --header-height: 112px; }
  .site-header .wrap { height: calc(var(--header-height) - 1px); display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding-top: 10px; padding-bottom: 8px; }
  .brand { font-size: 21px; }
  .brand i { display: inline; }
  .header-tools { grid-column: 2; grid-row: 1; }
  .search input { width: 160px; }
  .nav { grid-row: 2; grid-column: 1 / -1; margin: 0 -4px; overflow-x: auto; scrollbar-width: none; gap: 2px; padding-top: 7px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav > a, .nav-menu > summary { display: block; font-size: 12px; padding: 7px 7px; white-space: nowrap; }
  .nav-menu { position: static; }
  .fields-menu { position: fixed; left: 16px; right: 16px; top: calc(var(--header-height) + 6px); width: auto; max-height: calc(100dvh - var(--header-height) - 22px); }
  .search-results { position: fixed; left: 16px; right: 16px; top: 62px; width: auto; max-height: calc(100dvh - 90px); }
}
@media (max-width: 440px) {
  .brand { gap: 6px; font-size: 20px; }
  .brand-mark { width: 20px; }
  .search input { width: 38px; padding: 0; color: transparent; cursor: pointer; }
  .search input:not(:focus)::placeholder { color: transparent; }
  .search kbd { display: none; }
  .search input:focus { width: calc(100vw - 84px); position: fixed; left: 16px; top: 13px; padding: 0 12px; color: var(--ink); z-index: 60; cursor: text; }
  .search svg { pointer-events: none; }
  .search input:focus + svg { display: none; }
}

main { flex: 1; }
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 26px 0 40px; color: var(--ink-3); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ============================================================ common bits */
.eyebrow { font: 600 11.5px/1.45 var(--font-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); }
.col-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bc, var(--c-accent)); flex: none; }
/* collection colours: [data-col="…"] { --bc } and [data-field="…"] { --fc } come from data/atlas.css */
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--panel); font-size: 13px; line-height: 1.3; max-width: 100%;
}
.chip:hover { border-color: var(--bc, var(--c-accent)); color: var(--ink); }
.chip .num { flex: none; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-2); }
.chip .nm { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 13px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-size: 13.5px; font-weight: 500; color: var(--ink);
}
.btn:hover { border-color: var(--c-accent); color: var(--c-accent); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .88; color: var(--bg); }
.btn-icon { width: 38px; padding: 0; justify-content: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.loading { padding: 80px 0; text-align: center; color: var(--ink-3); }

/* ============================================================ home */
.hero { padding-top: 48px; padding-bottom: 8px; }
.hero h1 { font-size: clamp(38px, 4.6vw, 58px); font-weight: 400; letter-spacing: -.035em; margin-top: 0; }
.hero h1 em { font-style: italic; color: var(--ink-2); }
.hero p.lede { font-family: var(--font-serif); font-size: clamp(18px, 2vw, 20px); color: var(--ink-2); max-width: 520px; margin-top: 14px; line-height: 1.45; }
.hero-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 64px; align-items: center; }
.hero-intro { min-width: 0; }
#chain { max-height: 240px; overflow: auto; overscroll-behavior: contain; padding: 4px; }
.hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 24px; margin-top: 20px; }
.hero-actions .btn { min-height: 38px; gap: 12px; padding: 8px 0; border: 0; border-radius: 0; background: none; color: var(--c-accent); }
.hero-actions .btn:hover { color: var(--c-accent); text-decoration: underline; text-underline-offset: 4px; }
.hero-browse { display: inline-flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 500; padding-block: 10px; color: var(--ink-2); }
.hero-discover { min-width: 0; padding: 0; }
.hero-stats { display: flex; flex-wrap: wrap; margin-top: 28px; padding: 20px 0 8px; border-top: 1px solid var(--line); gap: 10px 28px; }
.hero-stats > * { display: inline-flex; align-items: baseline; gap: 6px; }
.hero-stats b { font-size: 13px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-stats span { color: var(--ink-3); font-size: 12px; }
.hero-stats a:hover b, .hero-stats a:hover span { color: var(--c-accent); }
.flow-card { margin-top: 28px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.flow-head { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.flow-head h2 { font-size: 22px; }
.flow-svg { width: 100%; display: block; overflow: visible; }
.flow-svg text { font-family: var(--font-ui); }
.books { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; margin-top: 28px; }
.book-card { padding: 22px 22px 14px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.book-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--bc); }
.book-card h2 { font-size: 25px; margin: 6px 0 4px; }
.book-card .ed { color: var(--ink-3); font-size: 13px; }
.book-card .desc { color: var(--ink-2); font-family: var(--font-serif); font-size: 16.5px; line-height: 1.45; margin: 10px 0 14px; }
.ch-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.ch-list li a { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.ch-list li:last-child a { border-bottom: 0; }
.ch-list .n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.ch-list .c { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.ch-list li a:hover .t { color: var(--bc); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 48px 0 14px; flex-wrap: wrap; }
.section-title h2 { font-size: 28px; }
.featured { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.feat { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .15s; }
.feat:hover { border-color: var(--bc); transform: none; color: inherit; }
.feat .eyebrow { display: flex; align-items: center; gap: 7px; }
.feat .nm { font-family: var(--font-serif); font-size: 18px; line-height: 1.25; }
.feat .why { color: var(--ink-2); font-size: 13px; }

/* ============================================================ book & chapter pages */
.page-head { padding-top: 40px; padding-bottom: 10px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { opacity: .6; }
.page-head > .eyebrow, .thm-head > div > .eyebrow { margin-bottom: 10px; line-height: 1.5; }
.page-head h1 { font-size: clamp(30px, 4.6vw, 46px); font-weight: 400; }
.page-head .sub { font-family: var(--font-serif); font-size: 19px; color: var(--ink-2); margin-top: 10px; max-width: 760px; line-height: 1.45; }
.chapters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 24px; }
.ch-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.ch-card:hover { border-color: var(--bc); color: inherit; }
.ch-card h3 { font-size: 21px; }
.ch-card .sum { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ch-card .meta { color: var(--ink-3); font-size: 12.5px; margin-top: auto; }
.ch-graph-card { margin-top: 22px; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: none; }
.ch-graph-card .cg-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; padding: 4px 6px 8px; }
.thm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; margin-top: 18px; }
.thm-card { padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.thm-card:hover { border-color: var(--bc); color: inherit; }
.thm-card .top { display: flex; align-items: baseline; gap: 8px; }
.thm-card .num { font-family: var(--font-mono); font-size: 12px; color: var(--bc); font-weight: 500; }
.thm-card .kind { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }
.thm-card .nm { font-family: var(--font-serif); font-size: 18px; line-height: 1.25; }
.thm-card .st { color: var(--ink-2); font-size: 13px; line-height: 1.5; max-height: 4.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.thm-card .st p { margin: 0; }
.thm-card .st .katex { font-size: 1em; }
.thm-card .foot { font-size: 12px; color: var(--ink-3); display: flex; gap: 12px; margin-top: auto; }

/* ============================================================ theorem page */
.thm-page { padding-top: 30px; }
.thm-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.thm-title .eyebrow { display: flex; flex-wrap: wrap; line-height: 1.5; gap: 4px 8px; align-items: center; color: var(--bc); }
.thm-title h1 { font-size: clamp(28px, 4.4vw, 44px); font-weight: 400; margin-top: 8px; }
.thm-nav { display: flex; gap: 8px; }
.statement {
  margin-top: 18px; padding: 18px 22px; border-left: 3px solid var(--bc); background: var(--panel); border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif); font-size: 19px; line-height: 1.55; box-shadow: var(--shadow); border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.statement p:last-child { margin-bottom: 0; }
.statement .katex { font-size: 1.04em; }
.rich-line { display: block; }
.rich-item { display: grid; grid-template-columns: 2.1em minmax(0, 1fr); margin: .25em 0; }
.rich-tag { color: var(--ink-2); }
.thm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 22px; }
.viz-card { padding: 14px; }
.viz-caption { font-size: 13.5px; color: var(--ink-2); padding: 2px 4px 10px; display: flex; gap: 8px; align-items: flex-start; }
.viz-caption > svg { flex: none; margin-top: 3px; color: var(--bc); }
.viz-caption p { margin: 0; }
@media (max-width: 640px) {
  .viz-caption { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .viz-caption > :not(svg) { grid-column: 2; min-width: 0; }
}
.viz-share { border-top: 1px solid var(--line); margin-top: 16px; padding: 10px 4px 2px; font-size: 13px; color: var(--ink-2); }
.viz-share summary { cursor: pointer; color: var(--ink); width: fit-content; }
.viz-share p { margin: 10px 0; }
.share-output { margin-top: 12px; }
.share-output label { display: block; margin: 10px 0 6px; }
.share-output input, .share-output textarea { display: block; width: 100%; min-width: 0; box-sizing: border-box; margin-top: 5px; padding: 8px; font: 12px/1.5 var(--font-mono); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--bg); }
.share-output textarea { resize: vertical; overflow-wrap: anywhere; }
.share-status, .viz-state-notice { overflow-wrap: anywhere; }
.viz-state-notice { padding: 10px; margin-bottom: 10px; border-left: 3px solid var(--c-orange); color: var(--ink-2); font-size: 13px; }
.embed-attribution { display: none; }
.embed-view { --header-height: 0px; scroll-padding-top: 0; }
.embed-view .site-header, .embed-view .site-footer, .embed-view .skip-link,
.embed-view .thm-page > .crumbs, .embed-view .thm-page > .statement,
.embed-view .thm-head .eyebrow, .embed-view .thm-head .provenance, .embed-view .thm-nav,
.embed-view .thm-page > .paper-cite, .embed-view .side-grid, .embed-view .lineage-card,
.embed-view .thm-page > .kbd-hint, .embed-view .viz-share { display: none; }
.embed-view .thm-page { padding: 16px; max-width: 1200px; }
.embed-view .thm-head { margin: 0; }
.embed-view .thm-head h1 { font-size: clamp(21px, 4vw, 30px); margin: 0; }
.embed-view .thm-grid { margin-top: 12px; }
.embed-view .viz-card { padding: 10px; box-shadow: none; }
.embed-view .embed-attribution { display: block; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.bridge-picture { margin: 0 0 28px; padding: 18px; }
.bridge-picture h2 { margin: 8px 0 12px; font-size: 25px; }
.bridge-model, .bridge-model-limit, .bridge-picture-sources { font-size: 13.5px; line-height: 1.65; color: var(--ink-2); overflow-wrap: anywhere; }
.bridge-model-limit { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.bridge-picture-sources { margin-bottom: 0; }
.bridge-picture-sources a { white-space: normal; }
@media (max-width: 440px) { .bridge-picture { padding: 10px; } .bridge-picture h2 { font-size: 22px; } }
.prose { position: relative; min-width: 0; overflow-wrap: anywhere; font-family: var(--font-serif); font-size: 18px; line-height: 1.6; color: var(--ink); }
.katex { position: relative; }
.prose .katex { font-size: 1.02em; }
.side-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.panel { padding: 18px 20px; }
.panel h2 { font-size: 21px; margin-bottom: 10px; display: flex; align-items: baseline; gap: 10px; }
.panel h2 .count { font: 500 12px var(--font-mono); color: var(--ink-3); }
.chip-list { display: flex; flex-wrap: wrap; gap: 7px; }
.empty-note { color: var(--ink-3); font-size: 14px; font-style: italic; }
.lineage-card { padding: 14px 14px 8px; }
.graph-hint { margin: 2px 6px 10px; font-size: 12px; color: var(--ink-3); }
.lineage-head { scroll-margin-top: calc(var(--header-height) + 12px); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 6px 6px; }
.lineage-head h2 { font-size: 21px; }
.lineage-svg-wrap { position: relative; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
.lineage-svg { display: block; margin: 0 auto; }
.lineage-svg text { font-family: var(--font-ui); }
.gnode { cursor: pointer; }
.gnode rect { transition: stroke-width .12s; }
.gnode:hover rect { stroke-width: 2.2; }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.stats-row { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.stats-row b { color: var(--ink); font-weight: 600; }
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel-2); }
.seg button { border: 0; background: none; padding: 5px 11px; font-size: 13px; cursor: pointer; color: var(--ink-2); min-height: 30px; border-radius: 6px; }
.seg button + button { border-left: 0; }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button:hover:not(.on) { color: var(--ink); background: var(--panel-2); }
.kbd-hint { font-size: 12px; color: var(--ink-3); }

/* ============================================================ viz runtime */
.viz { display: flex; flex-direction: column; gap: 10px; }
.viz-stages { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.stage { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stage[hidden] { display: none !important; }
.stage-title { font-size: 13px; color: var(--ink-2); font-weight: 500; padding: 0 2px; }
.stage-box { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.viz-card .stage-box { background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
.stage-box canvas { display: block; position: absolute; inset: 0; }
.stage-overlay { position: absolute; inset: 0; pointer-events: none; }
.tex-label { position: absolute; white-space: nowrap; line-height: 1; text-shadow: 0 0 3px var(--panel), 0 0 3px var(--panel), 0 0 2px var(--panel); }
.stage-hint { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: var(--ink-3); pointer-events: none; transition: opacity .4s; }
.stage-box.touched .stage-hint { opacity: 0; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); padding: 0 4px; }
.viz-legend:empty { display: none; }
.lg-item { display: inline-flex; align-items: center; gap: 7px; }
.lg-swatch { width: 18px; height: 3px; border-radius: 2px; background: var(--sw); flex: none; display: inline-block; vertical-align: middle; }
.lg-swatch.dash { background: repeating-linear-gradient(90deg, var(--sw) 0 5px, transparent 5px 8px); }
.lg-swatch.dot { width: 9px; height: 9px; border-radius: 50%; }
.lg-swatch.area { height: 10px; opacity: .45; border-radius: 3px; }
.viz-controls { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; padding: 16px 4px 4px; background: none; border-top: 1px solid var(--line); }
.viz-controls:empty { display: none; }
.ctl { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.ctl-label { color: var(--ink-2); white-space: nowrap; }
.ctl-label .katex { font-size: 1.08em; color: var(--ink); }
.ctl-slider { flex: 1 1 260px; max-width: 440px; min-width: 0; }
.ctl-slider .ctl-label { white-space: normal; flex: 0 1 auto; min-width: 0; max-width: 60%; line-height: 1.25; } /* long labels wrap instead of squeezing the value */
.ctl-slider input[type=range] { flex: 1; min-width: 90px; }
.ctl-input { flex: 1 1 260px; max-width: 520px; flex-wrap: wrap; }
.ctl-input input { flex: 1; min-width: 140px; font: 14px var(--font-mono); padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); }
.ctl-input input:focus { outline: 2px solid color-mix(in oklab, var(--accent) 45%, transparent); outline-offset: 1px; }
.ctl-input.bad input { border-color: var(--c-red, #c33); }
.ctl-input-err { flex-basis: 100%; font-size: 12px; color: var(--c-red, #c33); min-height: 0; }
.ctl-input-err:empty { display: none; }
.ctl-value { flex: none; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; min-width: 4em; padding: 4px 0; text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl-play { gap: 6px; }
.ctl-toggle { max-width: 100%; min-width: 0; }
.ctl-toggle .ctl-label { white-space: normal; line-height: 1.5; }
input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--c-accent); border: 2.5px solid var(--panel); box-shadow: 0 0 0 1px var(--c-accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--c-accent); border: 2.5px solid var(--panel); box-shadow: 0 0 0 1px var(--c-accent); }
.switch { max-width: 100%; min-width: 0; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 36px; height: 22px; border-radius: 10px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; left: 2px; top: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--panel); transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--c-accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.viz-readout { position: relative; overflow-x: auto; overflow-wrap: anywhere; min-width: 0; font-size: 14px; color: var(--ink-2); padding: 0 4px; font-variant-numeric: tabular-nums; min-height: 1px; }
.viz-readout:empty { display: none; }
.viz-readout .katex { font-size: 1.05em; color: var(--ink); }
.viz-error { padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--c-red) 12%, transparent); color: var(--c-red); font-size: 13.5px; }
.viz-placeholder { padding: 40px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: 12px; }

/* ============================================================ map */
.map-page, .timeline-page { position: relative; height: calc(100dvh - var(--header-height)); min-height: 520px; overflow: hidden; }
.timeline-page canvas { position: absolute; inset: 0; display: block; touch-action: none; cursor: grab; }
.map-page canvas { position: absolute; inset: 0; display: block; touch-action: none; }
.map-ui { position: absolute; left: 16px; top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; z-index: 5; max-width: calc(100% - 32px); }
.map-ui .card { padding: 6px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; box-shadow: var(--shadow); max-width: 100%; }
.map-ui label { font-size: 13px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--ink-2); }
.map-tip {
  position: absolute; z-index: 6; pointer-events: none; max-width: 340px; padding: 10px 12px; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: none;
}
.map-tip .nm { font-family: var(--font-serif); font-size: 17px; line-height: 1.25; margin: 2px 0 4px; }
.map-tip .st { color: var(--ink-2); font-size: 12.5px; max-height: 6em; overflow: hidden; }
.map-tip .st p { margin: 0; }
.map-side {
  position: absolute; right: 16px; top: 14px; width: min(360px, calc(100% - 32px)); max-height: calc(100% - 28px); overflow: auto; z-index: 7;
  padding: 16px 18px; display: none;
}
.map-side.open { display: block; }
.map-side .nm { font-family: var(--font-serif); font-size: 22px; line-height: 1.2; margin: 6px 0 8px; }
.map-side .st { font-family: var(--font-serif); font-size: 16px; color: var(--ink); }
.map-legend { position: absolute; left: 16px; bottom: 14px; z-index: 5; padding: 8px 12px; font-size: 12.5px; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-help { position: absolute; right: 16px; bottom: 14px; z-index: 5; font-size: 12px; color: var(--ink-3); }
@media (max-width: 1100px) { .map-help { display: none; } }
@media (max-width: 640px) { .map-legend { display: none; } }


/* about */
.about { max-width: 760px; }
.about h2 { font-size: 26px; margin: 36px 0 10px; }
.about a, .refs a, .refs-inline a { color: var(--bc, var(--c-accent)); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.about a:hover, .refs a:hover, .refs-inline a:hover { text-decoration-color: currentColor; }
.about p, .about li { font-family: var(--font-serif); font-size: 18px; line-height: 1.6; }

/* graph extras */
.gedge { transition: opacity .12s; }
.gedge.hot { stroke: var(--c-accent) !important; stroke-width: 2.2 !important; opacity: 1 !important; }
.flow-svg .gnode { cursor: pointer; }
.flow-svg .gnode:hover .hit { fill: var(--panel-2); }
.flow-svg .fedge { transition: opacity .15s; }
.chip-list > .faint { align-self: center; }
.ch-graph-card .lineage-svg-wrap { max-height: 600px; overflow: auto; overscroll-behavior: contain; }
.lineage-card .lineage-svg-wrap { max-height: 640px; overflow: auto; }
.viz-controls [hidden] { display: none !important; }
.viz-readout { pointer-events: auto; }
.viz-controls { position: relative; z-index: 1; }

/* ============================================================ atlas: fields, collections, status */
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; align-items: start; }
.field-card { padding: 20px 20px 12px; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.field-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--fc); }
.field-card h2 { font-size: 24px; }
.field-card h2 a:hover { color: var(--fc); }
.field-card .ed { color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.field-card .desc { color: var(--ink-2); font-family: var(--font-serif); font-size: 16px; line-height: 1.45; margin: 10px 0 12px; }
.col-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.col-list li a { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; align-items: center; }
.col-list li:last-child a { border-bottom: 0; }
.col-list .c { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.col-list li a:hover .t { color: var(--bc); }
.col-list li.soon .t { color: var(--ink-3); }
.col-list li.soon .col-dot, .col-card.soon .col-dot, .status-table tr.soon .col-dot { background: none; box-shadow: inset 0 0 0 1.5px var(--bc); }
.field-area { margin-top: 30px; }
.area-title { font-size: 22px; margin-bottom: 12px; }
.col-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.col-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.col-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--bc); }
.col-card:hover { border-color: var(--bc); color: inherit; }
.col-card .eyebrow { display: flex; align-items: center; gap: 7px; }
.col-card h3 { font-size: 21px; }
.col-card .sum { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.col-card .meta { color: var(--ink-3); font-size: 12.5px; margin-top: auto; display: flex; align-items: center; gap: 8px; }
.col-card.soon, .ch-card.soon { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); box-shadow: none; }
.col-card.soon h3, .ch-card.soon h3 { color: var(--ink-2); }
.progress { display: inline-block; width: 64px; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--bc, var(--fc)) 18%, transparent); overflow: hidden; vertical-align: middle; flex: none; }
.progress > span { display: block; height: 100%; background: var(--bc, var(--fc)); }
.refs { margin-top: 14px; font-size: 13.5px; color: var(--ink-2); }
.refs ul { margin: 6px 0 0; padding-left: 18px; }
.refs li { margin: 2px 0; }
.refs-inline { margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.refs-inline .eyebrow { margin-right: 4px; }
.scope { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-2); font-family: var(--font-ui); font-size: 14px; color: var(--ink-2); }
.scope .eyebrow { margin-right: 6px; }
.empty-shelf { margin-top: 24px; padding: 22px 24px; max-width: 760px; }
.empty-shelf h2 { font-size: 22px; margin-bottom: 8px; }
.empty-shelf p { font-family: var(--font-serif); font-size: 17px; color: var(--ink-2); margin: 0; }
.planned-note { font-family: var(--font-ui); font-size: 15.5px; color: var(--ink-2); border-left-style: dashed; }
.thm-card.planned { background: color-mix(in srgb, var(--panel) 55%, var(--bg)); box-shadow: none; border-style: dashed; }
.thm-card.planned .nm { color: var(--ink-2); }
.chip.planned { border-style: dashed; background: transparent; }
.chip.planned .col-dot { background: none; box-shadow: inset 0 0 0 1.5px var(--bc); }
.chip.planned .nm { color: var(--ink-2); }
.gnode.planned text { font-style: italic; }
.status-field { margin-top: 30px; }
.status-field h2 { font-size: 22px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.status-field h2::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--fc); }
.status-table { width: 100%; border-collapse: collapse; font-size: 14px; background: none; }
.status-table th { text-align: left; font: 600 11px var(--font-ui); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.status-table td { padding: 7px 12px; border-bottom: 1px solid var(--line); }
.status-table tr:last-child td { border-bottom: 0; }
.status-table td a { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; }
.status-table .st-title { min-width: 0; overflow-wrap: anywhere; }
.status-table th.r { font: 600 11px var(--font-ui); }
.status-table td a:hover { color: var(--bc); }
.status-table .r { text-align: right; font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.status-table tr.soon td:first-child a { color: var(--ink-2); }
@media (max-width: 640px) {
  .status-table { table-layout: fixed; }
  .status-table th, .status-table td { padding: 10px 8px; }
  .status-table th:nth-child(2), .status-table td:nth-child(2),
  .status-table th:nth-child(5), .status-table td:nth-child(5),
  .status-table th:nth-child(6), .status-table td:nth-child(6) { display: none; }
  .status-table th:nth-child(3), .status-table th:nth-child(4) { width: 23%; }
}
.pic-plan { margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: color-mix(in srgb, var(--bc) 8%, transparent); color: var(--ink); font-size: 15px; }
.pic-plan .eyebrow { display: block; margin-bottom: 4px; color: var(--bc); }
.thm-card.planned .st.pic { font-style: italic; }
.treemap-svg { display: block; width: 100%; height: auto; font-family: var(--font-ui); }
.treemap-svg .tm-field.zoomable { cursor: zoom-in; }
.treemap-svg .tm-col, .treemap-svg .tm-ch { cursor: pointer; }
.treemap-svg .tm-col:hover > rect:first-child { stroke-width: 2; stroke-opacity: 1; }
.treemap-svg .tm-ch:hover { fill-opacity: .55; }
.tm-crumbs { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); min-height: 0; margin: -2px 0 8px; }
.tm-crumbs:empty { display: none; }
.tm-crumbs a { color: var(--ink-2); } .tm-crumbs a:hover { color: var(--c-accent); }

/* bridges */
.bridge-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.bridge-card:hover { border-color: var(--c-accent); color: inherit; }
.bridge-card h3 { font-size: 21px; }
.bridge-card .sum { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bridge-card .meta { color: var(--ink-3); font-size: 12.5px; margin-top: auto; display: flex; align-items: center; gap: 8px; }
.field-path { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.field-path .fp-sep { width: 10px; height: 1.5px; background: var(--line-2); }
.journey { list-style: none; margin: 18px 0 0; padding: 0; max-width: 820px; }
.j-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; position: relative; }
.j-rail { position: relative; display: flex; justify-content: center; }
.j-rail::before { content: ""; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--fc); opacity: .35; }
.j-step:first-child .j-rail::before { top: 22px; } .j-step:last-child .j-rail::before { bottom: calc(100% - 22px); }
.j-num { position: relative; z-index: 1; margin-top: 10px; width: 26px; height: 26px; border-radius: 50%; background: var(--fc); color: var(--bg); font: 600 12px var(--font-mono); display: grid; place-items: center; }
.j-card { min-width: 0; overflow-wrap: anywhere; margin: 0 0 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 5px; }
.j-card:hover { border-color: var(--bc); color: inherit; }
.j-card .eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--bc); }
.j-card .nm { font-family: var(--font-serif); font-size: 20px; line-height: 1.25; }
.j-card .note { color: var(--ink-2); font-family: var(--font-serif); font-size: 16.5px; line-height: 1.5; }
.j-step.planned .j-card { border-style: dashed; background: color-mix(in srgb, var(--panel) 60%, var(--bg)); box-shadow: none; }
.j-step.planned .j-num { background: var(--bg); color: var(--fc); box-shadow: inset 0 0 0 2px var(--fc); }
/* prerequisite planner */
.path-page h1 em { font-style: italic; }
.path-group { margin-top: 18px; max-width: 860px; }
.path-group h3 { flex-wrap: wrap; line-height: 1.5; font-family: var(--font-ui); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--bc); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.path-group ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); overflow: hidden; }
.path-group li > a { min-width: 0; overflow-wrap: anywhere; }
.path-group li label { flex: none; }
.path-group li .tag { flex: none; }
.path-group li { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.path-group li:last-child { border-bottom: 0; }
.path-group li label { min-height: 30px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.path-group li .num { font: 500 12px var(--font-mono); color: var(--ink-3); min-width: 3.4em; }
.path-group li .kind { font: 500 11px var(--font-mono); color: var(--bc); margin-right: 4px; }
.path-group li a:hover { color: var(--bc); }
.path-group li.known a { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--line-2); }
.path-group li.next { background: color-mix(in srgb, var(--c-green) 9%, var(--panel)); }
.path-group li .tag { margin-left: auto; font: 600 10.5px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--c-green); }
.path-group li .tag.faint { color: var(--ink-3); }
.path-group li.planned a { color: var(--ink-2); font-style: italic; }
.path-group.target ul { border-color: var(--bc); }
.path-group .mark-all { margin-left: auto; border: 0; background: none; color: var(--ink-3); font: 500 11.5px var(--font-ui); letter-spacing: 0; text-transform: none; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.path-group .mark-all:hover { color: var(--c-accent); background: var(--panel-2); }
.timeline-page .map-help { top: 14px; bottom: auto; }

/* ---------- landmark papers ---------- */
.paper-cite { overflow-wrap: anywhere; margin: 18px 0; padding: 14px 18px; border-left: 3px solid var(--bc, var(--accent)); background: none; border-radius: 0; box-shadow: var(--shadow); max-width: 860px; }
.paper-cite .pc-authors { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.paper-cite .pc-title { font-family: var(--font-serif); font-size: 20px; line-height: 1.3; margin: 2px 0; font-style: italic; }
.paper-cite .pc-title a { color: inherit; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.paper-cite .pc-title a:hover { text-decoration-color: currentColor; }
.paper-cite .pc-venue, .paper-cite .pc-doi { font-size: 13px; color: var(--ink-3); }
.papers-list { display: grid; gap: 8px 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); }
.chord-wrap { display: grid; grid-template-columns: minmax(0, 560px) minmax(220px, 1fr); gap: 24px; align-items: center; }
@media (max-width: 860px) { .chord-wrap { grid-template-columns: 1fr; } }
.chord { width: 100%; height: auto; display: block; max-width: 560px; margin: 0 auto; }
.chord .ribbons path { fill-opacity: 0.42; stroke-opacity: 0.6; stroke-width: 0.5; transition: fill-opacity .15s, stroke-opacity .15s; }
.chord .ribbons path:hover { fill-opacity: 0.75; }
.chord .ribbons path.dim { fill-opacity: 0.05; stroke-opacity: 0.08; }
.chord-arc { cursor: pointer; transition: opacity .15s; outline: none; }
.chord-arc.dim { opacity: 0.25; }
.chord-arc:focus-visible { stroke: var(--ink); stroke-width: 1.5; }
.chord-lab { font: 600 12px var(--font-sans, Inter, system-ui, sans-serif); cursor: pointer; letter-spacing: .02em; }
.chord-c1 { font: 600 17px var(--font-serif); fill: var(--ink); paint-order: stroke; stroke: var(--panel); stroke-width: 5px; stroke-linejoin: round; }
.chord-c2 { font: 12px var(--font-sans, Inter, system-ui, sans-serif); fill: var(--ink-2); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.chord-side h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 0 0 10px; font-weight: 600; }
.flow-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.flow-list li { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; font-size: 13.5px; cursor: default; padding: 2px 4px; border-radius: 6px; }
.flow-list li:hover { background: var(--panel-2, rgba(0,0,0,.04)); }
.flow-list .fl-t { white-space: nowrap; font-weight: 600; }
.flow-list .fl-bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.flow-list .fl-bar i { display: block; height: 100%; border-radius: 4px; opacity: .8; }
.flow-list .fl-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.home-papers { height: 300px; }
#home-papers { margin-top: 12px; }

.tex-label.plate { background: color-mix(in oklab, var(--panel) 88%, transparent); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.provenance { margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.provenance .eyebrow { display: inline; margin-right: 6px; }
.provenance a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); }
.provenance a:hover { border-color: var(--bc, var(--accent)); }
.provenance .pv-au { font-weight: 600; }
.papers-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-top: 14px; }
.papers-q { flex: 1 1 320px; max-width: 520px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); color: var(--ink-3); }
.papers-q:focus-within { border-color: var(--accent); }
.papers-q input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; font-size: 15px; padding: 9px 0; color: var(--ink); outline: none; }
.field-chips button.chip { font: inherit; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.paper-row .pi { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.35; }
.paper-row .pi span { color: var(--ink-2); }
.paper-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: baseline; padding: 9px 14px; border-radius: 12px; background: var(--panel); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; border-left: 3px solid var(--bc); }
.paper-row:hover { background: var(--panel-2, var(--panel)); }
.paper-row .yr { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--bc); font-size: 15px; }
.paper-row .tt { font-family: var(--font-serif); font-size: 16.5px; line-height: 1.28; }
.paper-row .au { font-size: 13px; color: var(--ink-2); }
.paper-row .st { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.paper-row.planned { border-left-style: dashed; }
@media (max-width: 640px) { .paper-row { grid-template-columns: 48px 1fr; } .paper-row .st { display: none; } }

/* ---------- search ---------- */
.search-results { max-height: min(70vh, 620px); overflow-y: auto; }
.sr-item mark, .sr-list mark { background: color-mix(in oklab, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.sr-item.planned .sr-name { color: var(--ink-2); }
.sr-tag { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.sr-tag.paper { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.sr-page .sr-num { font-family: var(--font-ui); font-weight: 600; color: var(--bc, var(--fc, var(--ink-2))); }
.sr-all { border-top: 1px solid var(--line); margin-top: 4px; border-radius: 0 0 8px 8px; }
.sr-all span:last-child { color: var(--accent); font-weight: 500; font-size: 13px; }
.search-page .search-big { display: flex; gap: 10px; margin: 14px 0 8px; max-width: 760px; }
.search-page .search-big input { flex: 1; font: inherit; font-size: 17px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); }
.search-page .search-big input:focus { outline: 2px solid color-mix(in oklab, var(--accent) 50%, transparent); outline-offset: 1px; }
.search-help { margin: 12px 0; color: var(--ink-2); font-size: 13px; }
.search-help summary { cursor: pointer; width: fit-content; }
.search-help p { font-size: 13px; line-height: 1.9; max-width: 760px; margin-top: 8px; }
.search-help code { font-size: 12px; padding: 1px 5px; border-radius: 5px; background: var(--panel-2); margin-right: 2px; }
.search-layout.no-results { grid-template-columns: minmax(0, 1fr); }
.search-layout { display: grid; grid-template-columns: 230px 1fr; gap: 22px; align-items: start; margin-top: 10px; }
.facet-panel { position: sticky; top: calc(var(--header-height) + 16px); }
.facet-panel > summary { cursor: pointer; padding: 12px 16px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.facet-panel[open] > summary { border-bottom: 1px solid var(--line); }
.facets { padding: 14px; display: grid; gap: 14px; }
.facet .eyebrow { margin-bottom: 4px; }
.facet-row > span { display: inline-flex; align-items: center; gap: 6px; }
.facet-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 6px; border-radius: 6px; font-size: 13.5px; color: var(--ink-2); text-decoration: none; }
.facet-row:hover { background: var(--panel-2); color: var(--ink); }
.facet-row b { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sr-list { display: grid; gap: 4px; }
.sr-list .sr-item { background: var(--panel); box-shadow: var(--shadow); border-left: 3px solid var(--bc, var(--fc, var(--line-2))); }
.sr-list .sr-item:hover { background: var(--panel-2); }
.sr-pages { margin-bottom: 12px; }
@media (max-width: 760px) { .search-layout { grid-template-columns: 1fr; } .facet-panel { position: static; } }
.map-q { padding: 4px 8px; display: flex; align-items: center; gap: 8px; box-shadow: var(--shadow); }
.map-q input { font: inherit; font-size: 13px; width: min(320px, 50vw); border: none; background: transparent; color: var(--ink); outline: none; }
.map-q-n { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.papers-timeline { height: 360px; padding: 0; overflow: hidden; position: relative; margin-bottom: 18px; }
.field-chips .chip.on { color: var(--c-accent); border-color: var(--c-accent); background: color-mix(in srgb, var(--c-accent) 8%, var(--panel)); }
.hero-search { display: flex; gap: 8px; margin-top: 0; border-bottom: 1px solid var(--line-2); }
.hero-search input { flex: 1; min-width: 0; width: 100%; font-size: 14px; padding: 12px 0; border-radius: 0; border: 0; background: none; color: var(--ink); }
.hero-search input:focus { outline: 2px solid color-mix(in srgb, var(--c-accent) 35%, transparent); outline-offset: 2px; }
.hero-search:focus-within { border-color: var(--c-accent); }
.hero-search .btn { flex: none; width: 44px; padding: 0; border: 0; background: none; color: var(--ink-2); }
.hero-search .btn:hover { color: var(--c-accent); background: var(--panel-2); }
.hero-try { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 11px; color: var(--ink-3); }
.hero-try > span { margin-right: 2px; }
.hero-try a { color: var(--ink-2); padding: 4px 2px; }
.hero-try a:hover { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; }

/* Shared interaction and responsive details. */
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; background: var(--ink); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 12px; color: var(--bg); }
#app:focus { outline: none; }
.fields-menu, .search-results { box-shadow: 0 12px 40px -12px rgb(0 0 0 / .25); overscroll-behavior: contain; }
.search input:focus { border-color: var(--c-accent); }
.search:focus-within kbd { opacity: 0; }
.sr-item { min-width: 0; }
.sr-name { min-width: 0; overflow-wrap: anywhere; }
.sr-list .sr-item { padding: 14px 16px; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); box-shadow: none; }
.sr-item.sel { box-shadow: inset 0 0 0 1px var(--line-2); }
.search-big { align-items: stretch; }
.search-big input { min-width: 0; }
.field-chips { margin-top: 18px; }
.field-chips .count { color: var(--ink-3); font: 11px var(--font-mono); }
.ctl-select { flex-wrap: wrap; }
.ctl-input { min-width: 0; max-width: 100%; }
.ctl-input input { min-width: 0; width: 100%; }
.ctl-play .play { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.switch { min-height: 32px; }
button:disabled { cursor: default; opacity: .45; }
.card:is(a), .field-card { transition: border-color .18s, background-color .18s; }
.ch-card, .col-card, .bridge-card { padding: 20px; gap: 9px; }
.col-card .meta, .ch-card .meta, .bridge-card .meta { padding-top: 8px; }
.col-list li a, .ch-list li a { padding-block: 9px; }
.paper-row { box-shadow: none; border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding-block: 13px; }
.paper-row > span { min-width: 0; }
.section-title > .muted { font-size: 13px; }
.flow-head > .muted { max-width: 520px; line-height: 1.5; }
.map-q input { min-height: 30px; min-width: 0; }
.map-q:focus-within, .papers-q:focus-within { outline: 2px solid var(--c-accent); outline-offset: 2px; }
/* Quiet surfaces keep the collection colors and diagrams in focus. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.field-card, .col-card, .ch-card, .thm-card, .bridge-card, .feat, .j-card {
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none;
}
.field-card::before, .book-card::before { height: 2px; }
.col-card::before { width: 2px; }
.col-card.soon, .ch-card.soon, .thm-card.planned { background: none; }
.statement { background: none; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; box-shadow: none; }
.viz-card, .lineage-card { background: none; border: 0; padding-inline: 0; }
.panel { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding-inline: 0; }
.j-step.planned .j-card { background: none; }
.paper-row, .sr-list .sr-item { background: none; border-top: 0; border-right: 0; border-radius: 0; }
.paper-row:hover, .sr-list .sr-item:hover, a.card:hover { background: var(--panel-2); }
.seg { border-radius: 6px; }
.seg button { border-radius: 3px; }

@media (max-width: 1000px) {
  .hero-layout { gap: 32px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .hero-discover { padding: 0; }
}
@media (max-width: 760px) {
  .hero { padding-top: 36px; }
  .hero-layout { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { margin-top: 0; }
  .hero p.lede { font-size: 18px; }
  .hero-discover { padding: 0; }
  .hero-stats { margin-top: 24px; gap: 8px 20px; }
  .flow-card { padding: 16px 0 0; }
  .flow-head { gap: 6px; }
  .flow-head > .muted { font-size: 11px !important; }
  .section-title { margin-top: 32px; }
  .page-head { padding-top: 28px; }
  .thm-page { padding-top: 22px; }
  .statement { padding: 16px; font-size: 18px; overflow-x: auto; }
  .viz-card { padding: 10px 0; }
  .viz-controls { padding: 12px 2px 2px; gap: 12px 16px; }
  .ctl-slider { max-width: 100%; }
  .ctl-slider input[type=range] { min-width: 50px; }
  .ctl-slider .ctl-label { max-width: 45%; }
  .side-grid { gap: 14px; }
  .lineage-card .lineage-svg-wrap { max-height: 360px; }
  .path-group li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; }
  .path-group li .tag { grid-column: 2; margin-left: 0; }
  .path-group.target li { grid-template-columns: 3.4em minmax(0, 1fr); }
  .flow-list li { grid-template-columns: 140px minmax(0, 1fr) 38px; gap: 6px; }
  .facets { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .site-footer { margin-top: 40px; padding-bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}

/* Interactive diagrams retain the same cues for pointer and keyboard use. */
.gnode:focus-visible rect { stroke-width: 2.2; }
.tm-field-control:focus-visible, .tm-ch:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.treemap-svg .tm-label { paint-order: stroke; stroke: var(--panel); stroke-width: 1.2px; stroke-linejoin: round; }
.map-tip { max-width: min(340px, calc(100% - 16px)); overflow-wrap: anywhere; }
.canvas-tools { position: absolute; right: 16px; bottom: 14px; z-index: 5; display: flex; gap: 4px; }
.canvas-tools .btn-icon { font-size: 20px; font-weight: 400; }
.map-page .map-help { bottom: 62px; }
.timeline-page .canvas-tools { top: 10px; bottom: auto; }
.timeline-page .map-help { left: 14px; right: 190px; line-height: 1.5; }
.timeline-page canvas:focus-visible, .map-page canvas:focus-visible { outline-offset: -3px; }
@media (max-width: 640px) {
  .canvas-tools { right: 10px; bottom: 10px; }
}
