/* Headwork: one stylesheet. Direction "Ledger and chalk" (radar/unprompted/design/DESIGN.md).
   Tokens first, then base, layout, components, tools, print. No em dashes anywhere. */

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  /* colour: notebook */
  --paper: #eef2ea;
  --sheet: #f9fbf6;
  --sunk: #e2e9dd;
  --field: #ffffff;
  --ink: #17211c;
  --ink-2: #36443c;
  --ink-3: #4f5d54;
  --rule: #c7d2c4;
  --rule-strong: #8d9d8f;
  --dot: #c3cfc1;
  --accent: #1c5540;        /* pine: links, text accents */
  --btn-bg: #1c5540;
  --btn-bg-hover: #143f2f;
  --btn-fg: #ffffff;
  --mark: #f5d547;          /* highlighter, always behind ink text */
  --mark-soft: #fbeea6;
  --paste: #8a3d12;         /* pasted text marker */
  --paste-bg: #f6dccb;
  --ok: #1c5540;
  --warn: #7a4b00;
  --warn-bg: #fbeed0;
  --err: #9b1c1c;
  --err-bg: #fbe3e0;
  --focus: #0b3d91;
  --disabled-bg: #dbe2d7;
  --disabled-fg: #5b675f;
  --shadow-1: 0 1px 0 var(--rule), 0 12px 28px -22px rgba(23, 33, 28, .55);
  --shadow-2: 0 1px 0 var(--rule), 0 24px 48px -28px rgba(23, 33, 28, .6);
  /* type */
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-xs: .8125rem;
  --t-sm: .9375rem;
  --t-md: 1.0625rem;
  --t-lg: 1.25rem;
  --t-xl: clamp(1.45rem, 1.2rem + 1.1vw, 1.8rem);
  --t-2xl: clamp(1.8rem, 1.35rem + 2vw, 2.5rem);
  --t-3xl: clamp(2.15rem, 1.4rem + 3.6vw, 3.6rem);
  /* space (4px base) */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --gutter: 1rem;
  --measure: 66ch;
  --wide: 70rem;
  /* shape and motion */
  --r1: 6px; --r2: 10px; --r3: 16px; --pill: 999px;
  --fast: 120ms; --base: 220ms; --slow: 480ms;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
/* chalkboard: system dark unless the visitor chose light; or chosen dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #141c18; --sheet: #1b2520; --sunk: #0f1512; --field: #101713;
    --ink: #e9eee5; --ink-2: #c3cdc1; --ink-3: #a3b0a4;
    --rule: #2f3d35; --rule-strong: #5d7065; --dot: #26322b;
    --accent: #8fd6b3; --btn-bg: #8fd6b3; --btn-bg-hover: #a9e2c5; --btn-fg: #0f1512;
    --mark: #6b5a0c; --mark-soft: #4a3f0b;
    --paste: #f1b48f; --paste-bg: #4a2a17;
    --ok: #8fd6b3; --warn: #f3cf7a; --warn-bg: #3a2f10; --err: #ffb4ab; --err-bg: #47201c;
    --focus: #f0d24a; --disabled-bg: #26302a; --disabled-fg: #9aa79c;
    --shadow-1: 0 1px 0 #000, 0 12px 28px -22px #000;
    --shadow-2: 0 1px 0 #000, 0 24px 48px -28px #000;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141c18; --sheet: #1b2520; --sunk: #0f1512; --field: #101713;
  --ink: #e9eee5; --ink-2: #c3cdc1; --ink-3: #a3b0a4;
  --rule: #2f3d35; --rule-strong: #5d7065; --dot: #26322b;
  --accent: #8fd6b3; --btn-bg: #8fd6b3; --btn-bg-hover: #a9e2c5; --btn-fg: #0f1512;
  --mark: #6b5a0c; --mark-soft: #4a3f0b;
  --paste: #f1b48f; --paste-bg: #4a2a17;
  --ok: #8fd6b3; --warn: #f3cf7a; --warn-bg: #3a2f10; --err: #ffb4ab; --err-bg: #47201c;
  --focus: #f0d24a; --disabled-bg: #26302a; --disabled-fg: #9aa79c;
  --shadow-1: 0 1px 0 #000, 0 12px 28px -22px #000;
  --shadow-2: 0 1px 0 #000, 0 24px 48px -28px #000;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--paper); color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--sans);
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
main { flex: 1; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.12; letter-spacing: -.012em; margin: 0 0 var(--s4); text-wrap: balance; }
h1 { font-size: var(--t-3xl); }
h2 { font-size: var(--t-2xl); margin-top: var(--s7); }
h3 { font-size: var(--t-xl); margin-top: var(--s6); line-height: 1.2; }
h4 { font: 600 var(--t-md)/1.3 var(--sans); margin: var(--s5) 0 var(--s2); }
p, ul, ol, dl, table, blockquote, figure { margin: 0 0 var(--s4); }
ul, ol { padding-left: 1.3em; }
li { margin: .3em 0; }
a { color: var(--accent); text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2.5px; }
strong, b { font-weight: 650; }
small, .small { font-size: var(--t-sm); }
img, svg, canvas { max-width: 100%; height: auto; }
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s6) 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--mark); color: var(--ink); }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--s3); top: -4rem; z-index: 50; background: var(--ink); color: var(--paper); padding: .7rem 1rem; border-radius: var(--r2); }
.skip:focus { top: var(--s3); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 46rem; }
.section { padding: var(--s7) 0; }
.section.tight { padding: var(--s6) 0; }
.dots { background-image: radial-gradient(var(--dot) 1px, transparent 1.3px); background-size: 22px 22px; }
.band { background: var(--sunk); border-block: 1px solid var(--rule); }
.grid { display: grid; gap: var(--s4); }
@media (min-width: 720px) {
  :root { --gutter: 1.5rem; }
  .grid.c2 { grid-template-columns: 1fr 1fr; }
  .grid.c3 { grid-template-columns: repeat(3, 1fr); }
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1040px) { .grid.c4 { grid-template-columns: repeat(4, 1fr); } }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.spread { justify-content: space-between; }
.stack > * + * { margin-top: var(--s4); }
.center { text-align: center; }
.muted { color: var(--ink-3); }
.eyebrow { font: 600 var(--t-xs)/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--s3); }
.lede { font: 400 var(--t-lg)/1.5 var(--serif); color: var(--ink-2); max-width: 40rem; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.top .wrap { display: flex; align-items: center; gap: var(--s3); min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 650 1.3rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -.01em; min-height: 44px; margin-right: auto; }
.brand svg { width: 28px; height: 28px; flex: none; }
.nav { display: none; }
.nav a, .menu-panel a { color: var(--ink); text-decoration: none; font-weight: 550; font-size: var(--t-sm); padding: .65rem .7rem; border-radius: var(--r2); display: block; }
.nav a:hover, .menu-panel a:hover { background: var(--sunk); }
.nav a[aria-current="page"], .menu-panel a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--mark); }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; background: none; border: 1.5px solid transparent; border-radius: var(--r2); color: var(--ink); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--sunk); }
.icon-btn svg { width: 22px; height: 22px; }
.menu { position: static; }
.menu > summary { list-style: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: var(--r2); cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--sunk); }
.menu > summary svg { width: 24px; height: 24px; }
.menu-panel { position: absolute; left: 0; right: 0; top: 100%; background: var(--sheet); border-bottom: 1px solid var(--rule); box-shadow: var(--shadow-2); padding: var(--s3) var(--gutter) var(--s5); max-height: calc(100vh - 60px); overflow: auto; }
.menu-panel a { font-size: var(--t-md); padding: .8rem .6rem; border-bottom: 1px solid var(--rule); border-radius: 0; }
.menu-panel .eyebrow { margin: var(--s4) 0 0; }
@media (min-width: 960px) {
  .nav { display: flex; align-items: center; gap: 2px; }
  .menu { display: none; }
}
html[data-theme-now="dark"] .sun, html:not([data-theme-now="dark"]) .moon { display: none; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--rule); background: var(--sunk); padding: var(--s6) 0 var(--s7); margin-top: var(--s8); font-size: var(--t-sm); }
.foot h2 { font: 600 var(--t-xs)/1.3 var(--sans); letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--s2); }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin: 0; }
.foot a { color: var(--ink); text-decoration: none; display: inline-block; padding: .55rem 0; min-height: 40px; }
.foot a:hover { text-decoration: underline; }
.foot .cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5) var(--s4); }
@media (min-width: 720px) { .foot .cols { grid-template-columns: 1.4fr repeat(4, 1fr); } }
.foot .about { grid-column: 1 / -1; max-width: 26rem; color: var(--ink-2); }
@media (min-width: 720px) { .foot .about { grid-column: auto; } }
.foot .legal { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--rule); color: var(--ink-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .7rem 1.2rem; border-radius: var(--r2);
  font: 650 var(--t-md)/1.2 var(--sans); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--btn-bg); color: var(--btn-fg); border: 1.5px solid var(--btn-bg);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.ghost:hover { background: var(--sunk); }
.btn.quiet { background: transparent; color: var(--accent); border-color: transparent; padding-inline: .6rem; text-decoration: underline; text-underline-offset: .2em; }
.btn.quiet:hover { background: var(--sunk); }
.btn.small { min-height: 44px; padding: .5rem .9rem; font-size: var(--t-sm); }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--disabled-bg); border-color: var(--disabled-bg); color: var(--disabled-fg); cursor: not-allowed; transform: none; }
.btn svg { width: 1.1em; height: 1.1em; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-top: var(--s5); }
@media (max-width: 520px) { .actions > .btn:not(.quiet) { flex: 1 1 100%; } }

/* ---------- sheets (cards) ---------- */
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r3); padding: var(--s5); box-shadow: var(--shadow-1); }
.sheet > :first-child { margin-top: 0; }
.sheet > :last-child { margin-bottom: 0; }
.sheet h2, .sheet h3 { font-size: var(--t-xl); margin-top: 0; }
a.sheet { display: block; color: inherit; text-decoration: none; transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease); }
a.sheet:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
a.sheet .go { color: var(--accent); font-weight: 650; text-decoration: underline; text-underline-offset: .2em; }
.note { border-left: 4px solid var(--mark); background: var(--sheet); padding: var(--s4) var(--s4) var(--s4) var(--s5); border-radius: 0 var(--r2) var(--r2) 0; margin: var(--s5) 0; }
.note > :last-child { margin-bottom: 0; }
.note.warn { border-color: var(--warn); background: var(--warn-bg); }
.note.plain { border-color: var(--rule-strong); }
.dated { font-size: var(--t-sm); color: var(--ink-3); }

/* highlighter */
.hl { background: linear-gradient(transparent 56%, var(--mark) 56%, var(--mark) 93%, transparent 93%); background-repeat: no-repeat; background-size: 100% 100%; padding: 0 .08em; font-style: italic; }
@media (prefers-reduced-motion: no-preference) {
  .hl.draw { animation: swipe var(--slow) var(--ease) .25s both; }
  @keyframes swipe { from { background-size: 0 100%; } to { background-size: 100% 100%; } }
}

/* ---------- hero ---------- */
.hero { padding: var(--s7) 0 var(--s6); }
.hero h1 { max-width: 15ch; }
.hero.long h1 { max-width: 22ch; font-size: var(--t-2xl); }
.hero .answer { font: 400 var(--t-lg)/1.5 var(--serif); max-width: 38rem; color: var(--ink-2); }
.hero-grid { display: grid; gap: var(--s6); align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.05fr .95fr; gap: var(--s7); } .hero { padding-top: var(--s8); } }
.crumbs { font-size: var(--t-sm); color: var(--ink-3); margin: 0 0 var(--s3); }
.crumbs a { color: var(--ink-3); display: inline-block; padding: .5rem 0; }

/* ---------- steps ---------- */
.steps { list-style: none; padding: 0; counter-reset: s; display: grid; gap: var(--s4); }
.steps > li { counter-increment: s; position: relative; padding-left: 3.4rem; margin: 0; min-height: 2.6rem; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font: 600 1.2rem/1 var(--serif); background: var(--sheet); }
.steps h3 { font: 650 var(--t-lg)/1.25 var(--sans); letter-spacing: 0; margin: .35rem 0 .25rem; }
.steps p { margin: 0; color: var(--ink-2); }
@media (min-width: 960px) { .steps.five { grid-template-columns: repeat(5, 1fr); } .steps.five > li { padding: 3.2rem 0 0; } }

/* ---------- proof strip, quotes ---------- */
.finding { display: flex; flex-direction: column; }
.finding .big { font: 600 var(--t-2xl)/1.05 var(--serif); margin: 0 0 var(--s2); }
.finding .src { margin-top: auto; padding-top: var(--s3); font-size: var(--t-sm); color: var(--ink-3); }
.said { font: italic 400 var(--t-lg)/1.4 var(--serif); margin: 0; padding: var(--s4) var(--s4) var(--s4) var(--s5); border-left: 3px solid var(--rule-strong); }
.said + .who { font-size: var(--t-sm); color: var(--ink-3); padding-left: var(--s5); margin-top: var(--s1); }

/* ---------- faq ---------- */
.faq { border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 1rem 2.4rem 1rem 0; font: 650 var(--t-md)/1.35 var(--sans); list-style: none; position: relative; min-height: 48px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .4rem; top: .75rem; font: 400 1.6rem/1 var(--serif); color: var(--ink-3); transition: transform var(--base) var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .a { padding: 0 0 var(--s4); max-width: var(--measure); color: var(--ink-2); }
.faq .a > :last-child { margin-bottom: 0; }

/* ---------- prose (guides, legal) ---------- */
.prose { max-width: 44rem; }
.prose > p, .prose > ul, .prose > ol, .prose li, .prose blockquote { font: 400 1.19rem/1.6 var(--serif); }
.prose li p { font: inherit; }
.prose h2 { font-size: var(--t-xl); margin-top: var(--s7); }
.prose h3 { font: 650 var(--t-lg)/1.3 var(--sans); letter-spacing: 0; }
.prose .sheet p, .prose .sheet li, .prose .note p, .prose .note li { font: 400 var(--t-md)/1.55 var(--sans); }
.prose blockquote { border-left: 3px solid var(--rule-strong); padding-left: var(--s4); margin-left: 0; color: var(--ink-2); font-style: italic; }
.shot { border: 2px dashed var(--rule-strong); border-radius: var(--r2); padding: var(--s5) var(--s4); text-align: center; color: var(--ink-3); background: var(--sheet); margin: var(--s4) 0; font: 500 var(--t-sm)/1.4 var(--sans); }
.shot b { display: block; color: var(--ink-2); margin-bottom: var(--s1); }
.next { margin-top: var(--s7); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r2); background: var(--sheet); margin: 0 0 var(--s4); }
.table-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); }
th, td { text-align: left; vertical-align: top; padding: .7rem .8rem; border-bottom: 1px solid var(--rule); }
thead th { font-weight: 650; background: var(--sunk); white-space: nowrap; position: sticky; top: 0; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 650; }
.tag { display: inline-block; font: 650 var(--t-xs)/1 var(--sans); padding: .3rem .55rem; border-radius: var(--pill); border: 1.5px solid var(--rule-strong); color: var(--ink-2); white-space: nowrap; }
.tag.yes { border-color: var(--ok); color: var(--ok); }
.tag.pro { background: var(--mark); border-color: var(--mark); color: var(--ink); }
.tag.age { border-color: var(--warn); color: var(--warn); }
/* study cards on phones */
@media (max-width: 719px) {
  .cards-sm thead { position: absolute; left: -999em; }
  .cards-sm, .cards-sm tbody, .cards-sm tr, .cards-sm td, .cards-sm th { display: block; width: 100%; }
  .cards-sm tr { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
  .cards-sm tr:last-child { border-bottom: 0; }
  .cards-sm td, .cards-sm tbody th { border: 0; padding: .2rem .9rem; }
  .cards-sm td[data-l]::before { content: attr(data-l) ": "; font-weight: 650; color: var(--ink-3); }
}

/* ---------- forms ---------- */
label, .label { display: block; font: 650 var(--t-sm)/1.3 var(--sans); margin: 0 0 var(--s2); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.hint { font: 400 var(--t-sm)/1.4 var(--sans); color: var(--ink-3); margin: var(--s1) 0 0; }
input[type="text"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; font: 400 1.0625rem/1.45 var(--sans); color: var(--ink); background: var(--field);
  border: 1.5px solid var(--rule-strong); border-radius: var(--r2); padding: .7rem .8rem; min-height: 48px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
textarea { resize: vertical; min-height: 6.5rem; font-family: var(--serif); font-size: 1.19rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.field { margin-bottom: var(--s4); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s5); min-width: 0; }
legend { font: 650 var(--t-md)/1.3 var(--sans); padding: 0; margin-bottom: var(--s2); }
/* choice chips: radio or checkbox inside a label */
.choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
.choice { position: relative; margin: 0; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; min-height: 48px; padding: .55rem 1rem; border: 1.5px solid var(--rule-strong); border-radius: var(--pill); background: var(--field); font: 600 var(--t-sm)/1.2 var(--sans); transition: background var(--fast), border-color var(--fast); }
.choice input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice.wide { flex: 1 1 100%; }
.choice.wide span { border-radius: var(--r2); flex-direction: column; align-items: flex-start; gap: .15rem; }
.choice.wide small { font-weight: 400; color: var(--ink-3); }
.choice.wide input:checked + span small { color: inherit; opacity: .85; }
/* switch */
.switch { display: flex; align-items: center; gap: var(--s3); min-height: 48px; cursor: pointer; font-weight: 600; margin: 0; }
.switch input { appearance: none; width: 52px; height: 30px; border-radius: var(--pill); background: var(--field); border: 1.5px solid var(--rule-strong); position: relative; flex: none; margin: 0; cursor: pointer; transition: background var(--base) var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--ink-3); transition: transform var(--base) var(--ease), background var(--base); }
.switch input:checked { background: var(--btn-bg); border-color: var(--btn-bg); }
.switch input:checked::after { transform: translateX(22px); background: var(--btn-fg); }
.switch small { display: block; font-weight: 400; color: var(--ink-3); }
.msg { padding: var(--s3) var(--s4); border-radius: var(--r2); margin: var(--s3) 0 0; font-size: var(--t-sm); }
.msg.ok { background: var(--sunk); border: 1.5px solid var(--ok); }
.msg.err { background: var(--err-bg); color: var(--err); border: 1.5px solid var(--err); }
.msg.warn { background: var(--warn-bg); color: var(--warn); border: 1.5px solid var(--warn); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1.5px solid var(--rule-strong); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s5); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px; padding: .75rem .9rem; min-height: 48px; font: 650 var(--t-sm)/1.2 var(--sans); color: var(--ink-3); cursor: pointer; border-radius: var(--r1) var(--r1) 0 0; }
.tabs button:hover { color: var(--ink); background: var(--sunk); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs.sub { border-bottom-width: 1px; }
.tabs.sub button { font-weight: 550; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 60; display: grid; justify-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--gutter); }
.toast { pointer-events: auto; background: var(--ink); color: var(--paper); padding: .85rem 1.1rem; border-radius: var(--r2); font: 600 var(--t-md)/1.3 var(--sans); box-shadow: var(--shadow-2); max-width: 30rem; display: flex; gap: .6rem; align-items: center; }
.toast svg { width: 1.2em; height: 1.2em; flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise var(--base) var(--ease); }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--rule); border-radius: var(--r3); background: var(--sheet); color: var(--ink); padding: 0; width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(10, 16, 13, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s3) var(--s3) var(--s5); border-bottom: 1px solid var(--rule); position: sticky; top: 0; background: var(--sheet); }
.dlg-head h2 { margin: 0; font-size: var(--t-xl); }
.dlg-body { padding: var(--s5); }
.dlg-body h3 { font: 650 var(--t-md)/1.3 var(--sans); letter-spacing: 0; margin: var(--s5) 0 var(--s2); }
.dlg-body h3:first-child { margin-top: 0; }

/* ---------- tool shell ---------- */
.tool { padding: var(--s5) 0 var(--s7); }
.tool-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.tool-head h1 { font-size: var(--t-2xl); margin: 0; }
.tool-head p { margin: var(--s1) 0 0; color: var(--ink-2); }
.count { font: 600 var(--t-sm)/1 var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.count.good { color: var(--ok); }
.kbd { font: 600 .8em/1 var(--sans); border: 1.5px solid var(--rule-strong); border-bottom-width: 3px; border-radius: 5px; padding: .15em .4em; background: var(--field); white-space: nowrap; }
.only-kbd { display: none; }
@media (hover: hover) and (pointer: fine) { .only-kbd { display: revert; } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.stat { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r2); padding: var(--s3); text-align: center; }
.stat b { display: block; font: 600 1.7rem/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--t-xs); color: var(--ink-3); }
.empty { text-align: center; padding: var(--s6) var(--s4); color: var(--ink-3); border: 2px dashed var(--rule); border-radius: var(--r3); }
.empty b { display: block; font: 600 var(--t-lg)/1.3 var(--serif); color: var(--ink-2); margin-bottom: var(--s1); }
.offline-bar { background: var(--warn-bg); color: var(--warn); text-align: center; font: 600 var(--t-sm)/1.3 var(--sans); padding: .55rem var(--gutter); border-bottom: 1px solid var(--warn); }

/* instruction output */
.output { font: 400 1.02rem/1.55 var(--serif); white-space: pre-wrap; background: var(--field); border: 1.5px solid var(--rule-strong); border-radius: var(--r2); padding: var(--s4); max-height: 22rem; overflow: auto; margin: 0; }
.sticky-act { padding: var(--s3) 0; border-top: 1px solid var(--rule); margin-top: var(--s3); }

/* think pad */
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
@media (min-width: 620px) { .ai-grid { grid-template-columns: repeat(5, 1fr); } }
.ai-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem; min-height: 60px; padding: .5rem .4rem; border-radius: var(--r2); border: 1.5px solid var(--ink); background: var(--field); color: var(--ink); font: 650 var(--t-md)/1.15 var(--sans); cursor: pointer; transition: background var(--fast), transform var(--fast), color var(--fast); }
.ai-btn small { font: 500 var(--t-xs)/1.1 var(--sans); color: var(--ink-3); }
.ai-btn:hover { background: var(--ink); color: var(--paper); }
.ai-btn:hover small { color: inherit; }
.ai-btn:active { transform: translateY(1px); }
.ai-btn[aria-disabled="true"] { border-color: var(--rule-strong); color: var(--disabled-fg); background: var(--disabled-bg); cursor: not-allowed; }
.ai-btn[aria-disabled="true"]:hover small { color: var(--ink-3); }
.ai-grid.ready .ai-btn { box-shadow: 0 3px 0 var(--mark); }
.preview { font: 400 var(--t-md)/1.5 var(--serif); white-space: pre-wrap; color: var(--ink-2); background: var(--sunk); border-radius: var(--r2); padding: var(--s4); margin: var(--s3) 0 0; max-height: 14rem; overflow: auto; }
details.more > summary { cursor: pointer; font: 600 var(--t-sm)/1.3 var(--sans); color: var(--accent); padding: .8rem 0; min-height: 44px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); align-items: end; height: 150px; margin: var(--s4) 0 var(--s1); }
.bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; }
.bar i { display: block; border-radius: 4px 4px 0 0; background: var(--rule-strong); min-height: 0; }
.bar i.tried { background: var(--btn-bg); border-radius: 0; }
.bar i:first-child { border-radius: 4px 4px 0 0; }
.bar-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s2); text-align: center; font-size: var(--t-xs); color: var(--ink-3); }
.bar-labels .today { color: var(--ink); font-weight: 700; }
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--t-sm); color: var(--ink-2); }
.legend i { display: inline-block; width: .8em; height: .8em; border-radius: 2px; margin-right: .35em; background: var(--rule-strong); }
.legend i.tried { background: var(--btn-bg); }
.entry { border-bottom: 1px solid var(--rule); padding: var(--s3) 0; }
.entry time { font-size: var(--t-xs); color: var(--ink-3); }
.entry p { margin: .2rem 0 0; font-family: var(--serif); font-size: 1.12rem; }

/* writing pad */
.pad { display: grid; gap: var(--s4); }
@media (min-width: 1000px) { .pad { grid-template-columns: minmax(0, 1fr) 19rem; align-items: start; } .pad-side { position: sticky; top: 5rem; } }
.page { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r3); box-shadow: var(--shadow-1); padding: var(--s4); }
@media (min-width: 720px) { .page { padding: var(--s6) var(--s7); } }
.page input.title { border: 0; border-bottom: 1.5px solid var(--rule); border-radius: 0; background: transparent; font: 600 var(--t-xl)/1.2 var(--serif); padding: .4rem 0; margin-bottom: var(--s3); }
.page textarea.body { border: 0; background: transparent; padding: 0; min-height: 52vh; resize: none; font: 400 1.25rem/1.65 var(--serif); width: 100%; display: block; border-radius: 0; }
.page textarea.body:focus-visible, .page input.title:focus-visible { outline: none; box-shadow: none; }
.page:focus-within { border-color: var(--rule-strong); }
.pad-foot { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; justify-content: space-between; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.meter { margin: 0; }
.meter .label-row b { font: 600 1.9rem/1 var(--serif); font-variant-numeric: tabular-nums; }
.track { height: 12px; border-radius: var(--pill); background: var(--paste-bg); overflow: hidden; margin: var(--s2) 0; border: 1px solid var(--rule); }
.track.empty-track { background: var(--sunk); }
.track i { display: block; height: 100%; background: var(--btn-bg); width: 0; transition: width var(--base) var(--ease); border-radius: var(--pill) 0 0 var(--pill); }
.facts { list-style: none; padding: 0; margin: var(--s3) 0 0; font-size: var(--t-sm); color: var(--ink-2); }
.facts li { display: flex; justify-content: space-between; gap: var(--s3); padding: .35rem 0; border-bottom: 1px dotted var(--rule-strong); margin: 0; }
.facts li b { font-variant-numeric: tabular-nums; }
.pasted { background: var(--paste-bg); color: var(--paste); border-radius: 3px; }
.replay-text { font: 400 1.15rem/1.6 var(--serif); white-space: pre-wrap; min-height: 12rem; max-height: 50vh; overflow: auto; background: var(--field); border: 1.5px solid var(--rule-strong); border-radius: var(--r2); padding: var(--s4); }
.replay-text .caret { display: inline-block; width: 2px; height: 1.1em; background: var(--ink); vertical-align: text-bottom; margin-left: 1px; }
input[type="range"] { width: 100%; accent-color: var(--btn-bg); min-height: 44px; }
.draft-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.draft-row b { display: block; font-family: var(--serif); font-size: 1.1rem; }
.draft-row small { color: var(--ink-3); }
.focus-mode .top, .focus-mode .foot, .focus-mode .pad-side, .focus-mode .tool-head p, .focus-mode .below { display: none; }
.focus-mode .pad { grid-template-columns: minmax(0, 46rem); justify-content: center; }

/* pro card: calm, one per place */
.pro-card { border: 1.5px solid var(--ink); border-radius: var(--r3); padding: var(--s5); background: var(--sheet); position: relative; }
.pro-card .tag { position: absolute; top: -0.75rem; left: var(--s4); }
.pro-card h3 { margin-top: var(--s1); font-size: var(--t-xl); }
.pro-card p { color: var(--ink-2); }
.trial-chip { display: inline-flex; align-items: center; gap: .4rem; font: 650 var(--t-xs)/1 var(--sans); background: var(--mark); color: #17211c; padding: .4rem .65rem; border-radius: var(--pill); }
:root[data-theme="dark"] .trial-chip, :root[data-theme="dark"] .tag.pro { background: #f0d24a; border-color: #f0d24a; color: #17211c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .trial-chip, :root:not([data-theme="light"]) .tag.pro { background: #f0d24a; border-color: #f0d24a; color: #17211c; } }

/* pricing */
.bill { display: inline-flex; border: 1.5px solid var(--ink); border-radius: var(--pill); padding: 3px; background: var(--field); flex-wrap: wrap; }
.bill .choice span { border: 0; background: transparent; min-height: 44px; }
.plans { display: grid; gap: var(--s4); align-items: stretch; }
@media (min-width: 860px) { .plans { grid-template-columns: repeat(3, 1fr); } }
.plan { display: flex; flex-direction: column; }
.plan.best { border: 2px solid var(--ink); }
.plan h2 { font-size: var(--t-xl); margin: 0 0 var(--s1); }
.price { font: 600 2.6rem/1 var(--serif); font-variant-numeric: tabular-nums; margin: var(--s3) 0 var(--s1); }
.price small { font: 500 var(--t-sm)/1 var(--sans); color: var(--ink-3); }
.plan ul { list-style: none; padding: 0; margin: var(--s4) 0; }
.plan li { padding-left: 1.6rem; position: relative; margin: .5rem 0; }
.plan li::before { content: ""; position: absolute; left: .1rem; top: .45em; width: .9rem; height: .5rem; border-left: 2.5px solid var(--ok); border-bottom: 2.5px solid var(--ok); transform: rotate(-45deg); }
.plan .btn { margin-top: auto; }
.per { min-height: 2.6em; color: var(--ink-3); font-size: var(--t-sm); }

/* self-check */
.q { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.q legend { font: 500 1.19rem/1.4 var(--serif); margin-bottom: var(--s3); }
.q .choices { gap: var(--s1); }
.q .choice span { padding-inline: .8rem; }
.progress { height: 6px; background: var(--sunk); border-radius: var(--pill); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--btn-bg); width: 0; transition: width var(--base) var(--ease); }
.result-card { width: 100%; max-width: 30rem; border-radius: var(--r3); border: 1px solid var(--rule); display: block; }

/* printable pages */
.print-sheet { background: #fff; color: #111; border: 1px solid var(--rule-strong); border-radius: var(--r2); padding: var(--s5); max-width: 48rem; font-family: var(--serif); font-size: 1.1rem; }
.print-sheet h1, .print-sheet h2 { color: #111; }
.print-sheet h1 { font-size: 2rem; }
.print-sheet h2 { font-size: 1.3rem; margin-top: var(--s5); }
.print-sheet .line { border-bottom: 1px solid #555; height: 2.2rem; }
.print-sheet .box { border: 1px solid #555; min-height: 7rem; border-radius: 4px; margin-bottom: var(--s4); }
.print-sheet .sign { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s5); margin-top: var(--s6); }
.print-sheet .sign div { border-top: 1px solid #555; padding-top: .3rem; font: 500 .9rem var(--sans); color: #333; }
.print-sheet a { color: #111; }

@media print {
  .top, .foot, .no-print, .toasts, .skip { display: none !important; }
  body { background: #fff; color: #000; }
  .print-sheet { border: 0; padding: 0; max-width: none; }
  .wrap { padding: 0; max-width: none; }
  a { color: #000; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- page pieces ---------- */
.after { margin-top: var(--s5); }
.tools-row { margin-top: var(--s6); }
.plain-list { list-style: none; padding: 0; }
.plain-list li { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); margin: 0; }
.classroom { margin-top: var(--s4); }
.classroom h2 { margin: 0 0 var(--s1); }
.classroom p { margin: 0; max-width: 40rem; color: var(--ink-2); }
.result { margin-top: var(--s5); }
.output.key { font: 650 1.15rem/1.4 var(--sans); letter-spacing: .04em; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.progress.wait i { width: 40%; }
@media (prefers-reduced-motion: no-preference) {
  .progress.wait i { animation: slide 1.4s var(--ease) infinite alternate; }
  @keyframes slide { from { transform: translateX(-20%); } to { transform: translateX(170%); } }
}
.sheet + .sheet, .sheet + .pro-card, .pro-card + .sheet, .sheet + .stats, .sheet + .note, .pad + .below { margin-top: var(--s4); }
.grid > .sheet + .sheet, .plans > .sheet + .sheet { margin-top: 0; }
.below h2 { font-size: var(--t-xl); margin-top: var(--s6); }
.below .sheet .tag { margin-bottom: var(--s2); }
.pro-card { margin-top: var(--s5); }
fieldset.center { margin-bottom: var(--s5); }
.prose .actions { margin: var(--s5) 0; }
.prose .steps { margin: var(--s5) 0; }
.prose .steps p { font: 400 var(--t-md)/1.55 var(--sans); }
.prose .faq .a p { font: 400 var(--t-md)/1.6 var(--sans); }
.tool .sheet h2 { font-size: var(--t-xl); }
.tool .muted.small.center { margin-top: var(--s5); }
#ask-label { margin-top: var(--s4); }

/* hero demo: a still life of the think pad, made of real type */
.demo { transform: rotate(.6deg); }
.demo p { margin: 0; }
.demo .label { margin-bottom: var(--s1); }
.demo .demo-box { font: 400 1.08rem/1.45 var(--serif); background: var(--field); border: 1.5px solid var(--rule-strong); border-radius: var(--r2); padding: .6rem .75rem; margin-bottom: var(--s3); }
.demo .demo-box.tall { min-height: 4.6rem; }
.demo .demo-coach { display: flex; align-items: center; gap: .6rem; font: 600 var(--t-sm)/1.2 var(--sans); margin: var(--s3) 0; }
.demo-switch { width: 40px; height: 24px; border-radius: var(--pill); background: var(--btn-bg); position: relative; flex: none; }
.demo-switch::after { content: ""; position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--btn-fg); }
.demo-chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.demo-chips span { font: 650 var(--t-sm)/1 var(--sans); border: 1.5px solid var(--ink); border-radius: var(--r2); padding: .7rem .9rem; background: var(--field); box-shadow: 0 3px 0 var(--mark); }
.demo .demo-toast { display: inline-block; margin-top: var(--s4); background: var(--ink); color: var(--paper); font: 600 var(--t-sm)/1.2 var(--sans); padding: .6rem .9rem; border-radius: var(--r2); }

/* ---------- critique pass ---------- */
.dots:not(body) { background-image: none; position: relative; isolation: isolate; }
.dots:not(body)::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(var(--dot) 1px, transparent 1.3px); background-size: 22px 22px; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.hero.centered { text-align: center; }
.hero.centered h1, .hero.centered .answer { margin-inline: auto; }
.steps.five > li:first-child::before { background: var(--mark); }
.linklist { display: grid; gap: 0 var(--s6); }
@media (min-width: 720px) { .linklist { grid-template-columns: repeat(3, 1fr); } }
.linklist a { display: block; padding: var(--s4) 0; border-top: 1px solid var(--rule-strong); color: inherit; text-decoration: none; }
.linklist h3 { font-size: var(--t-lg); margin: 0 0 var(--s1); color: var(--accent); text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: .18em; }
.linklist a:hover h3 { text-decoration-thickness: 2.5px; }
.linklist p { margin: 0; color: var(--ink-2); }
.plain-cols > div { border-top: 3px solid var(--ink); padding-top: var(--s3); }
.plain-cols h3 { font-size: var(--t-lg); margin: 0 0 var(--s2); }
.plain-cols p { margin: 0; color: var(--ink-2); }
.tool-head { flex-wrap: nowrap; align-items: flex-start; }
.tool-head .row { flex-wrap: nowrap; gap: var(--s1); }
.tool-head .btn.small { padding-inline: .7rem; }
@media (max-width: 619px) { .ai-grid .ai-btn:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 52px; } }
.foot .legal a, .foot .about a { display: inline; padding: 0; min-height: 0; text-decoration: underline; }
.record h2, .below .sheet h2 { margin: 0; font-size: var(--t-xl); }
.record .draft-row small { display: block; }
.record .draft-row:last-child { border-bottom: 0; }
.draft-row > div:first-child { min-width: 0; flex: 1; }
.below { margin-top: var(--s4); }
.below .sheet + .sheet { margin-top: var(--s4); }
@media (max-width: 520px) { .record .draft-row { flex-direction: column; align-items: flex-start; } }

#replay-speed { width: auto; min-width: 8rem; }

/* ---------- design review, 14 Nov ---------- */
.wrap.prose { max-width: 46rem; }                       /* same column as the hero above it */
.progress { margin: var(--s2) 0 var(--s3); }
.table-wrap + .btn { margin-bottom: var(--s4); }
/* tool header: title and actions on one row, the line of help text below, full width */
.tool-head { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 var(--s3); }
.tool-head > div:first-child { display: contents; }
.tool-head h1 { grid-column: 1; grid-row: 1; }
.tool-head > .row, .tool-head > .btn { grid-column: 2; grid-row: 1; }
.tool-head p { grid-column: 1 / -1; grid-row: 2; }
/* writing pad on phones: the live record sits right under the page, before the extras */
@media (max-width: 999px) {
  .pad > div:first-child { display: contents; }
  .pad .page { order: 1; }
  .pad .pad-side { order: 2; }
  .pad .below { order: 3; margin-top: 0; }
  .page textarea.body { min-height: 42vh; }
}
