@font-face { font-family: Geist; src: url("../fonts/Geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/GeistMono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
/* ==========================================================
   Design tokens — the whole look lives here.
   Chart tokens (--chart-*) are shared by charts.js and docs/chart-style.md.
   ========================================================== */
:root {
  --ground: #2A2F37;
  --raised: #2F343C;
  --ink: #ECEEF1;
  --ink-2: #D5D9DE;      /* body text */
  --ink-3: #B4BBC4;      /* secondary */
  --muted: #8F98A4;      /* labels, meta (4.5:1 on ground) */
  --faint: #555D69;      /* decorative only */
  --rule: #3D444E;
  --rule-2: #4A515C;
  --axis: #596170;
  --amber: #F5B544;      /* the one accent */

  /* chart palette: categorical, in this order */
  --chart-1: #F5B544;    /* amber */
  --chart-2: #7DD3C0;    /* teal */
  --chart-3: #C4B5FD;    /* lavender */
  --chart-4: #F59E8B;    /* coral */
  --chart-5: #93C5FD;    /* sky */
  --chart-6: #D9D2C3;    /* sand */
  --chart-grid: #3D444E;
  --chart-axis: #596170;
  --chart-label: #8F98A4;

  --sans: Geist, system-ui, -apple-system, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { background: var(--ground); }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--ground); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: none; transition: color .2s; }
a:hover { color: var(--amber); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 1px solid var(--amber); outline-offset: 4px; border-radius: 4px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--amber); color: var(--ground); padding: 8px 12px; z-index: 10; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 20px; } }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--ink-3); }
.amber { color: var(--amber); }
.small { font-size: 12px; }
.strong { color: var(--ink); }
.ul { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 4px; }

/* header / footer */
.top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px 24px; padding: 40px 0 0; font-size: 13px; }
.top .muted a { color: var(--muted); }
.phone-nav { display: none; flex-basis: 100%; flex-wrap: wrap; gap: 20px; font-family: var(--sans); font-size: 14px; }
.phone-nav a { color: var(--ink-3); }
@media (max-width: 640px) { .phone-nav { display: flex; } }
.foot { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 96px; padding: 24px 0 48px; border-top: 1px solid var(--rule); font-size: 12px; }
.foot a { color: #9BA3AE; }
.foot a:hover { color: var(--ink); }
.foot .icons { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.foot .icons a { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--rule-2); border-radius: 50%; color: #9BA3AE; transition: color .2s, border-color .2s, background .2s; }
.foot .icons a:hover, .foot .icons a:focus-visible { color: var(--amber); border-color: var(--amber); background: var(--raised); }
.foot .ico { display: block; }
.foot { align-items: center; }
.push { margin-left: auto; }

/* type */
.lede { margin: 0; font-size: 26px; line-height: 1.4; font-weight: 300; letter-spacing: -0.01em; color: var(--ink-2); max-width: 560px; flex: 999 1 420px; }
.lede-sm { margin: 0; font-size: 20px; line-height: 1.6; font-weight: 300; color: var(--ink-2); }
.pagetitle { margin: 0; font-size: 40px; font-weight: 300; letter-spacing: -0.02em; line-height: 1.15; }
.h2 { margin: 6px 0 0; font-size: 28px; font-weight: 400; letter-spacing: -0.01em; }
.sub { margin: 12px 0 0; font-size: 16px; line-height: 1.6; color: var(--ink-3); max-width: 620px; }
.label { margin: 0; font-size: 12px; font-weight: 400; color: var(--muted); }
@media (max-width: 640px) { .pagetitle { font-size: 30px; } .lede { font-size: 22px; } }

/* layout */
.hero { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 24px 48px; margin-top: 88px; }
.caption { flex: 1 1 220px; margin: 0; font-size: 12px; line-height: 1.7; color: var(--muted); max-width: 280px; }
.split { display: flex; flex-wrap: wrap; gap: 16px 64px; }
.split > :first-child { flex: 1 1 220px; }
.split > :last-child { flex: 999 1 520px; min-width: 0; }
.head { margin-top: 88px; }
.block { margin-top: 96px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--rule); }
.rows > li:first-child { border-top: 1px solid var(--rule); }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; }
.row .t { font-size: 17px; }
.row:hover .t { color: var(--amber); }
.row.big { flex-wrap: wrap; gap: 6px 24px; padding: 20px 0; }
.row.big .when { width: 96px; }
.row.big .body { flex: 999 1 360px; min-width: 0; }
.row.big .t { font-size: 20px; font-weight: 300; }
.paper { padding: 16px 0; }
.paper p { margin: 0; }
.paper .t { font-size: 17px; margin-bottom: 6px; }
.themes { margin: 32px 0 0; padding: 0; list-style: none; font-size: 16px; line-height: 1.6; color: #C6CBD2; }
.themes li { display: flex; gap: 16px; padding: 10px 0; border-top: 1px solid var(--rule); }
.themes li:last-child { border-bottom: 1px solid var(--rule); }
.themes .mono { width: 32px; padding-top: 3px; flex: none; }
.meta { margin: 14px 0 0; }
.meta a { color: var(--ink-3); }

/* home diagram */
.csd { position: relative; margin-top: 56px; aspect-ratio: 900 / 560; cursor: crosshair; user-select: none; }
.csd svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.csd .lines { fill: none; stroke: #C3C8CF; stroke-width: 1; stroke-linecap: round; }
.csd .axis { fill: none; stroke: var(--axis); stroke-width: 1; }
.csd .tp { fill: var(--amber); animation: tp 3.6s ease-in-out infinite; }
.csd .glow { transition: transform .45s cubic-bezier(.2,.7,.2,1), opacity .45s ease; }
.csd .sweep { stroke: var(--amber); stroke-width: 1; stroke-opacity: .2; animation: sw 10s linear infinite; }
.csd .sweep.off { display: none; }
.csd .xh { opacity: 0; transition: opacity .2s; }
.csd .xh.on { opacity: 1; }
.csd .xh line { stroke: var(--ink); stroke-width: .75; stroke-opacity: .35; stroke-dasharray: 2 4; }
.csd .xh circle { fill: none; stroke: var(--amber); stroke-width: 1.2; }
.cell { position: absolute; transform: translate(-50%, -50%); text-align: center; padding: 10px 16px; white-space: nowrap; }
.cell .occ { font-size: 11px; color: var(--muted); transition: color .25s; }
.cell .w { font-size: 20px; font-weight: 400; transition: color .25s; }
.cell.lit .occ, .cell.lit .w, .cell:hover .occ, .cell:hover .w, .cell:focus-visible .w { color: var(--amber); }
.hidden-state { pointer-events: none; }
.hidden-state .occ { color: var(--faint); }
.hidden-state .reveal { display: none; font-size: 18px; color: var(--amber); }
.hidden-state.lit .reveal { display: inline; }
.hidden-state.lit .occ { color: var(--amber); }
.axlabel { position: absolute; font-size: 11px; color: var(--muted); }
.axlabel.x { right: 0; bottom: -26px; }
.axlabel.y { left: -34px; top: 0; }
@media (max-width: 640px) { .cell .w { font-size: 15px; } .cell { padding: 6px 8px; } .axlabel.y { left: 4px; top: -30px; } .axlabel.y br { display: none; } }

.readout { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 48px; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.readout .volts { min-width: 220px; }
.readout .read { flex: 1 1 300px; }
.dotring { fill: none; stroke: var(--muted); stroke-width: 1; }
.dotlink { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 2 3; }
.e { fill: var(--amber); opacity: .08; transition: opacity .3s; }
.e.on { opacity: 1; }
.cur { animation: blink 1.1s step-end infinite; }
.readout-line { margin: 16px 0 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--ink-3); }

@keyframes tp { 0%,100% { opacity: .4 } 50% { opacity: 1 } }
@keyframes sw { 0% { transform: translateX(-40px); opacity: 0 } 8% { opacity: 1 } 92% { opacity: 1 } 100% { transform: translateX(940px); opacity: 0 } }
@keyframes blink { 0%,49% { opacity: 1 } 50%,100% { opacity: 0 } }
@media (prefers-reduced-motion: reduce) { .csd .tp, .csd .sweep, .cur { animation: none; } .csd .glow, .e { transition: none; } }
.split > h2.label { padding-top: 2px; }
section.split { margin-top: 64px; }

/* lists, search, chips */
.q { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--axis); color: var(--ink); font: 300 22px var(--sans); padding: 10px 0; outline: none; }
.q:focus { border-bottom-color: var(--amber); outline: none; }
.q::placeholder { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 40px; }
.chip { font-family: var(--mono); font-size: 12px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--rule-2); background: transparent; color: var(--ink-3); cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; }
.chip:hover { border-color: var(--muted); color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); }
.empty { padding: 20px 0; }
.list li[hidden] { display: none; }

/* articles */
.article { margin-top: 88px; max-width: 640px; }
.article-title { margin: 14px 0 48px; }
.prose { font-size: 18px; line-height: 1.75; color: var(--ink-2); font-weight: 300; }
.prose p { margin: 0 0 24px; }
.prose a { text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 4px; }
.prose h2 { font-size: 24px; font-weight: 400; color: var(--ink); margin: 48px 0 16px; }
.prose h3 { font-size: 19px; font-weight: 500; color: var(--ink); margin: 32px 0 12px; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 24px; }
.prose blockquote { margin: 0 0 24px; padding-left: 20px; border-left: 2px solid var(--rule-2); color: var(--ink-3); }
.prose code { font-family: var(--mono); font-size: .85em; background: var(--raised); padding: 2px 6px; border-radius: 4px; }
.prose pre { background: var(--raised); padding: 16px 20px; border-radius: 8px; overflow-x: auto; font-size: 14px; }
.prose pre code { background: none; padding: 0; }
.prose img { max-width: 100%; border-radius: 6px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; margin-bottom: 24px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 8px 12px; text-align: left; }
.math-block { margin: 8px 0 32px; padding: 20px 24px; border-left: 2px solid var(--amber); background: var(--raised); overflow-x: auto; color: var(--ink); }
.prose details { margin: 0 0 32px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.prose details summary { cursor: pointer; list-style: none; padding: 14px 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.prose details summary::-webkit-details-marker { display: none; }
.prose details summary::before { content: "+"; margin-right: 8px; display: inline-block; transition: transform .2s; }
.prose details[open] summary::before { content: "–"; }
.prose details summary:hover { color: var(--amber); }
.prose details > :not(summary) { font-size: 16px; }
.footnote { font-size: 14px; color: #9BA3AE; border-top: 1px solid var(--rule); margin-top: 48px; padding-top: 16px; }
.footnote hr { display: none; }
.footnote-ref a, sup a { color: var(--amber); text-decoration: none; font-family: var(--mono); font-size: 11px; }
/* sidenotes: prose.js moves footnotes into the margin on wide screens */
.sidenote { font-size: 14px; line-height: 1.6; color: #9BA3AE; }
.sidenote .n { font-family: var(--mono); font-size: 11px; color: var(--amber); margin-right: 4px; }
@media (min-width: 1100px) {
  .sidenote { float: right; clear: right; width: 260px; margin-right: -320px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--rule); }
}
@media (max-width: 1099px) {
  .sidenote { display: block; margin: -12px 0 24px; padding-left: 14px; border-left: 2px solid var(--rule-2); }
}
.tags { margin: 40px 0 0; }
.discussion { margin-top: 80px; max-width: 640px; }
.discussion .label { margin-bottom: 12px; }
.box { padding: 24px; border: 1px dashed var(--rule-2); border-radius: 12px; font-size: 15px; margin: 0; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; margin-top: 64px; font-size: 12px; }
.pager a { color: #9BA3AE; max-width: 40%; }
.pager a:hover { color: var(--ink); }

/* widgets */
.widget { margin: 0 0 32px; padding: 24px; border: 1px solid var(--rule); border-radius: 12px; background: var(--raised); font-weight: 400; }
.widget h4 { margin: 0 0 18px; font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.widget .cols { display: flex; flex-wrap: wrap; gap: 24px 40px; align-items: center; }
.widget .controls { flex: 1 1 260px; display: flex; flex-direction: column; gap: 18px; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.widget input[type=range] { width: 100%; accent-color: var(--amber); }
.widget .out { flex: 1 1 220px; display: flex; gap: 24px; align-items: center; font-family: var(--mono); font-size: 13px; line-height: 1.9; color: var(--ink-3); }
.widget .big { color: var(--amber); font-size: 20px; white-space: nowrap; }

/* charts (see charts.js) */
.chart { margin-top: 32px; }
.chart .controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chart .plot { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 600px; }
.chart .pt { transition: r .15s, opacity .25s; cursor: pointer; }
.chart .hover { margin: 16px 0 0; padding: 12px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.chart .hover a { color: var(--ink-3); text-decoration: underline; text-decoration-color: var(--axis); text-underline-offset: 3px; }
.ds-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 32px; }
.ds-head p { margin: 0; }

/* now + bookshelf */
.nowlist { margin: 0; font-size: 18px; line-height: 1.6; font-weight: 300; }
.nowlist div { display: flex; flex-wrap: wrap; gap: 4px 24px; padding: 16px 0; border-top: 1px solid var(--rule); }
.nowlist div:last-child { border-bottom: 1px solid var(--rule); }
.nowlist dt { width: 120px; padding-top: 6px; }
.nowlist dd { flex: 1 1 280px; margin: 0; }
.shelf-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.shelf-head p { margin: 0; }
.shelf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 40px; padding-bottom: 2px; border-bottom: 2px solid var(--axis); }
.book { background: #383D45; border-top: 3px solid var(--muted); display: flex; align-items: center; justify-content: center; transition: transform .25s ease; cursor: default; }
.book[href] { cursor: pointer; }
.book.reading { border-top-color: var(--amber); background: #3C4149; }
.book span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 13px; color: #C6CBD2; white-space: nowrap; overflow: hidden; max-height: 90%; }
.book:hover, .book:focus-visible { transform: translateY(-6px); }

/* research topics */
.row.topic .when { width: 40px; }
.article.wide { max-width: none; }
.article.wide .prose > p { max-width: 640px; }
.row.topic .arrow { transition: transform .2s, color .2s; }
.row.topic:hover .arrow { transform: translateX(4px); color: var(--amber); }
.topic-sum { margin: -28px 0 40px; }
.prose .chart { margin: 32px 0 8px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero.no-lede { margin-top: 72px; justify-content: flex-start; }
.hero.no-lede .caption { max-width: 520px; }

/* 404 */
.nf-k { padding-top: 14px; }
.nf-title { margin: 0 0 16px; }
.nf-links { margin-top: 32px; }
.nf-back { margin-top: 24px; }

/* keep the footer at the bottom on short pages */
body > .wrap { min-height: 100vh; display: flex; flex-direction: column; }
body > .wrap > main { flex: 1 0 auto; }

/* projects (posters) */
.row.project { align-items: center; gap: 24px; }
.row.project .body { flex: 1 1 auto; min-width: 0; }
.row.project .thumb { flex: 0 0 auto; width: 72px; height: 102px; overflow: hidden; border-radius: 4px; border: 1px solid var(--rule-2); background: var(--raised); }
.row.project .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; filter: grayscale(1) brightness(.85) contrast(.95); opacity: .75; transition: filter .3s, opacity .3s, transform .3s; }
.row.project:hover .thumb img, .row.project:focus-visible .thumb img { filter: none; opacity: 1; transform: scale(1.04); }
.project-meta { margin: -16px 0 28px; line-height: 1.7; }

/* poster: small card + full view */
.poster-card { display: flex; align-items: center; gap: 16px; padding: 12px 16px 12px 12px; margin: 0 0 48px; max-width: 360px; border: 1px solid var(--rule); border-radius: 8px; background: var(--raised); }
.pc-thumb { flex: 0 0 auto; padding: 0; border: 1px solid var(--rule-2); border-radius: 4px; overflow: hidden; background: none; cursor: zoom-in; line-height: 0; }
.pc-thumb img { width: 48px; height: 68px; object-fit: cover; object-position: top; filter: grayscale(1) brightness(.85); transition: filter .25s; }
.pc-thumb:hover img, .pc-thumb:focus-visible img { filter: none; }
.pc-text { display: flex; flex-direction: column; gap: 6px; }
.pc-links a { color: var(--ink-3); }
.pc-links a:hover { color: var(--amber); }
.poster-view { width: min(92vw, 900px); max-height: 92vh; padding: 16px; border: 1px solid var(--rule-2); border-radius: 10px; background: var(--ground); color: var(--ink); }
.poster-view::backdrop { background: rgb(20 23 28 / .82); }
.poster-view img { display: block; width: 100%; height: auto; border-radius: 4px; }
.poster-view form { text-align: right; margin: 0 0 10px; }
.pv-close { background: none; border: 0; color: var(--muted); cursor: pointer; }
.pv-close:hover { color: var(--amber); }
.poster-view p { margin: 12px 0 0; text-align: right; }

/* figures inside write-ups */
.prose .fig { margin: 32px 0; }
.prose .fig img { display: block; max-width: 100%; height: auto; margin: 0 auto; padding: 10px; border-radius: 6px; background: #fff; filter: brightness(.92); }
.prose .fig figcaption { margin-top: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); }
.prose .fig.wide { margin-left: calc(min(0px, (640px - 900px) / 2)); margin-right: calc(min(0px, (640px - 900px) / 2)); }
.prose .fig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 32px 0; align-items: start; }
.prose .fig-row .fig { margin: 0; }
@media (max-width: 900px) { .prose .fig.wide { margin-left: 0; margin-right: 0; } }
@media (max-width: 640px) { .prose .fig-row { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .row.project .thumb img { transition: none; } }
@media (max-width: 640px) { .row.topic .arrow { display: none; } }

/* plots in write-ups (plots.js) */
.plotw { margin: 32px 0; }
.plotw .tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.plotw .plot svg { display: block; width: 100%; height: auto; }
.plotw .plot.small { max-width: 340px; }
.plotw .plot.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: end; }
.plotw .sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 16px; }
.plotw .sl { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.plotw .sl b { font-weight: 400; color: var(--amber); }
.plotw input[type=range] { width: 100%; accent-color: var(--amber); }
.plotw .hover { margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid var(--rule); font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--ink-3); }
.plotw .maps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 20px; }
.plotw .mapc { margin: 0; }
.plotw .mw { position: relative; border-radius: 3px; overflow: hidden; border: 1px solid var(--rule-2); }
.plotw .mw canvas { display: block; width: 100%; aspect-ratio: 3 / 2; image-rendering: pixelated; }
.plotw .mk { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; border: 1.5px solid var(--ink); pointer-events: none; }
.plotw .mapc figcaption { margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; }
.plotw .mapnote { margin: 8px 0 0; }
@media (max-width: 640px) {
  .plotw .plot.two, .plotw .sliders { grid-template-columns: 1fr; }
  .plotw .maps { grid-template-columns: repeat(2, 1fr); }
}

.now-more { margin-top: 40px; }
#bookshelf { margin-top: 0; }

/* now: a dated note, older ones as a quiet log */
.now-stamp { margin: 6px 0 14px; color: var(--muted); }
.now-text p { margin: 0 0 12px; font-size: 22px; line-height: 1.55; font-weight: 300; color: var(--ink-2); max-width: 560px; }
.now-reading { margin: 24px 0 0; padding-top: 14px; border-top: 1px solid var(--rule); max-width: 560px; }
.now-log { list-style: none; margin: 0; padding: 0; }
.now-log li { padding: 18px 0; border-top: 1px solid var(--rule); opacity: .75; }
.now-log li:last-child { border-bottom: 1px solid var(--rule); }
.now-log p { margin: 0 0 6px; }
.now-log div p { margin: 0; font-size: 16px; line-height: 1.6; font-weight: 300; color: var(--ink-3); }
@media (max-width: 640px) { .now-text p { font-size: 19px; } }
.now-updated { margin-top: 14px; }
.now-label { margin: 0 0 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 8px; min-height: 120px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 10px; background: var(--raised); }
.tile .tl { font-size: 11px; color: var(--muted); }
.tile .tv { font-size: 20px; line-height: 1.3; font-weight: 300; color: var(--ink); }
.tile a.tv:hover { color: var(--amber); }
.tile .tv.dim { color: var(--ink-3); }
.tile .ts { margin-top: auto; font-size: 11px; color: var(--muted); }
#clock { font-variant-numeric: tabular-nums; }

.now-meta { margin-top: 28px !important; }
.now-facts { margin: 0; max-width: 560px; }
.now-facts div { display: flex; gap: 24px; padding: 12px 0; border-top: 1px solid var(--rule); }
.now-facts div:last-child { border-bottom: 1px solid var(--rule); }
.now-facts dt { width: 110px; flex: 0 0 auto; color: var(--muted); }
.now-facts dd { margin: 0; color: var(--ink-3); }

.now-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; max-width: 560px; }
.now-photos.one { grid-template-columns: 1fr; }
.now-photos figure { margin: 0; }
.now-photos img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; border: 1px solid var(--rule); filter: saturate(.9); }
.now-photos figcaption { margin-top: 6px; }

/* hole-spin database (templates/database.html, static/js/database.js) */
.db .db-banner { margin: -28px 0 32px; color: var(--amber); }
.db-stats { display: flex; flex-wrap: wrap; gap: 12px 40px; margin: 40px 0 0; padding: 20px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.db-stats div { display: flex; flex-direction: column; gap: 4px; }
.db-stats dt { font-size: 12px; color: var(--muted); }
.db-stats dd { margin: 0; font-size: 20px; color: var(--ink); }
.db-section { margin-top: 72px; }
.db-section .sub { margin-bottom: 8px; }
.db-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 24px 0 16px; color: var(--ink-3); }
.db-controls select, .db-controls input { font-family: var(--mono); font-size: 12px; color: var(--ink); background: var(--raised); border: 1px solid var(--rule-2); border-radius: 8px; padding: 8px 10px; min-height: 36px; max-width: 100%; }
.db-controls input[type=search] { flex: 1 1 220px; }
.db-note { margin: 12px 0 0; }
.db-scroll { overflow-x: auto; }
.db-table table, .db-gap table { border-collapse: collapse; width: 100%; font-family: var(--mono); font-size: 12px; }
.db-table th, .db-table td, .db-gap th, .db-gap td { border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; color: var(--ink-2); }
.db-table th, .db-gap th { color: var(--muted); font-weight: 400; }
.db-table td.num, .db-gap .num, .db-table td:nth-child(4) { white-space: nowrap; }
.db-gap td.num:not(.muted) { color: var(--amber); }
.db-pager { align-items: center; margin-top: 16px; }
.db-pager button:disabled { opacity: .35; cursor: default; }
.db-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }

/* tools (templates/tool.html, static/js/tools/) */
.tk { margin-top: 40px; }
.tk-grid { display: grid; grid-template-columns: minmax(240px, 300px) 1fr; gap: 40px; align-items: start; }
@media (max-width: 860px) { .tk-grid { grid-template-columns: 1fr; gap: 24px; } }
.tk-side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding: 2px 8px 8px 2px; scrollbar-width: thin; }
@media (max-width: 860px) { .tk-side { position: static; max-height: none; overflow: visible; } .tk-main { order: -1; } }
.tk-main { min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.tk-sec { font-family: var(--mono); font-size: 11px; color: var(--muted); margin: 8px 0 -6px; }
.tk-field { display: flex; flex-direction: column; gap: 8px; }
.tk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.tk-num { display: inline-flex; align-items: baseline; gap: 6px; }
.tk-num input, .tk-conv input, .tk-conv select { font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--raised); border: 1px solid var(--rule-2); border-radius: 6px; padding: 6px 8px; }
.tk-num input { width: 92px; text-align: right; }
.tk-num input.bad, .tk-conv input.bad { border-color: #e06c5a; }
.tk-unit { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tk-hint { font-size: 13px; line-height: 1.5; color: var(--ink-3); margin: 0; }
.tk-field input[type=range] { width: 100%; accent-color: var(--amber); height: 28px; margin: 0; }
.tk-seg { display: flex; flex-wrap: wrap; gap: 8px; }
.tk-presets, .tk-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-svg { width: 100%; height: auto; display: block; }
.tk-plot { background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; padding: 12px; }
.tk-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 24px; margin: 0; }
.tk-out div { display: flex; flex-direction: column; gap: 4px; }
.tk-out dt { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tk-out dd { margin: 0; font-family: var(--mono); font-size: 16px; color: var(--ink); }
.tk-matrices { display: flex; flex-wrap: wrap; gap: 32px; }
.tk-matrix table { border-collapse: collapse; font-family: var(--mono); font-size: 13px; margin-top: 6px; }
.tk-matrix td { padding: 4px 12px; text-align: right; color: var(--ink-2); border-left: 1px solid var(--rule); }
.tk-matrix td:first-child { border-left: 0; }
.tk-conv { display: flex; flex-direction: column; gap: 10px; }
.tk-conv-row { display: grid; grid-template-columns: 1fr minmax(120px, 200px) 90px; gap: 10px; align-items: center; }
@media (max-width: 560px) { .tk-conv-row { grid-template-columns: 1fr 90px; } .tk-conv-name { grid-column: 1 / -1; } }
.tk-conv-name { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.tk-conv input { width: 100%; text-align: right; font-size: 15px; }
.tk-notes { margin-top: 64px; max-width: 680px; }
.tk-cards { list-style: none; padding: 0; margin: 48px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tk-card { display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 22px; border: 1px solid var(--rule); border-radius: 12px; background: var(--raised); color: inherit; text-decoration: none; transition: border-color .15s; }
.tk-card:hover, .tk-card:focus-visible { border-color: var(--amber); }
.tk-card-title { font-size: 18px; color: var(--ink); }
.tk-card-sum { font-size: 14px; line-height: 1.5; color: var(--ink-3); }
.tk-card-ask { color: var(--amber); margin-top: auto; }
.tk-bloch .tk-svg { max-width: 520px; margin: 0 auto; display: block; user-select: none; }
.tk-scrub { display: flex; align-items: center; gap: 12px; }
.tk-scrub input[type=range] { flex: 1; accent-color: var(--amber); }
.tk-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .tk-two { grid-template-columns: 1fr; } }
.tk-mtx { border-collapse: collapse; font-family: "Geist Mono", ui-monospace, monospace; font-size: 13px; margin: 6px 0 8px; }
.tk-mtx th { color: var(--muted); font-weight: 400; padding: 4px 6px; text-align: center; }
.tk-mtx td { padding: 2px; text-align: right; }
.tk-mtx input { width: 4.6em; background: var(--ground); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 6px; font: inherit; text-align: right; }
.tk-mtx input:focus { outline: none; border-color: var(--amber); }
.tk-mtx-out td { padding: 5px 8px; border-radius: 4px; color: var(--ink); }
.tk-mtx-out td.tk-diag { color: var(--muted); }
.tk-matrix-in { overflow-x: auto; }
.tk-text { width: 100%; box-sizing: border-box; background: var(--ground); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 8px; font-family: "Geist Mono", ui-monospace, monospace; font-size: 13px; resize: vertical; }
.tk-text:focus, .tk-mtx select:focus { outline: none; border-color: var(--amber); }
.tk-sched .tk-mtx th { font-size: 11px; white-space: nowrap; }
.tk-sched .tk-mtx input { width: 5.4em; }
.tk-mtx select { background: var(--ground); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 5px 4px; font: inherit; }
.tk-sched .chip.tk-x { padding: 2px 9px; }
.tk-sched-head .tk-sec { margin-bottom: 2px; }

/* ---------- reading room ---------- */
.rr-head { display: grid; gap: 14px; margin: 8px 0 18px; }
.rr-stats { display: flex; flex-wrap: wrap; gap: 28px; }
.rr-stat { display: flex; flex-direction: column; }
.rr-stat-n { font-size: 28px; color: var(--ink); line-height: 1.1; }
.rr-stat-l { font-size: 11px; color: var(--muted); }
.rr-balance { display: grid; gap: 4px; max-width: 520px; }
.rr-bal-row { display: grid; grid-template-columns: 150px 1fr 24px; gap: 10px; align-items: center; font-size: 12px; color: var(--ink-3); }
.rr-bal-track { position: relative; height: 6px; background: var(--rule); border-radius: 3px; }
.rr-bal-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.rr-bal-target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-3); }
.rr-bal-n { text-align: right; color: var(--muted); }
.rr-sync { margin: 0; color: var(--muted); }
.rr-sync.error { color: var(--chart-4); }
.rr-sync.synced { color: var(--chart-2); }
.rr-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 20px; }
.rr-intro { color: var(--ink-3); margin: 0 0 14px; }
.rr-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.rr-card { background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; position: relative; }
.rr-card h3 { margin: 6px 0 2px; font-size: 18px; font-weight: 500; }
.rr-card h3 a { color: var(--ink); text-decoration: none; }
.rr-card h3 a:hover { color: var(--amber); }
.rr-card p { margin: 6px 0; line-height: 1.55; }
.rr-card-top { display: flex; gap: 14px; align-items: flex-start; }
.rr-cover { border-radius: 4px; flex: none; background: var(--rule); }
.rr-cover-m { width: 64px; }
.rr-cover-s { width: 40px; }
.rr-field { display: inline-block; font-family: var(--mono); font-size: 11px; color: var(--fc); border: 1px solid var(--fc); border-radius: 999px; padding: 1px 8px; }
.rr-reasons { margin: 8px 0; padding-left: 18px; color: var(--ink-3); font-size: 14px; line-height: 1.5; }
.rr-reasons li { margin: 3px 0; }
.rr-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.rr-primary { border-color: var(--amber) !important; color: var(--amber) !important; }
.rr-book { background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; padding: 16px 18px; margin: 0 0 18px; }
.rr-detail-card .rr-book { border: 0; padding: 0; background: none; margin-top: 12px; }
.rr-book-head { display: flex; gap: 12px; align-items: flex-start; }
.rr-book h3 { margin: 6px 0 2px; font-weight: 500; }
.rr-notes { width: 100%; box-sizing: border-box; background: var(--ground); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; font-family: var(--mono); font-size: 13px; line-height: 1.6; resize: vertical; margin-top: 10px; }
.rr-notes:focus, .rr-input:focus { outline: none; border-color: var(--amber); }
.rr-parsed { margin: 6px 0 0; }
.rr-finish { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.rr-finish p { margin: 0; width: 100%; }
.rr-stars { display: inline-flex; gap: 4px; }
.rr-stars .chip[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); }
.rr-input { background: var(--ground); color: var(--ink); border: 1px solid var(--rule); border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 14px; min-width: 0; }
.rr-finish .rr-input { flex: 1 1 260px; }
.rr-check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-3); }
.rr-help { margin: 0 0 14px; color: var(--ink-3); }
.rr-help summary { cursor: pointer; color: var(--muted); }
.rr-help code { font-family: var(--mono); color: var(--amber); font-size: 12px; }
.rr-flash { max-width: 620px; }
.rr-front { font-size: 20px; color: var(--ink); }
.rr-back { font-size: 17px; color: var(--chart-2); border-top: 1px solid var(--rule); padding-top: 10px; }
.rr-done { color: var(--ink-3); max-width: 620px; }
.rr-mapwrap { background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; padding: 8px; }
.rr-map { width: 100%; height: auto; display: block; }
.rr-node { cursor: pointer; }
.rr-node:hover text, .rr-node:focus text { fill: var(--amber); }
.rr-node:focus { outline: none; }
.rr-sec { display: flex; align-items: center; gap: 10px; margin: 22px 0 8px; font-weight: 400; }
.rr-list { list-style: none; padding: 0; margin: 0; }
.rr-list li { padding: 6px 0; border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.rr-list a { color: var(--ink); text-decoration: none; }
.rr-list a:hover { color: var(--amber); }
.rr-phase { width: 26px; }
.rr-chip { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--rule-2); border-radius: 999px; padding: 0 7px; margin-left: 4px; }
.rr-st-reading { color: var(--amber); border-color: var(--amber); }
.rr-st-read { color: var(--chart-2); border-color: var(--chart-2); }
.rr-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule); }
.rr-add p { width: 100%; margin: 0; color: var(--muted); }
.rr-detail { margin-top: 22px; }
.rr-close { position: absolute; right: 12px; top: 12px; padding: 2px 10px; }
.rr-range { accent-color: var(--amber); width: 240px; vertical-align: middle; }
.rr-card ol, .rr-card ul { line-height: 1.6; }
@media (max-width: 600px) { .rr-bal-row { grid-template-columns: 110px 1fr 20px; } .rr-stats { gap: 18px; } .rr-stat-n { font-size: 22px; } }

/* ---------- learn ---------- */
.lr-title { font-size: 30px; font-weight: 400; margin: 6px 0 4px; line-height: 1.2; }
.lr-hook { font-size: 18px; color: var(--ink-3); margin: 0 0 18px; }
.lr-gen { border-left: 3px solid var(--chart-4); padding: 6px 12px; color: var(--ink-3); background: rgba(245,158,139,0.06); }
.lr-lesson { max-width: 720px; }
.lr-prose h2 { font-size: 20px; font-weight: 500; margin-top: 28px; }
.lr-think { margin: 24px 0; padding: 14px 18px; border-left: 3px solid var(--amber); background: var(--raised); border-radius: 0 10px 10px 0; }
.lr-think p { margin: 4px 0; }
.lr-quiz { margin: 26px 0; padding: 18px; background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; }
.lr-q { margin: 14px 0 18px; }
.lr-qtext { margin: 0 0 8px; color: var(--ink); }
.lr-opts { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.lr-opt { text-align: left; white-space: normal; line-height: 1.4; }
.lr-opt.right { border-color: var(--chart-2) !important; color: var(--chart-2) !important; }
.lr-opt.wrong { border-color: var(--chart-4) !important; color: var(--chart-4) !important; }
.lr-opt.other { opacity: 0.55; }
.lr-why { color: var(--ink-3); margin: 6px 0 0; }
.lr-end p { margin: 8px 0; }
.lr-deeper ul { padding-left: 18px; line-height: 1.7; }
.lr-catch { margin: 0 0 14px; color: var(--muted); }
.lr-catch a { color: var(--ink-3); }
.lr-week { margin: 0 0 18px; }
.lr-week.current { border-left: 2px solid var(--amber); padding-left: 12px; }
.lr-week .rr-list li { gap: 8px; }
.lr-week a { color: var(--ink); text-decoration: none; }
.lr-week a:hover { color: var(--amber); }
.lr-done a { color: var(--ink-3); }
.lr-world h3 { margin: 6px 0; font-weight: 500; }
.lr-world h3 a { color: var(--ink); }
.lr-thumb { float: right; max-width: 140px; margin: 0 0 8px 14px; border-radius: 6px; }
.lr-count { white-space: nowrap; }

/* ---------- vault (password-protected pages) ---------- */
.vault-form { max-width: 360px; display: flex; flex-direction: column; gap: 10px; margin: 24px 0 40px; padding: 20px; background: var(--raised); border: 1px solid var(--rule); border-radius: 12px; }
.vault-form p { margin: 0; }
.vault-label { color: var(--ink-3); font-size: 14px; }
.vault-remember { display: flex; gap: 8px; align-items: center; color: var(--ink-3); }
.vault-err { color: var(--chart-4); min-height: 1.2em; }
.vault-msg { color: var(--ink-3); border-left: 3px solid var(--chart-4); padding: 8px 12px; }
.vault-form button { align-self: flex-start; }

/* The library reuses the reading room's cards, controls and type. */
#library-reading { display: grid; gap: 24px; align-items: start; }
#library-reading > *, #library .rr-body { min-width: 0; }
#library-reading aside { overflow-wrap: anywhere; }
#library .rr-input, #library progress { max-width: 100%; }
#library [aria-current="page"] { border-color: var(--amber); color: var(--amber); }
#library .db-scroll { max-height: 75vh; }
@media (min-width: 840px) {
  #library-reading { grid-template-columns: minmax(0, 2.4fr) minmax(220px, 1fr); }
}
@media (max-width: 360px) {
  #library .rr-cards { grid-template-columns: minmax(0, 1fr); }
}
