/* site.css: the shared components of the PlatAtlas marketing pages (/, /runs/, /setup, /demo/films/, /demo/record/).
 *
 * Load after /brand/fonts/fonts.css and /design-tokens.css; every colour, family and space is a --pa-* token from
 * there, with a literal fallback. The concept is a well-kept workpaper, not a dashboard: numbers in mono tabular
 * columns, a source line under every figure, and one motif, the 60-cell grid.
 *
 * MONO RULE: Plex Mono means "this is literally in a file or a run report" (file names, YAML lines, CSV rows, field
 * values, measured counts). Never use .mono, .stamp, .tree or .source for decoration.
 *
 * Components (numbered as in the build brief):
 *   1 .chip (.measured .inferred .illustrative .declared .fictional)   8 .works (li.runs / li.notyet)
 *   2 .grid60 (generated by tools/build-figures.mjs)                   9 .film
 *   3 .source                                                          10 .btn-primary, .btn-secondary, focus ring
 *   4 .stamp                                                           11 .icon (sprite /brand/icons.svg)
 *   5 .tree (generated)                                                12 .site-nav
 *   6 .lanes                                                           13 .plate
 *   7 .strata                                                          14 .role-ghost
 * Also: base type and layout, .table-mono (stacked rows under 640px), .why-trail, .spec-card and .lever (generated).
 * No motion except a 200ms fade on an opening <details>; none at all under prefers-reduced-motion.
 */

/* ---------- base type and layout ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--pa-paper, #ede4ce);
  color: var(--pa-ink, #1a1611);
  font: 400 18px/1.6 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif);
}
@media (max-width: 640px) { body { font-size: 17px; line-height: 1.55; } }

h1, h2 { font-family: var(--pa-font-serif, "Spectral", Georgia, serif); color: var(--pa-ink, #1a1611); }
h1 { font-weight: 600; font-size: clamp(2rem, 4.2vw + 0.6rem, 3.4rem); line-height: 1.08; letter-spacing: -0.01em; max-width: 20ch; margin: 0 0 var(--pa-s5, 24px); }
h2 { font-weight: 500; font-size: clamp(1.55rem, 2vw + 0.9rem, 2.15rem); line-height: 1.15; margin: 0 0 var(--pa-s4, 16px); max-width: 30ch; }
h3 { font: 600 19px/1.3 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); margin: 0 0 var(--pa-s2, 8px); }
p { margin: 0 0 var(--pa-s4, 16px); max-width: 64ch; }
a { color: var(--pa-accent-deep, #8c3a2c); text-decoration: underline; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--pa-ink-2, #4a4239); outline-offset: 2px; }

.eyebrow { font: 600 13px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); text-transform: uppercase; letter-spacing: 0.06em; color: var(--pa-ink-faint, #655d4f); margin: 0 0 var(--pa-s3, 12px); }
.lede { font-size: 1.12em; color: var(--pa-ink-2, #4a4239); }
.sub { color: var(--pa-ink-2, #4a4239); }
.small, small { font-size: 14px; line-height: 1.45; }
.mono, code, kbd, samp {
  font-family: var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace);
  font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.pull {
  font: italic 400 28px/1.3 var(--pa-font-serif, "Spectral", Georgia, serif);
  border-left: 3px solid var(--pa-accent-deep, #8c3a2c); padding-left: var(--pa-s5, 24px); margin: var(--pa-s6, 32px) 0; max-width: 34ch;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }
.read { max-width: 680px; }
.section, main > section { padding: var(--pa-s8, 64px) 0; border-top: 1px solid var(--pa-rule, #c4b591); }
@media (max-width: 640px) { .section, main > section { padding: var(--pa-s7, 48px) 0; } }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------- 1. provenance chips ---------- */
.chip {
  display: inline-block; vertical-align: 0.1em;
  font: 600 11.5px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
  padding: 2px 8px; border-radius: 2px; border: 1px solid transparent; color: var(--pa-ink, #1a1611); background: transparent;
  text-decoration: none;
}
.chip + .chip { margin-left: 4px; }
/* A long chip must not push a phone-width page sideways. */
@media (max-width: 640px) { .chip { white-space: normal; overflow-wrap: anywhere; } }
/* Only for committed check results (miss counts, rates, PASS/FAIL), always with a date. */
.chip.measured { background: var(--pa-ok, #2f6b45); border-color: var(--pa-ok, #2f6b45); color: var(--pa-paper, #ede4ce); }
/* Anything a model wrote: suggestions, probabilities, the inbox layout, hints, flag text, empty-state text. */
.chip.inferred { border: 1.5px dashed var(--pa-accent-deep, #8c3a2c); color: var(--pa-accent-deep, #8c3a2c); padding: 1.5px 7.5px; }
/* Staged or drawn examples. */
.chip.illustrative { border: 1px dotted var(--pa-ink, #1a1611); font-style: italic; }
/* A name written down, not proven. */
.chip.declared { border: 1px solid var(--pa-ink, #1a1611); }
/* Larkspur Garden Co., Hollis lab and their people. */
.chip.fictional { background: var(--pa-paper-3, #d8c9a3); border-color: var(--pa-paper-3, #d8c9a3); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: 0.1em; }
.chips .chip + .chip { margin-left: 0; }
.chip-glossary { display: grid; grid-template-columns: max-content 1fr; gap: var(--pa-s3, 12px) var(--pa-s4, 16px); align-items: baseline; margin: 0; }
.chip-glossary dt { margin: 0; } .chip-glossary dd { margin: 0; }

/* ---------- 2. the 60-cell grid (markup from tools/build-figures.mjs) ---------- */
.grid60 { margin: 0 0 var(--pa-s5, 24px); max-width: 100%; }
.grid60-label { display: block; font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; color: var(--pa-ink-2, #4a4239); margin: 0 0 var(--pa-s2, 8px); overflow-wrap: anywhere; }
.grid60-cells { display: block; line-height: 0; }
.grid60-cells svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.grid60-narrow { display: none !important; }
@media (max-width: 559.98px) { .grid60-wide { display: none !important; } .grid60-narrow { display: block !important; } }
.grid60 .cell-right { fill: none; stroke: var(--pa-ink-2, #4a4239); stroke-width: 1.5; }
.grid60 .hatch-bg { fill: var(--pa-fail, #8c3a2c); }
.grid60 .hatch-line { stroke: var(--pa-paper, #ede4ce); stroke-width: 1.5; }
.grid60 .limit { fill: none; stroke: var(--pa-ink, #1a1611); stroke-width: 1; }
.grid60 .limit-label { fill: var(--pa-ink, #1a1611); font: 400 11px var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); }
.grid60-sorted { display: block; font: 400 13px/1.45 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); color: var(--pa-ink-faint, #655d4f); margin: var(--pa-s2, 8px) 0 0; }
.grid60-result { display: flex; flex-wrap: wrap; align-items: center; gap: var(--pa-s2, 8px) var(--pa-s3, 12px); margin: var(--pa-s2, 8px) 0 0; font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.grid60-line { margin: var(--pa-s2, 8px) 0 0; max-width: 46ch; }
.verdict { display: inline-flex; align-items: center; gap: 4px; font: 600 15px/1 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); letter-spacing: 0.04em; }
.verdict .icon { width: 18px; height: 18px; }
.verdict.pass { color: var(--pa-ok, #2f6b45); }
.verdict.fail { color: var(--pa-fail, #8c3a2c); }
.grid-pair { display: grid; gap: var(--pa-s6, 32px); }
@media (min-width: 900px) { .grid-pair.side-by-side { grid-template-columns: 1fr 1fr; } }

/* ---------- 3. source lines ---------- */
.source { display: block; font: 400 13px/1.45 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); color: var(--pa-ink-faint, #655d4f); margin: var(--pa-s2, 8px) 0 var(--pa-s4, 16px); max-width: 64ch; overflow-wrap: anywhere; }
@media (min-width: 1100px) {
  .has-sidenotes { position: relative; max-width: 680px; }
  .has-sidenotes .source { float: right; clear: right; width: 220px; margin: 0.2em -252px var(--pa-s4, 16px) 0; }
  .has-sidenotes .source .source-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

/* ---------- 4. stamps ---------- */
.stamp { display: inline-block; font: 400 15px/1.4 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); border: 1.5px solid var(--pa-ink, #1a1611); padding: 6px 10px; margin: 0 var(--pa-s2, 8px) var(--pa-s2, 8px) 0; overflow-wrap: anywhere; }

/* ---------- 5. the file tree (markup from tools/build-figures.mjs) ---------- */
.tree { font: 400 15px/1.6 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; margin: 0 0 var(--pa-s4, 16px); }
.tree-root, .tree-dir { white-space: pre; }
.tree details { margin: 0; }
.tree summary { cursor: pointer; list-style: none; white-space: pre; color: var(--pa-accent-deep, #8c3a2c); }
.tree summary::-webkit-details-marker { display: none; }
.tree summary .tree-branch { color: var(--pa-ink-faint, #655d4f); }
.tree summary:hover .tree-name { text-decoration: underline; }
.tree pre {
  margin: var(--pa-s2, 8px) 0 var(--pa-s3, 12px) 4ch; padding: var(--pa-s3, 12px) var(--pa-s4, 16px);
  background: var(--pa-paper-2, #e5dabe); border-left: 2px solid var(--pa-rule, #c4b591);
  font: 400 13px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); color: var(--pa-ink, #1a1611);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.tree .tree-note { display: block; color: var(--pa-ink-faint, #655d4f); font-size: 13px; margin: 0 0 var(--pa-s2, 8px) 4ch; }

/* ---------- 6. lanes: a person, an agent, kept for a person ---------- */
.lanes { display: grid; gap: var(--pa-s5, 24px); margin: var(--pa-s5, 24px) 0; }
@media (min-width: 900px) { .lanes { grid-template-columns: repeat(3, 1fr); } }
.lane { border-top: 1.5px solid var(--pa-ink, #1a1611); padding-top: var(--pa-s4, 16px); }
.lane > .icon { width: 28px; height: 28px; color: var(--pa-ink-2, #4a4239); display: block; margin-bottom: var(--pa-s2, 8px); }
.lane p { font-size: 16px; }

/* ---------- 7. strata: rented above, owned below ---------- */
.strata { display: block; width: 100%; max-width: 520px; height: auto; }
.strata .band-rented { fill: var(--pa-paper-2, #e5dabe); stroke: var(--pa-rule, #c4b591); }
.strata .band-owned { fill: var(--pa-paper-3, #d8c9a3); stroke: var(--pa-ink, #1a1611); }
.strata text { fill: var(--pa-ink, #1a1611); font: 400 15px var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); }
.strata .band-owned text, .strata text.mono { font-family: var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); }
.strata text.tag { font: 600 11.5px var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); letter-spacing: 0.06em; text-transform: uppercase; fill: var(--pa-ink-2, #4a4239); }

/* ---------- 8. works / not yet (keep li.runs and li.notyet: tests parse them) ---------- */
.works { list-style: none; padding: 0; margin: 0; max-width: 72ch; }
.works li { padding: var(--pa-s3, 12px) 0; border-bottom: 1px solid var(--pa-rule, #c4b591); }
.works .tag { display: inline-block; min-width: 5.6em; font: 600 11.5px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); letter-spacing: 0.06em; text-transform: uppercase; }
.works li.runs .tag { color: var(--pa-ok, #2f6b45); }
.works li.notyet .tag { color: var(--pa-fail, #8c3a2c); }

/* ---------- 9. films ---------- */
.film { margin: 0 0 var(--pa-s6, 32px); }
.film video { display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--pa-paper-2, #e5dabe); border: 1px solid var(--pa-rule, #c4b591); }
.film-caption { font: 400 20px/1.35 var(--pa-font-serif, "Spectral", Georgia, serif); margin: var(--pa-s3, 12px) 0 0; }
.film-length { font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; color: var(--pa-ink-faint, #655d4f); }
.film details { margin-top: var(--pa-s2, 8px); font-size: 16px; color: var(--pa-ink-2, #4a4239); }
.film summary { cursor: pointer; font-weight: 600; color: var(--pa-ink, #1a1611); }

/* ---------- 10. buttons ---------- */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 2px;
  font: 600 16px/1.2 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); text-decoration: none; cursor: pointer;
}
.btn-primary { background: var(--pa-accent-deep, #8c3a2c); color: var(--pa-paper, #ede4ce); border: 1.5px solid var(--pa-accent-deep, #8c3a2c); }
.btn-secondary { background: transparent; color: var(--pa-ink, #1a1611); border: 1.5px solid var(--pa-ink, #1a1611); }
.btn-primary:hover, .btn-secondary:hover { text-decoration: underline; }
.ctas { display: flex; flex-wrap: wrap; gap: var(--pa-s3, 12px); align-items: center; }

/* ---------- 11. icons ---------- */
.icon { display: inline-block; width: 24px; height: 24px; vertical-align: middle; flex: none; color: inherit; }

/* ---------- 12. nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 10; height: 56px; background: var(--pa-paper, #ede4ce); border-bottom: 1px solid var(--pa-rule, #c4b591); }
.site-nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--pa-s4, 16px); }
.site-nav .mark { display: flex; align-items: center; gap: 10px; font: 600 21px/1 var(--pa-font-serif, "Spectral", Georgia, serif); color: var(--pa-ink, #1a1611); text-decoration: none; }
.site-nav .mark img { width: 24px; height: 24px; }
/* The mark is an <img> of a dark-ink SVG; on a dark page it is inverted so it stays visible. */
@media (prefers-color-scheme: dark) { :root[data-pa-auto-theme]:not([data-theme=light]) .site-nav .mark img { filter: invert(1); } }
:root[data-theme=dark] .site-nav .mark img { filter: invert(1); }
.site-nav nav { display: flex; align-items: center; gap: var(--pa-s5, 24px); }
.site-nav nav a { font-size: 15px; color: var(--pa-ink-2, #4a4239); text-decoration: none; }
.site-nav nav a:hover { color: var(--pa-ink, #1a1611); text-decoration: underline; }
.site-nav nav a.cta { color: var(--pa-paper, #ede4ce); background: var(--pa-accent-deep, #8c3a2c); font-weight: 600; padding: 8px 14px; border-radius: 2px; }
/* Under 720px the bar grows to two rows: the mark, then every link (wrapping), so no page loses its route to The runs. */
@media (max-width: 720px) {
  .site-nav { height: auto; position: static; }  /* not sticky on a phone: two rows would hold the screen */
  .site-nav .wrap { flex-wrap: wrap; row-gap: var(--pa-s1, 4px); padding-block: 6px; }
  .site-nav .mark { font-size: 19px; }
  .site-nav nav { flex-wrap: wrap; width: 100%; gap: var(--pa-s1, 4px) var(--pa-s4, 16px); }
  .site-nav nav a { font-size: 14px; line-height: 28px; }
  .site-nav nav a.cta { margin-left: auto; padding: 0 12px; }
}

/* ---------- 13. plates ---------- */
.plate { background: var(--pa-paper-2, #e5dabe); border: 1px solid rgba(26, 22, 17, 0.18); padding: var(--pa-s5, 24px); margin: 0 0 var(--pa-s5, 24px); }
:root[data-theme=dark] .plate { border-color: rgba(236, 227, 207, 0.18); }
@media (prefers-color-scheme: dark) { :root[data-pa-auto-theme]:not([data-theme=light]) .plate { border-color: rgba(236, 227, 207, 0.18); } }
.plate-caption { font: 500 24px/1.25 var(--pa-font-serif, "Spectral", Georgia, serif); margin: 0 0 var(--pa-s4, 16px); }
.plate img { display: block; max-width: 100%; height: auto; }
.plate .source { margin-bottom: 0; }

/* ---------- 14. another role, not built ---------- */
.role-ghost {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 120px; padding: var(--pa-s4, 16px);
  border: 1.5px dotted var(--pa-ink-faint, #655d4f); color: var(--pa-ink-faint, #655d4f); font-size: 15px;
}

/* ---------- tables: mono, tabular, stacked rows under 640px ---------- */
.table-mono { width: 100%; border-collapse: collapse; font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; margin: 0 0 var(--pa-s4, 16px); }
.table-mono caption { text-align: left; font: 600 15px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); padding-bottom: var(--pa-s2, 8px); }
.table-mono th { font: 600 13px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); text-align: left; color: var(--pa-ink-2, #4a4239); border-bottom: 1.5px solid var(--pa-ink, #1a1611); padding: 6px 12px 6px 0; }
.table-mono td { border-bottom: 1px solid var(--pa-rule, #c4b591); padding: 6px 12px 6px 0; vertical-align: top; overflow-wrap: anywhere; }
.table-mono td.num, .table-mono th.num { text-align: right; }
@media (max-width: 639.98px) {
  .table-mono thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-mono, .table-mono tbody, .table-mono tr, .table-mono td { display: block; width: 100%; }
  .table-mono tr { border-bottom: 1px solid var(--pa-rule, #c4b591); padding: var(--pa-s2, 8px) 0; }
  .table-mono td { border: 0; padding: 2px 0; text-align: left !important; }
  .table-mono td[data-label]::before { content: attr(data-label); display: block; font: 600 12px/1.4 var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); color: var(--pa-ink-faint, #655d4f); }
}

/* ---------- why-trail, surface spec card, lever (markup from tools/build-figures.mjs) ---------- */
.why-trail { list-style: none; padding: 0; margin: 0 0 var(--pa-s4, 16px); font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); font-variant-numeric: tabular-nums; }
.why-trail li { padding: 4px 0; border-bottom: 1px solid var(--pa-rule-soft, #d8caa6); overflow-wrap: anywhere; }
.why-trail .k { color: var(--pa-ink-faint, #655d4f); }
.suggestion { font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); margin: var(--pa-s3, 12px) 0; }
.spec-card { display: grid; grid-template-columns: max-content 1fr; gap: 4px var(--pa-s4, 16px); margin: 0 0 var(--pa-s3, 12px); font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); }
.spec-card dt { color: var(--pa-ink-faint, #655d4f); font-family: var(--pa-font-sans, "IBM Plex Sans", system-ui, sans-serif); font-size: 14px; }
.spec-card dd { margin: 0; overflow-wrap: anywhere; }
.lever .excerpt { font: 400 15px/1.5 var(--pa-font-mono, "IBM Plex Mono", ui-monospace, monospace); background: var(--pa-paper-2, #e5dabe); padding: var(--pa-s3, 12px) var(--pa-s4, 16px); margin: var(--pa-s3, 12px) 0; overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  details[open] > :not(summary) { animation: pa-fade 200ms ease-out; }
  @keyframes pa-fade { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
