/* Histor Labs, historlabs.eu. The page is a demo the reader scrolls through: seven beats, one sticky stage
   each. Tokens and rules from docs/DESIGN_SYSTEM.md: six type sizes plus the statement, two faces,
   one rule weight, radius 0, no shadow, colour only for a state. No inline style: the CSP is style-src self. */
@font-face { font-family: "Grotesk"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/fonts/inter-var.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500 600; font-display: swap; src: url("/fonts/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --paper: #F4F3EE;
  --ink: #0F1B2D;
  --ink-2: #4A5870;
  --ink-3: #5E6B80;
  --rule: #DEDDD6;
  --mist: #E9E8E2;            /* the field of a written thing: ink on grey, not a colour */
  --tile-bg: #E9E8E2;         /* the wash a mark stands on */
  --plate-k: #B9BCC2; --plate-m: #CBCDD1; --plate-mid: #DBDBD8;   /* a muted strip's greys, stepped down from the mist */
  --vault: #081A33;           /* the one dark mass */
  --block: #081A33;  --block-ink: #081A33;  --block-head: #FFFFFF;   /* the bold blocks: navy on paper, their glyphs white; an outlined block carries navy */
  --seal: #6B1D2A;            /* the sealing colour, the passport's burgundy: the title's seal tile, and the offer as a mass. Nowhere else */
  --bold: #081A33;
  --vault-2: #23385A;         /* rules inside it */
  --vault-head: #FFFFFF;
  --vault-text: #B4C0D3;
  --vault-label: #8C9BB3;
  --wine: #6B1D2A;            /* the burgundy as a mass: a whole section, alternating with the navy, never touching it */
  --wine-head: #FFFFFF; --wine-text: #E8CFD3; --wine-label: #D4A9B0; --wine-2: #8C3442;   /* 11.5, 7.8, 5.5 : 1; the rules inside it */
  --link: #2A62C4;
  --focus: #3D7BE6;
  --pat-paper: #F0EFE9; --pat-vault: #0B1E3B; --pat-wine: #651B28;   /* the field: each ground's own tone, a step off it */
  --glyph-vault: #1E3C6E; --glyph-wine: #8E3343; --glyph-paper: #E6E4DC;   /* the title's glyphs: a strong tone of their block; white text holds 10 and 7 : 1 on them */
  --warn-word: #4A2F06;  --warn-square: #A66D08;   /* waiting: the amber family */
  --fail-word: #9E2412;  --fail-square: #E5452A;   /* a finding: the alarm family */
  --sans: "Grotesk", "Inter", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --u: 8px;
  --gut: clamp(16px, 1.67vw, 24px);
  --margin: clamp(16px, 2.5vw, 36px);
  --t1: 12px; --t2: 14px; --t3: 16px; --t4: 20px; --t5: 24px; --t6: 64px;
  --m1: 11px; --m2: 13px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0D1522;
    --ink: #E6EAF0;
    --ink-2: #A7B2C3;
    --ink-3: #8C98AB;
    --rule: #223047;
    --mist: #162031;
    --tile-bg: #1B2940;
    --plate-k: #374862; --plate-m: #2A3A50; --plate-mid: #202E42;
    --vault: #06111F;
    --block: #1B2940; --block-ink: #E6EAF0; --block-head: #E6EAF0;
    --seal: #A33A4A;
    --bold: #E6EAF0;
    --vault-2: #1B2940;
    --vault-head: #E6EAF0;
    --vault-text: #A7B2C3;
    --vault-label: #8C98AB;
    --wine: #4A141D;
    --wine-head: #E6EAF0; --wine-text: #DDB8BE; --wine-label: #C99AA2; --wine-2: #6B2533;   /* 12.3, 8.3, 6.1 : 1 */
    --link: #7EAAF2;
    --focus: #7EAAF2;
    --pat-paper: #101928; --pat-vault: #09152A; --pat-wine: #4F1620;
    --glyph-vault: #1B3258; --glyph-wine: #6E2433; --glyph-paper: #17233A;
    --warn-word: #F2A81D; --warn-square: #F2A81D;
    --fail-word: #FF6D52; --fail-square: #FF6D52;
  }
}
@media (max-width: 599px) { :root { --t6: 52px; } }
:root { --card: #FFFFFF; --track: rgba(15,27,45,0.12); --cor-wash: #FCE0D8; --cor-head: #9E2412; --cor-body: #2A0701; }
@media (prefers-color-scheme: dark) { :root { --card: #162031; --track: rgba(230,234,240,0.14); --cor-wash: #3A1A16; --cor-head: #FF8C75; --cor-body: #F6D5CD; } }

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: var(--t3); font-weight: 450; line-height: 1.55; letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
p, h1, h2, h3, ul, dl, dd, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.mono { font-family: var(--mono); font-size: var(--m2); font-weight: 400; letter-spacing: 0; }
.skip { position: absolute; left: var(--margin); top: -100px; background: var(--vault); color: var(--vault-head); padding: 8px 16px; z-index: 3; }
.skip:focus { top: 8px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gut); max-width: 1440px; margin: 0 auto; padding-inline: var(--margin); }
.grid > * { grid-column: 1 / -1; }
h1, h2, h3 { font-weight: 780; letter-spacing: -0.035em; text-wrap: balance; }
h3 { font-size: var(--t4); font-weight: 580; letter-spacing: -0.02em; }

/* The bar: the mark, and the one way to reach us. */
.bar { padding-block: 16px; border-bottom: 1px solid var(--rule); }
.bar > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 580; }
.wordmark svg { display: block; }
.textlink { font-size: var(--t2); font-weight: 580; }
.button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; background: var(--vault); color: var(--vault-head); font-size: var(--t2); font-weight: 580; text-decoration: none; }
@media (prefers-color-scheme: dark) { .button { background: var(--ink); color: var(--paper); } }
.button:hover { text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; }

/* What the demo is made of, said once and kept in view while it runs. */
.demo-note { font-size: var(--t1); font-weight: 580; color: var(--ink-3); padding: 12px var(--margin) 0; max-width: 1440px; margin: 0 auto; }
html.js .demo-note { position: fixed; z-index: 2; left: var(--margin); bottom: 16px; padding: 6px 10px; margin: 0; background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); }
html.js.past-demo .demo-note { display: none; }

/* A beat: a tall section whose stage stays on screen while the reader scrolls through it.
   The script sets --p (0 to 1) on the beat and .on on each [data-at] it has passed. Without
   the script, or under reduced motion, every beat shows its end state. */
.beat { --p: 1; position: relative; }
html.js .beat { height: 190vh; }
.stage { min-height: 100vh; min-height: 100svh; align-content: center; row-gap: 32px; padding-block: 72px 56px; }
html.js .stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
html.js .beat.tall .stage { top: calc(-1 * var(--over)); height: auto; overflow: visible; }
.say h1, .say h2 { font-size: var(--t6); line-height: 1; }
.say .sub { margin-top: 20px; font-size: var(--t4); line-height: 1.4; color: var(--ink-2); max-width: 34ch; letter-spacing: -0.02em; }
@media (min-width: 960px) {
  .say { grid-column: 1 / 6; align-self: center; }
  .stage > :not(.say):not(.big) { grid-column: 6 / 13; align-self: center; }
  .stage { row-gap: 0; }
}
@media (max-width: 959px) { .stage { align-content: start; padding-top: 32px; row-gap: 24px; } .say .sub { font-size: var(--t3); margin-top: 12px; } }
@media (max-width: 599px) { .say h1, .say h2 { font-size: 40px; } }

.paper { background: var(--paper); }
.vault { background: var(--vault); color: var(--vault-head); }
.vault .say .sub { color: var(--vault-text); }
.wine { background: var(--wine); color: var(--wine-head); }
.wine .say .sub { color: var(--wine-text); }
/* Paper stands between the navy and the burgundy. */
.vault + .paper, .paper + .wine { border-top: 0; }

/* Things the scroll reveals. A short fade, never a swing. */
html.js .beat [data-at] { transition: opacity .2s linear, background-color .2s linear; }
html.js .beat .dec[data-at]:not(.on), html.js .beat .party[data-at]:not(.on), html.js .beat .host[data-at]:not(.on), html.js .beat .verdict[data-at]:not(.on) { opacity: 0; }

/* A person: a disc over a half disc on a square, in one of four tones. */
.who { display: block; width: 40px; height: 40px; flex: none; }
.who .bg { fill: var(--mist); }
.who.t0 .fg { fill: #B9BCC2; } .who.t1 .fg { fill: #8C98AB; } .who.t2 .fg { fill: #5E6B80; } .who.t3 .fg { fill: #3A4A63; }
@media (prefers-color-scheme: dark) { .who .bg { fill: #22304A; } .who.t3 .fg { fill: #A7B2C3; } .who.t2 .fg { fill: #8C98AB; } .who.t1 .fg { fill: #5E6B80; } .who.t0 .fg { fill: #4A5870; } }

/* The model's answer: a square and its word. */
.stamp { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t2); font-weight: 580; padding: 4px 8px 4px 6px; }
.stamp::before { content: ""; width: 10px; height: 10px; flex: none; }
.stamp.yes { background: var(--mist); color: var(--ink); }
.stamp.yes::before { background: var(--ink); }
.stamp.no { color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }
.stamp.no::before { box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.stamp.finding { background: var(--cor-wash); color: var(--cor-head); box-shadow: none; }
.stamp.finding::before { background: var(--fail-square); box-shadow: none; }

/* The documented case a demo mirrors, under its second statement. */
.say .real { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: var(--t2); color: var(--ink-2); max-width: 44ch; }
.say .real a { font-weight: 580; }
@media (max-width: 959px) { .say .real { margin-top: 12px; padding-top: 8px; font-size: var(--t1); } }

/* Beat 1: the queue the model reads. */
.queue { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gut); }
.app { background: var(--card); border: 1px solid var(--rule); padding: 16px; display: grid; grid-template-columns: 40px 1fr; column-gap: 12px; row-gap: 2px; align-items: center; }
.app .who { grid-row: 1 / 3; }
.app .nm { font-weight: 580; font-size: var(--t3); line-height: 1.25; letter-spacing: -0.02em; }
.app .role { font-size: var(--t1); color: var(--ink-3); }
.app .dec { grid-column: 1 / -1; margin-top: 14px; min-height: 30px; }
@media (max-width: 1199px) { .queue { grid-template-columns: repeat(3, minmax(0, 1fr)); } .app:nth-child(n+10) { display: none; } }
@media (max-width: 599px) { .queue { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .app { padding: 10px; } .app.far { display: none; } .app .dec { margin-top: 8px; } .app .nm { font-size: var(--t2); } }

/* Beat 2: one CV, two names. */
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gut); }
.cv { background: var(--card); border: 1px solid var(--rule); padding: 24px; }
.cv header { display: flex; align-items: center; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.cv .who { width: 56px; height: 56px; }
.cv .role { font-size: var(--t2); color: var(--ink-3); margin-top: 2px; }
.cv h3 { font-size: var(--t5); font-weight: 780; letter-spacing: -0.03em; line-height: 1.15; }
.cv dl { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding-block: 20px; font-size: var(--t2); }
.cv dt { color: var(--ink-3); font-weight: 580; }
.cv .dec { padding-top: 20px; border-top: 1px solid var(--rule); }
.cv .stamp { font-size: var(--t4); padding: 8px 14px 8px 10px; gap: 10px; }
.cv .stamp::before { width: 14px; height: 14px; }
@media (max-width: 599px) {
  .pair { gap: 8px; } .cv { padding: 12px; } .cv header { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 12px; }
  .cv .who { width: 40px; height: 40px; } .cv h3 { font-size: var(--t3); }
  .cv dl { grid-template-columns: 1fr; gap: 0 0; padding-block: 12px; font-size: var(--t1); } .cv dd + dt { margin-top: 6px; }
  .cv .dec { padding-top: 12px; } .cv .stamp { font-size: var(--t2); padding: 4px 8px 4px 6px; } .cv .stamp::before { width: 10px; height: 10px; }
}

/* Beat 3: the two sealed parts meet at the host. */
.meet { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gut); padding: 24px; border: 1px solid transparent; transition: border-color .2s linear; }
.meet:has(.host.on), html:not(.js) .meet { border-color: var(--vault-label); }
.party, .host { display: flex; gap: 16px; align-items: flex-start; }
.party { border: 1px solid var(--vault-2); padding: 20px; }
.host { grid-column: 1 / -1; padding-top: 8px; }
.meet .mk { width: 48px; height: 48px; flex: none; fill: var(--vault-head); }
.meet p { font-size: var(--t2); color: var(--vault-text); }
.meet b { display: block; font-size: var(--t4); font-weight: 580; color: var(--vault-head); letter-spacing: -0.02em; line-height: 1.3; margin-bottom: 4px; }
@media (max-width: 599px) { .meet { grid-template-columns: 1fr; padding: 12px; gap: 8px; } .party { padding: 12px; } .meet .mk { width: 24px; height: 24px; } .meet b { font-size: var(--t3); } }

/* Beat 4: the run. One square per answer; empty until answered. */
.key { margin-top: 24px; display: flex; align-items: center; gap: 8px; font-size: var(--t2); color: var(--vault-text); }
.key .k { width: 12px; height: 12px; display: inline-block; }
.key .k.out { margin-left: 16px; }
.k.in, .cells i.in.on, html:not(.js) .cells i.in { background: var(--vault-head); }
.k.out, .cells i.out.on, html:not(.js) .cells i.out { background: transparent; box-shadow: inset 0 0 0 1.5px var(--vault-label); }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gut); }
.grid3.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gname { font-size: var(--t2); font-weight: 580; }
.blk .gname { color: var(--vault-text); margin-bottom: 12px; }
.cells { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.cells i { display: block; aspect-ratio: 1; background: var(--vault-2); }
@media (max-width: 599px) { .cells { gap: 2px; } .blk .gname { font-size: var(--t1); margin-bottom: 6px; } }

/* Beats 5 and 6: the rates against the limit, and the verdict. */
.result { display: grid; row-gap: 32px; }
.bars { --q: clamp(0, calc((var(--p) - 0.08) * 4), 1); display: grid; row-gap: 20px; }
.bar-row { display: grid; grid-template-columns: 9.5em 1fr 4em; align-items: center; column-gap: 16px; }
.bar-row .gname { color: var(--ink-2); }
.track { position: relative; height: 40px; background: var(--track); }
.fill { position: absolute; inset: 0 auto 0 0; width: calc(var(--w) * 100% * var(--q)); background: var(--ink); }
.low .fill { background: var(--fail-square); }
.limit { position: absolute; top: -6px; bottom: -6px; left: calc(var(--w) * 100%); width: 2px; background: var(--ink); }
.pct { font-size: var(--t5); font-weight: 580; letter-spacing: -0.03em; text-align: right; font-variant-numeric: tabular-nums; }
.low .pct { color: var(--fail-word); }
.legend { display: flex; align-items: center; gap: 8px; font-size: var(--t1); color: var(--ink-3); font-weight: 580; }
.legend .tick { width: 2px; height: 16px; background: var(--ink); }
.verdict { display: flex; gap: 16px; align-items: flex-start; padding: 24px; }
.verdict .mk { width: 28px; height: 28px; flex: none; }
.verdict b { display: block; font-size: var(--t5); font-weight: 780; letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 4px; }
.verdict.fail { background: var(--cor-wash); color: var(--cor-body); }
.verdict.fail b { color: var(--cor-head); } .verdict.fail .mk { fill: var(--fail-square); }
.verdict.pass { background: var(--mist); color: var(--ink-2); }
.verdict.pass b { color: var(--ink); } .verdict.pass .mk { fill: var(--ink); }
@media (max-width: 599px) { .bar-row { grid-template-columns: 1fr 4em; row-gap: 6px; } .bar-row .gname { grid-column: 1 / -1; font-size: var(--t1); } .track { height: 24px; } .pct { font-size: var(--t4); } .verdict { padding: 16px; } .verdict b { font-size: var(--t4); } .result { row-gap: 20px; } .bars { row-gap: 12px; } }

/* Beat 7: sealed. The burgundy ground, the seal's rays behind the words. */
.wine .stage { position: relative; }
.wine .big { position: absolute; right: -6vw; top: 50%; width: min(78vw, 110vh); height: auto; transform: translateY(-50%); fill: var(--glyph-wine); pointer-events: none; }
.wine .say { position: relative; }
@media (min-width: 960px) { .wine .say { grid-column: 1 / 9; } .wine .say h2 { font-size: clamp(44px, 8vw, 128px); line-height: .95; letter-spacing: -0.045em; } .wine .say .sub { max-width: 40ch; } }
html.js .beat.wine { height: 140vh; }

/* The close: the promise, who it is for, and the way in. */
.close { padding-block: 120px 96px; row-gap: 56px; }
.statement { font-size: clamp(44px, 7vw, 112px); line-height: .95; letter-spacing: -0.045em; font-weight: 780; max-width: 16ch; }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gut); }
.roles > div { border-top: 1px solid var(--ink); padding-top: 16px; }
.roles p { margin-top: 8px; color: var(--ink-2); max-width: 34ch; }
@media (max-width: 799px) { .roles { grid-template-columns: 1fr; gap: 32px; } .close { padding-block: 72px; row-gap: 40px; } }

footer { border-top: 1px solid var(--rule); padding-block: 48px 64px; row-gap: 32px; font-size: var(--t2); color: var(--ink-2); }
footer p + p { margin-top: 8px; }
footer .base { display: flex; align-items: center; gap: 8px 24px; color: var(--ink-3); padding-top: 24px; border-top: 1px solid var(--rule); }
footer .base .seal { display: block; width: 40px; height: 40px; color: var(--plate-k); }
footer .base .seal svg { display: block; width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) { html.js .beat { height: auto; } html.js .stage { position: static; height: auto; } html.js .beat [data-at] { transition: none; } }

/* Bar widths, written by tools/demo_page.py. */
/* demo-widths:start */
.w4 { --w: 0.04; }
.w8 { --w: 0.08; }
.w10 { --w: 0.10; }
.w12 { --w: 0.12; }
.w14 { --w: 0.14; }
.w16 { --w: 0.16; }
.w17 { --w: 0.17; }
.w19 { --w: 0.19; }
.w21 { --w: 0.21; }
.w22 { --w: 0.22; }
.w25 { --w: 0.25; }
.w26 { --w: 0.26; }
.w28 { --w: 0.28; }
.w43 { --w: 0.43; }
.w46 { --w: 0.46; }
.w54 { --w: 0.54; }
.w57 { --w: 0.57; }
.w60 { --w: 0.60; }
.w65 { --w: 0.65; }
.w66 { --w: 0.66; }
.w68 { --w: 0.68; }
.w69 { --w: 0.69; }
.w71 { --w: 0.71; }
.w75 { --w: 0.75; }
.w79 { --w: 0.79; }
/* demo-widths:end */
