/* Kestrell: "The Quiet Instrument". One stylesheet, tokens first.
   Conventions:
   .band          full-width section; theme with .band--dark (graphite) or .band--light (grey)
   .col           the single reading column, same on phone and desktop
   .stack         vertical rhythm for children (--flow sets the gap)
   .btn           action; .btn--primary (orange, dark text), .btn--quiet, .btn--unavailable
   .scope/.cands  the example: a recording as a level trace, three spots, three candidate slips
   Motion: one idea only. The three marks over the example hover (a slow 2px drift) and drop
   onto their spot when you point at the matching candidate. Nothing else moves, and none of it
   runs with prefers-reduced-motion. */

@font-face {
  font-family: "Jost";
  src: url("../fonts/Jost-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour. Pairs and ratios are listed in tools/contrast_check.py; all text >= 4.5:1,
     UI boundaries and focus rings >= 3:1 against the surface they sit on. Orange carries
     meaning only on graphite; on grey it is never the only signal. */
  --graphite: #1c1f23;        /* dark band background; ink on light bands */
  --graphite-line: #3c424a;   /* decorative hairlines on dark */
  --on-dark: #eef0f2;         /* body text on graphite */
  --on-dark-muted: #b7bdc4;   /* secondary text on graphite */
  --grey: #eceeef;            /* light band background */
  --grey-line: #b9bec4;       /* decorative hairlines on light */
  --ink: #1c1f23;             /* body text on grey */
  --ink-muted: #4a5058;       /* secondary text on grey */
  --orange: #ff6a00;          /* the one accent: primary action, marks, focus on dark */
  --orange-hover: #ff8a3a;    /* hover colour for the action (dark text stays) */
  --draft-bg: #ffe08a;        /* local-draft banner and blocks (never shipped) */
  --draft-ink: #3d2b00;

  /* Type: one family; hierarchy by size, weight and spacing only. */
  --font: "Jost", "Century Gothic", "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  --text-s: 0.9375rem;                       /* 15px small print, captions */
  --text-m: 1.125rem;                        /* 18px body */
  --text-l: 1.3125rem;                       /* 21px lead sentence */
  --text-xl: 1.75rem;                        /* 28px h2 */
  --text-hero: clamp(2.25rem, 10.5vw, 3.75rem);
  --leading-body: 1.55;
  --leading-tight: 1.08;

  /* Space scale (rem). */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4.5rem;

  /* Widths: the column is 35rem (560px) including a 1.25rem gutter, so text is ~520px. */
  --col: 35rem;
  --gutter: 1.25rem;

  --focus: var(--orange);     /* redefined per theme below */
  --quick: 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-m);
  line-height: var(--leading-body);
  font-weight: 400;
  background: var(--graphite);
  color: var(--on-dark);
  overflow-wrap: break-word;
}

/* ---- Bands and column ---- */
.band { position: relative; padding-block: var(--s-7); }   /* phones; roomier from 40em */
.band--dark { background: var(--graphite); color: var(--on-dark); --focus: var(--orange); --muted: var(--on-dark-muted); --line: var(--graphite-line); }
.band--light { background: var(--grey); color: var(--ink); --focus: var(--graphite); --muted: var(--ink-muted); --line: var(--grey-line); }
/* The example band opens with a ruler edge, like the scale on an instrument: fine ticks, a
   longer one every fifth. Once only (more would be decoration). */
main > .example::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 0.5rem;
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 3.75rem) 0 0 / 100% 100% no-repeat,
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 0.75rem) 0 0 / 100% 45% no-repeat;
}
.col { max-width: var(--col); margin-inline: auto; padding-inline: var(--gutter); }
.stack { display: flex; flex-direction: column; gap: var(--flow, var(--s-4)); }

/* ---- Text ---- */
h1, h2, h3 { font-weight: 500; margin: 0; }
h1 { font-size: var(--text-hero); line-height: var(--leading-tight); }
h2 { font-size: var(--text-xl); line-height: 1.15; font-weight: 600; letter-spacing: -0.012em; }
h3 { font-size: var(--text-m); line-height: 1.3; font-weight: 600; }
p, ul, ol, dl, dd { margin: 0; }
p, li, dd { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
.nw { white-space: nowrap; }
.lead { font-size: var(--text-l); line-height: 1.45; }
.small { font-size: var(--text-s); color: var(--muted); line-height: 1.5; }
.muted { color: var(--muted); }
strong { font-weight: 600; }
a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--orange); color: var(--graphite); }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- Hero headline: the two lines look like what they say. The first is light, loose and
   runs on into a hairline with three marks on it; the second is short, heavy and tight. ---- */
.h1-long, .h1-short { display: block; }
.h1-long { display: flex; align-items: center; gap: 0.35em; font-weight: 300; letter-spacing: 0.01em; }
.h1-long > span { flex: 0 1 auto; min-width: 0; }
.h1-long::after {
  content: ""; flex: 1 1 2rem; min-width: 1.5rem; height: 0.42em; margin-right: calc(-1 * var(--gutter));
  background:
    linear-gradient(var(--orange), var(--orange)) 22% 50% / 3px 100% no-repeat,
    linear-gradient(var(--orange), var(--orange)) 57% 50% / 3px 100% no-repeat,
    linear-gradient(var(--orange), var(--orange)) 86% 50% / 3px 100% no-repeat,
    linear-gradient(var(--graphite-line), var(--graphite-line)) 0 50% / 100% 1px no-repeat;
}
.h1-short { font-weight: 700; letter-spacing: -0.03em; }

/* Lists: plain, spaced. Two marker variants carry the product's two shapes: the 9:16 frame
   (things you receive) and the hover mark (things you control or must supply). */
.list { padding-left: 1.1rem; }
.list li + li { margin-top: var(--s-3); }
.list li::marker { color: var(--muted); }
.list--frames, .list--marks { list-style: none; padding-left: 0; }
.list--frames li, .list--marks li { position: relative; padding-left: 1.75rem; }
.list--frames li::before { content: ""; position: absolute; left: 0.2rem; top: 0.3em; width: 0.5625rem; height: 1rem; border-radius: 1px; background: linear-gradient(var(--grey), var(--grey)) 50% 72% / 60% 2px no-repeat, currentColor; }  /* a filled 9:16 frame with a caption line, not an empty box */
.list--marks li::before { content: ""; position: absolute; left: 0.15rem; top: 0.42em; width: 0.6rem; height: 0.6rem; border: solid var(--orange); border-width: 0 0 3px 3px; transform: rotate(-45deg) scale(1, 0.8); transform-origin: 50% 50%; }

/* Steps: a real sequence, so it gets numerals and a spine joining them. */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; display: grid; grid-template-columns: 2.75rem 1fr; column-gap: var(--s-3); padding-bottom: var(--s-5); }
.steps li:last-child { padding-bottom: 0; }
.steps li::before { content: counter(step); font-size: 2.25rem; line-height: 1; font-weight: 300; color: var(--on-dark); font-feature-settings: "tnum"; }
.steps li::after { content: ""; position: absolute; left: 0.55rem; top: 2.75rem; bottom: 0.4rem; width: 1px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps strong { display: block; }

/* ---- Header, banner, skip link ---- */
.skip { position: absolute; left: var(--s-3); top: var(--s-3); z-index: 10; padding: var(--s-2) var(--s-4); background: var(--orange); color: var(--graphite); font-weight: 600; transform: translateY(-300%); }
.skip:focus { transform: none; outline: 3px solid var(--graphite); outline-offset: 2px; }
.draft-banner { background: var(--draft-bg); color: var(--draft-ink); font-size: var(--text-s); font-weight: 500; padding: var(--s-2) var(--gutter); text-align: center; border-bottom: 2px solid var(--draft-ink); }
.site-header { background: var(--graphite); padding-block: var(--s-5) 0; }
.wordmark { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; font-size: var(--text-l); letter-spacing: 0.04em; text-decoration: none; color: var(--on-dark); }
a.wordmark:hover { text-decoration: underline; }
/* The mark: something small holding still above one spot on a long line. */
.mark { flex: none; overflow: visible; }
.mark__bird, .mark__spot { stroke: var(--orange); }
.mark__line { stroke: var(--on-dark-muted); }

/* ---- Actions ---- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 0.7rem 1.2rem; border: 2px solid transparent; border-radius: 2px; text-decoration: none; cursor: pointer; line-height: 1.25; }
.btn--primary { background: var(--orange); color: var(--graphite); border-color: var(--orange); transition: transform var(--quick), background-color var(--quick); }
.btn--primary:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn--primary:active { transform: translateY(1px); }  /* a small drop when pressed */
.btn--quiet { background: transparent; color: inherit; border-color: currentColor; font-weight: 500; }
.btn--quiet:hover { background: rgba(255, 255, 255, 0.1); }
.band--light .btn--quiet:hover { background: rgba(0, 0, 0, 0.07); }
.btn--unavailable { border: 2px dashed currentColor; color: var(--on-dark-muted); font-weight: 500; cursor: default; }
.btn__note { display: block; font-size: var(--text-s); font-weight: 400; }
[data-copy-slot] { display: contents; }
.copy-status { display: block; font-size: var(--text-s); color: var(--muted); min-height: 1.5em; width: 100%; margin: 0; }
.copy-status:empty { display: none; }
.addr { font-weight: 600; user-select: all; }

/* ---- Hero ---- */
.hero { padding-block: var(--s-6) var(--s-7); }
.hero .stack { --flow: var(--s-5); }
.hero .actions + .small { margin-top: calc(var(--s-3) - var(--s-5)); }  /* the qualifier belongs to the action */

/* ---- The example ---- */
figure { margin: 0; }
.illus { display: flex; flex-direction: column; gap: var(--s-4); }
.illus__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-3); }
/* "made up" is stamped on, slightly off-square, the way a proof is marked. It is also said in
   words in the heading's sentence and in the caption. */
.tag { font-size: var(--text-s); font-weight: 600; line-height: 1; padding: 0.3rem 0.5rem 0.35rem; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-3deg); }

.scope { margin-top: var(--s-5); }
.scope__marks { position: relative; height: 1.25rem; }
.scope__marks i { position: absolute; bottom: 0.3rem; width: 0.8rem; height: 0.8rem; margin-left: -0.4rem; border: solid var(--ink); border-width: 0 0 3px 3px; transform: rotate(-45deg) scale(1, 0.8); transition: translate var(--quick); }
.wave { display: block; width: 100%; height: 4rem; background: var(--graphite); border-radius: 2px; }
.wave rect { fill: var(--on-dark-muted); opacity: 0.6; }
.wave .pk { fill: var(--orange); opacity: 1; }
.scope__keys { position: relative; display: flex; justify-content: space-between; height: 1.6rem; padding-top: 0.3rem; font-size: var(--text-s); line-height: 1.3; color: var(--muted); font-feature-settings: "tnum"; }
.scope__keys b { position: absolute; top: 0.3rem; transform: translateX(-50%); color: var(--ink); font-weight: 700; }

.cands { list-style: none; padding: 0; margin: var(--s-2) 0 0; display: flex; flex-direction: column; border-bottom: 1px solid var(--line); }
/* A candidate: a dark 9:16 frame and a note beside it. The frame and the time say "candidate";
   no card, no stripe. */
.cand { display: grid; grid-template-columns: 3rem 1fr; column-gap: var(--s-4); align-items: start; padding-block: var(--s-4); border-top: 1px solid var(--line); }
.cand__frame { position: relative; display: block; width: 3rem; aspect-ratio: 9 / 16; background: var(--graphite); border-radius: 2px; outline: 2px solid var(--ink); outline-offset: 3px; transition: outline-offset var(--quick); }
.cand__frame i { position: absolute; left: 18%; height: 3px; background: var(--on-dark); border-radius: 1px; }   /* caption lines */
.cand__frame i:nth-child(1) { bottom: 30%; width: 64%; }
.cand__frame i:nth-child(2) { bottom: 22%; width: 44%; left: 28%; }
.cand__frame i:nth-child(3) { top: 14%; left: auto; right: 14%; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }
.cand__body { display: block; min-width: 0; }
.cand__when { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--text-l); font-weight: 600; line-height: 1.2; font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.cand__n { flex: none; min-width: 1.4rem; padding: 0.1rem 0.3rem; font-size: var(--text-s); font-weight: 700; line-height: 1.2; text-align: center; color: var(--grey); background: var(--ink); border-radius: 2px; letter-spacing: 0; }
.cand__why { display: block; margin-top: var(--s-1); }
.cand__meta { display: block; margin-top: var(--s-1); font-size: var(--text-s); color: var(--muted); }
figcaption { font-size: var(--text-s); color: var(--muted); line-height: 1.5; }

/* Point at a candidate and its mark drops onto its spot; the frame's outline closes in. */
@media (hover: hover) {
  .cand:hover .cand__frame { outline-offset: 0; }
  .illus:has(.cand:nth-child(1):hover) .scope__marks i:nth-child(1),
  .illus:has(.cand:nth-child(2):hover) .scope__marks i:nth-child(2),
  .illus:has(.cand:nth-child(3):hover) .scope__marks i:nth-child(3) { translate: 0 0.55rem; animation: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .scope__marks i { animation: hover 3.4s ease-in-out infinite alternate; }
  .scope__marks i:nth-child(2) { animation-delay: -1.3s; }
  .scope__marks i:nth-child(3) { animation-delay: -2.4s; }
}
@keyframes hover { from { translate: 0 -2px; } to { translate: 0 1px; } }

/* ---- The 14-day line: the one number on the page that is a promise ---- */
.keyline { display: flex; align-items: center; gap: var(--s-4); padding-block: var(--s-2); }
.keyline__n { font-size: 4rem; line-height: 0.9; font-weight: 300; letter-spacing: -0.04em; font-feature-settings: "tnum"; }
.keyline__t { font-size: var(--text-l); line-height: 1.25; font-weight: 500; max-width: 14ch; }

/* ---- Questions ---- */
.qa { display: flex; flex-direction: column; }
.qa > div { padding-block: var(--s-4); border-top: 1px solid var(--line); }
.qa > div:last-child { border-bottom: 1px solid var(--line); }
.qa dt { font-weight: 600; }
.qa dd { margin-top: var(--s-1); }

/* ---- Closing ---- */
.closing h2 { font-size: clamp(1.875rem, 8vw, 2.75rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.08; }

/* ---- Footer ---- */
.site-footer { padding-block: var(--s-6); font-size: var(--text-s); border-top: 1px solid var(--graphite-line); }
.site-footer p { color: var(--muted); }
.site-footer p + p { margin-top: var(--s-2); }
.site-footer a { display: inline-block; padding-block: var(--s-3); }
.site-footer .sep { margin-inline: var(--s-2); }

/* ---- Draft markers (stripped from dist by tools/release_check.py) ---- */
.draft-block { background: var(--draft-bg); color: var(--draft-ink); border: 2px dashed var(--draft-ink); padding: var(--s-4); font-size: var(--text-s); }
.draft-block strong { display: block; margin-bottom: var(--s-2); }
.draft-block a { color: var(--draft-ink); }

/* ---- Privacy page ---- */
.prose { line-height: 1.6; }
.prose > h2 { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--line); }
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose > h2 + * { margin-top: var(--s-3); }
.prose > * + p, .prose > * + ul { margin-top: var(--s-3); }
.prose > * + .draft-block { margin-top: var(--s-4); }
.prose ul ul { margin-top: var(--s-2); }
.page-title { font-weight: 700; letter-spacing: -0.03em; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
/* Windows high-contrast and other forced colours: keep the trace and frames visible. */
@media (forced-colors: active) {
  .wave { forced-color-adjust: none; }
  .cand__frame, .list--frames li::before { border: 1px solid CanvasText; }
  .scope__marks i, .list--marks li::before { border-color: CanvasText; }
}
@media (max-width: 29.99em) {
  .actions .btn { flex: 1 1 100%; text-align: center; }
}
/* Narrowest phones: the headline's hairline gets its own row, and the trace's end times go
   (the sentence above already says "three-hour"), so they cannot collide with mark 3. */
@media (max-width: 23.99em) {
  .h1-long { flex-wrap: wrap; row-gap: 0.15em; }
  .h1-long::after { flex: 0 0 100%; height: 0.32em; }
  .scope__end { visibility: hidden; }
}
@media (min-width: 40em) {
  :root { --text-m: 1.1875rem; --text-l: 1.4375rem; --text-xl: 2rem; }
  .band { padding-block: var(--s-8); }
  .hero { padding-block: var(--s-7) var(--s-8); }
  .site-footer { padding-block: var(--s-6); }
  .h1-long::after { margin-right: -3rem; }   /* the long line runs a little past the column */
  .cand { grid-template-columns: 3.5rem 1fr; }
  .cand__frame { width: 3.5rem; }
}
