/* ==========================================================================
   Notes — base system
   Concept: a notebook page. Blue-black ink on clean paper, faint blue rules,
   and one red margin line. Young Serif speaks, Instrument Sans explains,
   Geist Mono labels the machinery (ciphertext, shortcuts, states).
   ========================================================================== */

@font-face { font-family: "Young Serif"; src: url("../fonts/young-serif.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-400.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-400i.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("../fonts/instrument-sans-700.woff") format("woff"); font-weight: 600 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../fonts/geist-mono.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Nothing You Could Do"; src: url("../fonts/nothing-you-could-do.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  /* Color: paper, ink, rules, the margin line */
  --paper: #FCFCFA;
  --paper-2: #F2F4F8;
  --surface: #FFFFFF;
  --ink: #14203D;
  --ink-2: #46526E;
  --ink-3: #69748E;
  --rule: #D6DEEB;
  --rule-2: #E6EBF3;
  --margin: #E0533D;
  --margin-ink: #B53A27;
  --margin-wash: #FCEAE6;
  --marker: #FFE68A;
  --on-ink: #FCFCFA;

  --inverse: #14203D;
  --inverse-2: #1C2A4D;
  --inverse-fg: #EEF1F7;
  --inverse-fg-2: #A7B2CA;
  --inverse-rule: #2D3B5E;

  --ok: #2D7A57;
  --ok-wash: #E4F2EA;
  --warn: #8F6210;
  --warn-wash: #FBF1DC;
  --bad: #B3362A;
  --bad-wash: #FBE7E4;
  --focus: #2E64F0;

  --proto: #5E49C2;
  --proto-wash: #F1EEFC;
  --proto-rule: #C9BFF2;

  --p-jules: #E09A2E;
  --p-morgan: #3D6BD6;
  --p-alex: #2C9A72;
  --p-sam: #B05CC2;

  --shadow-1: 0 1px 2px rgba(20, 32, 61, .06), 0 2px 8px rgba(20, 32, 61, .05);
  --shadow-2: 0 2px 4px rgba(20, 32, 61, .05), 0 18px 48px -12px rgba(20, 32, 61, .22);
  --shadow-3: 0 2px 6px rgba(20, 32, 61, .06), 0 40px 80px -24px rgba(20, 32, 61, .30);

  /* Type */
  --f-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-sans: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --f-hand: "Nothing You Could Do", "Bradley Hand", "Segoe Print", cursive;

  --t-display-xl: clamp(2.6rem, 1.4rem + 4.6vw, 5rem);
  --t-display-l: clamp(2.1rem, 1.3rem + 2.9vw, 3.6rem);
  --t-display-m: clamp(1.7rem, 1.25rem + 1.6vw, 2.5rem);
  --t-display-s: clamp(1.35rem, 1.15rem + .7vw, 1.7rem);
  --t-lede: clamp(1.1rem, 1.02rem + .35vw, 1.3rem);
  --t-body: 1.0625rem;
  --t-small: .9375rem;
  --t-micro: .8125rem;
  --t-label: .75rem;

  /* Space & shape */
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --max-text: 40rem;
  --section: clamp(64px, 8vw, 120px);
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --header-h: 64px;
  --rule-gap: 40px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1424;
    --paper-2: #121A2E;
    --surface: #161F35;
    --ink: #E8ECF5;
    --ink-2: #AEB8CD;
    --ink-3: #8592AC;
    --rule: #28334D;
    --rule-2: #1C2640;
    --margin: #FF6A52;
    --margin-ink: #FF8C79;
    --margin-wash: #2A1A22;
    --marker: #6B5A1C;
    --on-ink: #0E1424;
    --inverse: #172243;
    --inverse-2: #1E2B52;
    --inverse-fg: #EEF1F7;
    --inverse-fg-2: #A9B5CE;
    --inverse-rule: #33426B;
    --ok: #5CC495; --ok-wash: #12291F;
    --warn: #E6B45A; --warn-wash: #2A2213;
    --bad: #FF8A7A; --bad-wash: #2E1717;
    --focus: #7EA2FF;
    --proto: #B4A6F7; --proto-wash: #1D1A36; --proto-rule: #43398A;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
    --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 48px -12px rgba(0, 0, 0, .6);
    --shadow-3: 0 2px 6px rgba(0, 0, 0, .3), 0 40px 80px -24px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1424;
  --paper-2: #121A2E;
  --surface: #161F35;
  --ink: #E8ECF5;
  --ink-2: #AEB8CD;
  --ink-3: #8592AC;
  --rule: #28334D;
  --rule-2: #1C2640;
  --margin: #FF6A52;
  --margin-ink: #FF8C79;
  --margin-wash: #2A1A22;
  --marker: #6B5A1C;
  --on-ink: #0E1424;
  --inverse: #172243;
  --inverse-2: #1E2B52;
  --inverse-fg: #EEF1F7;
  --inverse-fg-2: #A9B5CE;
  --inverse-rule: #33426B;
  --ok: #5CC495; --ok-wash: #12291F;
  --warn: #E6B45A; --warn-wash: #2A2213;
  --bad: #FF8A7A; --bad-wash: #2E1717;
  --focus: #7EA2FF;
  --proto: #B4A6F7; --proto-wash: #1D1A36; --proto-rule: #43398A;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-2: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 48px -12px rgba(0, 0, 0, .6);
  --shadow-3: 0 2px 6px rgba(0, 0, 0, .3), 0 40px 80px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
h1, h2, h3, h4, p, ul, ol, dl, figure, blockquote { margin: 0; }
ul, ol { padding: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--marker); color: var(--ink); }
#main:focus { outline: none; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: var(--radius-s);
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.wrap-narrow { max-width: calc(52rem + var(--gutter) * 2); }
.section { padding-block: var(--section); }
.section-tight { padding-block: calc(var(--section) * .6); }
.section + .section { border-top: 1px solid var(--rule-2); }
.section-tint { background: var(--paper-2); }
.section.section-tint + .section, .section + .section.section-tint { border-top: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--stack, 16px); align-content: start; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster, 12px); }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
.split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.split-rev > :first-child { order: 2; }
@media (max-width: 900px) {
  .split, .split-even { grid-template-columns: minmax(0, 1fr); }
  .split-rev > :first-child { order: 0; }
}

/* ---------- Typography ---------- */
.display-xl, .display-l, .display-m, .display-s, .h-serif {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -.012em;
  text-wrap: balance;
}
.display-xl { font-size: var(--t-display-xl); line-height: 1.02; letter-spacing: -.02em; }
.display-l { font-size: var(--t-display-l); line-height: 1.06; letter-spacing: -.016em; }
.display-m { font-size: var(--t-display-m); line-height: 1.12; }
.display-s { font-size: var(--t-display-s); line-height: 1.2; }
.h3 { font-size: 1.1875rem; line-height: 1.35; font-weight: 700; letter-spacing: -.005em; text-wrap: balance; }
.h4 { font-size: 1rem; line-height: 1.4; font-weight: 700; }
.lede { font-size: var(--t-lede); line-height: 1.55; color: var(--ink-2); max-width: 36em; text-wrap: pretty; }
.prose { max-width: var(--max-text); color: var(--ink-2); text-wrap: pretty; }
.prose p + p { margin-top: 1em; }
.muted { color: var(--ink-2); }
.subtle { color: var(--ink-3); }
.small { font-size: var(--t-small); }
.micro { font-size: var(--t-micro); color: var(--ink-3); line-height: 1.5; }
.label {
  font-family: var(--f-mono);
  font-size: var(--t-label);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.4;
}
.label-accent { color: var(--margin-ink); }
.mono { font-family: var(--f-mono); font-size: .92em; letter-spacing: 0; }
.hand {
  font-family: var(--f-hand);
  color: var(--margin-ink);
  font-size: 1.35rem;
  line-height: 1.15;
  letter-spacing: .01em;
}
.num { font-variant-numeric: tabular-nums; }
kbd {
  font-family: var(--f-mono); font-size: .8em; padding: .1em .45em; border-radius: 5px;
  border: 1px solid var(--rule); border-bottom-width: 2px; background: var(--surface); color: var(--ink-2);
}
mark { background: var(--marker); color: inherit; padding: 0 .1em; border-radius: 2px; }

.section-head { display: grid; gap: 16px; max-width: 46rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head.center { margin-inline: auto; text-align: center; justify-items: center; }
.section-head .lede { margin-top: 4px; }

/* ---------- Links & buttons ---------- */
.btn {
  --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: var(--rule);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 46px; padding: 10px 20px;
  border-radius: var(--radius); border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: 1rem; line-height: 1.1; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { --btn-bd: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { --btn-bg: var(--ink); --btn-fg: var(--on-ink); --btn-bd: var(--ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { --btn-bg: var(--inverse-2); --btn-bd: var(--inverse-2); }
:root[data-theme="dark"] .btn-primary:hover { --btn-bg: #fff; --btn-bd: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary:hover { --btn-bg: #fff; --btn-bd: #fff; } }
.btn-secondary { --btn-bg: var(--surface); }
.btn-ghost { --btn-bd: transparent; padding-inline: 8px; }
.btn-ghost:hover { --btn-bd: transparent; text-decoration: underline; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: .9375rem; border-radius: 8px; }
.btn-lg { min-height: 54px; padding: 14px 26px; font-size: 1.0625rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-danger { --btn-fg: var(--bad); --btn-bd: color-mix(in srgb, var(--bad) 40%, transparent); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 600; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--rule); padding-bottom: 2px;
  transition: border-color .15s ease, gap .15s ease;
}
.link-arrow svg { width: 16px; height: 16px; transition: transform .15s ease; }
.link-arrow:hover { border-color: var(--margin); }
.link-arrow:hover svg { transform: translateX(2px); }
.text-link { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: .22em; }
.text-link:hover { text-decoration-color: var(--margin); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }

/* ---------- Pills, badges, chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: .8125rem; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule-2);
}
.pill svg { width: 13px; height: 13px; }
.pill-ok { background: var(--ok-wash); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-wash); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-wash); color: var(--bad); border-color: transparent; }
.pill-accent { background: var(--margin-wash); color: var(--margin-ink); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2);
  font-size: .9375rem; font-weight: 600; text-decoration: none;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.chip .count { font-family: var(--f-mono); font-weight: 400; font-size: .78rem; opacity: .7; }

/* ---------- Prototype review notes ---------- */
.proto-note {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: start;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--proto-wash); border: 1px dashed var(--proto-rule); color: var(--ink-2);
  font-size: var(--t-micro); line-height: 1.5; max-width: 44rem;
}
.proto-note::before {
  content: "Review note";
  font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--proto); padding-top: .15em; white-space: nowrap;
}
.proto-note strong { color: var(--ink); }
.proto-note a { color: var(--proto); font-weight: 600; }
.proto-inline {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px;
  background: var(--proto-wash); color: var(--proto); border: 1px dashed var(--proto-rule);
  font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap;
}
body.hide-proto .proto-note, body.hide-proto .proto-inline, body.hide-proto [data-proto] { display: none !important; }
@media (max-width: 560px) { .proto-note { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Ribbon ---------- */
.ribbon { background: var(--inverse); color: var(--inverse-fg-2); font-size: .8125rem; line-height: 1.3; }
.ribbon-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 36px; padding-block: 6px; }
.ribbon p { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ribbon-tag { font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .06em; text-transform: uppercase; color: var(--inverse-fg); white-space: nowrap; }
.ribbon-tag::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--margin); margin-right: 8px; vertical-align: 1px; }
.ribbon-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ribbon-actions { display: flex; align-items: center; gap: 16px; flex: none; }
.ribbon a { color: var(--inverse-fg); font-weight: 600; text-decoration: none; }
.ribbon a:hover { text-decoration: underline; }
.ribbon-toggle {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none;
  color: var(--inverse-fg); font-size: .8125rem; font-weight: 600;
}
.ribbon-switch { position: relative; width: 28px; height: 16px; border-radius: 99px; background: var(--inverse-rule); transition: background .2s ease; }
.ribbon-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--inverse-fg); transition: transform .2s ease; }
.ribbon-toggle[aria-pressed="true"] .ribbon-switch { background: #7D69E0; }
.ribbon-toggle[aria-pressed="true"] .ribbon-switch::after { transform: translateX(12px); }
@media (max-width: 720px) { .ribbon-text { display: none; } }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--rule-2); }
.header-inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand .mark { width: 28px; height: 28px; flex: none; }
.brand span { font-family: var(--f-display); font-size: 1.55rem; letter-spacing: -.015em; line-height: 1; padding-bottom: 3px; }
.mark-tile { fill: var(--ink); }
.mark-glyph { fill: var(--paper); }
.mark-rule { fill: var(--paper); opacity: .16; }
.mark-margin { fill: var(--margin); }
.primary-nav { display: flex; align-items: center; gap: 4px; margin-left: 16px; }
.primary-nav > a {
  position: relative; padding: 8px 12px; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-weight: 600; font-size: .9688rem;
}
.primary-nav > a:hover { color: var(--ink); background: var(--paper-2); }
.primary-nav > a[aria-current="page"] { color: var(--ink); }
.primary-nav > a[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--margin); }
.nav-mobile-extra { display: none; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-signin { padding: 8px 12px; border-radius: 8px; color: var(--ink-2); font-weight: 600; font-size: .9688rem; text-decoration: none; }
.header-signin:hover { color: var(--ink); background: var(--paper-2); }
.menu-button { display: none; position: relative; width: 42px; height: 42px; border: 1px solid var(--rule); border-radius: 10px; background: var(--surface); }
.menu-button span { position: absolute; left: 11px; right: 11px; height: 2px; border-radius: 2px; background: var(--ink); transition: transform .2s ease, top .2s ease; }
.menu-button span:first-child { top: 15px; }
.menu-button span:last-child { top: 23px; }
.menu-button[aria-expanded="true"] span:first-child { top: 19px; transform: rotate(45deg); }
.menu-button[aria-expanded="true"] span:last-child { top: 19px; transform: rotate(-45deg); }

@media (max-width: 860px) {
  .menu-button { display: inline-block; }
  .header-signin { display: none; }
  .header-actions .btn { display: none; }
  .primary-nav {
    position: fixed; inset: calc(var(--header-h) + env(safe-area-inset-top, 0px)) 0 auto 0; margin: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px var(--gutter) 24px; background: var(--paper); border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow-2);
    max-height: calc(100dvh - var(--header-h)); overflow-y: auto;
    display: none;
  }
  .primary-nav.is-open { display: flex; }
  .primary-nav > a { padding: 14px 4px; font-size: 1.125rem; border-bottom: 1px solid var(--rule-2); border-radius: 0; }
  .primary-nav > a:hover { background: none; }
  .primary-nav > a[aria-current="page"]::after { left: 4px; right: auto; width: 24px; bottom: 8px; }
  .nav-mobile-extra { display: grid; gap: 12px; padding-top: 16px; }
  .nav-mobile-extra a:not(.btn) { padding: 6px 4px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); background: var(--paper); padding-block: 64px 32px; }
.footer-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); gap: 48px; }
.footer-brand { display: grid; gap: 16px; align-content: start; justify-items: start; }
.footer-brand p { color: var(--ink-2); max-width: 18em; font-size: var(--t-small); }
.footer-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.footer-cols h2 { font-size: var(--t-micro); font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.footer-cols a { display: block; padding-block: 5px; color: var(--ink-2); text-decoration: none; font-size: var(--t-small); }
.footer-cols a:hover { color: var(--ink); text-decoration: underline; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule-2); font-size: var(--t-micro); color: var(--ink-3); }
@media (max-width: 960px) { .footer-top { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; } }

/* ---------- Forms ---------- */
.form { display: grid; gap: 20px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 640px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.field { display: grid; gap: 7px; }
.field > label, .field-label { font-weight: 600; font-size: .9375rem; color: var(--ink); display: flex; align-items: baseline; gap: 8px; }
.field-tag { font-weight: 400; font-size: .8125rem; color: var(--ink-3); }
.field-help { font-size: .8125rem; color: var(--ink-3); line-height: 1.45; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 9px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
  font-size: 1rem; line-height: 1.4; transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 40px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
[aria-invalid="true"] { border-color: var(--bad) !important; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; font-size: .9375rem; color: var(--ink-2); }
.check input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); }
.error-summary { padding: 16px 18px; border-radius: var(--radius); background: var(--bad-wash); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); color: var(--ink); }
.error-summary strong { display: block; margin-bottom: 6px; }
.error-summary ul { list-style: none; display: grid; gap: 4px; }
.error-summary button { padding: 0; border: 0; background: none; color: var(--bad); font-weight: 600; text-decoration: underline; text-align: left; }
.segmented { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--rule-2); gap: 2px; }
.segmented button { min-height: 38px; padding: 6px 16px; border-radius: 9px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: .9375rem; display: inline-flex; align-items: center; gap: 8px; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented .save { font-family: var(--f-mono); font-size: .6875rem; color: var(--ok); letter-spacing: .02em; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-l); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { padding: 14px 18px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule-2); }
.table thead th { font-size: .8125rem; color: var(--ink-3); font-weight: 600; background: var(--paper-2); border-bottom-color: var(--rule); }
.table tbody tr:last-child > * { border-bottom: 0; }
.table td { color: var(--ink-2); }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Disclosure / FAQ ---------- */
.faq { border-top: 1px solid var(--rule); max-width: 52rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 2px; cursor: pointer; list-style: none; font-weight: 600; font-size: 1.0625rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 12px; height: 12px;
  background: linear-gradient(currentColor 0 0) center / 12px 1.6px no-repeat, linear-gradient(currentColor 0 0) center / 1.6px 12px no-repeat;
  transition: transform .2s ease; color: var(--ink-3);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 2px 24px; color: var(--ink-2); max-width: 44rem; }
.faq details > div p + p { margin-top: .8em; }

/* ---------- Breadcrumbs ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; color: var(--ink); }
.crumbs span[aria-hidden] { opacity: .6; }

/* ---------- Modal ---------- */
#modal {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--rule); border-radius: var(--radius-l);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3);
}
#modal::backdrop { background: rgba(10, 16, 32, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#modal[open] { animation: modal-in .2s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px); } }
#modal-content { padding: 32px; display: grid; gap: 16px; }
#modal-content h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.75rem; line-height: 1.15; padding-right: 32px; }
#modal-content p { color: var(--ink-2); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); }
.modal-close:hover { background: var(--paper-2); color: var(--ink); }

/* ---------- Generic objects ---------- */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-l); padding: 24px; }
.card-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease; }
.card-link:hover { border-color: var(--ink-3); box-shadow: var(--shadow-1); }
.icon-tile { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--paper-2); color: var(--ink); border: 1px solid var(--rule-2); }
.icon-tile svg { width: 20px; height: 20px; }
.check-list { list-style: none; display: grid; gap: 10px; }
.check-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; color: var(--ink-2); }
.check-list svg { width: 18px; height: 18px; margin-top: .2em; color: var(--margin); }
.numbered { list-style: none; counter-reset: n; display: grid; gap: 14px; }
.numbered li { counter-increment: n; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; color: var(--ink-2); }
.numbered li::before { content: counter(n); font-family: var(--f-mono); font-size: .8125rem; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); display: grid; place-items: center; color: var(--ink); background: var(--surface); }
.divider { border: 0; border-top: 1px solid var(--rule-2); margin: 0; }
.related { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(220px, calc((100% - 24px) / 3)), 1fr)); gap: 12px; }
.related a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; font-weight: 600; color: var(--ink);
}
.related a:hover { border-color: var(--ink-3); }
.related svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

.noscript { padding-block: 80px; }
@media (max-width: 480px) { .btn { white-space: normal; text-align: center; } }

/* ---------- Classes in place of inline styles ----------
   The Content-Security-Policy is `style-src 'self'`, which refuses a style
   attribute, so each value the markup would set inline is a class here.
   The avatar classes pair with `.av` so they outrank mockups.css's default,
   which loads later. */
.av.av-morgan, .cursor.av-morgan { --av: var(--p-morgan); }
.av.av-jules, .cursor.av-jules { --av: var(--p-jules); }
.av.av-alex, .cursor.av-alex { --av: var(--p-alex); }
.av.av-sam, .cursor.av-sam { --av: var(--p-sam); }
.stack-10 { --stack: 10px; }
.stack-12 { --stack: 12px; }
.stack-14 { --stack: 14px; }
.stack-16 { --stack: 16px; }
.stack-18 { --stack: 18px; }
.stack-20 { --stack: 20px; }
.stack-24 { --stack: 24px; }
.w-40 { --w: 40%; }
.w-60 { --w: 60%; }
.w-72 { --w: 72%; }
.w-84 { --w: 84%; }
.w-88 { --w: 88%; }
.w-90 { --w: 90%; }
.w-94 { --w: 94%; }
.w-96 { --w: 96%; }

/* Shown without JavaScript; a script hides it (site.js marks <html>). */
.has-js .js-hidden { display: none; }

/* Each sync state's detail is a wrapper, so it spaces its own paragraphs. */
.sync-detail > [data-sync-detail]:not(.js-hidden) { display: grid; gap: 8px; }
