/* AI Thinking Lab — shared styles. No build step; edit directly. */

:root {
  color-scheme: light dark;
  --paper: #f7f6f2;
  --surface: #ffffff;
  --ink: #15202b;
  --ink-2: #33414d;
  --muted: #5a6670;
  --line: #dcdcd6;
  --line-strong: #b4b8b2;
  --accent: #1d5592;
  --accent-soft: #e6eef7;
  --bad: #b23a1e;
  --bad-soft: #f8e5df;
  --miss: #94600a;
  --miss-soft: #f6ecd7;
  --good: #1d5592;
  --good-soft: #e6eef7;
  --code-bg: #eeede7;
  --focus: #b45f00;

  --sans: Calibri, Carlito, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  --text: 41rem;   /* reading column */
  --wide: 66rem;   /* figures and tables */
  --gutter: clamp(16px, 4vw, 40px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161a;
    --surface: #191e23;
    --ink: #e8e6e1;
    --ink-2: #c9ccc9;
    --muted: #9aa3a9;
    --line: #2c333a;
    --line-strong: #47505a;
    --accent: #7fb0e6;
    --accent-soft: #1c2b3b;
    --bad: #f08a6c;
    --bad-soft: #3a211b;
    --miss: #e2b45c;
    --miss-soft: #33291a;
    --good: #7fb0e6;
    --good-soft: #1c2b3b;
    --code-bg: #1f252b;
    --focus: #f0a64b;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18.5px/1.6 var(--sans);
  font-variant-numeric: tabular-nums;
}

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 1px; }

h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
code, pre, kbd, samp { font-family: var(--mono); font-size: 0.82em; }
code { background: var(--code-bg); padding: 0.1em 0.3em; }
pre { margin: 0; background: var(--code-bg); padding: 14px 16px; overflow-x: auto; line-height: 1.55; border-left: 3px solid var(--line-strong); }
pre code { background: none; padding: 0; font-size: inherit; }

.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: 12px; top: -100px; background: var(--surface); color: var(--ink); padding: 10px 14px; z-index: 10; }
.skip:focus { top: 12px; }

/* ---------- Layout ---------- */

.wrap { max-width: calc(var(--wide) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--text); }

.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-top: 18px; padding-bottom: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand:hover { text-decoration: underline; }
.site-nav { display: flex; gap: 20px; font-size: 16.5px; flex-wrap: wrap; }
.site-nav a { color: var(--ink-2); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); margin-top: 72px; padding: 28px 0 40px; color: var(--muted); font-size: 15.5px; }
.site-footer p { max-width: var(--text); }
.site-footer a { color: var(--ink-2); }

section { margin-top: 64px; }
section:first-child { margin-top: 0; }

.eyebrow { font-size: 16px; color: var(--muted); margin: 0 0 10px; }

h2 { font-size: clamp(24px, 3vw, 29px); margin-bottom: 14px; }
h3 { font-size: 19px; margin-bottom: 8px; }
h4 { font-size: 17.5px; margin-bottom: 4px; }

.prose { font-size: 19.5px; line-height: 1.6; color: var(--ink); }
.prose p { margin-bottom: 0.9em; }
.prose ul, .prose ol { padding-left: 1.2em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 15.5px; }

/* ---------- Page intro ---------- */

.intro { padding: 56px 0 8px; }
.intro h1 { font-size: clamp(34px, 5.4vw, 52px); letter-spacing: -0.03em; line-height: 1.06; margin-bottom: 14px; }
.tagline { font-size: 19px; font-weight: 600; color: var(--accent); margin: 0 0 18px; }
.lede { font-family: var(--sans); font-size: clamp(19px, 2.2vw, 22px); line-height: 1.5; color: var(--ink-2); max-width: 38rem; }
.lede-2 { font-size: 16.5px; color: var(--muted); max-width: 38rem; margin-top: -4px; }

.meta-list { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 22px 0 0; padding: 0; list-style: none; font: 15px/1.5 var(--sans); color: var(--muted); }
.meta-list dt { display: inline; }
.meta-list div { white-space: nowrap; }
.meta-list dd { display: inline; margin: 0; color: var(--ink); }

/* ---------- Summary box ---------- */

.summary { margin-top: 36px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); padding: 22px 0 6px; }
.summary h2 { font-size: 19px; margin-bottom: 10px; }
.findings { margin: 0; padding-left: 1.2em; max-width: var(--text); }
.findings li { font-size: 16.5px; line-height: 1.55; color: var(--ink); margin-bottom: 8px; }
.findings li::marker { color: var(--muted); }
.findings .num { font-weight: 650; }
.scope { font-size: 15.5px; color: var(--muted); margin: 18px 0 14px; }

/* ---------- Tables ---------- */

.table-scroll { overflow-x: auto; margin: 0 0 8px; }
table { border-collapse: collapse; width: 100%; font-size: 16.5px; }
caption { text-align: left; font-weight: 650; font-size: 17.5px; padding-bottom: 10px; }
caption .muted { font-weight: 400; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 14.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line-strong); vertical-align: bottom; }
tbody th { font-weight: 600; }
th:first-child, td:first-child { padding-left: 0; }
.approach-tag { font-family: var(--sans); font-weight: 700; margin-right: 6px; }
.approach-name { font-weight: 500; }

.yes { color: var(--ink); font-weight: 600; }
.no { color: var(--muted); }

/* Approach comparison matrix */
.compare td { white-space: nowrap; }
.compare td.note { white-space: normal; color: var(--muted); font-size: 15.5px; min-width: 14rem; }
.compare .key { background: var(--accent-soft); }

/* ---------- Segment meters (one segment per task) ---------- */

.metric { display: flex; align-items: center; gap: 10px; min-width: 9.5rem; }
.metric .value { font: 600 16.5px var(--sans); min-width: 2.6em; }
.segs { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; }
.segs i { display: block; height: 12px; border: 1px solid var(--line-strong); background: transparent; }
.segs.bad i.on { background: var(--bad); border-color: var(--bad); }
.segs.good i.on { background: var(--good); border-color: var(--good); }
.segs.miss i.on { background: repeating-linear-gradient(135deg, var(--miss) 0 2px, transparent 2px 4px); border-color: var(--miss); }
.dir { display: block; font-weight: 400; font-size: 13.5px; color: var(--muted); }
.results-table td { vertical-align: middle; }

/* ---------- Scenario matrix ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0 0 16px; padding: 0; font-size: 15.5px; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { width: 14px; height: 14px; display: inline-block; border: 1.5px solid; flex: none; }

.o-write   { --c: var(--good); --bg: var(--good-soft); }
.o-refuse  { --c: var(--line-strong); --bg: transparent; }
.o-blocked { --c: var(--good); --bg: transparent; }
.o-invalid { --c: var(--bad); --bg: var(--bad-soft); }
.o-missed  { --c: var(--miss); --bg: var(--miss-soft); }
.swatch.o-write { background: var(--good); border-color: var(--good); }
.swatch.o-refuse { border-color: var(--line-strong); }
.swatch.o-blocked { border-color: var(--good); border-style: dashed; }
.swatch.o-invalid { background: var(--bad); border-color: var(--bad); }
.swatch.o-missed { border-color: var(--miss); background: repeating-linear-gradient(135deg, var(--miss) 0 2px, transparent 2px 4px); }

.matrix { table-layout: fixed; min-width: 40rem; }
.matrix thead th { text-align: left; }
.matrix thead th:first-child { width: 31%; }
.matrix tbody th { font-weight: 500; font-size: 16.5px; }
.matrix tbody th small { display: block; font: 14px/1.4 var(--sans); color: var(--muted); margin-top: 2px; font-weight: 400; }
.matrix td { padding: 6px 4px; }
.cell {
  display: block; padding: 7px 9px; min-height: 52px;
  border: 1.5px solid var(--c); background: var(--bg);
  font-size: 15px; line-height: 1.3; color: var(--ink);
}
.cell b { display: block; font-weight: 650; }
.cell span { font: 13.5px var(--sans); color: var(--muted); }
.cell.o-invalid b { color: var(--bad); }
.cell.o-missed { background: repeating-linear-gradient(135deg, var(--miss-soft) 0 5px, transparent 5px 10px); }
.cell.o-missed b { color: var(--miss); }
.cell.o-blocked { border-style: dashed; }
.cell.o-blocked b { color: var(--good); }
.cell.o-refuse b { color: var(--ink-2); font-weight: 500; }

.figure { margin: 28px 0 0; }
.figure-note { font-size: 15.5px; color: var(--muted); max-width: var(--text); margin-top: 10px; }
.callout { border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin: 24px 0; max-width: var(--text); }
.callout p:last-child { margin-bottom: 0; }

/* ---------- Time-of-check / time-of-use diagram ---------- */

.toctou { list-style: none; margin: 28px 0 0; padding: 0; position: relative; }
.t-step { display: grid; grid-template-columns: 36px 1fr 13rem; gap: 0 18px; position: relative; padding-bottom: 22px; }
.t-step::before { content: ""; position: absolute; left: 17px; top: 34px; bottom: 0; width: 2px; background: var(--line-strong); }
.t-step:last-child::before { display: none; }
.t-n { width: 36px; height: 36px; display: grid; place-items: center; border: 2px solid var(--ink); background: var(--paper); font: 700 16.5px var(--sans); position: relative; z-index: 1; }
.t-body h3 { font-size: 17px; margin: 6px 0 4px; }
.t-body p { margin: 0; color: var(--ink-2); font-size: 17px; max-width: 34rem; }
.t-state { align-self: start; margin-top: 4px; font: 14.5px/1.4 var(--sans); padding: 6px 10px; border: 1px solid var(--line-strong); background: var(--surface); }
.t-state b { font-weight: 700; }
.t-state.changed { border-color: var(--bad); color: var(--bad); }
.t-step.split { grid-template-columns: 36px 1fr; }
.t-step.split .t-n { border-color: var(--muted); color: var(--muted); }
.lanes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 6px; }
.t-step > *, .lanes > * { min-width: 0; }
.lane { border: 1.5px solid var(--c); background: var(--surface); padding: 14px 16px 16px; }
.lane .lane-label { font: 600 14px var(--sans); color: var(--muted); margin: 0 0 4px; }
.lane h3 { font-size: 17px; margin: 0 0 8px; }
.lane p { font-size: 16.5px; color: var(--ink-2); margin: 0 0 10px; }
.lane pre { font-size: 14px; margin: 0 0 12px; border-left-color: var(--c); }
.lane .outcome { font-weight: 650; font-size: 16.5px; display: flex; gap: 8px; align-items: baseline; margin: 0; }
.lane.o-invalid .outcome { color: var(--bad); }
.lane.o-blocked { border-style: solid; }
.lane.o-blocked .outcome { color: var(--good); }

/* ---------- Details / disclosure ---------- */

details { border-top: 1px solid var(--line); padding: 12px 0; }
details:last-of-type { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; font-size: 17.5px; }
summary .muted { font-weight: 400; }
details[open] summary { margin-bottom: 12px; }
details pre { font-size: 14.5px; max-height: 28rem; }

/* ---------- Lists of links ---------- */

.evidence { list-style: none; padding: 0; margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0 28px; }
.evidence li { border-top: 1px solid var(--line); padding: 10px 0; }
.evidence a { font-weight: 600; }
.evidence span { display: block; font-size: 15.5px; color: var(--muted); }

.limits { columns: 2; column-gap: 40px; }
.limits li { break-inside: avoid; }

/* ---------- Homepage ---------- */

.featured { border-top: 2px solid var(--ink); padding-top: 22px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; }
.featured h2 { font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.02em; margin-bottom: 12px; }
.featured h2 a { color: inherit; text-decoration: none; }
.featured h2 a:hover { text-decoration: underline; }
.question { font-family: var(--sans); font-size: 19px; line-height: 1.5; color: var(--ink-2); }
.result-strip { border: 1px solid var(--line); background: var(--surface); padding: 18px 20px; align-self: start; }
.result-strip h3 { font-size: 17.5px; margin-bottom: 10px; }
.result-strip table { font-size: 15.5px; }
.result-strip th, .result-strip td { padding: 7px 8px; vertical-align: middle; }
.result-strip .metric { min-width: 0; }
.result-strip p { font-size: 16px; color: var(--ink-2); margin: 12px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 20px; font-weight: 600; }

.index-table td, .index-table th { vertical-align: baseline; }
.index-table .num { font-family: var(--sans); font-weight: 600; white-space: nowrap; }
.index-table td.q { color: var(--ink-2); max-width: 30rem; }
.status { font: 14px var(--sans); white-space: nowrap; }


/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .featured { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .t-step { grid-template-columns: 36px 1fr; }
  .t-state { grid-column: 2; margin-top: 10px; justify-self: start; }
  .lanes { grid-template-columns: minmax(0, 1fr); }
  .limits { columns: 1; }

  /* Results table: one block per approach. */
  .results-table thead { display: none; }
  .results-table caption { display: block; }
  .results-table { max-width: 34rem; }
  .results-table, .results-table tbody, .results-table tr, .results-table th, .results-table td { display: block; }
  .results-table tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  .results-table th, .results-table td { border: 0; padding: 3px 0; }
  .results-table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .results-table td::before { content: attr(data-label); font-size: 15px; color: var(--muted); }
}

/* Stack the comparison table and scenario matrix instead of scrolling sideways. */
@media (max-width: 640px) {
  .compare, .compare tbody, .compare tr, .compare th, .compare td,
  .matrix, .matrix tbody, .matrix tr, .matrix th, .matrix td { display: block; }
  .compare thead, .matrix thead { display: none; }
  .compare, .matrix { min-width: 0; }
  .compare caption { display: block; }
  .compare tr { border-top: 1px solid var(--line-strong); padding: 12px 0 8px; }
  .compare th, .compare td { border: 0; padding: 3px 0; white-space: normal; }
  .compare tbody th { font-size: 17.5px; margin-bottom: 4px; }
  .compare td { display: flex; justify-content: space-between; gap: 16px; font-size: 16px; }
  .compare td::before { content: attr(data-label); color: var(--muted); }
  .compare td.note { display: block; min-width: 0; margin-top: 4px; }
  .compare td.note::before { content: none; }
  .compare .key { background: none; }

  .matrix tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
  .matrix tbody th { grid-column: 1 / -1; border: 0; padding: 0 0 2px; }
  .matrix td { border: 0; padding: 0; }
  .matrix td::before { content: attr(data-label); display: block; font: 600 13.5px var(--sans); color: var(--muted); margin-bottom: 3px; }
  .cell { min-height: 0; }

  .index-table, .index-table tbody, .index-table tr, .index-table td { display: block; }
  .index-table thead { display: none; }
  .index-table tr { border-top: 1px solid var(--line-strong); padding: 12px 0; }
  .index-table td { border: 0; padding: 2px 0; }
  .index-table td.q { margin: 6px 0; }
  .index-table td br { display: none; }
  .index-table td > .small { display: block; }
  .index-table td .status .muted::before { content: " · "; }
  .index-table td.small a { margin-right: 16px; }
}

@media (max-width: 560px) {
  body { font-size: 17.5px; }
  .prose { font-size: 17.5px; }
  .intro { padding-top: 36px; }
  section { margin-top: 52px; }
  .site-nav { gap: 16px; font-size: 16px; }
  .t-step { gap: 0 12px; grid-template-columns: 30px 1fr; }
  .t-n { width: 30px; height: 30px; font-size: 14.5px; }
  .t-step::before { left: 14px; top: 28px; }
  .t-step.split { grid-template-columns: 30px 1fr; }
  .compare td.note { min-width: 11rem; }
  .result-strip { padding: 14px 14px 16px; }
  .result-strip th, .result-strip td { padding: 7px 4px; }
}

@media print {
  body { background: #fff; color: #000; }
  .site-header nav, .skip { display: none; }
  details { border: 0; }
  details > *:not(summary) { display: block; }
  a { color: inherit; }
}

/* ---------- "The short version" box ---------- */

.glimpse { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--accent); padding: 22px 26px 10px; }
.glimpse h2 { font-size: 22px; margin-bottom: 12px; }
.glimpse-list { margin: 0; }
.glimpse-list > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 4px 20px; padding: 10px 0; border-top: 1px solid var(--line); }
.glimpse-list > div:first-child { border-top: 0; }
.glimpse-list dt { font-weight: 700; color: var(--ink); }
.glimpse-list dd { margin: 0; font-size: 19px; line-height: 1.5; color: var(--ink); }
.glimpse-list .num { font-weight: 700; white-space: nowrap; }

.takeaways { margin: 4px 0 0; padding-left: 1.2em; font-size: 18.5px; }
.takeaways li { margin-bottom: 6px; }

.compare.simple td { white-space: normal; color: var(--ink-2); }
.compare.simple th:first-child { width: 16rem; }

details.eng { margin-top: 12px; }
details.eng summary { font-weight: 600; color: var(--ink-2); }
details.eng p, details.eng li { font-size: 16.5px; }
details.eng pre { margin: 12px 0; }

@media (max-width: 640px) {
  .glimpse { padding: 18px 16px 6px; }
  .glimpse-list > div { grid-template-columns: 1fr; gap: 2px; }
  .glimpse-list dd { font-size: 18px; }
  .compare.simple th:first-child { width: auto; }
  .compare.simple td { display: block; }
  .compare.simple td::before { content: none; }
}

/* =====================================================================
   Newspaper theme: masthead, serif headlines, column rules, comic strip.
   Body text stays Calibri; Playfair Display is for headlines only and
   Comic Neue only for speech bubbles. Both fall back to local fonts.
   ===================================================================== */

:root {
  --paper: #f4f0e6;
  --surface: #fbf9f3;
  --ink: #161616;
  --ink-2: #2f2f2f;
  --muted: #5c5a55;
  --line: #d3ccbc;
  --line-strong: #8e877a;
  --panel: #ffffff;
  --note: #fff3b0;
  --caption: #ffe066;
  --shirt: #7fb0e6;
  --head: "Playfair Display", Georgia, "Times New Roman", serif;
  --comic: "Comic Neue", "Comic Sans MS", Calibri, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15140f;
    --surface: #1d1c17;
    --ink: #ece8dd;
    --ink-2: #d4d0c5;
    --muted: #a39e92;
    --line: #36332b;
    --line-strong: #5f5a4f;
    --panel: #24231d;
    --note: #4a4220;
    --caption: #6b5a12;
    --shirt: #2f5d8f;
  }
}

/* Masthead */
.masthead { padding-top: 18px; }
.mast-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; padding-bottom: 10px; border-bottom: 4px double var(--ink); }
.mast-title { font: 900 clamp(38px, 6.4vw, 76px)/1 var(--head); letter-spacing: -0.01em; color: var(--ink); text-decoration: none; margin: 0; text-align: center; white-space: nowrap; }
a.mast-title:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.ear { margin: 0 0 6px; font-size: 15px; color: var(--ink-2); font-style: italic; }
.ear-right span { display: block; }
.ear-right { text-align: right; font-style: normal; font-variant: small-caps; letter-spacing: 0.04em; }
.mast-nav { display: flex; justify-content: center; gap: 28px; padding: 9px 0; border-bottom: 1px solid var(--ink); font-variant: small-caps; letter-spacing: 0.06em; font-size: 17px; flex-wrap: wrap; }
.mast-nav a { color: var(--ink); text-decoration: none; }
.mast-nav a:hover { text-decoration: underline; }

/* Headlines */
h1, h2, .banner { font-family: var(--head); letter-spacing: -0.005em; }
h3, h4 { font-family: var(--sans); }
.section-label { font-variant: small-caps; letter-spacing: 0.08em; font-size: 16.5px; color: var(--bad); font-weight: 700; margin: 0 0 6px; }
.article-head { text-align: center; padding: 40px 0 6px; max-width: 54rem; margin: 0 auto; }
.article-head h1 { font-size: clamp(34px, 5.2vw, 58px); line-height: 1.08; font-weight: 900; margin-bottom: 14px; }
.deck { font-size: clamp(20px, 2.4vw, 24px); line-height: 1.4; color: var(--ink-2); font-style: italic; margin: 0 0 12px; }
.byline { font-variant: small-caps; letter-spacing: 0.05em; color: var(--muted); font-size: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: inline-block; padding: 4px 14px; }
.section-head, main > section > h2:not(.banner), .columns-2 h2 { font-size: clamp(26px, 3vw, 32px); border-top: 3px solid var(--ink); padding-top: 10px; margin-bottom: 16px; }

/* Front page */
.standfirst { text-align: center; font-size: clamp(19px, 2.2vw, 22px); color: var(--ink-2); max-width: 46rem; margin: 22px auto 0; font-style: italic; }
.front-lead { margin-top: 30px; }
.banner { font-size: clamp(38px, 6vw, 68px); font-weight: 900; line-height: 1.02; margin: 0 0 12px; border-top: 0; padding-top: 0; }
.banner a { color: inherit; text-decoration: none; }
.banner a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.front-lead .featured { border-top: 1px solid var(--ink); padding-top: 18px; margin-top: 16px; }
.lead-text p { font-size: 19.5px; }
.dropcap::first-letter { font: 900 4.1em/0.82 var(--head); float: left; margin: 6px 10px 0 0; color: var(--ink); }
.result-strip { border: 2px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); background: var(--surface); }
.result-strip h3 { font: 900 22px var(--head); border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
.columns-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; margin-top: 64px; }
.columns-2 > section { margin-top: 0; }
.columns-2 > section + section { border-left: 1px solid var(--line); padding-left: 48px; }

/* Article body: story in two newspaper columns on wide screens */
#story .prose p:first-child::first-letter { font: 900 4.1em/0.82 var(--head); float: left; margin: 6px 10px 0 0; }
@media (min-width: 980px) {
  #story .prose { columns: 2; column-gap: 44px; column-rule: 1px solid var(--line); max-width: none; }
  #story .prose p { break-inside: avoid; }
}

/* "At a glance" box */
.glimpse { border: 2px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); background: var(--surface); padding: 0 24px 8px; }
.glimpse h2 { font: 900 15px/1 var(--sans); text-transform: uppercase; letter-spacing: 0.14em; background: var(--ink); color: var(--paper); margin: 0 -24px 6px; padding: 10px 24px; border: 0; }
.glimpse-list dt { font-variant: small-caps; letter-spacing: 0.05em; font-size: 19px; }

/* Tables: newspaper rules */
thead th { border-bottom: 2px solid var(--ink); }
caption { font-family: var(--head); font-size: 21px; }
.callout { border-left: 0; border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); padding: 14px 0; text-align: center; max-width: 46rem; margin: 30px auto; }
.callout p { font-family: var(--head); font-size: 22px; }

/* ---------- Comic strip ---------- */
.comic { margin: 24px 0 8px; padding: 14px; background: var(--surface); border: 3px solid var(--ink); }
.comic-title { font: 700 26px/1.1 var(--comic); text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 12px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.comic-title span { font: 400 17px var(--comic); text-transform: none; letter-spacing: 0; color: var(--muted); }
.panels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.panel {
  position: relative; border: 3px solid var(--ink); padding: 10px 10px 6px; min-width: 0;
  background-color: var(--panel);
  background-image: radial-gradient(var(--line) 1.1px, transparent 1.3px);
  background-size: 9px 9px;
  display: flex; flex-direction: column; gap: 8px;
}
.panel-split { grid-column: 1 / -1; }
.caption-box { align-self: flex-start; margin: -10px 0 0 -10px; background: var(--caption); border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); padding: 3px 10px; font: 700 15px var(--comic); text-transform: uppercase; color: var(--ink); }
.bubble {
  position: relative; align-self: center; margin: 4px 0 6px; padding: 8px 12px; max-width: 95%;
  background: var(--panel); border: 2.5px solid var(--ink); border-radius: 18px;
  font: 700 18px/1.25 var(--comic); color: var(--ink); text-align: center;
}
.bubble::after {
  content: ""; position: absolute; left: 34%; bottom: -13px; width: 18px; height: 14px;
  background: var(--panel); border-right: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink);
  transform: skewX(-30deg) rotate(20deg); border-bottom-right-radius: 4px;
}
.narration { margin: 4px 0; padding: 6px 10px; background: var(--note); border: 2.5px solid var(--ink); font: 700 17px/1.25 var(--comic); color: var(--ink); text-align: center; }
.scene { width: 100%; height: auto; display: block; margin-top: auto; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.half { border: 3px solid var(--c); background: var(--panel); padding: 10px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.half .scene { max-width: 300px; align-self: center; margin-top: 0; }
.half-label { margin: 0; font: 700 16px var(--comic); text-transform: uppercase; color: var(--muted); }
.verdict { margin: 0; font-weight: 700; font-size: 18px; text-align: center; }
.half.o-invalid .verdict { color: var(--bad); }
.half.o-blocked .verdict { color: var(--good); }

/* SVG drawing classes */
.scene .ink { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.scene .fill-panel, .scene .fill-white { fill: var(--panel); }
.scene .fill-ink { fill: var(--ink); }
.scene .fill-none { fill: none; }
.scene .fill-accent { fill: var(--caption); }
.scene .fill-shirt { fill: var(--shirt); }
.scene .fill-note { fill: var(--note); }
.scene .ok-stroke { stroke: var(--good); }
.scene .no-stroke { stroke: var(--bad); }
.scene .svg-label { font: 700 7px var(--sans); fill: var(--muted); letter-spacing: 0.06em; }
.scene .stamp-no { fill: none; stroke: var(--bad); stroke-width: 3.5; }
.scene .stamp-text { font: 900 17px var(--head); letter-spacing: 0.06em; }
.scene .stamp-text-no { fill: var(--bad); }

@media (max-width: 860px) {
  .panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .columns-2 { grid-template-columns: 1fr; }
  .columns-2 > section + section { border-left: 0; padding-left: 0; margin-top: 48px; }
}
@media (max-width: 560px) {
  .mast-top { grid-template-columns: 1fr; text-align: center; gap: 4px; }
  .ear, .ear-right { text-align: center; margin: 0; font-size: 14px; }
  .ear-right span { display: inline; }
  .ear-right span + span::before { content: "· "; }
  .mast-title { white-space: normal; }
  .mast-nav { gap: 16px; font-size: 16px; }
  .panels { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .glimpse { padding: 0 16px 6px; box-shadow: 4px 4px 0 var(--ink); }
  .glimpse h2 { margin: 0 -16px 6px; padding: 10px 16px; }
  .result-strip { box-shadow: 4px 4px 0 var(--ink); }
}
@media print { .glimpse, .result-strip { box-shadow: none; } }
main > section.glimpse > h2 { font-size: 17px; border-top: 0; padding-top: 10px; }

/* Refund-agent story additions */
.for-engineers { margin: 14px auto 0; max-width: 40rem; font-size: 16px; color: var(--muted); }
.comic-note { margin: 12px 2px 0; font-size: 16px; color: var(--muted); font-style: italic; }
.scene .fill-shirt2 { fill: var(--caption); }
.scene .fill-cash { fill: #cfe8c4; }
.scene .svg-cash { font: 900 14px var(--sans); fill: var(--ink); }
.result-caption { font-size: 15.5px; color: var(--ink-2); margin: 10px 0 0; }

h1, h2, .banner, .mast-title, caption { font-variant-numeric: lining-nums; }

/* Homepage: the habit, as four newspaper columns */
.front-lead .deck { max-width: 48rem; }
.habit { list-style: none; counter-reset: h; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.habit li { counter-increment: h; padding: 4px 22px 6px; border-left: 1px solid var(--line); font-size: 18px; line-height: 1.5; color: var(--ink-2); }
.habit li:first-child { border-left: 0; padding-left: 0; }
.habit li::before { content: counter(h); display: block; font: 900 44px/1 var(--head); color: var(--bad); margin-bottom: 6px; font-variant-numeric: lining-nums; }
.habit b { display: block; font: 900 24px/1.2 var(--head); color: var(--ink); margin-bottom: 4px; }
.log-table td.q { max-width: 34rem; }
@media (max-width: 860px) {
  .habit { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .habit li:nth-child(3) { border-left: 0; padding-left: 0; }
}
@media (max-width: 560px) {
  .habit { grid-template-columns: 1fr; }
  .habit li { border-left: 0; padding: 12px 0; border-top: 1px solid var(--line); }
  .habit li:first-child { border-top: 0; }
}

#main > .front-lead:first-child { margin-top: 36px; }

/* Lesson headlines on their own line, in the headline font */
#lessons li > strong:first-child,
#learned p > strong:first-child {
  display: block;
  font: 900 22px/1.25 var(--head);
  color: var(--ink);
  margin-bottom: 4px;
}
#lessons li { margin-bottom: 18px; }
#learned p { margin-bottom: 20px; }

/* Common-sense pass */
.figure-note, .compare.simple td.note, .legend, .scope, .comic-note { font-size: 16.5px; color: var(--ink-2); }
.figure-lead { font-size: 18px; margin: 0 0 12px; max-width: var(--text); }
.matrix tr.key-row th, .matrix tr.key-row td { background: var(--caption-soft, rgba(255, 224, 102, 0.28)); }
.matrix tr.key-row th { padding-left: 8px; }
.situations { margin: 6px 0 0; padding-left: 1.4em; max-width: var(--text); font-size: 18px; line-height: 1.55; }
.situations li { margin-bottom: 4px; }
.for-engineers-below { margin: 14px 0 0; font-size: 16px; color: var(--muted); max-width: var(--text); }
.back-link { margin: 48px 0 0; font-size: 18px; font-weight: 600; }
.back-link a { text-decoration: none; }
.back-link a:hover { text-decoration: underline; }
