/* IDLEWHARF — shared base (LANDING owns this file; /docs, /ledger, /proof link it too).
   Look: "tidal lock" — dark, calm, futuristic. Deep navy-graphite ground, light text, ONE sea-glass accent (#7FE3D8)
   for the liquid/vault/positive, amber (#F2A65A) ONLY for warnings (stale, blocked, risk).
   Fonts (self-hosted, OFL, /fonts/LICENSE.txt): Geist for text + headlines, Geist Mono for every number, label, address, curl, JSON.
   All colours + fonts are tokens in :root.

   Primitives for /docs /ledger /proof (names kept stable across restyles):
     .wrap                 page width container (topbar/footer)
     .page                 centered column grid: text column + right margin column (single column ≤ 900px)
     .masthead             page header: .kicker + h1 + .lead
     .clause               one row of .page: <div class="prose">…</div><aside class="side">…</aside>
     .prose                reading text (p, ol, ul, h2, h3 get spacing)
     .kicker / .label      small mono uppercase labels
     .sec / .sec-head      section + heading on a hairline (<div class="sec-head"><h2>…</h2><span class="meta">…</span></div>)
     .glass                dark translucent panel with a 1px hairline
     .side .note           side note: .label + .value (big mono number) + .sub
     table.tide            plain table (mono, hairlines); td.r right-aligned; .table-wrap scrolls on phones
     pre.well / .well      code / JSON block;  .j-k .j-s .j-n .j-l JSON colours
     .notice               amber warning line;  .warnbox  amber-bordered block (risk)
     .btn .btn-ink .btn-sm .field   buttons + inputs
     sup.fn / ol.footnotes numbered footnotes
     .mono .num .muted .small .ext(↗) .pos   helpers                                                               */

@font-face {
  font-family: 'Geist';
  src: url(/fonts/geist-wght.woff2) format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url(/fonts/geist-mono-wght.woff2) format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  color-scheme: dark;
  /* palette — "tidal lock" */
  --bg: #070B10;           /* page ground (top) */
  --bg-2: #0C1520;         /* page ground (bottom), raised areas */
  --paper: #070B10;        /* alias kept for older pages */
  --panel: rgba(14, 24, 34, .62);   /* glass panels */
  --panel-solid: #0F1A26;
  --well: rgba(4, 9, 14, .55);      /* code, JSON */
  --ink: #DCE6EE;          /* text */
  --ink-2: #AFC0CD;        /* secondary text */
  --ink-3: #7F93A3;        /* muted, labels (AA on --bg) */
  --rule: rgba(160, 196, 220, .14);  /* hairlines */
  --rule-2: rgba(160, 196, 220, .28);
  --accent: #7FE3D8;       /* sea glass: liquid, vault, positive */
  --accent-ink: #7FE3D8;
  --accent-tint: rgba(127, 227, 216, .12);
  --gas: #8C9AA6;          /* gas, wallet line */
  --warn: #F2A65A;         /* amber: warnings only */
  --warn-ink: #F2A65A;
  --warn-tint: rgba(242, 166, 90, .1);
  --on-ink: #070B10;       /* text on light buttons */
  /* type */
  --f-text: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --fs-body: 16px;
  --lh-body: 1.6;
  /* geometry */
  --radius: 4px;
  --gutter: clamp(16px, 3.4vw, 40px);
  --measure: 66ch;
  --margin-col: 220px;
  --col-gap: 44px;
  --max: 1240px;
  --blur: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; color: var(--ink); min-height: 100vh;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%) fixed var(--bg);
  font-family: var(--f-text); font-size: var(--fs-body); line-height: var(--lh-body);
  font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: var(--rule-2); }
a:hover { text-decoration-color: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: rgba(127, 227, 216, .28); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: -.02em; }
em { font-style: normal; color: var(--accent); }

/* ---------- helpers ---------- */
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -40px; z-index: 50; background: var(--accent); color: var(--on-ink); padding: 6px 10px; text-decoration: none; font: 13px var(--f-mono); }
.skip:focus { top: 8px; }
.mono, code, kbd, samp, pre, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.label, .kicker { font-family: var(--f-mono); font-size: 11px; line-height: 1.3; font-weight: 450; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 14px; line-height: 1.5; }
.mono.small, .small.mono { font-size: 12px; }
.pos, .vault { color: var(--accent); }
.gas { color: var(--gas); }
.nowrap { white-space: nowrap; }
.warn-text { color: var(--warn-ink); }
code { font-size: .84em; background: rgba(127, 227, 216, .07); border: 1px solid var(--rule); padding: 1px 5px; border-radius: 3px; overflow-wrap: anywhere; }
.ext::after { content: '\2197'; font-family: var(--f-mono); display: inline-block; margin-left: 2px; font-size: .85em; text-decoration: none; }
.loading { color: var(--ink-3); }

/* ---------- glass ---------- */
.glass { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); -webkit-backdrop-filter: blur(var(--blur)) saturate(1.1); backdrop-filter: blur(var(--blur)) saturate(1.1); }

/* ---------- page grid (docs / ledger / proof) ---------- */
.page { display: grid; grid-template-columns: minmax(0, var(--measure)) var(--margin-col); column-gap: var(--col-gap); justify-content: center; padding: 0 var(--gutter); }
.page > * { grid-column: 1; min-width: 0; }
.page > .full, .page > .clause { grid-column: 1 / -1; }
.clause { display: grid; grid-template-columns: minmax(0, var(--measure)) var(--margin-col); column-gap: var(--col-gap); align-items: start; }
.clause > * { min-width: 0; }
.prose > * + * { margin-top: .85em; }
.prose ol, .prose ul { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: .4em; }
.prose h2 { font-size: 24px; line-height: 1.25; }
.prose h3 { font-size: 18px; line-height: 1.35; font-weight: 500; }
.masthead { padding: 56px 0 8px; }
.masthead h1 { margin-top: 14px; font-size: clamp(32px, 4.6vw, 52px); line-height: 1.06; font-weight: 300; letter-spacing: -.035em; text-wrap: balance; }
.masthead .lead { margin-top: 16px; font-size: 18px; color: var(--ink-2); max-width: var(--measure); }

.sec { padding-top: 48px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 14px; flex-wrap: wrap; border-top: 1px solid var(--rule-2); padding-top: 10px; margin-bottom: 16px; }
.sec-head h2 { font-family: var(--f-mono); font-size: 11.5px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }
.sec-head h2 .no { color: var(--accent); margin-right: 10px; }
.sec-head .meta { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); }

/* ---------- side notes ---------- */
.side { font-family: var(--f-mono); }
.side .note { border-top: 1px solid var(--rule); padding: 9px 0 14px; }
.side .note:first-child { border-top-color: var(--rule-2); }
.side .value { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; font-size: 24px; line-height: 1.05; font-weight: 350; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.side .value .unit { font-size: 11px; letter-spacing: .08em; color: var(--ink-3); }
.side .sub { margin-top: 6px; font-size: 11.5px; line-height: 1.45; color: var(--ink-3); }
.is-stale .value, .is-stale [data-v] { opacity: .45; }

/* ---------- top bar (rendered by site.js into <header class="topbar" data-topbar>) ---------- */
.topbar { position: relative; z-index: 20; border-bottom: 1px solid var(--rule); background: rgba(7, 11, 16, .55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.topbar-in { display: flex; align-items: center; gap: 10px 22px; min-height: 60px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-mono); font-weight: 500; font-size: 13.5px; letter-spacing: .22em; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 18px; height: 18px; flex: none; color: var(--ink-2); }
.brand .ticker { font-weight: 400; letter-spacing: .04em; color: var(--accent); font-size: 12px; }
.ca { display: inline-flex; align-items: center; min-width: 0; border: 1px solid var(--rule-2); height: 30px; font-family: var(--f-mono); font-size: 12px; border-radius: 999px; background: rgba(12, 21, 32, .6); overflow: hidden; }
.ca-k { padding: 0 9px 0 12px; height: 100%; display: inline-flex; align-items: center; color: var(--accent); font-size: 10.5px; letter-spacing: .14em; }
.ca-v { padding: 0 8px 0 0; white-space: nowrap; }
.ca-note { padding-right: 10px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ca-copy { height: 100%; width: 34px; border: 0; border-left: 1px solid var(--rule); background: transparent; display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); padding: 0; flex: none; }
.ca-copy svg { width: 14px; height: 14px; }
.ca-copy:hover { background: var(--accent-tint); color: var(--ink); }
.ca-copy[aria-disabled='true'] { color: var(--ink-3); cursor: help; }
.ca-copy.is-done { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px 20px; margin-left: auto; font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .04em; }
.nav a { text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }
.nav .x-link svg { width: 14px; height: 14px; }
.nav a.btn { color: var(--on-ink); }

/* ---------- buttons + fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid var(--rule-2); background: rgba(12, 21, 32, .5); color: var(--ink); text-decoration: none; font-family: var(--f-mono); font-size: 12.5px; font-weight: 450; letter-spacing: .03em; cursor: pointer; border-radius: 999px; white-space: nowrap; transition: border-color .15s, background .15s; }
.btn:hover { border-color: var(--accent); background: var(--accent-tint); color: var(--ink); }
.btn-ink { background: var(--accent); border-color: var(--accent); color: var(--on-ink); }
.btn-ink:hover { background: #A6EEE6; border-color: #A6EEE6; color: var(--on-ink); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn[disabled], .btn[aria-disabled='true'] { opacity: .45; cursor: not-allowed; }
.btn.is-done { border-color: var(--accent); color: var(--accent); }
.field { display: grid; gap: 6px; min-width: 0; }
.field input { height: 42px; width: 100%; border: 1px solid var(--rule-2); background: rgba(4, 9, 14, .6); padding: 0 12px; font-family: var(--f-mono); font-size: 15px; border-radius: var(--radius); font-variant-numeric: tabular-nums; color: var(--ink); }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.field input[aria-invalid='true'] { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.unit-in { position: relative; display: block; }
.unit-in > span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); pointer-events: none; }
.unit-in input { padding-right: 52px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tide { width: 100%; border-collapse: collapse; font-family: var(--f-mono); font-size: 12.5px; line-height: 1.4; font-variant-numeric: tabular-nums; }
table.tide th { text-align: left; font-weight: 450; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); padding: 0 12px 8px 0; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
table.tide td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; white-space: nowrap; }
table.tide th:last-child, table.tide td:last-child { padding-right: 0; }
table.tide .r { text-align: right; }
table.tide .what small { display: block; color: var(--ink-3); font-size: 11px; margin-top: 2px; }
.empty { padding: 14px 0; }

/* ---------- wells ---------- */
pre.well, .well { background: var(--well); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; font-family: var(--f-mono); font-size: 12px; line-height: 1.6; overflow: auto; margin: 0; color: var(--ink-2); }
pre.well { white-space: pre; tab-size: 2; }
.j-k { color: var(--ink-3); } .j-s { color: var(--accent); } .j-n { color: var(--ink); } .j-l { color: var(--gas); }

/* ---------- warnings (amber only here) ---------- */
.notice { font-family: var(--f-mono); font-size: 12.5px; line-height: 1.5; color: var(--warn-ink); border: 1px solid rgba(242, 166, 90, .55); background: var(--warn-tint); padding: 9px 12px; border-radius: var(--radius); }
.notice b { font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-right: 8px; }
.warnbox { border: 1px solid rgba(242, 166, 90, .45); padding: 16px 20px 18px; border-radius: var(--radius); background: rgba(242, 166, 90, .04); }
.warnbox > .label { color: var(--warn-ink); }

/* ---------- footnotes ---------- */
sup.fn { font-family: var(--f-mono); font-size: 10.5px; line-height: 0; margin-left: 1px; vertical-align: super; }
sup.fn a { text-decoration: none; color: var(--accent); padding: 0 1px; }
sup.fn a:hover { text-decoration: underline; }
ol.footnotes { list-style: none; padding: 0; margin: 0; font-family: var(--f-mono); font-size: 12px; line-height: 1.5; color: var(--ink-2); }
ol.footnotes li { display: grid; grid-template-columns: 2.6em minmax(0, 1fr); padding: 7px 0; border-bottom: 1px solid var(--rule); }
ol.footnotes li::before { content: '[' attr(data-n) ']'; color: var(--ink-3); }
ol.footnotes li > span { overflow-wrap: anywhere; }
ol.footnotes li:target { background: var(--accent-tint); }

/* ---------- footer (rendered by site.js into <footer class="footer" data-footer>) ---------- */
.footer { position: relative; z-index: 2; margin-top: 72px; border-top: 1px solid var(--rule-2); padding: 24px 0 48px; font-size: 14px; color: var(--ink-2); background: rgba(7, 11, 16, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 20px 48px; }
.footer-links { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; align-content: start; margin: 0; font-family: var(--f-mono); font-size: 12px; }
.footer-links dt { color: var(--ink-3); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; padding-top: 2px; }
.footer-links dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.disclaimer { line-height: 1.6; max-width: 70ch; }
.footer-base { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 6px 20px; color: var(--ink-3); font-family: var(--f-mono); font-size: 11.5px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 12px); background: var(--panel-solid); border: 1px solid var(--rule-2); color: var(--ink); font-family: var(--f-mono); font-size: 12.5px; padding: 9px 14px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 60; max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .page, .clause { grid-template-columns: minmax(0, 1fr); }
  .page { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; }
  .side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; margin-top: 18px; }
  .side .note:nth-child(2) { border-top-color: var(--rule-2); }
  .side .note.solo { grid-column: 1 / -1; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  :root { --fs-body: 15.5px; }
  .topbar-in { gap: 8px 14px; min-height: 0; }
  .nav { gap: 4px 16px; }
  .ca { order: 3; width: 100%; }
  .ca-note { flex: 1; }
  .side .value { font-size: 21px; }
  .masthead { padding-top: 36px; }
  .hide-sm { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
