/* Folio, variant 6: one continuous sheet of ruled paper, written live in Folio's own hand.
   Three voices: Source Serif 4 is the printed page, Noto Sans is Folio's software (anything you click),
   and ink is Folio's handwriting from glyphs.rs (never a font). Golden yellow only ever means
   "Folio wrote this", the way the app writes an auto-math answer before it fades to the pen colour. */

/* the three faces live in fonts.css (generated, inlined, metrics pinned) */

/* ------------------------------------------------------------------ tokens */
:root {
  --paper: #fbfaf7;
  --rule-c: #c3d0e0;
  --margin-c: #e07a80;
  --text: #1d1e23;
  --muted: #5b606c;
  --ink: #1f2f57;          /* Folio's default pen */
  --gold: #e8a800;         /* auto-math write-on on light paper (painting.rs) */
  --hl: rgba(232, 168, 0, .32);
  --ui: #ffffff;
  --ui-ink: #18181b;
  --ui-muted: #6b6b73;
  --ui-line: #e6e6ea;
  --ui-hover: #f2f2f4;
  --ui-btn: #f1f1f3;
  --ui-danger: #dc2626;
  --ui-shadow: 0 12px 32px -10px rgba(20, 22, 30, .22), 0 2px 6px -2px rgba(20, 22, 30, .10), 0 0 0 1px var(--ui-line);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45  0 0 0 0 .42  0 0 0 0 .38  0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");

  --serif: "Page Serif", "Source Serif 4", Georgia, serif;
  --sans: "Folio UI", "Noto Sans", system-ui, sans-serif;

  /* the ruling: every text baseline on the page lands on a rule */
  --rule: 32px;
  --fs-body: 19px;
  --fs-lead: 23px;
  --fs-small: 15px;
  --fs-h3: 21px;
  --fs-h2: 46px;
  --fs-h1: clamp(60px, 6.1vw, 88px);
  --lh-h1: calc(3 * var(--rule));
  --bf: .3505;             /* (ascent - descent) / 2 of the serif, pinned by the overrides */
  --bb: calc(var(--rule) / 2 + var(--bf) * var(--fs-body));

  --cue: 200px;
  --paper-x: var(--cue);   /* the red margin line, from the left of the column */
  --gap-l: 56px;
  --pad-r: 72px;
  --sheet-w: min(1320px, 100vw - 96px);
  --bar-h: 64px;
  /* velocity curves: the launch film's set (video/src/film/motion.ts) */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  color-scheme: light;
}
html[data-theme="dark"] {
  --paper: #111214;
  --rule-c: #2b2e35;
  --margin-c: #8e3c47;
  --text: #e8e8eb;
  --muted: #a2a5ae;
  --ink: #e8ebf2;          /* Folio's dark pen */
  --gold: #ffd43b;         /* auto-math write-on on dark paper */
  --hl: rgba(255, 212, 59, .3);
  --ui: #18191c;
  --ui-ink: #f1f1f3;
  --ui-muted: #a9a9b2;
  --ui-line: #2a2b30;
  --ui-hover: #232428;
  --ui-btn: #232428;
  --ui-danger: #f87171;
  --ui-shadow: 0 16px 36px -12px rgba(0, 0, 0, .85), 0 0 0 1px var(--ui-line);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .0175 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

@media (max-width: 1180px) {
  :root { --cue: 150px; --gap-l: 40px; --pad-r: 48px; --sheet-w: calc(100vw - 48px); }
}
@media (max-width: 960px) {
  :root {
    --rule: 30px; --fs-body: 18px; --fs-lead: 21px; --fs-small: 15px; --fs-h3: 19px; --fs-h2: 40px;
    --fs-h1: clamp(46px, 7.4vw, 60px); --lh-h1: calc(2 * var(--rule));
    --cue: 120px; --gap-l: 32px; --pad-r: 36px;
  }
}
@media (max-width: 680px) {
  :root {
    --rule: 24px; --fs-body: 16px; --fs-lead: 18px; --fs-small: 14px; --fs-h3: 17px; --fs-h2: 32px;
    --fs-h1: clamp(34px, 10.4vw, 42px); --lh-h1: calc(2 * var(--rule));
    --cue: 0px; --paper-x: 22px; --gap-l: 36px; --pad-r: 18px; --sheet-w: calc(100vw - 16px); --bar-h: 56px;
  }
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--bar-h); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 var(--fs-body)/var(--rule) var(--serif);
  font-optical-sizing: auto;
  color: var(--text);
  background: var(--grain), var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; animation: focus-in .3s var(--ease-out); }
@keyframes focus-in { from { outline-offset: 9px; outline-color: transparent; } }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 10px; z-index: 100; padding: 10px 16px; border-radius: 8px; background: var(--paper); color: var(--text); font: 500 15px/1 var(--sans); text-decoration: none; }
.skip:focus { left: 16px; }

/* ------------------------------------------------------------------ top bar: the head of the same page */
.bar {
  position: sticky; top: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 max(24px, (100vw - var(--sheet-w)) / 2);
  color: var(--text);
  font: 450 14.5px/1 var(--sans);
}
.bar > :not(.bar__blur) { position: relative; }
/* progressive blur: stacked backdrop blurs, each stronger one masked closer to the top edge,
   over a paper tint that fades out downwards */
.bar__blur { position: absolute; inset: 0 0 calc(-1 * var(--bar-h) * .4); pointer-events: none; background: linear-gradient(to bottom, color-mix(in srgb, var(--paper) 92%, transparent) 0%, color-mix(in srgb, var(--paper) 66%, transparent) 50%, color-mix(in srgb, var(--paper) 0%, transparent) 100%); }
.bar__blur i { position: absolute; inset: 0; }
.bar__blur i:nth-child(1) { backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); mask: linear-gradient(to top, transparent 0%, #000 16%, #000 32%, transparent 48%); }
.bar__blur i:nth-child(2) { backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); mask: linear-gradient(to top, transparent 16%, #000 32%, #000 48%, transparent 64%); }
.bar__blur i:nth-child(3) { backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); mask: linear-gradient(to top, transparent 32%, #000 48%, #000 64%, transparent 80%); }
.bar__blur i:nth-child(4) { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); mask: linear-gradient(to top, transparent 48%, #000 64%, #000 80%, transparent 96%); }
.bar__blur i:nth-child(5) { backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); mask: linear-gradient(to top, transparent 64%, #000 82%); }
.brand { display: flex; align-items: center; gap: 2px; text-decoration: none; color: var(--ink); margin-right: auto; }
.brand__nib { width: 24px; height: 24px; fill: currentColor; }
.brand__word { height: 30px; width: auto; overflow: visible; }
.brand__word path { fill: none; stroke: currentColor; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }
.bar__end { display: flex; align-items: center; gap: 10px; }
.theme { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: color-mix(in srgb, var(--text) 78%, var(--paper)); cursor: pointer; transition: color .2s var(--ease-out), background-color .2s var(--ease-out); }
.theme:hover { color: var(--text); background: color-mix(in srgb, var(--text) 7%, transparent); }
.theme svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme svg path { transform-box: fill-box; transform-origin: center; transition: opacity .35s var(--ease-out), transform .55s var(--ease-out); }
html[data-theme="dark"] .theme__sun, html:not([data-theme="dark"]) .theme__moon { opacity: 0; transform: rotate(-70deg) scale(.5); }

/* ------------------------------------------------------------------ buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 46px; padding: 0 20px; border-radius: 10px;
  font: 550 15px/1 var(--sans); letter-spacing: .005em; text-decoration: none; white-space: nowrap;
  transition: transform .18s cubic-bezier(.3, .7, .3, 1), box-shadow .25s var(--ease-out), background-color .2s var(--ease-out);
}
.btn:active { transform: translateY(1px) scale(.985); }
.btn--ink { background: var(--ink); color: var(--paper); box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 6px 16px -8px color-mix(in srgb, var(--ink) 80%, transparent); }
.btn--ink:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 10px 22px -8px color-mix(in srgb, var(--ink) 85%, transparent); transform: translateY(-1px); }
html[data-theme="dark"] .btn--ink, html[data-theme="dark"] .btn--ink:hover { color: #111214; box-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.btn--sm { height: 40px; padding: 0 16px; }
/* no build for this computer: the button settles into a quiet outlined label */
html .btn.btn--ink[aria-disabled="true"] { background: transparent; color: var(--ui-muted); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-muted) 40%, transparent); transform: none; cursor: default; }

.link { position: relative; display: inline-block; color: var(--text); text-decoration: none; font: 500 15px/1 var(--sans); padding: 6px 0; }
.link .scrawl { position: absolute; left: -2px; right: -2px; bottom: -3px; width: calc(100% + 4px); height: 8px; overflow: visible; pointer-events: none; }
.link .scrawl path { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 1 1.2; stroke-dashoffset: 1.1; transition: stroke-dashoffset .45s cubic-bezier(.4, .1, .2, 1); }
.link:hover .scrawl path, .link:focus-visible .scrawl path { stroke-dashoffset: 0; }
.link--go .go { display: inline-block; width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease-out); }
.link--go:hover .go { transform: translateX(3px); }
.bar__dl { transition: transform .45s var(--ease-out), box-shadow .25s var(--ease-out), background-color .2s var(--ease-out), opacity .35s var(--ease-out); }
.bar__dl.away { opacity: 0; transform: translateY(-6px) scale(.96); pointer-events: none; }
.link:not(:has(.scrawl)) { text-decoration: underline; text-underline-offset: 4px; }

/* ------------------------------------------------------------------ the paper and its sections */
/* One sheet runs from under the top bar to the bottom of the page. Each section is a whole number of
   rules tall (CSS for fixed heights, Sheet.snap in app.js for the rest), so the ruling never breaks. */
.paper { position: relative; isolation: isolate; }
.sheet {
  position: relative;
  width: var(--sheet-w);
  margin: 0 auto;
  padding: calc(3 * var(--rule)) var(--pad-r) calc(4 * var(--rule) + var(--snap, 0px)) 0;
  display: grid;
  grid-template-columns: var(--cue) minmax(0, 1fr);
  align-items: start;
  isolation: isolate;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='translate(7.5 25) rotate(40) scale(.26)'%3E%3Cpath d='M0-77C19-64 23-41 12-22C8.5-15 3.5-7 0 0C-3.5-7-8.5-15-12-22C-23-41-19-64 0-77Z' fill='%231f2f57' stroke='white' stroke-width='5'/%3E%3C/g%3E%3C/svg%3E") 7 25, crosshair;
}
html[data-theme="dark"] .sheet {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cg transform='translate(7.5 25) rotate(40) scale(.26)'%3E%3Cpath d='M0-77C19-64 23-41 12-22C8.5-15 3.5-7 0 0C-3.5-7-8.5-15-12-22C-23-41-19-64 0-77Z' fill='%23e8ebf2' stroke='%23111' stroke-width='5'/%3E%3C/g%3E%3C/svg%3E") 7 25, crosshair;
}
.sheet :is(a, button, input, summary, label, code) { cursor: pointer; }
.sheet :is(h1, h2, h3, p, dd, dt, li, code, .chapter__d) { cursor: text; }
.sheet input { cursor: text; }

/* the ruling (paper style) and the margin line, full bleed; 100cqw is the page width without a scrollbar */
.paper-lines { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: clip; container-type: inline-size; }
.paper-lines::before, .paper-lines::after { content: ""; position: absolute; inset: 0; }
.paper-lines { --col-x: calc((100cqw - var(--sheet-w)) / 2 + var(--paper-x)); }
/* one rule-tall tile repeated down the page: a single page-tall repeating gradient drops lines in Chrome */
html[data-paper="ruled"] .paper-lines::before {
  background: linear-gradient(180deg, transparent calc(var(--rule) - 1px), var(--rule-c) 0) 0 calc(var(--bb) + 2px - var(--rule)) / 100% var(--rule) repeat-y;
}
html[data-paper="ruled"] .paper-lines::after {
  left: calc(var(--col-x) - 1px); right: auto; width: 1.5px;
  background: var(--margin-c);
}
html[data-paper="grid"] .paper-lines::before {
  background:
    linear-gradient(180deg, transparent calc(var(--rule) - 1px), var(--rule-c) 0) 0 calc(var(--bb) + 2px - var(--rule)) / 100% var(--rule) repeat-y,
    linear-gradient(90deg, transparent calc(var(--rule) - 1px), var(--rule-c) 0) calc(var(--col-x) - var(--rule)) 0 / var(--rule) 100% repeat-x;
  opacity: .8;
}
html[data-paper="dot"] .paper-lines::before {
  background: radial-gradient(circle, var(--rule-c) 1.3px, transparent 1.9px);
  background-size: var(--rule) var(--rule);
  background-position: calc(var(--col-x) - var(--rule) / 2) calc(var(--bb) + 1.5px - var(--rule) / 2);
  filter: contrast(1.25);
}
html[data-theme="dark"][data-paper="dot"] .paper-lines::before { filter: brightness(1.5); }

.notes { grid-column: 2; min-width: 0; padding-left: var(--gap-l); position: relative; }

/* ------------------------------------------------------------------ type on the ruling */
.notes :where(h1, h2, h3, p, dt, dd, summary, .chapter__t, .chapter__d) {
  --fs: var(--fs-body); --lh: var(--rule);
  position: relative;
  top: calc(mod(var(--bb) - var(--lh) / 2 - var(--bf) * var(--fs) + 10.5 * var(--rule), var(--rule)) - var(--rule) / 2);
  margin: 0;
  font-size: var(--fs);
  line-height: var(--lh);
}
.notes .ui :where(h1, h2, h3, p, dt, dd) { top: 0; }
.t-h1 { --fs: var(--fs-h1) !important; --lh: var(--lh-h1) !important; font-weight: 420; letter-spacing: -.022em; font-variation-settings: "opsz" 60; color: var(--text); text-wrap: balance; }
.t-h1 .ln { display: block; }
.t-h2 { --fs: var(--fs-h2) !important; --lh: calc(2 * var(--rule)) !important; font-weight: 440; letter-spacing: -.016em; font-variation-settings: "opsz" 60; text-wrap: balance; max-width: 22ch; }
.t-h3 { --fs: var(--fs-h3) !important; font-weight: 620; letter-spacing: -.004em; }
.t-lead { --fs: var(--fs-lead) !important; font-variation-settings: "opsz" 28; color: var(--text); max-width: 30ch; text-wrap: pretty; }
.t-sub { margin-top: var(--rule) !important; max-width: 52ch; color: color-mix(in srgb, var(--text) 80%, var(--paper)); text-wrap: pretty; }
.t-small { --fs: var(--fs-small) !important; color: var(--muted); }
.notes p, .notes dd { text-wrap: pretty; }

/* ------------------------------------------------------------------ hero */
/* about one screen tall, ending early enough that the next heading shows above the fold */
.sheet--hero { min-height: round(down, 100vh - var(--bar-h) - 7 * var(--rule), var(--rule)); padding-bottom: calc(2 * var(--rule) + var(--snap, 0px)); }
.hero { margin-top: var(--rule); display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 0 48px; align-items: start; }
.hero__copy { padding-top: 0; }
.ctas { height: calc(2 * var(--rule)); margin-top: var(--rule); display: flex; align-items: center; gap: 28px; }
.slot { position: relative; margin: 0; }
.slot--hero { height: calc(7 * var(--rule)); }
.notes .slot__tip {
  --fs: var(--fs-small); --lh: var(--rule);
  position: absolute; left: 0; right: 0; bottom: 0; top: auto; margin: 0;
  font-size: var(--fs); line-height: var(--lh); font-style: italic; color: color-mix(in srgb, var(--text) 74%, var(--paper));
  translate: 0 calc(mod(var(--bb) - var(--lh) / 2 - var(--bf) * var(--fs) + 10.5 * var(--rule), var(--rule)) - var(--rule) / 2);
  opacity: 0; transition: opacity .6s var(--ease-out); pointer-events: none;
}
.notes .slot__tip.on { opacity: 1; }
@media (max-width: 960px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .slot--hero { margin-top: var(--rule); height: calc(7 * var(--rule)); }
}
@media (max-width: 680px) {
  .slot--hero { height: calc(8 * var(--rule)); }
  /* when the two wrap, each still fills two rules */
  .ctas { gap: 0 20px; flex-wrap: wrap; height: auto; }
  .ctas > .btn { margin-block: calc(var(--rule) - 23px); }
  .ctas > .link { line-height: calc(2 * var(--rule) - 12px); }
}

/* ------------------------------------------------------------------ gestures */
.play { margin-top: calc(2 * var(--rule)); display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); gap: 0 56px; align-items: start; }
.chapters { display: flex; flex-direction: column; }
.chapter {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  width: 100%; padding: 0; margin: 0 0 var(--rule); border: 0; background: none; color: var(--muted);
}
.chapter:last-child { margin-bottom: 0; }
.chapter__t { --fs: calc(var(--fs-body) - 2px) !important; --bf: .388; font-family: var(--sans); font-weight: 600; letter-spacing: .005em; transition: color .25s var(--ease-out); }
/* 0fr -> 1fr rows animate the open height in every browser, unlike height: auto */
.chapter__d { display: grid; grid-template-rows: 0fr; opacity: 0; color: var(--text); font-family: var(--serif); transition: grid-template-rows .45s cubic-bezier(.3, .7, .2, 1), opacity .3s var(--ease-out); }
.chapter__d > span { min-height: 0; overflow: hidden; }
.chapter[aria-selected="true"] .chapter__t, .chapter:hover .chapter__t { color: var(--text); }
.chapter[aria-selected="true"] .chapter__d { grid-template-rows: 1fr; opacity: 1; }
.chapter__bar { position: absolute; left: calc(-1 * min(16px, var(--gap-l) * .45) - 1px); top: 4px; bottom: 4px; width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 30%, transparent); transform-origin: top; transform: scaleY(0); opacity: 0; transition: opacity .3s var(--ease-out), transform .4s var(--ease-out); }
@media (max-width: 680px) { .chapter__bar { left: -9px; } }
.chapter[aria-selected="true"] .chapter__bar { opacity: 1; }
.chapter__bar::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--ink); transform-origin: top; transform: scaleY(var(--p, 0)); }
.chapter[aria-selected="true"] .chapter__bar { transform: scaleY(1); }
.slot--stage { height: calc(12 * var(--rule)); touch-action: none; }
@media (max-width: 960px) {
  .play { grid-template-columns: minmax(0, 1fr); }
  .slot--stage { margin-top: var(--rule); }
}

/* ------------------------------------------------------------------ math */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 56px; align-items: start; }
.split__text .t-h2 { max-width: 20ch; }
/* the demo column starts one rule down, level with the heading's letters rather than its line box */
.split > .mathwrap, .split > .searchwrap { margin-top: var(--rule); }
.mathwrap { position: relative; }
.slot--math { height: calc(4 * var(--rule)); touch-action: none; transition: height .45s var(--ease-out); }
.slot--math.tall { height: calc(8 * var(--rule)); }
.solver { max-width: 420px; margin-top: calc(2 * var(--rule)); }
@media (max-width: 960px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split__text .t-h2 { max-width: 22ch; }
  .split > .mathwrap, .split > .searchwrap { margin-top: calc(2 * var(--rule)); }
}

/* ------------------------------------------------------------------ Folio UI replicas */
.ui { font: 400 14px/1.4 var(--sans); color: var(--ui-ink); }
.ui .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.uibtn { height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--ui-btn); color: var(--ui-ink); font: 500 13.5px/1 var(--sans); cursor: pointer; transition: background-color .15s var(--ease-out), transform .15s var(--ease-out); white-space: nowrap; }
.uibtn:hover { background: var(--ui-hover); box-shadow: 0 0 0 1px var(--ui-line) inset; }
.uibtn:active { transform: scale(.97); }
.uibtn--dark { background: var(--ui-ink); color: var(--ui); }
.uibtn--dark:hover { background: var(--ui-ink); opacity: .9; }

.solver { background: var(--ui); border-radius: 14px; box-shadow: var(--ui-shadow); padding: 16px; position: relative; z-index: 3; cursor: default; }
.solver__head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15.5px; margin-bottom: 12px; }
.seg { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 3px; border-radius: 10px; box-shadow: 0 0 0 1px var(--ui-line) inset; margin-bottom: 14px; }
.seg button { height: 30px; border: 0; border-radius: 7px; background: none; font: 450 13px/1 var(--sans); color: var(--ui-ink); cursor: pointer; transition: background-color .2s var(--ease-out); }
.seg button { position: relative; z-index: 1; }
.seg__thumb { position: absolute; left: 3px; top: 3px; height: 30px; border-radius: 7px; background: var(--ui-btn); box-shadow: 0 0 0 1px var(--ui-line) inset; transition: transform .38s var(--ease-out), width .38s var(--ease-out); }
.solver__label { font-size: 13px; color: var(--ui-muted); margin: 4px 0 6px; }
.mx { font-family: var(--serif); font-variation-settings: "opsz" 40; text-align: center; color: var(--ui-ink); }
.mx i { font-style: italic; }
.mx--big { font-size: 30px; line-height: 1; padding: 14px 0; border-radius: 10px; box-shadow: 0 0 0 1px var(--ui-line) inset; margin-bottom: 10px; }
.mx--answer { font-size: 30px; line-height: 1; padding: 16px 0; border-radius: 10px; background: var(--ui-btn); margin-bottom: 14px; }
.solver__steps-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.solver__actions { display: flex; gap: 6px; }
.steps { list-style: none; margin: 0; padding: 0; min-height: 40px; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; padding: 10px 0 2px; animation: step-in .45s cubic-bezier(.2, .7, .2, 1) both; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1px var(--ui-line) inset; display: grid; place-items: center; font-size: 11.5px; font-weight: 600; }
.steps .d { font-size: 13.5px; }
.steps .m { grid-column: 2; font-family: var(--serif); font-size: 19px; padding: 2px 0 4px; }
.steps .m i { font-style: italic; }
.steps .hint { grid-column: 2; font-size: 13px; color: var(--ui-muted); }
.steps .done { grid-column: 1 / -1; font-size: 13px; color: var(--ui-muted); padding-top: 6px; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); filter: blur(3px); } }
.graph { width: 100%; height: auto; }
.graph__grid path { stroke: var(--ui-line); stroke-width: 1; }
.graph__axis { stroke: var(--ui-muted); stroke-width: 1.2; fill: none; }
.graph__flat { stroke: var(--ui-muted); stroke-width: 1.4; stroke-dasharray: 4 4; fill: none; }
.graph__line { stroke: var(--ui-ink); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.graph__pt { fill: var(--ui); stroke: var(--ui-ink); stroke-width: 2; }
.graph__t { font: 500 12px var(--sans); fill: var(--ui-ink); }
.graph__t--m { font: italic 14px var(--serif); fill: var(--ui-muted); }
.solver__view[data-panel="graph"]:not([hidden]) .graph__line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s .1s cubic-bezier(.4, .1, .2, 1) forwards; }
.solver__view[data-panel="graph"]:not([hidden]) .graph__pt, .solver__view[data-panel="graph"]:not([hidden]) .graph__t { animation: step-in .4s var(--ease-out) 1s both; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.solver__note { font-size: 12.5px; color: var(--ui-muted); margin: 8px 0 0; }
.checks { list-style: none; margin: 0 0 12px; padding: 0; min-height: 64px; }
.checks li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; box-shadow: 0 0 0 1px var(--ui-line) inset; margin-bottom: 8px; animation: step-in .4s var(--ease-out) both; }
.checks .m { font-family: var(--serif); font-size: 20px; min-width: 76px; }
.checks .m i { font-style: italic; }
.checks .v { font-size: 13px; color: var(--ui-muted); }
.checks .ok svg, .checks .no svg { width: 18px; height: 18px; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.checks .ok svg { stroke: #16a34a; }
.checks .no svg { stroke: var(--ui-danger); }

/* selection, menus and review: placed over the ink */
.overlay { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.selbox { position: absolute; border: 1px dashed var(--ui-ink); pointer-events: auto; cursor: move; transition: opacity .2s var(--ease-out); }
.selbox .h { position: absolute; width: 9px; height: 9px; background: var(--ui); box-shadow: 0 0 0 1px var(--ui-ink) inset; }
.selbox .h:nth-child(1) { left: -5px; top: -5px; }
.selbox .h:nth-child(2) { right: -5px; top: -5px; }
.selbox .h:nth-child(3) { left: -5px; bottom: -5px; }
.selbox .h:nth-child(4) { right: -5px; bottom: -5px; }
.selbox .rot { position: absolute; left: 50%; top: -22px; width: 1px; height: 17px; background: var(--ui-ink); }
.selbox .rot::before { content: ""; position: absolute; left: -4px; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--ui-ink); }
.selbox.pop { animation: sel-in .28s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes sel-in { from { opacity: 0; transform: scale(.94); } }
.menu, .review { position: absolute; background: var(--ui); border-radius: 14px; box-shadow: var(--ui-shadow); pointer-events: auto; cursor: default; animation: menu-in .26s cubic-bezier(.2, .8, .3, 1.15) both; transform-origin: top center; z-index: 5; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.96); } }
.menu { width: 212px; padding: 8px; }
.menu__icons { display: flex; justify-content: space-around; padding: 2px 0 8px; margin-bottom: 6px; box-shadow: 0 1px 0 var(--ui-line); }
.menu__icons button, .menu__row, .review__row { border: 0; background: none; cursor: pointer; color: var(--ui-ink); }
.menu__icons button { width: 36px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.menu__icons button:hover, .menu__row:hover, .menu__row.hot, .review__row:hover, .review__row.hot { background: var(--ui-hover); }
.menu__icons .del { color: var(--ui-danger); }
.menu__row, .review__row { display: flex; align-items: center; gap: 12px; width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; font: 400 14px/1 var(--sans); text-align: left; transition: background-color .15s var(--ease-out); }
.menu__row[aria-disabled="true"] { opacity: .4; cursor: default; }
.menu__row[aria-disabled="true"]:hover { background: none; }
.review { width: 320px; padding: 10px; }
.review__head { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 4px; font-weight: 600; font-size: 14px; margin-bottom: 8px; box-shadow: 0 1px 0 var(--ui-line); padding-bottom: 8px; height: 42px; }
.review__head svg { width: 16px; height: 16px; }
.review input { width: 100%; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--ui-line); background: var(--ui); color: var(--ui-ink); font: 400 15px/1 var(--sans); margin-bottom: 8px; outline: none; }
.review input:focus { border-color: var(--ui-muted); }
.review__rows { box-shadow: 0 -1px 0 var(--ui-line); padding-top: 6px; }
.typed { position: absolute; z-index: 2; white-space: nowrap; font-family: var(--sans); color: var(--ink); transform-origin: left bottom; cursor: text; }
.typed span { display: inline-block; animation: type-in .32s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes type-in { from { opacity: 0; transform: translateY(.25em); filter: blur(2px); } }
.typed.gold { color: var(--gold); transition: color .46s var(--ease-in-out) .11s; }

/* ------------------------------------------------------------------ search */
.searchwrap { max-width: 760px; }
.findpage { position: relative; }
.find { position: absolute; z-index: 5; top: 0; left: 0; width: min(100%, 360px); height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; background: var(--ui); border-radius: 10px; box-shadow: var(--ui-shadow); cursor: text; }
.find input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; font: 400 14.5px/1 var(--sans); color: var(--ui-ink); }
.find input::placeholder { color: var(--ui-muted); }
.find input::-webkit-search-cancel-button { display: none; }
.find:focus-within { box-shadow: var(--ui-shadow), 0 0 0 2px var(--gold); }
.find__n { font-size: 12.5px; color: var(--ui-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.find__step { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 7px; background: none; color: var(--ui-ink); cursor: pointer; }
.find__step:hover { background: var(--ui-hover); }
.find__step svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.slot--search { height: calc(12 * var(--rule)); touch-action: none; }
.hl { transition: background-color .25s var(--ease-out), box-shadow .25s var(--ease-out); position: absolute; z-index: -1; border-radius: 3px 5px 4px 3px; background: var(--hl); transform-origin: left center; animation: swipe .38s cubic-bezier(.3, .6, .2, 1) both; pointer-events: none; }
html:not([data-theme="dark"]) .hl { mix-blend-mode: multiply; }
.hl.cur { background: color-mix(in srgb, var(--gold) 58%, transparent); box-shadow: 0 0 0 1.5px var(--gold); }
html[data-theme="dark"] .hl.cur { background: color-mix(in srgb, var(--gold) 30%, transparent); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--gold) 80%, transparent); }
@keyframes swipe { from { transform: scaleX(0); } }

/* ------------------------------------------------------------------ paper and pens */
/* pickers keep their natural one-row width; the live sample takes the rest */
.picks-row { margin-top: calc(2 * var(--rule)); display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 1fr); gap: 0 56px; align-items: stretch; }
.picks { display: grid; gap: var(--rule) 0; }
.slot--sample { min-height: calc(5 * var(--rule)); }
@media (max-width: 1180px) { .picks-row { grid-template-columns: minmax(0, 1fr); } .slot--sample { margin-top: var(--rule); min-height: 0; height: calc(4 * var(--rule)); } }
/* every wrapped row of buttons fills exactly two rules */
.choices { --ch: 44px; margin-top: 0; padding: calc(var(--rule) - var(--ch) / 2) 0; display: flex; align-items: center; gap: calc(2 * var(--rule) - var(--ch)) 8px; flex-wrap: wrap; }
.choices button {
  height: var(--ch); display: inline-flex; align-items: center; gap: 10px; padding: 0 14px 0 8px;
  border: 0; border-radius: 10px; background: var(--ui); color: var(--ui-ink); font: 450 14px/1 var(--sans);
  box-shadow: 0 0 0 1px var(--ui-line), 0 1px 2px rgba(0, 0, 0, .06); cursor: pointer;
  transition: box-shadow .2s var(--ease-out), transform .15s var(--ease-out);
}
.choices button:hover { box-shadow: 0 0 0 1px var(--ui-muted), 0 2px 6px rgba(0, 0, 0, .08); }
html[data-theme="dark"] .choices button { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-muted) 38%, transparent); }
html[data-theme="dark"] .choices button:hover { box-shadow: 0 0 0 1px var(--ui-muted); }
.choices button:active { transform: scale(.97); }
.choices button[aria-checked="true"], html[data-theme="dark"] .choices button[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
.swatch { --sw: color-mix(in srgb, var(--text) 26%, var(--paper)); width: 28px; height: 28px; border-radius: 6px; background-color: var(--paper); box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 22%, transparent) inset; flex: none; }
.swatch--ruled { background-image: repeating-linear-gradient(180deg, transparent 0 6px, var(--sw) 6px 7px); }
.swatch--grid { background-image: repeating-linear-gradient(180deg, transparent 0 6px, var(--sw) 6px 7px), repeating-linear-gradient(90deg, transparent 0 6px, var(--sw) 6px 7px); }
.swatch--dot { background-image: radial-gradient(circle, var(--muted) .9px, transparent 1.3px); background-size: 7px 7px; }
.pensw { width: 40px; height: 26px; overflow: visible; flex: none; }
.choices--pens button { padding-left: 10px; }
html:not([data-theme="dark"]) .pensw .hi { mix-blend-mode: multiply; }
@media (max-width: 680px) {
  .choices { --ch: 40px; column-gap: 6px; }
  .choices button { padding-right: 10px; font-size: 13.5px; gap: 8px; }
  .pensw { width: 30px; }
}

/* ------------------------------------------------------------------ questions */
.faq { margin-top: var(--rule); max-width: 640px; }
.faq details { margin: 0; }
.faq summary {
  --lh: calc(2 * var(--rule)) !important; --fs: calc(var(--fs-body) - 1px) !important; --bf: .388;
  font-family: var(--sans); font-weight: 600; letter-spacing: .003em;
  list-style: none; display: flex; align-items: baseline; gap: 18px; cursor: pointer; transition: color .25s var(--ease-out);
}
.faq summary::-webkit-details-marker { display: none; }
.faq details:not(.on) summary:hover { color: color-mix(in srgb, var(--text) 72%, var(--paper)); }
.faq details:not(.on) summary:hover .pm path { transform: rotate(90deg); }
.faq summary .pm { flex: none; width: 18px; height: 18px; align-self: center; overflow: visible; margin-left: auto; }
.faq summary .pm path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; transition: transform .35s cubic-bezier(.3, .7, .2, 1.2); transform-origin: center; transform-box: fill-box; }
.faq details.on .pm .v { transform: scaleY(0); }
.faq details p { max-width: 62ch; padding-bottom: var(--rule); }
/* open and close are animated from app.js so they work in every browser */
.faq details { overflow: clip; }
.faq details p { opacity: 0; transition: opacity .3s var(--ease-out); }
.faq details.on p { opacity: 1; transition-delay: .08s; }
@supports (interpolate-size: allow-keywords) { :root { interpolate-size: allow-keywords; } }

/* ------------------------------------------------------------------ fresh page */
.sheet--fresh { padding-bottom: calc(2 * var(--rule) + var(--snap, 0px)); min-height: round(down, 100vh - var(--bar-h) - 4 * var(--rule), var(--rule)); }
.fresh__sub { max-width: 64ch !important; }
.get__col p .link { display: inline; padding: 0; font: inherit; }
.get { margin-top: calc(2 * var(--rule)); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 56px; }
.get__col p { margin-bottom: 0; }
/* the button and the command each fill two rules, so the row after them stays on the ruling */
.get__col .btn { display: flex; width: fit-content; margin: calc(var(--rule) + (2 * var(--rule) - 46px) / 2) 0 calc((2 * var(--rule) - 46px) / 2); }
.cmd { margin: calc(var(--rule) + (2 * var(--rule) - 46px) / 2) 0 calc((2 * var(--rule) - 46px) / 2); height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px; background: var(--ui); border-radius: 10px; box-shadow: var(--ui-shadow); }
.cmd code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font: 400 13px/46px ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", monospace; color: var(--ui-ink); scrollbar-width: none; -webkit-mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.endcard { position: relative; height: calc(7 * var(--rule)); margin-top: calc(2 * var(--rule)); }
/* the launch film's end card (endcard.js); app.js nudges it so the name sits on a rule */
.endcard__logo { position: absolute; left: 0; top: calc(3 * var(--rule)); width: min(100%, 340px); color: var(--ink); pointer-events: none; }
@media (max-width: 960px) { .get { grid-template-columns: minmax(0, 1fr); gap: var(--rule) 0; } }

/* ------------------------------------------------------------------ footer: the last rows of the page */
.foot { width: var(--sheet-w); margin: 0 auto; padding: 0 var(--pad-r) calc(3 * var(--rule)) calc(var(--cue) + var(--gap-l)); }
.foot__in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 32px; }
.foot :is(p, a) {
  --fs: 14px; --bf: .388;  /* Noto Sans: (ascent - descent) / 2, pinned in fonts.css */
  position: relative; display: block; margin: 0;
  top: calc(mod(var(--bb) - var(--rule) / 2 - var(--bf) * var(--fs) + 10.5 * var(--rule), var(--rule)) - var(--rule) / 2);
  font: 400 var(--fs)/var(--rule) var(--sans); color: color-mix(in srgb, var(--text) 70%, var(--paper)); text-decoration: none;
}
.foot__links { display: flex; flex-wrap: wrap; gap: 0 28px; }
.foot__links a { transition: color .2s var(--ease-out); }
.foot__links a:hover { color: var(--text); }


/* ------------------------------------------------------------------ ink */
.ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; overflow: visible; pointer-events: none; }
.ink path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ink path.fill { stroke: none; }
.ink path.ans { stroke: var(--ink); transition: stroke .46s var(--ease-in-out) .11s; }
.ink path.ans.gold { stroke: var(--gold); }
.ink .pencil { filter: url(#graphite); }
.ink .hi { stroke-linecap: butt; }
html:not([data-theme="dark"]) .ink .hi { mix-blend-mode: multiply; }
.hold { position: absolute; z-index: 6; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; animation: hold-in .22s var(--ease-out) both; }
@keyframes hold-in { from { opacity: 0; transform: scale(.6); } }
.hold circle { fill: none; stroke: var(--ink); stroke-width: 2; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: .7; }

/* ------------------------------------------------------------------ the load moment */
@media (prefers-reduced-motion: no-preference) {
  html.js .paper-lines::before { animation: rule-in 1.6s .05s var(--ease-out) both; }
  html.js .paper-lines::after { animation: margin-in 1.4s .3s var(--ease-out) backwards; }
  html.js .sheet--hero .ln { animation: ink-in .9s cubic-bezier(.2, .6, .2, 1) both; }
  html.js .sheet--hero .ln + .ln { animation-delay: .14s; }
  html.js .sheet--hero .hero__copy > * { animation: ink-in .8s .38s cubic-bezier(.2, .6, .2, 1) both; }
  html.js .sheet--hero .hero__copy > :nth-child(2) { animation-delay: .46s; }
  /* arriving from juckul.com on a sheet of this paper: the bar inks in with the page */
  html.arrive .bar > :not(.bar__blur) { animation: ink-in .8s .2s cubic-bezier(.2, .6, .2, 1) both; }
}
@keyframes rule-in {
  from { opacity: 0; -webkit-mask: linear-gradient(180deg, #000 0, transparent 40vh) 0 0 / 100% 100% no-repeat; mask: linear-gradient(180deg, #000 0, transparent 40vh) 0 0 / 100% 100% no-repeat; }
  to { opacity: 1; -webkit-mask: linear-gradient(180deg, #000 100vh, #000 200vh) 0 0 / 100% 100% no-repeat; mask: linear-gradient(180deg, #000 100vh, #000 200vh) 0 0 / 100% 100% no-repeat; }
}
/* the margin line draws down the first screen, whatever the page height */
@keyframes margin-in { from { clip-path: inset(0 0 100% 0); opacity: 0; } to { clip-path: inset(0 0 calc(100% - 100vh) 0); } }
@keyframes ink-in { from { opacity: 0; filter: blur(7px); transform: translateY(.06em); } }

/* text and UI ease in as they scroll into view (app.js adds .rv to what starts below the fold) */
.rv { opacity: 0; translate: 0 18px; filter: blur(5px); transition: opacity .8s var(--ease-out) var(--d, 0s), translate 1s var(--ease-out) var(--d, 0s), filter .8s var(--ease-out) var(--d, 0s); }
.rv.in { opacity: 1; translate: 0 0; filter: blur(0); }

/* paper and theme swaps use a view transition: a circle of new paper spreads from the click */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------------ narrow bars */
@media (max-width: 680px) {
  .bar { gap: 12px; padding: 0 14px; }
  .brand__word { height: 26px; }
  .btn--sm { height: 36px; padding: 0 12px; font-size: 14px; }
}
