/* One stylesheet for every page. Night (navy) by default; Day with the toggle (data-theme="light" on <html>).
   Palette: night sky, cream paper, marigold, ultramarine, rose and mint. Figures and diagrams sit on cream
   "sheets" in both modes, so their colours are checked against one surface. */
:root {
  color-scheme: dark;
  --bg: #1f2747;
  --surface: #252f57;
  --ink: #f6eedc;
  --ink-2: #e2d6bc;
  --muted: #aab0c8;
  --rule: #343d66;
  --rule-2: #4a5480;
  --accent: #f4b93e;
  --accent-text: #f4b93e;
  --tag: #ee7fa0;
  --tag-ok: #5cc8a1;
  --tag-ink: #141826;
  --shadow: rgba(10, 13, 28, .5);
  --sky: url(/assets/sky-night.svg);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --measure: 41rem;
  --wide: 64rem;
  --gutter: clamp(1rem, 4vw, 2rem);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ede6d6;
  --surface: #f6eedc;
  --ink: #141826;
  --ink-2: #2c3352;
  --muted: #5d6178;
  --rule: #dccfb4;
  --rule-2: #c7b897;
  --accent: #2e4ab8;
  --accent-text: #2e4ab8;
  --shadow: rgba(20, 24, 38, .16);
  --sky: url(/assets/sky-day.svg);
}
/* Cream paper, the same in both modes: figures and the home page's diagram. */
.sheet, .fig {
  color-scheme: light;
  --surface: #f6eedc;
  --ink: #141826;
  --ink-2: #2c3352;
  --muted: #5d6178;
  --rule: #e2d6bc;
  --rule-2: #cbbd9e;
  --accent: #2e4ab8;
  --accent-text: #2e4ab8;
  --mark: #a26d0c;
  --quiet: #d4c6a8;
  --series-1: #a26d0c;
  --series-2: #3a5bd9;
  background: var(--surface);
  color: var(--ink);
  border-radius: 4px;
  box-shadow: 6px 6px 0 var(--shadow);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg) var(--sky) center top / cover fixed;
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--tag-ink); }
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--rule-2); transition: text-decoration-color .15s, color .15s; }
a:hover { text-decoration-color: var(--accent); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-family: var(--sans); text-wrap: balance; }
h1 { font-weight: 700; font-size: clamp(2.2rem, 5.4vw, 3.3rem); line-height: 1.04; letter-spacing: -.035em; }
h2 { font-weight: 700; font-size: clamp(1.45rem, 3vw, 1.8rem); line-height: 1.15; letter-spacing: -.025em; }
h3 { font-weight: 600; font-size: 1.05rem; line-height: 1.35; letter-spacing: -.01em; }
p { margin: 0; }
code, pre, kbd { font-family: var(--mono); font-size: .88em; }
.dot { color: var(--accent); }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; padding: .5rem .75rem; background: var(--ink); color: var(--bg); z-index: 10; }
.skip:focus { left: 1rem; top: 1rem; }

/* Header and footer */
.site-head { border-bottom: 1px solid var(--rule); background: color-mix(in oklab, var(--bg) 82%, transparent); }
.head-row { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; flex-wrap: wrap; padding-block: .5rem; }
.brand { display: inline-flex; align-items: center; gap: .65rem; text-decoration: none; margin-right: auto; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 4px; background: var(--ink); color: var(--bg); font: 400 1.25rem/1 var(--serif); padding-bottom: 2px; box-shadow: 3px 3px 0 var(--shadow); }
/* The bar shows no mark or name: the home page's title is the name. The link stays for screen readers and keyboards, and shows the name when focused. */
.brand-mark { display: none; }
.brand:focus-visible .brand-name { position: static; width: auto; height: auto; clip-path: none; }
.brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.site-nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.6rem); font-size: .95rem; }
.site-nav a { text-decoration: none; color: var(--muted); padding-block: .3rem; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.theme { appearance: none; border: 1px solid var(--rule-2); background: transparent; color: var(--ink); width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.theme svg { width: 1rem; height: 1rem; }
.theme circle { fill: none; stroke: currentColor; stroke-width: 1.5; }
.theme path { fill: currentColor; }
@media (max-width: 34rem) {
  .head-row { gap: .5rem 1rem; }
  .site-nav { order: 3; width: 100%; justify-content: space-between; border-top: 1px solid var(--rule); padding-top: .4rem; }
}
.site-foot { margin-top: 6rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .9rem; background: color-mix(in oklab, var(--bg) 70%, transparent); }
.foot-row { padding-block: 2rem 3rem; display: grid; gap: .5rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; }
.foot-note { font-size: .82rem; }
.foot-sign { font: .75rem/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; margin-top: .75rem; }

/* Small mono labels */
.kicker, .small-head, .entry-date, .status, .stamp, .fig-n, .crumbs, .tldr-label, .facts dt, .status-date, .timeline time, .block-aside {
  font-family: var(--mono); font-size: .75rem; letter-spacing: .06em; text-transform: uppercase;
}
.kicker, .small-head, .block-aside { color: var(--muted); }
.lede { font-size: clamp(1.15rem, 2.2vw, 1.3rem); line-height: 1.5; color: var(--ink); }

/* Home */
.hero { padding-block: clamp(3rem, 8vw, 5.5rem) 1rem; display: grid; gap: 2.5rem; align-items: center; }
.hero-text { display: grid; gap: 1.1rem; max-width: var(--measure); }
.hero h1 { font-size: clamp(2.8rem, 7.5vw, 4.6rem); }
.hero .voice { font: italic 400 clamp(1.35rem, 2.6vw, 1.65rem)/1.3 var(--serif); color: var(--ink-2); }
.hero p:not(.kicker):not(.lede):not(.voice) { color: var(--ink-2); }
.hero-fig { margin: 0; padding: 1.25rem 1.25rem 1rem; justify-self: center; width: min(100%, 27rem); }
.hero-fig figcaption { margin-top: .6rem; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.hero-fig .fig-n { display: block; margin-bottom: .2rem; }
@media (min-width: 56rem) { .hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }

.thread { margin-top: 2.5rem; padding-block: 2rem; border-block: 1px solid var(--rule); display: grid; gap: .8rem; }
.thread-q { font-weight: 700; font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.12; letter-spacing: -.03em; max-width: 34rem; }
.thread-q em { font-style: normal; color: var(--accent-text); }
.thread > p:not(.thread-q):not(.small-head) { color: var(--ink-2); max-width: var(--measure); }
.fields { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.fields h3 { margin-bottom: .25rem; }
.fields p { color: var(--ink-2); font-size: .97rem; }

/* The diagram (on a sheet) */
.diagram { width: 100%; height: auto; overflow: visible; display: block; }
.diagram .d-label { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; fill: var(--muted); }
.diagram .d-wire, .diagram .d-tip { stroke: var(--rule-2); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.diagram .d-node { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.5; }
.diagram .d-hit { fill: var(--accent); stroke: var(--accent); }
.diagram .d-answer { font: 700 18px var(--sans); fill: var(--ink); letter-spacing: -.02em; }
.diagram .d-copy, .diagram .d-copy-tip { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.diagram .d-note { font: italic 400 16px var(--serif); fill: var(--accent); }

/* Lists of work */
.block { margin-top: clamp(3rem, 7vw, 4.5rem); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--rule-2); padding-bottom: .6rem; }
.block-head h2 { margin-right: auto; }
.block-head a { font-size: .92rem; color: var(--muted); }
.block-aside { width: 100%; order: 3; }
.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 7.5rem 1fr; gap: .25rem 1.5rem; padding-block: 1.35rem; border-bottom: 1px solid var(--rule); }
.entry-date { color: var(--muted); padding-top: .25rem; }
.entry-main { display: grid; gap: .35rem; max-width: var(--measure); }
.entry-title { font-weight: 700; font-size: 1.2rem; line-height: 1.3; letter-spacing: -.02em; }
.entry-title a { text-decoration: none; }
.entry-title a:hover { color: var(--accent-text); }
.entry-sum { color: var(--ink-2); }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .3rem; }
.entry-empty { display: block; color: var(--muted); }
@media (max-width: 40rem) { .entry { grid-template-columns: 1fr; } .entry-date { padding-top: 0; } }

/* Status: a plain label, then a paper tag (NOT PEER-REVIEWED) */
.status { color: var(--muted); }
.stamp { display: inline-block; background: var(--tag); color: var(--tag-ink); padding: .12rem .8rem .1rem .5rem; border-radius: 2px; font-weight: 500; line-height: 1.5; transform: rotate(-1.5deg); clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%); }
.stamp-ok { background: var(--tag-ok); }

/* Page heads */
.page-head { padding-block: clamp(2.5rem, 7vw, 4.5rem) 0; display: grid; gap: 1rem; max-width: var(--measure); }
.legend { margin-top: 2.5rem; padding: 1.25rem 1.5rem; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); }
.legend .small-head { margin: 0; cursor: pointer; list-style: none; }
.legend .small-head::-webkit-details-marker { display: none; }
.legend .small-head::before { content: "+ "; }
.legend[open] .small-head::before { content: "− "; }
.legend[open] .small-head { margin-bottom: .9rem; }
.status-legend { margin: 0; display: grid; gap: .9rem; }
.status-legend div { display: grid; grid-template-columns: 20rem 1fr; gap: .25rem 1rem; align-items: baseline; }
.status-legend dt { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.status-legend dd { margin: 0; color: var(--ink-2); font-size: .95rem; }
@media (max-width: 40rem) { .status-legend div { grid-template-columns: 1fr; } }
.field-head { border-bottom: 1px solid var(--rule-2); padding-bottom: .75rem; display: grid; gap: .3rem; }
.field-q { font: italic 400 1.2rem/1.4 var(--serif); color: var(--ink-2); }

/* A research entry or a note */
.crumbs { display: flex; gap: .5rem; color: var(--muted); padding-top: 2rem; }
.crumbs a { color: var(--muted); }
.paper-head { padding-block: 1.25rem 0; display: grid; gap: 1rem; max-width: 46rem; }
.paper-head h1 { font-size: clamp(1.9rem, 4.6vw, 2.8rem); line-height: 1.1; }
.paper-status { display: flex; flex-wrap: wrap; gap: .5rem .7rem; align-items: center; }
.status-date { color: var(--muted); }
.byline { color: var(--ink-2); }
.tldr { font-size: 1.15rem; line-height: 1.55; padding-left: 1rem; border-left: 3px solid var(--accent); }
/* Paper titles are long: a little smaller on phones, so the summary and the paper's buttons fit the first screen. */
@media (max-width: 34rem) { .paper .paper-head h1 { font-size: 1.6rem; } .paper .tldr { font-size: 1.05rem; } }
.tldr-label { display: block; color: var(--accent-text); margin-bottom: .15rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; padding-top: .25rem; }
.btn { display: inline-flex; align-items: center; min-height: 2.5rem; padding: .45rem .95rem; border: 1px solid var(--rule-2); border-radius: 4px; text-decoration: none; font-size: .92rem; background: var(--surface); }
.btn:hover { border-color: var(--ink); }
.btn-main { background: var(--accent); color: var(--tag-ink); border-color: var(--accent); font-weight: 500; box-shadow: 3px 3px 0 var(--shadow); }
:root[data-theme="light"] .btn-main { color: #fff; }
.btn-main:hover { border-color: var(--accent); filter: brightness(1.05); }
.notice { margin-top: 2rem; max-width: var(--measure); padding: .9rem 1.1rem; border-radius: 4px; background: var(--surface); border-left: 4px solid var(--tag); font-size: .95rem; color: var(--ink); }

.prose { max-width: var(--measure); margin-top: 2.5rem; }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { margin-top: 3rem; }
.prose h3 { margin-top: 2rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: .45rem; }
.prose li::marker { color: var(--accent); }
.prose strong { font-weight: 600; }
.prose blockquote { margin-inline: 0; padding-left: 1rem; border-left: 2px solid var(--rule-2); color: var(--ink-2); font-style: italic; }
.prose code { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .05em .3em; }
pre { background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 1rem; overflow-x: auto; line-height: 1.5; }
pre code { background: none; border: 0; padding: 0; font-size: .82rem; }
.prose .fig { max-width: none; }
.fig-shot img { display: block; width: 100%; height: auto; border-radius: 3px; border: 1px solid var(--rule-2); }

/* Figures: drawn on a sheet */
.fig { margin: 2.5rem 0; padding: 1.25rem; }
.fig figcaption { font-weight: 600; font-size: 1rem; line-height: 1.4; margin-bottom: 1rem; }
.fig-n { display: block; color: var(--muted); font-weight: 400; margin-bottom: .2rem; }
.fig-caption { margin-top: .75rem; color: var(--ink-2); font-size: .95rem; }
.fig-note { margin-top: .5rem; color: var(--muted); font-size: .85rem; }
.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .baseline { stroke: var(--rule-2); stroke-width: 1; }
.chart .ref { stroke: var(--ink-2); stroke-width: 1; opacity: .55; }
.chart .ref-label { fill: var(--muted); font-size: 11px; }
.chart .tick { fill: var(--muted); font: 11px var(--mono); }
.chart .axis-title { fill: var(--muted); font-size: 12px; }
.chart .row-label { fill: var(--ink-2); font-size: 13px; }
.chart .value { fill: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--mark); }
.chart .bar-quiet { fill: var(--quiet); }
.chart .link { stroke: var(--rule-2); stroke-width: 2; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }
.chart .dot-q { fill: var(--muted); }
.chart .dot-1 { fill: var(--series-1); }
.chart .dot-2 { fill: var(--series-2); }
.chart .dot-3 { fill: var(--ink); }
.chart .legend-text { fill: var(--ink-2); font-size: 12.5px; }
.chart .row-label, .chart .value, .chart .ref-label { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .mark:hover .bar, .chart .mark:hover .dot { filter: brightness(1.12); }
.chart-narrow { display: none; }
.fig-data { margin-top: .9rem; font-size: .9rem; }
.fig-data summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.fig-data table { margin-top: .6rem; border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.fig-data th, .fig-data td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--rule); font-weight: 400; }
.fig-data tr:first-child th { color: var(--muted); }
.fig-data td { text-align: right; }
@media (max-width: 34rem) {
  .chart-wide { display: none; }
  .chart-narrow { display: block; }
  .fig { padding: 1rem .9rem; }
}
@media (forced-colors: active) { .chart .bar, .chart .dot-1 { fill: CanvasText; } .chart .dot-2 { fill: Highlight; } }

/* How it went, and the citation block */
.paper .block { max-width: 46rem; }
.paper .block h2 { margin-bottom: 1.25rem; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule-2); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.25rem; display: grid; gap: .15rem; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: .4rem; width: 9px; height: 9px; transform: rotate(45deg); background: var(--accent); }
.timeline time { color: var(--muted); }
.timeline p { color: var(--ink-2); }
.facts { margin: 0 0 2rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem 1.5rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; }
.facts dt { color: var(--muted); margin-bottom: .2rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.abstract { display: grid; gap: .9rem; margin: .75rem 0 2rem; color: var(--ink-2); }
.bib-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.copy { appearance: none; font: 500 .85rem/1 var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--rule-2); border-radius: 4px; padding: .5rem .85rem; cursor: pointer; }
.copy:hover { border-color: var(--ink); }

/* Tool page extras */
.example { display: grid; gap: .5rem; padding: 1rem 1.1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; font-size: .95rem; }
.example p { display: grid; grid-template-columns: 6rem 1fr; gap: 1rem; }
.example b { font: 500 .75rem/1.9 var(--mono); letter-spacing: .06em; color: var(--muted); }
.fig-glyph { display: grid; justify-items: center; }
.fig-glyph .glyph { width: min(100%, 18rem); margin: .5rem auto 0; overflow: visible; }
.lg-ink { fill: var(--ink); }
.lg-haze { fill: var(--ink); opacity: .14; }
.lg-bleeds { opacity: .7; }
.lg-pos { fill: var(--series-2); }
.lg-neg { fill: var(--series-1); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  .site-head, .site-foot, .actions, .copy, .theme { display: none; }
  body { background: #fff; color: #000; }
  .fig, .facts, pre, .sheet { box-shadow: none; border: 1px solid #ccc; }
}

/* ---------- Finding cards: a small chart on a sheet, the short title, one line ---------- */
.cards { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); }
.card { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: 4px; padding: 1rem 1rem 1.1rem; box-shadow: 5px 5px 0 var(--shadow); transition: translate .25s ease, box-shadow .25s ease; }
.card:hover { translate: 0 -3px; box-shadow: 8px 9px 0 var(--shadow); }
.card-link { display: grid; gap: .45rem; text-decoration: none; flex: 1; align-content: start; }
.card-link::after { content: ''; position: absolute; inset: 0; }
.card-link:focus-visible { outline: none; }
.card:has(.card-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.card-sheet { height: 6.5rem; padding: .75rem .9rem; margin-bottom: .5rem; rotate: -.6deg; box-shadow: 3px 3px 0 var(--shadow); display: grid; align-items: center; }
.card:nth-child(even) .card-sheet { rotate: .5deg; }
.card-meta { display: flex; justify-content: space-between; gap: 1rem; font: .72rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card-title { font-size: 1.1rem; line-height: 1.3; }
.card:hover .card-title { color: var(--accent-text); }
.card-hook { color: var(--ink-2); font-size: .95rem; line-height: 1.5; }
.card-tags { margin-top: .9rem; position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.chart.mini { width: 100%; height: 100%; max-height: 5rem; display: block; }
.chart.mini .ref { opacity: .4; }
:root[data-theme="light"] .card { background: #f6eedc; }

/* ---------- Key numbers on a research page ---------- */
.numbers { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); max-width: 52rem; }
.numbers li { display: grid; gap: .35rem; align-content: start; padding: 1rem 1.1rem; border-radius: 4px; background: var(--surface); border-top: 3px solid var(--accent); }
.num { font-weight: 700; font-size: clamp(1.5rem, 3.2vw, 1.95rem); line-height: 1.1; letter-spacing: -.03em; color: var(--accent-text); }
.num-label { color: var(--ink-2); font-size: .9rem; line-height: 1.45; }
.abstract-box { margin: .5rem 0 2rem; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: .8rem 0; }
.abstract-box summary { cursor: pointer; font-weight: 600; }
.abstract-box .abstract { margin-bottom: .5rem; }

/* ---------- The two fields, with their drawings ---------- */
.fields li { display: grid; grid-template-columns: 3rem 1fr; column-gap: 1rem; align-items: start; }
.fields li > :not(svg) { grid-column: 2; }
.fields .glyph-icon { grid-row: 1 / span 2; width: 3rem; height: 3rem; }
.glyph-icon circle, .glyph-icon ellipse { fill: var(--bg); stroke: var(--ink); stroke-width: 1.6; }
.glyph-icon .g-line path { fill: none; stroke: var(--ink-2); stroke-width: 1.3; stroke-linecap: round; opacity: .8; }
.glyph-icon .g-wing { fill: none; stroke: var(--ink-2); stroke-width: 1.3; opacity: .8; }
.glyph-icon .g-hit { fill: var(--accent); stroke: var(--accent); }

/* ---------- A few stars that twinkle (night only) ---------- */
.twinkle { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.twinkle i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); background: #f6eedc; opacity: .45; clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); }
:root[data-theme="light"] .twinkle { display: none; }

/* ---------- The steps of a study (notes) ---------- */
.steps { list-style: none; padding: 0; margin: 2rem 0; display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.prose .steps { max-width: none; }
.steps li { margin: 0; padding: 1rem 1.1rem 1.1rem; border-radius: 4px; background: var(--surface); display: grid; gap: .4rem; align-content: start; box-shadow: 4px 4px 0 var(--shadow); }
.steps li + li { margin-top: 0; }
.step-n { font: 700 .8rem/1 var(--mono); color: var(--tag-ink); background: var(--accent); justify-self: start; padding: .3rem .45rem; border-radius: 2px; }
.steps h3 { margin: .2rem 0 0; }
.steps p { color: var(--ink-2); font-size: .95rem; line-height: 1.5; }
@media (min-width: 64rem) { .note .prose:has(.steps) { max-width: 56rem; } .note .prose:has(.steps) > :not(.steps) { max-width: var(--measure); } }

/* ---------- Motion (only with JavaScript and without reduced motion: the class is set by site.js) ---------- */
.motion .reveal { opacity: 0; transform: perspective(900px) rotateX(-16deg) translateY(16px); transform-origin: 50% 0; transition: opacity .6s ease, transform .9s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 90ms); }
.motion .reveal.in { opacity: 1; transform: none; }
.motion .card.reveal { transition-property: opacity, transform, translate, box-shadow; }
.hero-fig { rotate: -1.2deg; }

/* bars grow from their baseline, dots drop in, values follow */
.motion .chart .bar { transform: scaleX(0); transform-box: fill-box; transform-origin: 0 50%; transition: transform .9s cubic-bezier(.2, .8, .2, 1) calc(.3s + var(--i, 0) * 90ms); }
.motion .chart .bar-neg { transform-origin: 100% 50%; }
.motion .in .chart .bar { transform: none; }
.motion .chart .dot { transform: scale(0); transform-box: fill-box; transform-origin: 50% 50%; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) calc(.35s + var(--i, 0) * 110ms); }
.motion .in .chart .dot { transform: none; }
.motion .chart .value, .motion .chart .link { opacity: 0; transition: opacity .5s ease calc(.9s + var(--i, 0) * 90ms); }
.motion .in .chart .value, .motion .in .chart .link { opacity: 1; }

/* tags are stamped on */
@keyframes stamp-on { from { opacity: 0; transform: scale(1.6) rotate(-9deg); } to { opacity: 1; transform: rotate(-1.5deg); } }
.motion .reveal .stamp { opacity: 0; }
.motion .reveal.in .stamp { animation: stamp-on .4s cubic-bezier(.2, 1.4, .4, 1) .55s both; }
.motion .paper-status .stamp { animation: stamp-on .4s cubic-bezier(.2, 1.4, .4, 1) .35s both; }

/* the study's timeline marks fill in, one after another */
.motion .timeline li::before { transform: rotate(45deg) scale(0); transition: transform .4s cubic-bezier(.3, 1.6, .5, 1) calc(.2s + var(--i, 0) * 140ms); }
.motion .timeline.in li::before { transform: rotate(45deg) scale(1); }
.motion .timeline.reveal { transform: none; }

/* the home diagram plays its move on a loop: A pulses, the copy arrow draws, B takes the value, the answer turns */
.motion .hero-fig .d-src { transform-box: fill-box; transform-origin: 50% 50%; animation: d-pulse 7s ease-in-out infinite; }
.motion .hero-fig .d-copy { stroke-dasharray: 100; animation: d-draw 7s ease-in-out infinite; }
.motion .hero-fig .d-copy-tip, .motion .hero-fig .d-note { animation: d-show 7s ease-in-out infinite; }
.motion .hero-fig .d-dst { animation: d-fill 7s ease-in-out infinite; }
.motion .hero-fig .d-result { animation: d-turn 7s ease-in-out infinite; }
@keyframes d-pulse { 0%, 4% { transform: scale(1); } 9% { transform: scale(1.4); } 15%, 100% { transform: scale(1); } }
@keyframes d-draw { 0%, 12% { stroke-dashoffset: 100; } 40%, 86% { stroke-dashoffset: 0; } 95%, 100% { stroke-dashoffset: 100; } }
@keyframes d-show { 0%, 38% { opacity: 0; } 44%, 86% { opacity: 1; } 94%, 100% { opacity: 0; } }
@keyframes d-fill { 0%, 40% { fill: var(--surface); } 47%, 86% { fill: var(--accent); } 95%, 100% { fill: var(--surface); } }
@keyframes d-turn { 0%, 48% { fill: var(--ink); } 55%, 86% { fill: var(--accent); } 95%, 100% { fill: var(--ink); } }

/* stars twinkle */
@keyframes twinkle { from { opacity: .1; transform: scale(.6); } to { opacity: .85; transform: scale(1); } }
.motion .twinkle i { animation: twinkle var(--d) ease-in-out var(--w) infinite alternate; }
@media print { .motion .reveal, .motion .chart .bar, .motion .chart .dot, .motion .chart .value, .motion .chart .link, .motion .stamp { opacity: 1 !important; transform: none !important; animation: none !important; } .twinkle { display: none; } }
.empty-note { grid-column: 1 / -1; list-style: none; margin-top: 1.25rem; padding: 1.1rem 1.25rem; border: 1px dashed var(--rule-2); border-radius: 4px; color: var(--muted); font: .8rem/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

/* Line charts */
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-1 { stroke: var(--series-1); }
.chart .line-2 { stroke: var(--series-2); }
.chart .line-3 { stroke: var(--ink); }
.chart .pt { stroke: var(--surface); stroke-width: 1.5; }
.chart .pt-1 { fill: var(--series-1); }
.chart .pt-2 { fill: var(--series-2); }
.chart .pt-3 { fill: var(--ink); }
.motion .chart .line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.4s cubic-bezier(.3, .7, .3, 1) calc(.3s + var(--i, 0) * 250ms); }
.motion .in .chart .line { stroke-dashoffset: 0; }
.motion .chart .pt { opacity: 0; transition: opacity .4s ease calc(1.3s + var(--i, 0) * 250ms); }
.motion .in .chart .pt { opacity: 1; }
.btn-todo { opacity: .55; border-style: dashed; cursor: default; }
.chart .pt-label { fill: var(--muted); font: 11px var(--mono); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; }
.chart .cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .cursor-dot { stroke: var(--surface); stroke-width: 2; transition: cx .15s, cy .15s; }
.scrub { display: grid; grid-template-columns: 1fr; gap: .4rem; margin-top: .6rem; }
.scrub input { width: 100%; accent-color: #a26d0c; }
.scrub-out { font: .85rem/1.5 var(--mono); color: var(--ink-2); min-height: 1.5em; }
.scrub-line { font: 1rem/1.4 var(--mono); white-space: pre; overflow: hidden; margin-bottom: .8rem; padding: .5rem .6rem; background: #efe5cf; border-radius: 3px; color: var(--ink); }
.scrub-done { color: var(--ink); }
.scrub-left { color: var(--muted); opacity: .45; }
.scrub-caret { display: inline-block; width: 2px; height: 1.1em; vertical-align: -.2em; background: #a26d0c; margin: 0 1px; }
@media (max-width: 34rem) { .scrub-line { font-size: .78rem; } }

/* Mechanism diagrams (content/diagrams/*.svg) */
.diagram-fig .mech { max-width: 100%; }
.mech .m-text { font: 14px var(--mono); fill: var(--ink); white-space: pre; }
.mech .m-faint { fill: var(--muted); }
.mech .m-dec-t { fill: var(--ink); font-weight: 500; }
.mech .m-note { font: italic 13px var(--serif); fill: var(--muted); }
.mech .m-label { font: 500 11.5px var(--mono); letter-spacing: .02em; paint-order: stroke; stroke: #f6eedc; stroke-width: 5px; stroke-linejoin: round; }
.mech .m-count-t { fill: #a26d0c; }
.mech .m-read-t { fill: #3a5bd9; }
.mech .m-arc { fill: none; stroke-width: 2.2; stroke-linecap: round; }
.mech .m-count { stroke: #a26d0c; stroke-dasharray: none; }
.mech .m-read { stroke: #3a5bd9; }
.mech .m-nl { fill: #141826; }
.mech .m-nl-t { font: 600 15px var(--mono); fill: #f6eedc; }
.mech .m-dec { fill: none; stroke: #a26d0c; stroke-width: 2; }
.mech .m-tag { font: 600 12px var(--mono); letter-spacing: .04em; text-transform: uppercase; fill: var(--ink); }
.mech .m-small { font: 12.5px var(--sans); fill: var(--ink-2); }
.mech .m-box { fill: #efe5cf; stroke: var(--rule-2); }
.mech .m-flow { stroke: var(--ink-2); stroke-width: 1.5; fill: none; }
.mech .m-flow-tip { stroke: var(--ink-2); stroke-width: 1.5; fill: none; stroke-linejoin: round; }
.motion .diagram-fig .anim-draw { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.2s cubic-bezier(.3, .7, .3, 1) .4s; }
.motion .diagram-fig .m-read.anim-draw { transition-delay: .9s; }
.motion .diagram-fig .m-flow.anim-draw { transition-delay: 1.5s; transition-duration: .5s; }
.motion .diagram-fig.in .anim-draw { stroke-dashoffset: 0; }
/* On phones a diagram with a portrait version (<name>-narrow.svg) swaps to it; one without scrolls sideways. */
.diagram-fig .mech-narrow { display: none; }
@media (max-width: 34rem) {
  .diagram-fig:not(.has-narrow) { overflow-x: auto; }
  .diagram-fig:not(.has-narrow) .mech { min-width: 560px; }
  .diagram-fig .mech-wide { display: none; }
  .diagram-fig .mech-narrow { display: block; }
}
.chart .line-dash { stroke-dasharray: 6 4; }
.motion .chart .line-dash { stroke-dasharray: 6 4; stroke-dashoffset: 0; opacity: 0; transition: opacity 1s ease .6s; }
.motion .in .chart .line-dash { opacity: 1; }
.mech .m-hdr { fill: none; stroke: var(--rule-2); stroke-width: 1.4; }
.mech .m-hdr-on { stroke: #3a5bd9; stroke-width: 2; }
.mech .m-cand { stroke: #3a5bd9; opacity: .25; stroke-dasharray: 3 4; }
.mech .m-copy { stroke: #a26d0c; stroke-width: 1.6; stroke-dasharray: 3 3; fill: none; }
.mech .m-caret { fill: #a26d0c; }
.mech .m-tok { fill: #f6eedc; stroke: var(--ink-2); stroke-width: 1.4; }
.mech .m-tok-on { fill: #e3e7f7; stroke: #3a5bd9; stroke-width: 2; }
.mech .m-tok-t { font: 600 15px var(--mono); fill: var(--ink); }
.mech .m-route { fill: #efe5cf; stroke: #a26d0c; stroke-width: 1.2; }
.mech .m-route-b { stroke: var(--rule-2); }
.mech .m-strong { font-weight: 600; fill: var(--ink); }
.mech .m-out { fill: #141826; }
.mech .m-out-t { font: 600 17px var(--mono); fill: #f6eedc; }
.mech .m-win { fill: #f4b93e; }
.mech .m-rule { stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 2 4; }
.mech .m-strip { fill: #e3e7f7; }
.mech .m-strip-cap { fill: #a26d0c; }
.mech .m-ticks line { stroke: var(--ink-2); stroke-width: 1; }
.mech .m-axis { font: 11px var(--mono); fill: var(--muted); }
.mech .m-word { font: 600 20px var(--mono); fill: #3a5bd9; }
.mech .m-word-cap { fill: #a26d0c; }
.mech .m-ell { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 4 3; }
.mech .m-bracket { fill: none; stroke: var(--ink-2); stroke-width: 1.3; }
.mech .m-bracket-w { stroke: #a26d0c; }
.mech .m-faint-line { stroke: var(--rule-2); stroke-dasharray: 3 3; }
.mech .m-task { fill: #141826; }
.mech .m-task-t { font: 600 13px var(--sans); fill: #f6eedc; }
.mech .m-own { fill: #efe5cf; stroke: var(--rule-2); }
.mech .m-shared { fill: #f6eedc; stroke: #a26d0c; stroke-width: 2.2; }
.mech .m-gen { fill: none; stroke: var(--ink-2); stroke-width: 1.3; stroke-dasharray: 5 4; }
.mech .m-link { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.mech .m-link-on { stroke: #a26d0c; stroke-width: 2.2; }
.mech .m-link-dash { stroke-dasharray: 4 4; opacity: .7; }
.motion .diagram-fig .anim-pop { transform-box: fill-box; transform-origin: 50% 50%; transform: scale(.85); opacity: 0; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1) .5s, opacity .4s ease .5s; }
.motion .diagram-fig.in .anim-pop { transform: none; opacity: 1; }
.tally { list-style: none; padding: 0; margin: 1.75rem 0; display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); max-width: none; }
.prose .tally li { margin: 0; padding: .7rem .8rem; border-radius: 4px; background: var(--surface); border-top: 3px solid var(--tag-ok); display: grid; gap: .15rem; }
.tally b { font-size: 1.15rem; letter-spacing: -.02em; }
.tally span { font: .72rem/1.4 var(--mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.prose .tally li.tally-miss { border-top-color: var(--tag); }
.motion .tally li { opacity: 0; transform: translateY(8px); transition: opacity .4s ease calc(var(--i) * 80ms), transform .5s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * 80ms); }
.motion .tally.in li { opacity: 1; transform: none; }
.motion .tally.reveal { opacity: 1; transform: none; }
