/* CaretFlow website. The four themes are the app's own (Paper, Sepia, Ink, Slate): the --w-* values
   are copied from the app's style.css and color everything drawn as a CaretFlow window. */

@font-face { font-family: 'Fraunces'; src: url('../assets/fonts/fraunces-latin-full-normal.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('../assets/fonts/fraunces-latin-full-italic.woff2') format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Geist'; src: url('../assets/fonts/geist-latin-wght-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('../assets/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2'); font-weight: 100 800; font-display: swap; }

:root {
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Geist', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pad: clamp(20px, 5vw, 56px);
  --gap: clamp(88px, 11vw, 152px);

  color-scheme: light;
  --bg: #f9f7f3;
  --bg-2: #f1eee7;
  --card: #ffffff;
  --fg: #3d3a35;
  --strong: #1d1b18;
  --muted: #6f6961;
  --line: #e2ddd3;
  --brand: #5b3a8a;
  --brand-hi: #6d4aa0;
  --on-brand: #ffffff;
  --peach: #d95f3c;
  --shadow: 0 30px 70px -20px rgba(40, 20, 70, 0.28), 0 6px 18px rgba(40, 20, 70, 0.1);

  --w-bg: #ffffff;
  --w-fg: #333333;
  --w-strong: #1f1f1f;
  --w-muted: #8a8a8a;
  --w-chrome: #f7f7f6;
  --w-chrome-2: #efefed;
  --w-border: #e5e5e2;
  --w-accent: #4178c8;
  --w-accent-soft: #e3ecf9;
  --w-code-bg: #f4f4f2;
  --w-code-fg: #c0392b;
  --w-doc-font: var(--sans);
  --sp: #e0453a;
  --gr: #2f6fdb;
  --st: #c98a12;
}
:root[data-theme='sepia'] {
  --bg: #f2e9d5;
  --bg-2: #eadfc6;
  --card: #f8f1e0;
  --fg: #5a4632;
  --strong: #3d2e1f;
  --muted: #806b54;
  --line: #d9cbac;
  --peach: #c2532f;
  --shadow: 0 30px 70px -20px rgba(70, 40, 10, 0.3), 0 6px 18px rgba(70, 40, 10, 0.12);

  --w-bg: #f6efdf;
  --w-fg: #5a4632;
  --w-strong: #3d2e1f;
  --w-muted: #9a8670;
  --w-chrome: #eee5d0;
  --w-chrome-2: #e6dcc3;
  --w-border: #ddd0b4;
  --w-accent: #a0622d;
  --w-accent-soft: #ead9bd;
  --w-code-bg: #ece2cb;
  --w-code-fg: #9b3c1c;
  --w-doc-font: Georgia, Cambria, 'Noto Serif', serif;
}
:root[data-theme='ink'] {
  color-scheme: dark;
  --bg: #15161a;
  --bg-2: #1b1d21;
  --card: #1f2126;
  --fg: #c6c6c1;
  --strong: #f0f0ec;
  --muted: #92969e;
  --line: #2e3036;
  --brand: #b9a0f3;
  --brand-hi: #cbb8f8;
  --on-brand: #1c1233;
  --peach: #ff9478;
  --shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7), 0 6px 18px rgba(0, 0, 0, 0.4);

  --w-bg: #1d1f23;
  --w-fg: #d4d4cf;
  --w-strong: #ecece8;
  --w-muted: #7c7f86;
  --w-chrome: #18191c;
  --w-chrome-2: #26282d;
  --w-border: #2e3036;
  --w-accent: #6aa0f0;
  --w-accent-soft: #24344d;
  --w-code-bg: #272a30;
  --w-code-fg: #f08d76;
  --sp: #ff6b5e;
  --gr: #6fa2ff;
  --st: #e3b341;
}
:root[data-theme='slate'] {
  color-scheme: dark;
  --bg: #191e27;
  --bg-2: #1f2530;
  --card: #242b37;
  --fg: #c3ccd9;
  --strong: #eef2f7;
  --muted: #8f9bad;
  --line: #323a47;
  --brand: #b9a8f5;
  --brand-hi: #cdbff9;
  --on-brand: #1a1433;
  --peach: #ff9a7d;
  --shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7), 0 6px 18px rgba(0, 0, 0, 0.4);

  --w-bg: #222833;
  --w-fg: #cdd5e0;
  --w-strong: #eef2f7;
  --w-muted: #7d8899;
  --w-chrome: #1c212a;
  --w-chrome-2: #2a313d;
  --w-border: #323a47;
  --w-accent: #88b4e7;
  --w-accent-soft: #2c3e57;
  --w-code-bg: #2b3240;
  --w-code-fg: #e5a07a;
  --sp: #ff6b5e;
  --gr: #6fa2ff;
  --st: #e3b341;
}

/* ═════════════════════ base */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--brand); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p { margin: 0 0 1em; text-wrap: pretty; }
h1, h2, h3 { margin: 0; color: var(--strong); text-wrap: balance; }
h1, h2 { font-family: var(--serif); font-variation-settings: 'opsz' 144, 'SOFT' 60, 'WONK' 0; letter-spacing: -0.02em; line-height: 1.04; }
h2 { font-size: clamp(2rem, 4.3vw, 3.35rem); font-weight: 560; margin-bottom: 0.5em; }
h3 { font: 600 1.0625rem/1.3 var(--sans); }
strong { color: var(--strong); font-weight: 600; }
code { font: 0.86em var(--mono); background: var(--bg-2); padding: 0.12em 0.4em; border-radius: 5px; }
kbd {
  display: inline-block;
  font: 500 0.78em/1 var(--mono);
  color: var(--strong);
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2.5px;
  border-radius: 6px;
  padding: 0.34em 0.5em 0.3em;
  margin: 0 0.12em;
  vertical-align: 0.08em;
  white-space: nowrap;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--brand) 26%, transparent); }

[hidden] { display: none !important; }
.wrap { max-width: 1240px; margin-inline: auto; padding-inline: var(--pad); }
.grow { flex: 1; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--brand); color: var(--on-brand); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.aside { font-size: 0.94rem; color: var(--muted); }
.center { text-align: center; max-width: 62ch; margin-inline: auto; }

/* things come in as they scroll into view; without JavaScript they are simply there */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.8s var(--ease) var(--d, 0s), transform 0.8s var(--ease) var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* headings "render": light and gray like text just typed, with their ## in the margin, then set */
h2.md { position: relative; }
.js h2.md { font-weight: 300; color: var(--muted); transition: font-weight 0.7s var(--ease) 0.25s, color 0.7s var(--ease) 0.25s; }
.js .in h2.md, .js h2.md.in { font-weight: 560; color: var(--strong); }
@media (min-width: 1360px) {
  .js h2.md::before {
    content: '##';
    position: absolute;
    right: 100%;
    top: 0.42em;
    margin-right: 0.55em;
    font: 500 0.36em/1 var(--mono);
    letter-spacing: 0;
    color: var(--peach);
    transition: opacity 0.5s var(--ease) 0.25s, transform 0.5s var(--ease) 0.25s;
  }
  .js .in h2.md::before, .js h2.md.in::before { opacity: 0; transform: translateX(10px); }
}

/* ═════════════════════ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.78em 1.25em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--strong);
  font-weight: 550;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--strong) 35%, var(--line)); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 8px 22px -10px var(--brand); }
.btn.primary:hover { background: var(--brand-hi); border-color: var(--brand-hi); }
.btn.big { font-size: 1.1rem; padding: 0.95em 1.6em; }
.linkish { background: none; border: 0; padding: 0; color: var(--brand); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; cursor: pointer; }
.mini {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  background: var(--w-bg);
  border: 1px solid var(--w-border);
  color: var(--w-fg);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.mini:hover { border-color: var(--w-muted); }
.mini kbd { font-size: 0.72rem; margin: 0; background: var(--w-chrome-2); border-color: var(--w-border); color: var(--w-fg); }

/* ═════════════════════ nav */
.nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid transparent; transition: border-color 0.3s; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav-in { max-width: 1240px; margin-inline: auto; padding: 12px var(--pad); display: flex; align-items: center; gap: clamp(12px, 2.5vw, 28px); }
.brand { display: flex; align-items: center; gap: 10px; font: 600 1.125rem var(--serif); font-variation-settings: 'opsz' 40, 'SOFT' 60; color: var(--strong); text-decoration: none; letter-spacing: -0.01em; }
.logo { width: 30px; height: 30px; flex: none; }
.nav-links { display: flex; gap: clamp(12px, 2vw, 26px); margin-left: auto; font-size: 0.94rem; }
.nav-links a { color: var(--fg); text-decoration: none; padding: 6px 2px; }
.nav-links a:hover { color: var(--strong); text-decoration: underline; }
.themes { display: flex; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; }
.themes button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(128, 128, 128, 0.45); padding: 0; cursor: pointer; position: relative; transition: transform 0.2s var(--ease); }
.themes button:hover { transform: scale(1.15); }
.themes button[aria-checked='true']::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--brand); }
[data-set-theme='paper'] { background: #fff; }
[data-set-theme='sepia'] { background: #ead9bd; }
[data-set-theme='ink'] { background: #1d1f23; }
[data-set-theme='slate'] { background: #34425a; }
.gh { display: flex; align-items: center; gap: 7px; color: var(--strong); text-decoration: none; font-size: 0.94rem; font-weight: 500; }
.gh:hover { text-decoration: underline; }
@media (max-width: 760px) {
  .nav-links { display: none; }
  .themes { margin-left: auto; }
  .gh span { display: none; }
}

/* ═════════════════════ hero */
.hero { padding-top: clamp(32px, 4.5vw, 64px); }
.hero-head { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(24px, 5vw, 72px); align-items: end; }
.eyebrow { font: 500 0.8125rem var(--mono); color: var(--muted); margin-bottom: 1.4em; letter-spacing: 0.01em; }
.hero-title { position: relative; font-size: clamp(3rem, 8.4vw, 7rem); font-weight: 600; line-height: 0.98; letter-spacing: -0.035em; min-height: 1.96em; }
.hero-title .ch { transition: opacity 0.12s; }
.hero-title .ch.off { opacity: 0; }
.js .hero-title.typing { font-weight: 300; color: var(--muted); }
.js .hero-title { transition: font-weight 0.8s var(--ease), color 0.8s var(--ease); }
.hero-title .hash { position: absolute; right: 100%; margin-right: 0.3em; top: 0.5em; font: 500 0.26em/1 var(--mono); letter-spacing: 0; color: var(--peach); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.hero-title:not(.typing) .hash { opacity: 0; transform: translateX(12px); }
@media (max-width: 1360px) { .hero-title .hash { display: none; } }
.caret { display: inline-block; width: 0.055em; min-width: 2px; height: 0.86em; margin-left: 0.04em; margin-right: -0.1em; vertical-align: -0.06em; background: var(--peach); border-radius: 2px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.lede { font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.55; color: var(--fg); max-width: 46ch; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 1.6em 0 1.1em; }
.fine { font-size: 0.875rem; color: var(--muted); margin: 0; }
@media (max-width: 900px) {
  .hero-head { grid-template-columns: 1fr; align-items: start; }
  .hero-title { min-height: 0; }
}

/* the stage: the deep plum and peach of the app icon, with two slow ribbons */
.stage { position: relative; margin-top: clamp(32px, 4.5vw, 56px); border-radius: clamp(18px, 3vw, 34px); padding: clamp(18px, 5.5vw, 76px) clamp(12px, 5.5vw, 84px); background: #160c28; isolation: isolate; }
.aurora { position: absolute; inset: 0; z-index: -1; border-radius: inherit; overflow: hidden;
  background:
    radial-gradient(60% 55% at 8% 12%, #c2409a 0%, transparent 62%),
    radial-gradient(55% 60% at 95% 8%, #6a3fd8 0%, transparent 60%),
    radial-gradient(50% 55% at 100% 95%, #2f7ee8 0%, transparent 58%),
    radial-gradient(60% 60% at 0% 100%, #ff7a59 0%, transparent 55%),
    linear-gradient(160deg, #4b2f6e 0%, #2a1748 55%, #1a0f30 100%); }
.aurora svg { position: absolute; inset: -6%; width: 112%; height: 112%; max-width: none; }
.ribbon { filter: blur(26px); opacity: 0.8; transform-box: fill-box; transform-origin: center; }
.ribbon.b { opacity: 0.6; }
.thread { opacity: 0.4; transform-box: fill-box; transform-origin: center; }
.ribbon.a, .thread.a { animation: drift-a 19s ease-in-out infinite alternate; }
.ribbon.b, .thread.b { animation: drift-b 23s ease-in-out infinite alternate; }
@keyframes drift-a { from { transform: translate(-2%, 3%) rotate(-1.5deg); } to { transform: translate(3%, -4%) rotate(2deg) scaleY(1.12); } }
@keyframes drift-b { from { transform: translate(2%, -2%) rotate(1deg); } to { transform: translate(-3%, 5%) rotate(-2deg) scaleY(1.2); } }
.stage-toggle { position: absolute; right: 14px; bottom: 12px; display: inline-flex; align-items: center; gap: 7px; background: rgba(20, 10, 40, 0.55); color: #f1e9ff; border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 999px; padding: 5px 11px 5px 9px; font-size: 0.75rem; cursor: pointer; backdrop-filter: blur(6px); }
.stage-toggle:hover { background: rgba(20, 10, 40, 0.8); }
.stage-toggle .i-play, .stage-toggle[aria-pressed='true'] .i-pause { display: none; }
.stage-toggle[aria-pressed='true'] .i-play { display: inline; }
@media (max-width: 620px) { .stage-toggle { bottom: 2px; right: 8px; padding: 3px 9px 3px 7px; } }

/* ═════════════════════ the drawn CaretFlow window */
.mock { background: var(--w-bg); color: var(--w-fg); border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 80px rgba(10, 0, 30, 0.55), 0 8px 24px rgba(10, 0, 30, 0.35); font-size: 13px; line-height: 1.4; }
.mock-bar { display: flex; align-items: center; height: 36px; background: var(--w-chrome); border-bottom: 1px solid var(--w-border); }
.mock-menus { display: flex; gap: 16px; padding-left: 14px; color: var(--w-fg); white-space: nowrap; }
.mock-title { flex: 1; min-width: 0; text-align: center; color: var(--w-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 12px; }
.mock-ctl { display: flex; }
.mock-ctl svg { width: 46px; height: 36px; padding: 13px 18px; fill: none; stroke: var(--w-fg); stroke-width: 1; }
.mock-body { display: grid; grid-template-columns: 190px minmax(0, 1fr); height: 432px; }
.mock-side { background: var(--w-chrome); border-right: 1px solid var(--w-border); padding: 8px; }
.mock-tabs { display: flex; gap: 2px; margin-bottom: 14px; font-size: 10px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; color: var(--w-muted); }
.mock-tabs span { flex: 1; text-align: center; padding: 6px 0; border-radius: 6px; }
.mock-tabs .on { background: var(--w-chrome-2); color: var(--w-strong); }
.mock-root { font-weight: 600; color: var(--w-strong); padding: 0 6px 8px; }
.mock-file { padding: 5px 6px 5px 22px; border-radius: 6px; }
.mock-file.on { background: var(--w-accent-soft); color: var(--w-strong); font-weight: 550; }
.mock-content { position: relative; overflow: hidden; }
.mock-status { display: flex; align-items: center; gap: 14px; height: 28px; padding: 0 12px; background: var(--w-chrome); border-top: 1px solid var(--w-border); color: var(--w-muted); font-size: 11.5px; white-space: nowrap; }
.mock-path { overflow: hidden; text-overflow: ellipsis; }
.mock-wpm { color: var(--w-accent); font-variant-numeric: tabular-nums; }
.mock-wpm.idle { color: var(--w-muted); opacity: 0.6; }
.mock-mode { font-family: var(--mono); padding: 1px 6px; border-radius: 5px; transition: background 0.2s, color 0.2s; }
.mock.source .mock-mode { background: var(--w-accent); color: var(--w-bg); }

.mock-doc, .mock-src { position: absolute; inset: 0; margin: 0; padding: 34px clamp(20px, 5vw, 56px); transition: opacity 0.35s var(--ease), transform 0.35s var(--ease), filter 0.35s; }
.mock-doc { font: 16px/1.7 var(--w-doc-font); }
.mock-doc.wipe { opacity: 0; }
.mock-src { font: 13px/1.75 var(--mono); color: var(--w-fg); white-space: pre-wrap; opacity: 0; transform: translateY(8px); pointer-events: none; }
.mock-src .n { display: inline-block; width: 2.2em; color: var(--w-muted); opacity: 0.7; user-select: none; }
.mock-src i { font-style: normal; color: var(--w-accent); }
.mock-src b { color: var(--w-strong); }
.mock.source .mock-doc { opacity: 0; transform: translateY(-8px); filter: blur(3px); }
.mock.source .mock-src { opacity: 1; transform: none; }
.mock-keys { position: absolute; left: 50%; bottom: 22px; transform: translate(-50%, 12px); opacity: 0; transition: opacity 0.25s, transform 0.25s var(--ease); background: var(--w-strong); padding: 8px 10px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.mock-keys.show { opacity: 1; transform: translate(-50%, 0); }
.mock-keys kbd { background: var(--w-bg); color: var(--w-strong); border-color: var(--w-border); font-size: 12px; }

.blk { min-height: 1.7em; }
.blk.h1 { font: 700 1.75em/1.3 var(--w-doc-font); color: var(--w-strong); padding-bottom: 0.25em; margin-bottom: 0.5em; border-bottom: 1px solid var(--w-border); letter-spacing: -0.01em; }
.blk.p { margin-bottom: 0.7em; }
.blk.task { display: flex; align-items: baseline; margin-bottom: 0.25em; }
.blk.task + .blk.p { margin-top: 0.7em; }
.box { flex: none; align-self: center; width: 16px; height: 16px; margin-right: 12px; border: 1.5px solid var(--w-muted); border-radius: 3px; background: no-repeat center / 12px; transition: background-color 0.2s, border-color 0.2s, transform 0.25s var(--ease); }
.box.on { background-color: var(--w-muted); border-color: var(--w-muted); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.4 2.4 4.6-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.box.pop { transform: scale(1.25); }
.mk { font-family: var(--mono); font-size: 0.86em; font-weight: 400; color: var(--w-muted); white-space: pre; transition: font-size 0.28s var(--ease), opacity 0.2s; }
.blk.h1 .mk { font-size: 0.55em; }
.blk .mk.gone { font-size: 0; opacity: 0; }
.b { font-weight: 700; color: var(--w-strong); }
.i { font-style: italic; }
.math { font-family: 'Cambria Math', 'STIX Two Math', Georgia, 'Times New Roman', serif; font-size: 1.12em; color: var(--w-accent); white-space: nowrap; padding: 0 0.1em; }
.math sup { font-size: 0.65em; }
.pending { font-family: var(--mono); font-size: 0.86em; color: var(--w-muted); }
.word { border-radius: 2px; transition: background 0.3s; }
.word.sp { text-decoration: underline wavy var(--sp) 1.3px; text-underline-offset: 0.2em; }
.word.gr { text-decoration: underline double var(--gr) 1px; text-underline-offset: 0.2em; }
.word.fixed { background: color-mix(in srgb, var(--w-accent) 22%, transparent); }
.tc { display: inline-block; width: 1.5px; height: 1.15em; margin: 0 -0.75px; vertical-align: -0.18em; background: var(--w-strong); animation: blink 1.05s steps(1) infinite; }
.mock.busy .tc { animation: none; }
.sugg { position: absolute; z-index: 3; min-width: 150px; background: var(--w-bg); border: 1px solid var(--w-border); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); font: 13px/1.3 var(--sans); opacity: 0; transform: translateY(-4px); transition: opacity 0.15s, transform 0.15s; }
.sugg.show { opacity: 1; transform: none; }
.sugg div { padding: 6px 10px; border-radius: 5px; color: var(--w-fg); }
.sugg .hot { font-weight: 600; color: var(--w-strong); }
.sugg .hot.on { background: var(--w-accent); color: var(--w-bg); }
.sugg .dim { color: var(--w-muted); }
@media (max-width: 760px) {
  .mock-body { grid-template-columns: minmax(0, 1fr); height: 470px; }
  .mock-side, .mock-menus span:nth-child(n + 4), .mock-path { display: none; }
  .mock-doc, .mock-src { padding: 24px 20px; }
  .mock-doc { font-size: 15px; }
}

/* the typing cat (the app's own drawing, from companion.js) */
.cat { position: absolute; right: 16px; bottom: 0; line-height: 0; pointer-events: none; }
.cat svg { display: block; overflow: visible; width: 124px; height: auto; }
.cat .fur, .cat .ear, .cat .paw ellipse { fill: #fff; stroke: #2a2a2e; stroke-width: 3; stroke-linejoin: round; }
.cat .ear-in { fill: #f6b3c0; }
.cat .blush { fill: #f59ab0; opacity: 0.5; }
.cat .eyes-open circle { fill: #2a2a2e; }
.cat .eyes-happy path, .cat .mouth { fill: none; stroke: #2a2a2e; stroke-width: 2.4; stroke-linecap: round; }
.cat .eyes-happy, .cat .down { display: none; }
.cat.typing .eyes-happy { display: inline; }
.cat.typing .eyes-open { display: none; }
.cat .desk { fill: var(--w-chrome-2); stroke: var(--w-border); stroke-width: 1.5; }
.cat .kbd { fill: #3b3e46; }
.cat .kbd-keys rect { fill: #9096a1; }
.cat .hit { fill: none; stroke: var(--w-muted); stroke-width: 2; stroke-linecap: round; }
.cat.l .paw-l.up, .cat.both .paw-l.up, .cat.r .paw-r.up, .cat.both .paw-r.up { display: none; }
.cat.l .paw-l.down, .cat.both .paw-l.down, .cat.r .paw-r.down, .cat.both .paw-r.down { display: inline; }
.cat.typing .cat-body { transform: translateY(1px); }
.mock .cat { transition: opacity 0.3s; }
.mock.source .cat { opacity: 0; }
@media (max-width: 760px) { .mock .cat svg { width: 92px; } }

/* ═════════════════════ strip */
.strip { margin-top: clamp(48px, 7vw, 88px); border-block: 1px solid var(--line); overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.strip-track { display: flex; width: max-content; animation: marquee 46s linear infinite; }
.strip:hover .strip-track, .strip:focus-within .strip-track { animation-play-state: paused; }
.strip ul { display: flex; gap: clamp(28px, 4vw, 56px); margin: 0; padding: 18px clamp(14px, 2vw, 28px); list-style: none; font: 500 clamp(1.05rem, 1.8vw, 1.4rem) var(--serif); font-variation-settings: 'opsz' 40, 'SOFT' 60; color: var(--strong); white-space: nowrap; }
.strip i { font: 400 0.72em var(--mono); color: var(--peach); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ═════════════════════ sections */
.sec { margin-top: var(--gap); }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 6vw, 88px); align-items: center; }
.split.flipside { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.copy p { max-width: 50ch; }
.sec-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 52px); }
.sec-head p { font-size: 1.125rem; max-width: 58ch; margin: 0; }
@media (max-width: 900px) {
  .split, .split.flipside { grid-template-columns: 1fr; }
  .split.flipside .copy { order: -1; }
}

.legend { list-style: none; padding: 0; margin: 1.3em 0; display: grid; gap: 0.55em; }
.u { color: var(--strong); font-weight: 550; text-underline-offset: 0.24em; }
.u.sp { text-decoration: underline wavy var(--sp) 1.4px; }
.u.gr { text-decoration: underline double var(--gr) 1px; }
.u.st { text-decoration: underline dotted var(--st) 2px; }

/* small windows you can play with */
.toy { position: relative; background: var(--w-bg); color: var(--w-fg); border: 1px solid var(--w-border); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.toy-doc { position: relative; padding: clamp(22px, 4vw, 44px) clamp(20px, 4.5vw, 52px) clamp(20px, 3vw, 34px); font: 1.0625rem/1.9 var(--w-doc-font); }
.toy-doc p { margin: 0; text-wrap: wrap; }
.toy-h1 { font: 700 1.7em/1.3 var(--w-doc-font); color: var(--w-strong); letter-spacing: -0.01em; padding-bottom: 0.25em; margin-bottom: 0.6em; border-bottom: 1px solid var(--w-border); }
.toy-h2 { font: 700 1.4em/1.3 var(--w-doc-font); color: var(--w-strong); padding-bottom: 0.25em; margin-bottom: 0.6em; border-bottom: 1px solid var(--w-border); }
.toy-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 44px; padding: 7px 12px; background: var(--w-chrome); border-top: 1px solid var(--w-border); font-size: 0.8125rem; color: var(--w-muted); }

.iss { font: inherit; color: inherit; background: none; border: 0; padding: 0 1px; margin: 0 -1px; border-radius: 3px; cursor: pointer; text-underline-offset: 0.22em; transition: background 0.2s; }
.iss.sp { text-decoration: underline wavy var(--sp) 1.4px; }
.iss.gr { text-decoration: underline double var(--gr) 1px; }
.iss:hover, .iss.open { background: var(--w-accent-soft); }
.iss.done { text-decoration: none; cursor: text; animation: fixed 1.1s var(--ease); }
@keyframes fixed { 0% { background: color-mix(in srgb, var(--w-accent) 34%, transparent); } 100% { background: transparent; } }
.pop { position: absolute; z-index: 4; width: min(280px, calc(100% - 24px)); background: var(--w-bg); border: 1px solid var(--w-border); border-radius: 12px; padding: 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22); font: 0.875rem/1.45 var(--sans); animation: pop-in 0.18s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } }
.pop-kind { display: inline-block; font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: #fff; padding: 4px 7px; border-radius: 4px; margin-bottom: 8px; background: var(--gr); }
.pop-kind.sp { background: var(--sp); }
.pop-msg { margin-bottom: 12px; color: var(--w-fg); }
.pop-btns { display: flex; gap: 8px; }
.pop-btns button { border: 1px solid var(--w-border); background: var(--w-bg); color: var(--w-fg); border-radius: 7px; padding: 6px 12px; cursor: pointer; font-size: 0.875rem; }
.pop-btns .pop-fix { background: var(--w-accent); border-color: var(--w-accent); color: var(--w-bg); font-weight: 600; }
.count { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.count.bad { color: var(--sp); }
.count.ok { color: #2f9e5b; }

/* rendered ⇄ raw */
.flip-stack { display: grid; }
.flip-face { grid-area: 1 / 1; margin: 0; padding: clamp(22px, 4vw, 40px) clamp(20px, 4.5vw, 48px); min-height: 318px; transition: opacity 0.38s var(--ease), transform 0.38s var(--ease), filter 0.38s; }
.flip-face.rendered { font: 1rem/1.7 var(--w-doc-font); }
.flip-face .task { display: flex; align-items: center; margin-bottom: 0.3em; }
.flip-face table { border-collapse: collapse; width: 100%; margin-top: 1.1em; font-size: 0.94em; }
.flip-face th, .flip-face td { border: 1px solid var(--w-border); padding: 8px 12px; text-align: left; }
.flip-face th { background: var(--w-chrome); color: var(--w-strong); }
.flip-face code { background: var(--w-code-bg); color: var(--w-code-fg); }
.flip-face.raw { font: 0.875rem/1.85 var(--mono); white-space: pre; overflow: hidden; opacity: 0; transform: translateY(10px); pointer-events: none; }
.flip-face.raw .ln { display: inline-block; width: 2.4em; color: var(--w-muted); opacity: 0.65; user-select: none; }
.flip-face.raw i { font-style: normal; color: var(--w-accent); }
.flip-face.raw b { color: var(--w-strong); }
.flip-face.raw u { text-decoration: none; color: var(--w-code-fg); }
.flip-face.raw .cur { position: absolute; background: var(--w-strong); color: transparent; opacity: 0.55; animation: blink 1.1s steps(1) infinite; }
.flip.raw .rendered { opacity: 0; transform: translateY(-10px); filter: blur(3px); pointer-events: none; }
.flip.raw .flip-face.raw { opacity: 1; transform: none; pointer-events: auto; }
.vim { font: 700 0.6875rem var(--mono); background: var(--w-accent); color: var(--w-bg); padding: 3px 7px; border-radius: 4px; display: none; }
.flip.raw .vim { display: inline-block; }
.mini.keys kbd { margin-right: -2px; }
@media (max-width: 520px) { .flip-face.raw { font-size: 0.72rem; } }

/* themes */
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 1.6em 0; max-width: 460px; }
.swatch { display: grid; gap: 8px; justify-items: center; background: none; border: 0; padding: 0; cursor: pointer; font-size: 0.875rem; color: var(--fg); }
.sw-doc { display: grid; gap: 6px; align-content: start; width: 100%; aspect-ratio: 4 / 5; padding: 14px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--b); transition: transform 0.3s var(--ease), box-shadow 0.3s, border-color 0.3s; }
.sw-doc b { height: 7px; width: 62%; border-radius: 3px; background: var(--s); }
.sw-doc i { height: 4px; border-radius: 2px; background: var(--f); opacity: 0.55; }
.sw-doc i.s { width: 48%; background: var(--a); opacity: 1; }
.sw-doc[data-t='paper'] { --b: #ffffff; --s: #1f1f1f; --f: #333333; --a: #4178c8; }
.sw-doc[data-t='sepia'] { --b: #f6efdf; --s: #3d2e1f; --f: #5a4632; --a: #a0622d; }
.sw-doc[data-t='ink'] { --b: #1d1f23; --s: #ecece8; --f: #d4d4cf; --a: #6aa0f0; }
.sw-doc[data-t='slate'] { --b: #222833; --s: #eef2f7; --f: #cdd5e0; --a: #88b4e7; }
.swatch:hover .sw-doc { transform: translateY(-4px) rotate(-1.5deg); }
.swatch[aria-checked='true'] .sw-doc { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand), 0 14px 28px -14px var(--brand); }
.swatch[aria-checked='true'] { color: var(--strong); font-weight: 600; }
.shot { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--w-bg); }
.shot img { width: 100%; transition: opacity 0.25s; }
.shot img.swap { opacity: 0; }

/* the theme change spreads from the swatch that was clicked */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: spread 0.65s var(--ease); }
@keyframes spread { from { clip-path: circle(0 at var(--tx, 50%) var(--ty, 50%)); } to { clip-path: circle(150vmax at var(--tx, 50%) var(--ty, 50%)); } }

/* ═════════════════════ try it */
.try { margin-top: var(--gap); padding-block: clamp(56px, 8vw, 104px); background: var(--bg-2); border-block: 1px solid var(--line); }
.try-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 4vw, 64px); align-items: end; }
.try-head h2 { margin: 0; }
.try-head p { margin: 0; max-width: 46ch; font-size: 1.125rem; }
.demo-stage { margin-top: clamp(28px, 4vw, 48px); padding: clamp(10px, 3.2vw, 44px); }
.demo { position: relative; aspect-ratio: 16 / 10; max-height: 82vh; width: 100%; border-radius: 12px; overflow: hidden; background: var(--w-bg); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 30px 80px rgba(10, 0, 30, 0.55); }
.demo iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--w-bg); }
.demo-poster { position: absolute; inset: 0; }
.demo-poster img { width: 100%; height: 100%; object-fit: cover; object-position: top left; filter: saturate(0.7); }
.demo-over { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center; padding: 20px; background: color-mix(in srgb, var(--w-bg) 74%, transparent); backdrop-filter: blur(3px); }
.demo-over p { margin: 0; font-size: 0.875rem; color: var(--w-fg); }
.demo.live .demo-poster { display: none; }
.demo.max { position: fixed; inset: 0; z-index: 200; aspect-ratio: auto; max-height: none; border-radius: 0; }
html.demo-max { overflow: hidden; }
.try-foot { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 18px; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 760px) {
  .try-head { grid-template-columns: 1fr; }
  .demo { aspect-ratio: 4 / 3; }
}

/* ═════════════════════ shortcuts */
.keys-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.keys-list li { padding: 28px clamp(0px, 2vw, 28px) 30px 0; border-bottom: 1px solid var(--line); }
.keys-list li:not(:nth-child(3n + 1)) { padding-left: clamp(16px, 2vw, 28px); border-left: 1px solid var(--line); }
.keycap { display: flex; gap: 4px; margin-bottom: 18px; min-height: 40px; align-items: center; }
.keycap kbd { font-size: 0.9375rem; padding: 0.55em 0.7em 0.5em; margin: 0; border-radius: 8px; box-shadow: 0 2px 0 var(--line); transition: transform 0.12s, box-shadow 0.12s; }
.keys-list li:hover .keycap kbd { transform: translateY(2px); box-shadow: 0 0 0 var(--line); }
.keys-list li:hover .keycap kbd:nth-child(2) { transition-delay: 0.06s; }
.keys-list li:hover .keycap kbd:nth-child(3) { transition-delay: 0.12s; }
.keys-list h3 { margin-bottom: 0.35em; }
.keys-list p { margin: 0; font-size: 0.96rem; }
@media (max-width: 900px) {
  .keys-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .keys-list li:not(:nth-child(3n + 1)) { padding-left: 0; border-left: 0; }
  .keys-list li:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .keys-list { grid-template-columns: 1fr; }
  .keys-list li:nth-child(even) { padding-left: 0; border-left: 0; }
}

/* ═════════════════════ extensions */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); margin-bottom: 36px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; transition: transform 0.35s var(--ease), box-shadow 0.35s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.card img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; border-bottom: 1px solid var(--line); transition: transform 0.6s var(--ease); transform-origin: top left; }
.card:hover img { transform: scale(1.04); }
.card h3 { padding: 20px 22px 0; }
.card p { padding: 6px 22px 22px; margin: 0; font-size: 0.96rem; }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; max-width: 520px; } }

/* ═════════════════════ cat */
.catbox { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(20px, 4vw, 56px); align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: clamp(24px, 4.5vw, 60px); }
.catbox h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.cat-field { display: grid; gap: 6px; margin-top: 1.4em; font-size: 0.875rem; color: var(--muted); max-width: 440px; }
.cat-field textarea { font: 1rem/1.5 var(--sans); color: var(--strong); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; resize: none; }
.cat-field textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.catbox-stage { position: relative; height: 220px; border-radius: 16px; background: var(--w-bg); border: 1px solid var(--w-border); overflow: hidden; }
.cat.big { right: 50%; transform: translateX(50%); }
.cat.big svg { width: 230px; }
.wpm { position: absolute; left: 14px; top: 12px; font: 500 0.8125rem var(--mono); color: var(--w-accent); font-variant-numeric: tabular-nums; }
.wpm.idle { color: var(--w-muted); }
@media (max-width: 760px) { .catbox { grid-template-columns: 1fr; } }

/* ═════════════════════ facts */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px); margin: 0; }
.facts div { border-top: 2px solid var(--strong); padding-top: 18px; }
.facts dt { font: 560 1.4rem/1.2 var(--serif); font-variation-settings: 'opsz' 60, 'SOFT' 60; color: var(--strong); margin-bottom: 0.5em; letter-spacing: -0.01em; }
.facts dd { margin: 0; font-size: 0.96rem; }
@media (max-width: 900px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } }

/* ═════════════════════ download */
.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); align-items: start; margin-bottom: 36px; }
.dl-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 26px 22px 18px; }
.dl-card h3 { font: 560 1.5rem/1.2 var(--serif); font-variation-settings: 'opsz' 60, 'SOFT' 60; margin-bottom: 14px; padding-inline: 6px; }
.dl-card.yours { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
.dl-card.yours::after { content: 'Your system'; position: absolute; top: 28px; right: 24px; font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase; color: var(--on-brand); background: var(--brand); padding: 5px 8px; border-radius: 999px; }
.dl-card ul { list-style: none; margin: 0; padding: 0; }
.dl-card li + li { border-top: 1px solid var(--line); }
.dl-card a[data-asset] { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 6px; border-radius: 8px; text-decoration: none; color: var(--fg); transition: background 0.2s; }
.dl-card a[data-asset]:hover { background: var(--bg-2); }
.dl-card a[data-asset] b { color: var(--strong); font-weight: 600; }
.dl-card a[data-asset] span { grid-column: 1; font-size: 0.875rem; color: var(--muted); }
.dl-card a[data-asset]::after { content: '↓'; grid-column: 2; grid-row: 1 / span 2; width: 32px; height: 32px; display: grid; place-content: center; border-radius: 50%; border: 1px solid var(--line); color: var(--strong); transition: transform 0.25s var(--ease), background 0.2s, color 0.2s, border-color 0.2s; }
.dl-card a[data-asset]:hover::after { transform: translateY(3px); background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.dl-card a[data-asset] em { font-style: normal; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dl-card .aside { margin: 12px 6px 6px; }
@media (max-width: 900px) { .dl { grid-template-columns: 1fr; max-width: 520px; } }

/* ═════════════════════ footer */
.foot { margin-top: var(--gap); border-top: 1px solid var(--line); background: var(--bg-2); padding-block: clamp(36px, 5vw, 64px) 28px; font-size: 0.94rem; }
.foot-in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px clamp(24px, 6vw, 96px); }
.foot-brand { display: flex; gap: 16px; align-items: flex-start; }
.foot-brand img { border-radius: 11px; flex: none; }
.foot-brand strong { font: 600 1.2rem var(--serif); font-variation-settings: 'opsz' 40, 'SOFT' 60; }
.foot-brand p { margin: 6px 0 0; color: var(--muted); max-width: 44ch; }
.foot nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 24px; align-content: start; }
.foot nav a { color: var(--fg); text-decoration: none; }
.foot nav a:hover { color: var(--strong); text-decoration: underline; }
.foot-fine { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
@media (max-width: 760px) { .foot-in { grid-template-columns: 1fr; } }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 300; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--strong); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; transition: opacity 0.25s, transform 0.25s var(--ease); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ═════════════════════ calm mode */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ribbon, .thread, .strip-track, .caret, .tc, .flip-face.raw .cur { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .js h2.md { font-weight: 560; color: var(--strong); transition: none; }
  .js h2.md::before { display: none; }
  .strip-track { flex-wrap: wrap; width: auto; }
  .strip-track ul[aria-hidden] { display: none; }
  .strip ul { flex-wrap: wrap; row-gap: 8px; }
  ::view-transition-new(root) { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ════════════════════════════════════════ /privacy/ and /terms/ (scripts/build-legal.mjs) */
.legal { max-width: 78ch; padding-block: clamp(32px, 6vw, 72px) var(--gap); }
.legal h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 560; margin-bottom: 0.3em; }
.legal h2 { font-size: clamp(1.4rem, 2.6vw, 1.8rem); margin: 1.8em 0 0.5em; }
.legal ul { padding-left: 1.3em; margin: 0 0 1em; }
.legal li { margin-bottom: 0.35em; }
.legal table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.2em; font-size: 0.94rem; }
.legal th, .legal td { text-align: left; vertical-align: top; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); }
.legal th { color: var(--strong); font-weight: 600; white-space: nowrap; }
.legal-src { margin-top: 2.5em; padding-top: 1.2em; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.nav-links a[aria-current='page'] { color: var(--strong); font-weight: 600; }
