/* StudyWeave site: the shared design system. Every page links this file.
   Tokens come from the app's plum family (packages/ui/src/tokens/colors.ts on design/glass); the paper, Freight
   display type, the threads and the illustrations are the site's own (decisions 2026-11-10, item 4).
   See docs/design-system.md. */

:root {
  /* Paper and ink */
  --paper: #f8f7f3;            /* bone: warm like the drawings, close in value to the app's canvas */
  --ink: #111337;              /* app ink */
  --ink-2: #2b2d55;            /* body text */
  --muted: #5f6185;            /* app ink-muted */
  --line: #d8d0e3;             /* app line */
  --line-soft: #e7e2ee;
  --line-control: #77738a;     /* app line-control: field borders */

  /* The app's plum family */
  --plum: #76208f;
  --plum-hover: #5c176f;
  --plum-deep: #45125a;
  --lavender: #eee7f6;
  --focus: #8240b1;
  --canvas: #f8f9fb;           /* app canvas, inside product frames */
  --surface: #ffffff;
  --sunken: #eef0f4;
  --selected: #ececf1;
  --success: #24664a;
  --warning: #805700;
  --warning-bg: #fff6dc;
  --warning-line: #ecd7a4;
  --info: #1f5a8f;
  --mark: #f6e4b4;             /* a highlighted source passage */

  /* Study-map kinds (app graph tokens) */
  --k-objective: #4b2a9e; --k-assessment: #1f5a8f; --k-visit: #2a7ab8; --k-crf: #3c3fb0; --k-rule: #9a5b00;

  /* Loom's knot (app loom tokens) */
  --loom-gold: #f5dfa5; --loom-blue: #b8d1e1; --loom-lilac: #bdaecc; --loom-ink: #242326;

  /* The threads: the drawings' own colours, site only */
  --t-purple: rgb(130, 93, 172); --t-gold: rgb(252, 214, 101); --t-blue: rgb(110, 174, 204); --t-pink: rgb(212, 142, 163);

  /* Type: five sizes site-wide. Freight for display only; Inter for everything else. */
  --fs-hero: 72px;     /* the one hero line per page (Freight Big Medium) */
  --fs-display: 48px;  /* section heads (Freight Display) */
  --fs-title: 24px;    /* card and step titles (Inter 600) */
  --fs-body: 19px;     /* body and leads (Inter 450) */
  --fs-small: 15px;    /* nav, buttons, eyebrows, captions, footer (Inter) */
  --serif-hero: "freight-big-pro", Newsreader, Georgia, serif;
  --serif: "freight-display-pro", Newsreader, Georgia, serif;
  --sans: Inter, system-ui, sans-serif;

  /* Layout and motion */
  --wrap: 1240px;
  --pad: 56px;
  --nav-h: 76px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-app: cubic-bezier(0.2, 0, 0, 1);          /* app motion.easing */
  --ease-snappy: cubic-bezier(0.32, 0.72, 0, 1);   /* app motion.easingSnappy */
}
@media (min-width: 1800px) { :root { --wrap: 1400px; --fs-hero: 80px; --fs-display: 54px; } }
@media (max-width: 1000px) { :root { --pad: 20px; --fs-hero: 46px; --fs-display: 34px; --fs-title: 22px; --fs-body: 18px; } }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink-2); font: 450 var(--fs-body)/1.6 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); position: relative; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.t-hero { font: 500 var(--fs-hero)/1.02 var(--serif-hero); color: var(--ink); }
.t-display { font: 400 var(--fs-display)/1.08 var(--serif); color: var(--ink); }
.t-title { font: 600 var(--fs-title)/1.25 var(--sans); letter-spacing: -.015em; color: var(--ink); }
.t-small { font-size: var(--fs-small); line-height: 1.5; }
.eyebrow { font: 600 var(--fs-small)/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--plum); margin-bottom: 18px; }
.lead { max-width: 720px; color: var(--ink-2); }
.muted { color: var(--muted); }
em.accent { font-style: normal; color: var(--plum); }
/* What only the founder, or a future run, can settle: kept visible, as the copy deck marks it. */
.tbc { background: var(--warning-bg); color: var(--warning); box-shadow: 0 0 0 3px var(--warning-bg); border-radius: 4px; }
/* Placeholder copy, waiting for the copy deck (docs/copy/). */
.copy-todo { color: var(--muted); }
.copy-todo::before { content: "[copy] "; font: 600 var(--fs-small)/1 var(--sans); letter-spacing: .04em; color: var(--plum); }

/* ---------- Buttons and links ---------- */
.ctas { margin-top: 30px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: 500 var(--fs-small)/1 var(--sans); padding: 16px 24px; min-height: 48px; --r: 24px; border-radius: var(--r); border: 0; cursor: pointer;
  transition: background .15s, box-shadow .15s, transform .15s, border-radius .3s var(--ease); }
.btn:hover { border-radius: calc(var(--r) - 10px); }   /* every button squares off by the same amount */
.btn:active { transform: translateY(1px); }
.btn .arrow { display: inline-block; transition: transform .18s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn:hover .arrow.down { transform: translateY(3px); }
.btn.primary { background: var(--plum); color: #fff; }
.btn.primary:hover { background: var(--plum-hover); }
.btn.ghost { background: rgba(255, 255, 255, .8); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn.small { padding: 12px 18px; min-height: 44px; --r: 22px; }
.link { display: inline-flex; gap: 6px; font-weight: 500; color: var(--plum); border-bottom: 1px solid currentColor; padding-bottom: 2px; }
.link .arrow { transition: transform .18s var(--ease); }
.link:hover .arrow { transform: translateX(4px); }
.more { margin-top: 24px; }

/* ---------- Nav: transparent at the top; a solid paper bar with a hairline once scrolled, the wordmark folding into the mark ---------- */
.nav { position: fixed; z-index: 50; top: 0; left: 0; right: 0; height: var(--nav-h); display: flex; align-items: center; gap: 32px;
  padding: 0 max(24px, calc((100% - var(--wrap)) / 2 + var(--pad))); background: rgba(248, 247, 243, 0); box-shadow: 0 1px 0 rgba(216, 208, 227, 0);
  font-size: var(--fs-small); font-weight: 500; transition: background .3s, box-shadow .3s, height .35s var(--ease); }
.nav.scrolled { background: var(--paper); box-shadow: 0 1px 0 var(--line); height: 62px; }
.brand { display: flex; align-items: center; --logo-h: 34px; }
/* The official lock-up (assets/brand/04-studyweave-horizontal.svg, 792.74 x 133.2). Scrolled, the bar clips it to its
   own woven W, which ends at x = 194 of the file: the wordmark folds into the mark without redrawing either. */
.brand .lockup { display: block; overflow: hidden; width: calc(var(--logo-h) * 792.74 / 133.2); transition: width .5s var(--ease); }
.brand img { display: block; height: var(--logo-h); width: auto; max-width: none; }
.nav.scrolled .brand .lockup { width: calc(var(--logo-h) * 201 / 133.2); }
.nav-links { list-style: none; display: flex; gap: 6px; color: var(--ink-2); }
.nav-links > li { position: relative; }
.nav-links > li > a, .nav-links > li > button { display: inline-flex; align-items: center; gap: 4px; padding: 10px 10px; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; border-radius: 10px; }
.nav-links > li > a:hover, .nav-links > li > button:hover, .nav-links [aria-current="page"] { color: var(--plum); }
.nav-links .caret { font-size: 10px; color: var(--muted); }
.menu { position: absolute; top: 100%; left: -8px; min-width: 240px; padding: 8px; margin-top: 4px; list-style: none; background: var(--surface); border-radius: 12px;
  box-shadow: 0 0 0 1px var(--line-soft), 0 4px 16px rgb(17 19 55 / 8%); opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .18s var(--ease-app), transform .18s var(--ease-app), visibility 0s .18s; }
.has-menu:hover .menu, .has-menu:focus-within .menu { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.menu a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink); }
.menu a:hover, .menu a[aria-current="page"] { background: var(--lavender); color: var(--plum); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }

/* ---------- Page heads and sections ---------- */
.page-head { padding: calc(var(--nav-h) + 84px) 0 40px; }
.page-head .lead { margin-top: 24px; }
.section { padding: 120px 0 0; }
.section > .wrap > .lead, .section-head .lead { margin-top: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 72px; align-items: center; }
.split.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.split.flip > :first-child { order: 2; }
.split .text p + p, .split .text .t-title + p { margin-top: 14px; }
.split .text .eyebrow + .t-title { margin-top: 0; }
.split > *, .grid2 > *, .grid3 > *, .grid4 > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 64px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.mt-l { margin-top: 56px; }
/* A rule in a thread colour over a short statement. */
.ruled > * { padding-top: 18px; border-top: 2px solid var(--t-purple); }
.ruled > :nth-child(4n + 2) { border-color: var(--t-gold); } .ruled > :nth-child(4n + 3) { border-color: var(--t-blue); } .ruled > :nth-child(4n + 4) { border-color: var(--t-pink); }
.ruled p { margin-top: 10px; }
.card { position: relative; z-index: 2; background: var(--surface); box-shadow: 0 0 0 1px var(--line-soft); border-radius: 20px; padding: 24px 28px 30px;
  transition: translate .35s var(--ease), box-shadow .35s, border-radius .35s var(--ease); }
a.card:hover, .card.lift:hover { translate: 0 -6px; border-radius: 28px; box-shadow: 0 0 0 1px var(--line), 0 24px 40px -30px rgba(17, 19, 55, .4); }
.card p { margin-top: 10px; }
.card ul { margin-top: 12px; list-style: none; display: grid; gap: 8px; }
.card li { position: relative; padding-left: 20px; }
.card li::before { content: ""; position: absolute; left: 0; top: .72em; width: 10px; height: 2px; border-radius: 2px; background: var(--t-gold); }
.closing { padding: 140px 0 160px; text-align: center; }
.closing .wrap { max-width: 820px; }
.closing .lead { margin: 22px auto 0; }
.closing .ctas { flex-direction: column; justify-content: center; }

/* ---------- Footer ---------- */
.footer { position: relative; z-index: 2; background: var(--paper); padding: 64px 0 72px; font-size: var(--fs-small); color: var(--muted); border-top: 1px solid var(--line-soft); }
.fcols { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; }
.fcols h5 { margin: 0 0 14px; font: 600 var(--fs-small)/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); }
.fcols ul { list-style: none; } .fcols li { margin-top: 8px; } .fcols a:hover { color: var(--plum); }
.fbrand { display: block; height: 32px; width: auto; }
.claims { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.card.reveal { transition: opacity .9s var(--ease), transform .9s var(--ease), translate .35s var(--ease), box-shadow .35s, border-radius .35s var(--ease);
  transition-delay: var(--d, 0s), var(--d, 0s), 0s, 0s, 0s; }

/* =====================================================================================================================
   App frame: a live HTML replica of one task in the app, built from the app's tokens. White cards with hairlines on the
   app canvas, Inter, the glass rail. Inside a frame the type follows the app's own UI scale (11 to 26 px), not the
   site's; that is what makes it read as the product. Frames sit above the threads (z-index 2).
   ===================================================================================================================== */
.frame { position: relative; z-index: 2; min-width: 0; }
.af { position: relative; display: flex; background: var(--canvas); border-radius: 16px; overflow: hidden; color: var(--ink); text-align: left;
  font: 400 14px/22px var(--sans); letter-spacing: 0; -webkit-font-smoothing: antialiased;
  box-shadow: 0 0 0 1px rgba(17, 19, 55, .08), 0 30px 64px -40px rgba(17, 19, 55, .38); }
.af button { font: inherit; color: inherit; }
/* The glass rail, as the app's sidebar: icons over 11 px labels. */
.af-rail { flex: none; width: 68px; margin: 10px 0 10px 10px; padding: 12px 0; border-radius: 18px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(255,255,255,.9), rgba(226,224,234,.35) 60%, rgba(255,255,255,.75));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 0 0 1px rgba(17, 19, 55, .07); }
.af-rail .logo { width: 30px; height: auto; margin-bottom: 10px; }
/* Loom's knot (assets/brand/loom-reference.svg) sits in a wide margin of its 1000-unit square; boxes are sized so it reads at icon size. */
.af-rail img.knot { width: 30px; height: 30px; margin: -5px; }
.af-rail span { display: grid; justify-items: center; gap: 1px; width: 52px; padding: 5px 0; border-radius: 8px; font-size: 11px; line-height: 14px; color: var(--ink-2); }
.af-rail span.on { background: var(--lavender); color: var(--plum); }
.af-rail svg { width: 20px; height: 20px; }
.af-main { flex: 1; min-width: 0; padding: 18px 22px 22px; }
.af-crumbs { font-size: 13px; line-height: 20px; color: var(--muted); }
.af-crumbs b { font-weight: 400; color: var(--ink); }
.af-head { display: flex; align-items: flex-start; gap: 12px; margin-top: 6px; }
.af-head h4 { margin: 0; font: 600 22px/30px var(--sans); color: var(--ink); }
.af-head p { font-size: 13px; line-height: 20px; color: var(--muted); }
.af-head .grow { flex: 1; min-width: 0; }
.af-pill { display: inline-flex; align-items: center; height: 32px; padding: 0 14px; border-radius: 999px; background: var(--plum); color: #fff; font-size: 13px; font-weight: 500; white-space: nowrap; }
.af-pill.out { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.af-tabs { display: flex; gap: 20px; margin-top: 10px; font-size: 14px; }
.af-tabs b { color: var(--plum); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.af-eyebrow { font: 600 11px/16px var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.af-meta { font-size: 13px; line-height: 20px; color: var(--muted); }
.af-meta .warn { color: var(--warning); } .af-meta .ok { color: var(--success); } .af-meta .loom { color: var(--plum); }
.af-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }

/* The Forms board (Figma F-C2): columns of cards divided by full-height hairlines, no tinted boxes. */
.af-board { margin-top: 16px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); overflow: hidden; }
.af-col { padding: 0 14px; min-width: 0; }
.af-col:first-child { padding-left: 0; } .af-col:last-child { padding-right: 0; }
.af-col + .af-col { border-left: 1px solid var(--line); }
.af-col > h5 { margin: 0; font: 600 13px/20px var(--sans); color: var(--ink); }
.af-col > p { font-size: 12px; line-height: 16px; color: var(--muted); margin-bottom: 8px; }
.af-card { display: grid; gap: 2px; width: 100%; padding: 9px 12px; margin-bottom: 8px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.af-card b { font: 500 13px/20px var(--sans); }
.af-card small { font-size: 12px; line-height: 16px; color: var(--muted); }
button.af-card { cursor: pointer; transition: border-color .12s, box-shadow .18s var(--ease-app); }
button.af-card:hover { border-color: var(--plum); } button.af-card:hover b { color: var(--plum); }
.af-card[aria-pressed="true"] { border-color: var(--plum); box-shadow: 0 0 0 1px var(--plum); }
.af-card[aria-pressed="true"] b { color: var(--plum); }
.af-card.flag small { color: var(--warning); }

/* The R4-9 question cards: number, question, one meta line, the answer's field. */
.af-section { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; padding-left: 4px; }
.af-q { display: grid; grid-template-columns: 28px minmax(0, 1fr); padding: 14px 18px 16px 14px; margin-bottom: 10px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.af-q > i { font-style: normal; font-size: 13px; line-height: 22px; color: var(--muted); }
.af-q b { display: block; font: 600 14px/22px var(--sans); color: var(--ink); }
.af-q .af-meta { display: block; margin-top: 2px; }
.af-q .note { margin-top: 6px; padding-left: 14px; font-size: 12px; line-height: 18px; color: var(--ink-2); }
.af-field { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; width: min(220px, 100%); height: 32px; padding: 0 12px; border: 1px solid var(--line-control); border-radius: 8px; font-size: 14px; color: var(--muted); background: var(--surface); }
.af-opts { margin-top: 8px; display: grid; gap: 4px; font-size: 14px; color: var(--ink); }
.af-opts span { display: flex; align-items: center; gap: 10px; }
.af-opts span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-control); flex: none; }
.af-opts.many span::before { border-radius: 3px; }
button.af-q { cursor: pointer; transition: box-shadow .18s var(--ease-app), border-color .12s; }
button.af-q:hover { border-color: #b9b0c8; }
.af-q[aria-pressed="true"] { border-color: var(--plum); box-shadow: 0 0 0 1px var(--plum); }
.af-q.flag { box-shadow: inset 3px 0 0 var(--warning-line); }
.af-q.flag[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--warning-line), 0 0 0 1px var(--plum); }
.af-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12px; line-height: 18px; background: var(--lavender); color: var(--plum); }
.af-chip.ref { background: #e6eef7; color: var(--info); }

/* A protocol passage, with its highlighted source. */
.af-source { padding: 14px 16px; font-size: 15px; line-height: 24px; color: var(--ink-2); }
.af-source h6 { margin: 12px 0 4px; font: 600 11px/16px var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.af-source h6:first-child { margin-top: 0; }
.af-source mark { background: transparent; border-radius: 3px; color: inherit; transition: background .3s, box-shadow .3s; }
.af-source mark.on, .af-source mark.lit { background: var(--mark); box-shadow: 0 0 0 3px var(--mark); }

/* Study-map items: a kind colour on the left edge. */
.af-node { position: relative; padding: 7px 10px 7px 13px; margin-bottom: 7px; border-radius: 10px; background: var(--surface); font-size: 13px; line-height: 20px;
  box-shadow: inset 3px 0 0 var(--k, var(--k-visit)), 0 0 0 1px var(--line); }
.af-node b { font-weight: 500; color: var(--ink); } .af-node small { margin-left: 4px; font-size: 12px; color: var(--muted); }
.af-node.flag { background: var(--warning-bg); box-shadow: inset 3px 0 0 var(--k, var(--k-visit)), 0 0 0 1px var(--warning-line); }
.af-node.flag small { color: var(--warning); }
.af-node.sel { box-shadow: inset 3px 0 0 var(--k, var(--k-visit)), 0 0 0 2px var(--plum); }
.af-node[data-k="objective"] { --k: var(--k-objective); } .af-node[data-k="assessment"] { --k: var(--k-assessment); } .af-node[data-k="crf"] { --k: var(--k-crf); } .af-node[data-k="rule"] { --k: var(--k-rule); }
.af-note { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; line-height: 20px; color: var(--ink-2); }
.af-note .knot { width: 34px; height: 34px; margin: -5px; flex: none; }
.af-note.warn { background: var(--warning-bg); border-color: var(--warning-line); color: var(--warning); }
.af-dialog { background: var(--surface); border-radius: 16px; padding: 18px; box-shadow: 0 0 0 1px rgba(17,19,55,.06), 0 12px 40px rgb(17 19 55 / 14%); }
.af-dialog h5 { margin: 0; font: 600 18px/26px var(--sans); color: var(--ink); }
.af-dialog label { display: block; margin-top: 10px; font-size: 13px; line-height: 20px; color: var(--ink); font-weight: 500; }
.af-dialog .af-field { width: 100%; margin-top: 4px; }
.af-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13px; line-height: 20px; }
.af-row:first-child { border-top: 0; }
.af-row .grow { flex: 1; min-width: 0; }
.af-avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--ink); flex: none; }
/* "Example": content shown before a recorded run replaces it (copy deck rule H10). */
.af-example { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-right: 4px; border-radius: 6px; background: var(--warning-bg); box-shadow: inset 0 0 0 1px var(--warning-line); color: var(--warning); font: 600 11px/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; align-self: center; }
/* A quiet label under a frame: where its content comes from. */
.frame-src { display: inline-flex; margin-top: 12px; font-size: 13px; line-height: 20px; color: var(--muted); border-bottom: 1px solid var(--line); }
.frame-src:hover { color: var(--plum); border-color: currentColor; }
/* A frame cropped at its right edge, as the board scrolls sideways in the app. */
.af-crop { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); }

/* Screen loops: things appear as if the app were working. Paused until on screen. */
.loop .pop { animation: pop 8s var(--ease) infinite both; }
@keyframes pop { 0% { opacity: 0; transform: translateY(8px) scale(.97); } 5%, 92% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.loop .late { animation: late 8s var(--ease) infinite both; }
@keyframes late { 0%, 30% { opacity: 0; transform: translateY(6px); } 36%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.loop .press { animation: press 8s ease-in-out infinite; }
@keyframes press { 0%, 55%, 70%, 100% { transform: scale(1); } 62% { transform: scale(1.05); } }
.loop .lit-late mark { animation: litlate 8s var(--ease) infinite both; }
@keyframes litlate { 0%, 40% { background: transparent; box-shadow: 0 0 0 3px transparent; } 46%, 92% { background: var(--mark); box-shadow: 0 0 0 3px var(--mark); } 100% { background: transparent; } }
.loop:not(.playing) * { animation-play-state: paused !important; }

/* ---------- The thread layer: one SVG over the page, behind frames and the demo panel ---------- */
#threads { position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; z-index: 1; overflow: visible; }
#threads path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
/* The ending's rest: the drawn word and W fade under a soft mask and the official lock-up fades in where they were. */
#threads .end-hole { opacity: 0; transition: opacity 1s var(--ease); }
#threads.ended .end-hole { opacity: 1; }
.lockup-end { position: absolute; z-index: 2; height: auto; opacity: 0; pointer-events: none; transition: opacity 1s var(--ease) .25s; }
.lockup-end.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .loop * { animation: none !important; opacity: 1 !important; transform: none !important; }
  .menu, .btn, .card, .lockup-end, #threads .end-hole { transition: none; }
}
@media (max-width: 1000px) {
  .nav-links, .nav .signin { display: none; }
  .split, .split.flip, .grid2, .grid3, .grid4, .fcols { grid-template-columns: 1fr; }
  .split.flip > :first-child { order: 0; }
  .split { gap: 36px; }
  .fcols { gap: 24px; }
  .section { padding-top: 84px; }
  .af-rail { display: none; }
  .af-board { overflow-x: auto; grid-auto-columns: minmax(170px, 1fr); }
  #threads { display: none; }
}
