/* Jindal Stainless surface-defect detection -- static site.
   Palette lifted from .streamlit/config.toml and demo/app.py PALETTE so the page,
   the console and the deck read as one system. No framework, no build step. */

:root {
  --bg: #0C0F13;
  --panel: #151A21;
  --panel-alt: #11161C;
  --border: #232A33;
  --border-soft: #1B212A;
  --text: #E4E8EE;
  --dim: #C6CCD6;
  --muted: #8A94A3;
  --accent: #F5A524;
  --pass: #3FB950;
  --fail: #F85149;

  --low: #3FB950;
  --medium: #D6A31A;
  --high: #F0883E;
  --critical: #F85149;

  --crazing: #FF8200;
  --inclusion: #DC1E2D;
  --patches: #3796FF;
  --pitted_surface: #AA50DC;
  --rolled-in_scale: #F0BE00;
  --scratches: #00C8A0;

  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;
  --wrap: 1140px;
}

* { box-sizing: border-box; }

/* The UA rule is [hidden]{display:none}, one attribute selector -- which any author
   class rule that sets `display` beats, because the author sheet outranks the UA sheet
   at equal specificity. `.btn` sets display:inline-flex, so `<a class="btn" hidden>`
   rendered as a visible button linking to "#". That is the console link, which must
   stay invisible until HF_SPACE_URL exists. Make `hidden` mean hidden. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 0.86em; }

/* ---------- masthead ---------- */

header.mast {
  position: sticky; top: 0; z-index: 50;
  background: rgba(12, 15, 19, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.mast .wrap { display: flex; align-items: center; gap: 18px; height: 56px; }
.mast .brand { font-weight: 650; letter-spacing: 0.01em; white-space: nowrap; }
.mast .brand a { color: inherit; text-decoration: none; }
.mast .brand a:hover { color: var(--text); }
.mast .brand span { color: var(--accent); }
.mast nav { display: flex; gap: 18px; margin-left: auto; font-size: 0.86rem; overflow-x: auto; }
.mast nav a { color: var(--muted); white-space: nowrap; }
.mast nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- hero ---------- */

.hero { border-bottom: 1px solid var(--border); padding: 40px 0 34px; }
.kicker {
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
h1 {
  font-size: clamp(1.85rem, 4.6vw, 3rem); line-height: 1.1;
  margin: 14px 0 0; font-weight: 680; letter-spacing: -0.02em;
}
.lede { font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--dim); max-width: 68ch; margin: 18px 0 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 3px; font-size: 0.88rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  cursor: pointer; font-family: inherit;
}
.btn:hover { border-color: #33404F; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0B0E12; }
.btn.primary:hover { background: #FFB63D; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- stat strip ---------- */

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
  margin-top: 34px;
}
.stat { background: var(--panel); padding: 15px 17px; }
.stat .k { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-size: 1.55rem; font-weight: 650; margin-top: 5px; font-family: var(--mono); }
.stat .n { font-size: 0.71rem; color: var(--muted); margin-top: 3px; }
.stat .v.good { color: var(--pass); }
.stat .v.warn { color: var(--accent); }

/* ---------- sections ---------- */

section { padding: 46px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 58px; }
section > .wrap > h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem); margin: 0; font-weight: 660; letter-spacing: -0.01em;
}
.sub { color: var(--muted); max-width: 76ch; margin: 10px 0 0; font-size: 0.95rem; }
h3 { font-size: 1.02rem; font-weight: 640; margin: 30px 0 10px; }

.src {
  display: block; font-family: var(--mono); font-size: 0.71rem; color: var(--muted);
  margin-top: 8px; word-break: break-word;
}
.src::before { content: 'source '; color: #5C6675; }

/* ---------- demo ---------- */

.demo-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr); gap: 22px; margin-top: 26px; }
@media (max-width: 900px) { .demo-grid { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 3px; }
.panel > .hd {
  padding: 11px 15px; border-bottom: 1px solid var(--border); background: var(--panel-alt);
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.panel > .hd .right { margin-left: auto; font-family: var(--mono); letter-spacing: 0; text-transform: none; }
.panel > .bd { padding: 15px; }

#drop {
  position: relative; border: 1px dashed #2E3844; border-radius: 3px;
  background: var(--panel-alt); min-height: 260px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
#drop { cursor: pointer; }
#drop:hover { border-color: var(--accent); }
#drop:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#drop.over { border-color: var(--accent); background: #16191C; }
#drop.has-image { border-style: solid; border-color: var(--border); background: #0B0E12; }
#drop canvas { display: block; max-width: 100%; height: auto; image-rendering: crisp-edges; }
#dropHint { color: var(--muted); font-size: 0.88rem; text-align: center; padding: 30px 20px; }
#dropHint b { color: var(--text); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip {
  font-family: var(--mono); font-size: 0.72rem; padding: 5px 9px; border-radius: 2px;
  background: var(--panel-alt); border: 1px solid var(--border); color: var(--dim);
  cursor: pointer; border-left: 3px solid var(--cc, var(--muted));
}
.chip:hover { border-color: #3A4553; color: var(--text); }
.chip.active { background: #1D2530; color: var(--text); }
.chip.wide { border-left-color: var(--muted); font-style: italic; }

.ctl { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.ctl label { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
input[type=range] { flex: 1; min-width: 160px; accent-color: var(--accent); }
.ctl .val { font-family: var(--mono); font-size: 0.86rem; min-width: 4.2em; }

.bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: 12px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.12s linear; }

#status { font-size: 0.8rem; color: var(--muted); margin-top: 10px; min-height: 1.4em; font-family: var(--mono); }
#status.err { color: var(--fail); }

.timing { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); }
.timing div { background: var(--panel-alt); padding: 9px 11px; }
.timing .k { font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.timing .v { font-family: var(--mono); font-size: 1.02rem; margin-top: 3px; }

/* results table */
.tbl-scroll { overflow-x: auto; margin-top: 4px; }
table.res { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.res th {
  text-align: left; padding: 7px 8px; font-size: 0.66rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border);
  background: var(--panel-alt); white-space: nowrap; font-weight: 600;
}
table.res td { padding: 7px 8px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.res td.mono, table.res td.num { font-family: var(--mono); font-size: 0.75rem; white-space: nowrap; }
table.res tr.sel { background: #1A2027; }
table.res tbody tr { cursor: pointer; }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 1px; margin-right: 7px; vertical-align: baseline; }
.pill {
  display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 0.68rem;
  font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
}
.pill.low { background: rgba(63,185,80,0.16); color: var(--low); }
.pill.medium { background: rgba(214,163,26,0.16); color: var(--medium); }
.pill.high { background: rgba(240,136,62,0.16); color: var(--high); }
.pill.critical { background: rgba(248,81,73,0.16); color: var(--critical); }

.empty { color: var(--muted); font-size: 0.86rem; padding: 18px 4px; }

/* guidance cards */
.guide { margin-top: 12px; display: grid; gap: 10px; }
.gcard {
  border: 1px solid var(--border); border-left: 3px solid var(--cc, var(--accent));
  background: var(--panel-alt); padding: 12px 14px; border-radius: 2px;
}
.gcard .top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gcard .nm { font-family: var(--mono); font-weight: 650; font-size: 0.86rem; }
.gcard .cf { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-left: auto; }
.gcard dl { margin: 9px 0 0; }
.gcard dt {
  font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin-top: 9px;
}
.gcard dd { margin: 3px 0 0; font-size: 0.85rem; line-height: 1.55; color: var(--dim); }

/* ---------- generic cards / tables ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 22px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 3px; padding: 16px 17px; }
.card h4 { margin: 0 0 8px; font-size: 0.94rem; font-weight: 640; }
.card p { margin: 0; font-size: 0.88rem; color: var(--dim); }

table.data { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 16px; }
table.data th {
  text-align: left; padding: 9px 11px; font-size: 0.66rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border);
  background: var(--panel-alt); font-weight: 600;
}
table.data td { padding: 9px 11px; border-bottom: 1px solid var(--border-soft); }
table.data td.num, table.data td.mono { font-family: var(--mono); font-size: 0.8rem; }
table.data tr:last-child td { border-bottom: none; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 3px; }
.tbl-wrap table.data { margin-top: 0; }

.delta { color: var(--pass); font-weight: 650; }
.delta.bad { color: var(--fail); }
.arrow { color: var(--muted); padding: 0 5px; }

/* AP50 bar */
.apbar { position: relative; height: 6px; background: var(--border); border-radius: 2px; min-width: 90px; }
.apbar > i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--cc, var(--accent)); }

/* ---------- limitations ---------- */

.lim { border-left: 3px solid var(--fail); background: rgba(248,81,73,0.05); padding: 2px 0; }
.lim .card { border-radius: 0; background: transparent; border: none; border-bottom: 1px solid var(--border-soft); }
.lim .card:last-child { border-bottom: none; }
.lim .card h4 { color: var(--text); }
.lim .card h4::before { content: '\2014\00a0'; color: var(--fail); }

/* ---------- console ---------- */

/* Two-column argument, collapsing to one before the columns get too narrow to read. */
.cons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-top: 24px; }
.cons-col h3 { margin: 0 0 10px; font-size: 1.02rem; font-weight: 640; }
.cons-col p { margin: 0 0 11px; font-size: 0.9rem; color: var(--dim); }
.cons-col p:last-child { margin-bottom: 0; }
.cons-col strong { color: var(--text); font-weight: 640; }

.cons-h {
  margin: 34px 0 0; font-size: 1.02rem; font-weight: 640;
  padding-top: 22px; border-top: 1px solid var(--border-soft);
}

/* A command block is the one thing on the page that must not be re-wrapped: a broken
   line is a command that does not run. It scrolls inside its own box instead. */
.cmd {
  margin: 14px 0 0; padding: 13px 15px; background: var(--panel-alt);
  border: 1px solid var(--border); border-left: 2px solid var(--accent); border-radius: 3px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.cmd code {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.75; color: var(--dim);
  background: none; padding: 0; white-space: pre;
}

.cons-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

/* The optional live embed. Only ever present when HF_SPACE_URL is set. */
#console-slot iframe { width: 100%; height: 78vh; min-height: 520px; border: 1px solid var(--border); border-radius: 3px; background: var(--panel-alt); }

/* ---------- footer ---------- */

footer { padding: 34px 0 48px; color: var(--muted); font-size: 0.82rem; }
footer .links { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 14px; }
footer p { margin: 6px 0; max-width: 84ch; }

.note {
  font-size: 0.82rem; color: var(--muted); border-left: 2px solid var(--border);
  padding-left: 12px; margin-top: 16px; max-width: 82ch;
}
.tag {
  display: inline-block; font-family: var(--mono); font-size: 0.66rem; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 2px; color: var(--muted); vertical-align: middle;
}
.tag.pass { color: var(--pass); border-color: rgba(63,185,80,0.4); }
.tag.warn { color: var(--accent); border-color: rgba(245,165,36,0.4); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar > i { transition: none; }
}

/* ---------- narrow viewports ----------
   Judges open this on a phone. Three things break a dark data-dense page at 360 px:
   long unbroken monospace strings (box coordinates, file paths, class names) pushing
   the body wider than the screen; fixed multi-column grids; and 20 px gutters eating
   a sixth of the width. Everything wide on this page -- tables, the command block,
   the canvas -- already scrolls inside its own container, so the rule here is that
   the BODY never scrolls sideways. */

/* A belt-and-braces guard against one long token anywhere dragging the page wide. */
html, body { overflow-x: hidden; }
.wrap { width: 100%; }

/* Monospace runs are the usual culprit: they have no spaces to break at. */
.src, footer p, .card p, .cons-col p, .note { overflow-wrap: break-word; }
code { overflow-wrap: break-word; }

@media (max-width: 720px) {
  .wrap { padding: 0 14px; }

  h1 { font-size: clamp(1.5rem, 6.4vw, 2rem); line-height: 1.22; }
  h2 { font-size: 1.18rem; }
  section { padding: 34px 0; }

  /* Auto-fit grids with a 260-320 px minimum still overflow a 360 px viewport once
     the gutters are counted. Below this width one column is the only honest layout. */
  .stats, .cards, .cons-grid, .demo-grid { grid-template-columns: 1fr; }
  .timing { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .stat .v { font-size: 1.3rem; }
  .lede { font-size: 0.97rem; }
  .sub { font-size: 0.9rem; }

  /* The masthead nav is already a horizontal scroller; hide the scrollbar so it does
     not read as a broken element, and let it bleed to the screen edge so it is
     obviously swipeable. */
  .mast .wrap { gap: 12px; }
  .mast .brand { font-size: 0.86rem; white-space: nowrap; }
  .mast nav { gap: 14px; font-size: 0.8rem; scrollbar-width: none; -ms-overflow-style: none; }
  .mast nav::-webkit-scrollbar { display: none; }

  /* Full-width tap targets beat a row of half-width ones on a phone. */
  .hero-actions .btn, .cons-links .btn { flex: 1 1 100%; text-align: center; }

  .cmd code { font-size: 0.74rem; }
  footer .links { gap: 10px 14px; }
}

@media (max-width: 420px) {
  /* At iPhone SE width the coordinate column of the results table is what forces the
     scroll. That is fine -- it scrolls in .tbl-scroll -- but the pills and swatches
     should not wrap mid-row. */
  .timing { grid-template-columns: 1fr; }
  .chip { font-size: 0.72rem; }
  table.data { font-size: 0.78rem; }
}

/* ======================================================================
   REDESIGN LAYER -- the one-page front door.
   Everything above this line is still used verbatim by evidence/,
   console/ and technical.html; nothing here overrides those pages.
   The rule for the front page: the working detector is above the fold,
   the prose is one screen of plain language, and every claim that used
   to be printed inline is now one click away in a <details> or on
   technical.html.
   ====================================================================== */

/* ---------- hero: copy on the left, the running detector on the right ---------- */

.hero.live { padding: 26px 0 30px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 30px; align-items: start;
}
.hero-copy { display: flex; flex-direction: column; gap: 0; }

.hero-lead h1 {
  font-size: clamp(1.62rem, 2.9vw, 2.3rem);
  margin: 9px 0 0; line-height: 1.09; letter-spacing: -0.022em;
}
.hero-lead .lede { font-size: 1rem; line-height: 1.55; margin-top: 13px; max-width: 52ch; }
.hero-lead .lede strong { color: var(--text); font-weight: 650; }

/* The invitation. It points right on a wide screen and down on a phone,
   because that is where the detector actually is in each layout. */
.nudge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 0.92rem; font-weight: 640; color: var(--accent);
}
.nudge::after { content: '\2192'; font-size: 1.05rem; }

.hero-facts { margin-top: 18px; }

/* ---------- three headline numbers, each with a plain-English gloss ---------- */

.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; background: var(--border); border: 1px solid var(--border);
}
.fact { background: var(--panel); padding: 12px 13px 13px; }
.fact .v { font-family: var(--mono); font-size: 1.24rem; font-weight: 650; letter-spacing: -0.01em; }
.fact .v.good { color: var(--pass); }
.fact .k { font-size: 0.64rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.fact .g { font-size: 0.75rem; line-height: 1.42; color: var(--dim); margin-top: 6px; }

/* ---------- the detector panel ---------- */

.panel.demo-panel > .bd { padding: 13px; }
.demo-panel #drop { min-height: 250px; }
/* A 200 px sample blown up to the full panel width would push the samples off
   the fold, and a 2048 px strip would be a letterbox slit. Cap the DISPLAY
   height; app.js reads this back and picks the canvas resolution from it, so
   the label chips stay legible at whatever size the cap lands on. */
.demo-panel #drop canvas { max-height: min(42vh, 360px); }

.verdict {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding: 9px 11px; border-radius: 3px;
  background: var(--panel-alt); border: 1px solid var(--border);
  font-size: 0.84rem;
}
.verdict .dot { width: 9px; height: 9px; border-radius: 2px; background: var(--cc, var(--muted)); flex: none; }
.verdict .nm { font-weight: 650; }
.verdict .sep { color: #43505F; }
.verdict .mono { color: var(--muted); }
.verdict .ms { margin-left: auto; padding-left: 10px; }
.verdict.none { color: var(--muted); }

/* The progress bar is a progress bar, not a rule: it exists only while the 12.1 MB
   model is coming down, and disappears once there is nothing to report. */
.demo-panel .bar { margin-top: 11px; display: none; }
.demo-panel .bar.on { display: block; }
.demo-panel #status { margin-top: 8px; font-size: 0.76rem; }

.chips-label {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; font-size: 0.7rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted);
}
.chips-label .hint { letter-spacing: 0; text-transform: none; color: #6E7887; font-size: 0.74rem; }

/* Sample chips: one click, obviously clickable, colour-coded by defect class. */
.chips { gap: 7px; margin-top: 9px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 0.78rem; font-weight: 600;
  padding: 7px 10px; border-radius: 3px;
  background: #1A212A; border: 1px solid #2B3541; border-left: 1px solid #2B3541;
  color: var(--dim); cursor: pointer; line-height: 1;
}
.chip::before {
  content: ''; width: 8px; height: 8px; border-radius: 2px; flex: none;
  background: var(--cc, var(--muted));
}
.chip:hover { background: #222D39; border-color: #435263; color: var(--text); }
.chip.active { color: var(--text); border-color: var(--accent); background: #23282B; }
.chip.wide { font-style: normal; border-style: dashed; }
.chip.suggest { box-shadow: 0 0 0 1px rgba(245,165,36,0.55); }
.chips .row-note {
  flex-basis: 100%; margin: 5px 0 1px; font-size: 0.72rem; color: var(--muted);
}

.demo-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 13px;
  font-size: 0.8rem; color: var(--muted);
}
.btn.sm { padding: 6px 11px; font-size: 0.8rem; }
.lnk { color: var(--accent); font-weight: 600; }

/* Three lines of plain reassurance, in the space the copy column leaves. */
.trust { list-style: none; margin: 16px 0 0; padding: 0; }
.trust li {
  position: relative; padding-left: 17px; margin-top: 7px;
  font-size: 0.82rem; color: var(--muted); line-height: 1.45;
}
.trust li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 6px; height: 6px; border-radius: 1px; background: var(--accent);
}
.trust strong { color: var(--dim); font-weight: 640; }

/* ---------- section furniture ---------- */

.sec-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
/* h2 here is not a direct child of .wrap, so it would keep the UA's 0.83em margins
   and open a gap the size of a paragraph between the heading and its own subtitle. */
.sec-head h2 {
  margin: 0; font-weight: 660; letter-spacing: -0.01em;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem);
}
.sec-head .idx {
  font-family: var(--mono); font-size: 0.72rem; color: var(--accent);
  letter-spacing: 0.1em; text-transform: uppercase;
}
section > .wrap > .sub { margin-top: 8px; }

/* ---------- collapsible depth ---------- */

details.d {
  border: 1px solid var(--border); border-radius: 3px; background: var(--panel);
  margin-top: 10px;
}
details.d > summary {
  cursor: pointer; padding: 12px 40px 12px 14px; position: relative; list-style: none;
}
details.d > summary::-webkit-details-marker { display: none; }
details.d > summary::after {
  content: '+'; position: absolute; right: 14px; top: 11px;
  font-family: var(--mono); font-size: 1rem; color: var(--muted);
}
details.d[open] > summary::after { content: '\2212'; }
details.d > summary:hover { background: #191F27; }
details.d > summary .t { display: block; font-weight: 640; font-size: 0.93rem; color: var(--text); }
details.d > summary .s { display: block; font-size: 0.85rem; color: var(--dim); margin-top: 4px; max-width: 78ch; }
details.d .dbody {
  padding: 2px 14px 14px; font-size: 0.86rem; color: var(--dim); max-width: 84ch;
}
details.d .dbody p { margin: 0 0 10px; }
details.d .dbody p:last-child { margin-bottom: 0; }
details.d .dbody .src { margin-top: 6px; }
details.d.warn { border-left: 3px solid var(--fail); }
details.d.warn > summary .t::before { content: '\2014\00a0'; color: var(--fail); }

.d-row { display: grid; gap: 10px; margin-top: 14px; }

/* ---------- where this model sits against published work ---------- */

.band { margin-top: 30px; max-width: 560px; }
.band-track {
  position: relative; height: 38px; border: 1px solid var(--border);
  background: var(--panel-alt); border-radius: 3px;
}
.band-pub {
  position: absolute; top: 0; bottom: 0; background: rgba(138,148,163,0.2);
  border-left: 1px solid #3A4553; border-right: 1px solid #3A4553;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 0.66rem; color: var(--muted); text-align: center;
}
.band-mark { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--accent); }
.band-mark::after {
  content: attr(data-label); position: absolute; left: 50%; transform: translateX(-50%);
  top: -21px; font-family: var(--mono); font-size: 0.72rem; font-weight: 650;
  color: var(--accent); white-space: nowrap;
}
.band-ax { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.68rem; color: var(--muted); margin-top: 5px; }
.band-key { font-size: 0.78rem; color: var(--muted); margin-top: 8px; }

/* ---------- before / after ---------- */

.ba-title { margin: 22px 0 0; font-size: 0.92rem; font-weight: 640; color: var(--text); }
.ba-bars { display: grid; gap: 12px; margin-top: 12px; }
.ba-row { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 14px; align-items: center; }
.ba-row .lab { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; }
.ba-row.before .lab { color: var(--fail); }
.ba-row.after .lab { color: var(--pass); }
.ba-row .lab small { display: block; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); margin-top: 3px; font-size: 0.74rem; }
.ba-bar { position: relative; height: 30px; background: var(--panel-alt); border: 1px solid var(--border); border-radius: 3px; }
.ba-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 2px 0 0 2px; }
.ba-row.before .ba-bar > i { background: rgba(248,81,73,0.42); }
.ba-row.after .ba-bar > i { background: rgba(63,185,80,0.42); }
.ba-bar > b {
  position: absolute; top: 0; bottom: 0; left: 10px; display: flex; align-items: center;
  font-family: var(--mono); font-size: 0.88rem; font-weight: 650;
}
.ba-cap { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }

table.data td.was { color: var(--fail); font-weight: 650; }
table.data td.now { color: var(--pass); font-weight: 650; }
table.data th.was { color: var(--fail); }
table.data th.now { color: var(--pass); }

/* ---------- squashed vs tiled ---------- */

.vs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 20px; }
.vs .side { border: 1px solid var(--border); border-radius: 3px; background: var(--panel); padding: 15px 16px; }
.vs .side.bad { border-left: 3px solid var(--fail); }
.vs .side.good { border-left: 3px solid var(--pass); }
.vs .side h4 { margin: 0 0 6px; font-size: 0.92rem; font-weight: 640; }
.vs .side .big { font-family: var(--mono); font-size: 1.5rem; font-weight: 650; margin: 8px 0 2px; }
.vs .side.bad .big { color: var(--fail); }
.vs .side.good .big { color: var(--pass); }
.vs .side p { margin: 6px 0 0; font-size: 0.85rem; color: var(--dim); }

/* ---------- link cards ---------- */

.linkcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 20px; }
.linkcard {
  display: block; border: 1px solid var(--border); border-radius: 3px;
  background: var(--panel); padding: 14px 15px; color: var(--text);
}
.linkcard:hover { border-color: var(--accent); text-decoration: none; }
.linkcard .t { font-weight: 640; font-size: 0.93rem; }
.linkcard .t::after { content: '\00a0\2192'; color: var(--accent); }
.linkcard .s { font-size: 0.81rem; color: var(--muted); margin-top: 5px; line-height: 1.45; }

/* ---------- footer, front page ---------- */

footer.slim { padding: 26px 0 40px; }
footer.slim .links { margin-bottom: 12px; }

/* ---------- narrow ---------- */

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  /* The headline leads, the detector comes second, the numbers third: on a phone
     the judge should reach a clickable sample without passing a stat strip. */
  .hero-copy { display: contents; }
  .hero-lead { order: 1; }
  .hero-demo { order: 2; }
  .hero-facts { order: 3; margin-top: 0; }
  .nudge::after { content: '\2193'; }
  .hero-lead .lede { max-width: 60ch; }
}

@media (max-width: 720px) {
  .hero.live { padding: 14px 0 22px; }

  /* One line of masthead, or the brand eats a fifth of the fold. */
  .mast .brand .b2 { display: none; }
  .mast .brand .sl { display: none; }
  .hero.live .kicker { font-size: 0.6rem; letter-spacing: 0.1em; }

  /* The runtime version is a footnote; it is not worth a second header line here. */
  .demo-panel > .hd .right { display: none; }
  .chips-label { margin-top: 12px; }
  .hero-lead h1 { font-size: clamp(1.42rem, 6vw, 1.75rem); line-height: 1.16; }
  .hero-lead .lede { font-size: 0.94rem; margin-top: 10px; }
  .hero-lead .nudge { margin-top: 11px; }
  .hero-lead h1 { margin-top: 7px; }
  .facts { grid-template-columns: 1fr; }
  .fact { padding: 11px 13px; }
  .demo-panel #drop { min-height: 150px; }
  /* Tight enough that the verdict line under the frame is still on the first screen
     of a 390x844 phone after a sample is clicked -- the answer and the picture of the
     answer arrive together, without a scroll. */
  .demo-panel #drop canvas { max-height: max(34vh, 180px); }
  .verdict { font-size: 0.79rem; padding: 7px 9px; gap: 7px; }
  .verdict .ms { margin-left: 0; padding-left: 0; }
  .demo-panel > .bd { padding: 11px; }
  #dropHint { padding: 18px 16px; }
  .chip { font-size: 0.75rem; padding: 7px 9px; }
  .ba-row { grid-template-columns: 1fr; gap: 6px; }
  .ba-row .lab small { display: inline; margin-left: 6px; }
  .band-mark::after { font-size: 0.68rem; }
  details.d > summary { padding-right: 34px; }
}
