/* Palette and type follow NEAR's site (near.org CSS tokens): black on white, off-white panels, NEAR green #00ec97 as accent.
   Headlines: Mona Sans (as near.org). Body: Hanken Grotesk, a free stand-in for near.org's FK Grotesk.
   Chart series validated with the dataviz palette checks (light surface): green #00a86b, lavender #7a6cf0; references grey. */
:root {
  color-scheme: light;
  --page: #ffffff; --band: #000000; --band-ink: #ffffff; --band-2: #acaba6; --brand: #00ec97;
  --ink: #000000; --ink-2: #3f3f3c; --muted: #757575; --accent-ink: #00754a;
  --rule: #000000; --hair: #e5e5e5; --grid: #efefea; --axis: #acaba6; --panel: #f2f1e9;
  --s1: #00a86b; --s2: #8a8a85; --s3: #7a6cf0; --shade: rgba(0,236,151,0.12);
  --good: #00754a; --critical: #bf000f;
  --serif: "Mona Sans", "Hanken Grotesk", Arial, sans-serif;
  --sans: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
code { font-size: 12px; }

/* masthead */
.band { background: var(--band); color: var(--band-ink); border-bottom: 4px solid var(--brand); }
.band .in { max-width: 1120px; margin: 0 auto; padding: 10px 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
            font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
.band .in span:last-child { color: var(--band-2); font-weight: 500; }
main { max-width: 1120px; margin: 0 auto; padding: 0 24px 64px; }

.kicker { margin: 28px 0 10px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kicker b { color: var(--ink); }
h1 { font: 650 36px/1.14 var(--serif); margin: 0 0 12px; letter-spacing: -.02em; max-width: 34ch; }
.deck { font: 400 18px/1.5 var(--serif); color: var(--ink-2); margin: 0 0 20px; max-width: 62ch; }
.byline { display: flex; gap: 24px; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 0; border-top: 3px solid var(--rule); border-bottom: 1px solid var(--hair); }
.byline b { color: var(--ink); font-weight: 600; }

/* front page: summary + sidebar */
.front { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; margin-top: 28px; }
h2 { font: 600 13px/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.takeaways { margin: 0; padding: 0; list-style: none; counter-reset: k; }
.takeaways li { counter-increment: k; position: relative; padding: 0 0 14px 34px; }
.takeaways li::before { content: counter(k, decimal-leading-zero); position: absolute; left: 0; top: 1px; font: 600 12px/1.6 var(--sans); color: var(--accent-ink); }
.takeaways b { font-weight: 600; }
.takeaways p { margin: 2px 0 0; color: var(--ink-2); }

.rating { background: var(--panel); border-top: 3px solid var(--rule); padding: 16px 18px 6px; }
.rating .pos { border-bottom: 1px solid var(--hair); padding-bottom: 12px; margin-bottom: 4px; }
.rating .pos .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.rating .pos .v { font: 700 24px/1.15 var(--serif); color: var(--ink); margin: 2px 0 4px; }
.rating .pos .q { font-size: 12px; color: var(--ink-2); }
.kv { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.kv td { padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.kv tr:last-child td { border-bottom: 0; }
.kv td:first-child { color: var(--ink-2); }
.kv td:last-child { text-align: right; font-weight: 600; }
.hero { margin: 0 0 24px; display: flex; gap: 20px; align-items: baseline; border-bottom: 1px solid var(--hair); padding-bottom: 18px; }
.hero .big { font: 700 64px/1 var(--serif); color: var(--ink); letter-spacing: -.02em; }
.hero .lab { font-size: 13px; color: var(--ink-2); max-width: 40ch; }
.hero .lab b { display: block; color: var(--ink); font-size: 14px; }

/* tripwires */
.trip { margin-top: 36px; }
.trip table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.trip th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 0 12px 8px 0; border-bottom: 1px solid var(--hair); }
.trip td { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.trip td.n { text-align: right; font-weight: 600; white-space: nowrap; }
.trip th.n { text-align: right; }
.trip .rule { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.flag { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.flag::before { content: ""; width: 8px; height: 8px; background: currentColor; }
.flag.ok { color: var(--good); } .flag.bad { color: var(--critical); }

/* exhibits */
.exhibit { margin-top: 40px; }
.exhibit .hd { display: flex; gap: 10px; align-items: baseline; border-top: 1px solid var(--rule); padding-top: 10px; }
.exhibit .no { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--accent-ink); white-space: nowrap; }
.exhibit h3 { font: 600 17px/1.3 var(--serif); margin: 0; }
.exhibit .sub { color: var(--ink-2); font-size: 13px; margin: 4px 0 6px; max-width: 80ch; }
.exhibit .src { color: var(--muted); font-size: 11px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--hair); }
.exhibit .note { color: var(--ink-2); font-size: 13px; margin: 8px 0 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; margin: 8px 0 2px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { width: 18px; height: 0; border-top: 2px solid; display: inline-block; }
.key.dash { border-top-style: dashed; }
.dotkey { width: 8px; height: 8px; display: inline-block; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink-2); font-size: 11px; }
.tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--rule); padding: 8px 10px; font-size: 12px;
       opacity: 0; transition: opacity .1s; min-width: 150px; z-index: 2; font-variant-numeric: tabular-nums; }
.tip .t { color: var(--muted); margin-bottom: 4px; font-size: 11px; letter-spacing: .04em; }
.tip .r { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tip .r b { font-weight: 600; color: var(--ink); }
.tip .r span:last-child { color: var(--ink-2); }

details { margin-top: 6px; font-size: 12px; }
summary { cursor: pointer; color: var(--accent-ink); font-weight: 500; }
.tbl { max-height: 260px; overflow: auto; margin-top: 8px; border-top: 1px solid var(--hair); }
.tbl table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: right; padding: 4px 8px; border-bottom: 1px solid var(--grid); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--ink-2); font-weight: 600; position: sticky; top: 0; background: #fff; }

.disc { margin-top: 56px; padding-top: 12px; border-top: 3px solid var(--rule); font-size: 11px; color: var(--muted); line-height: 1.6; }
.disc h2 { border: 0; padding: 0; margin-bottom: 6px; font-size: 11px; }
.disc p { margin: 0 0 8px; max-width: 110ch; }

@media (max-width: 860px) {
  .front, .two { grid-template-columns: 1fr; gap: 28px; }
  h1 { font-size: 27px; } .deck { font-size: 16px; } .hero .big { font-size: 48px; }
  .band .in, main { padding-left: 16px; padding-right: 16px; }
  .trip .hide-s { display: none; }
}
@media print { .band { -webkit-print-color-adjust: exact; print-color-adjust: exact; } details { display: none; } }

/* thesis page (docs/thesis.html, rendered by src/build.py) */
.prose { max-width: 780px; padding-top: 28px; }
.prose .back { font-size: 12px; margin: 0 0 18px; }
.prose h1 { max-width: none; font-size: 32px; }
.prose h1 + p { color: var(--muted); font-size: 12px; padding: 10px 0; border-top: 3px solid var(--rule); border-bottom: 1px solid var(--hair); margin-bottom: 24px; }
.prose h2 { margin-top: 40px; }
.prose h3 { font: 600 18px/1.3 var(--serif); margin: 28px 0 8px; }
.prose p, .prose li { font: 400 16px/1.65 var(--serif); color: var(--ink); }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose code { font-size: 13px; background: var(--panel); padding: 1px 4px; }
.prose pre { background: var(--panel); padding: 12px 14px; overflow-x: auto; border-left: 3px solid var(--rule); }
.prose pre code { background: none; padding: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font: 13px/1.45 var(--sans); font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.prose th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule); }
.prose td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--hair); vertical-align: top; }
.prose blockquote { margin: 0 0 28px; padding: 18px 22px; background: var(--panel); border-left: 3px solid var(--brand); }
.prose blockquote p { margin: 0 0 10px; }
.prose blockquote p:last-child { margin: 0; }
.prose blockquote strong:first-child { font: 700 11px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin-right: 4px; }

/* the four-beat story strip under the headline */
.story { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin: 4px 0 24px; border-top: 1px solid var(--hair); }
.story div { padding: 14px 18px 4px 0; font: 400 15px/1.5 var(--serif); color: var(--ink-2); }
.story div + div { padding-left: 18px; border-left: 1px solid var(--hair); }
.story b { display: block; font: 700 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
.story div:last-child { color: var(--ink); font-weight: 600; }
@media (max-width: 860px) { .story { grid-template-columns: 1fr; } .story div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--hair); } }

/* "what the freeze bears got right and wrong" panel */
.bears { margin-top: 40px; }
.bgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-top: 1px solid var(--hair); }
.bgrid div { padding: 14px 18px 6px 0; font-size: 13px; color: var(--ink-2); }
.bgrid div + div { padding-left: 18px; border-left: 1px solid var(--hair); }
.bgrid b { display: inline-block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; padding: 3px 6px; margin-bottom: 8px; color: #fff; }
.bgrid b.w { background: var(--good); } .bgrid b.r { background: var(--critical); } .bgrid b.n { background: var(--muted); }
.bgrid strong { display: block; font: 600 16px/1.3 var(--serif); color: var(--ink); margin-bottom: 4px; }
@media (max-width: 860px) { .bgrid { grid-template-columns: 1fr; } .bgrid div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--hair); } }

/* rating page: the timestamped rule, folded */
.prose details { font-size: inherit; margin: 8px 0 24px; }
.prose summary { font-size: 14px; margin-bottom: 12px; }
