/* ============================================================================
   MORPH — styles.css
   Single source of truth for usemorph.xyz (landing · docs · dashboard).

   DIRECTION: "CLEANROOM" — dark, precision-luxury, spec-sheet rigor.
   A sealed cleanroom rebuilt as a technical spec sheet. Structure comes from
   hairlines (not shadows), one rationed clinical-mint accent that means
   "verified / safe / confirm" (the product's whole claim), mono type used as a
   LABELING SYSTEM (section numbering, metadata, DSL specimens), near-black that
   never hits #000, and exactly one choreographed load. No gradient blobs, no
   glassmorphism, no emoji icons, no purple.

   Fonts (loaded per-page via Google Fonts — see DESIGN.md):
     Display : Schibsted Grotesk  (tight, cool grotesque — headlines/marks)
     Body    : Hanken Grotesk     (warm technical grotesque — prose/UI)
     Mono    : IBM Plex Mono      (every DSL fragment + micro-label)

   TABLE OF CONTENTS
     1.  Design tokens (color, type, space, radius, shadow, motion)
     2.  Reset + base elements
     3.  Layout: container, seam, grids, sections
     4.  Background atmosphere (grid, dots, grain, glow)
     5.  Type utilities: eyebrow, index, meta, kbd, badge, stat, rules
     6.  Buttons
     7.  Navigation
     8.  Hero
     9.  Cards (feature / capability / pillar / trust / doc-track)
     10. Device frame + DSL specimen
     11. Code block + syntax tokens
     12. Docs shell (sidebar + prose + on-this-page TOC)
     13. Prose elements (headings, lists, tables, callouts, blockquote)
     14. Forms + dashboard (fields, tabs, switch, key-rows, pills, toast, panel)
     15. Footer
     16. Motion utilities (load rise, hover lift, link underline) + a11y guard
     17. Responsive collapse
   ============================================================================ */


/* ============================================================================
   1. DESIGN TOKENS
   ============================================================================ */
:root {
  color-scheme: dark;

  /* --- Color: dark is the primary identity ------------------------------- */
  --bg:            #0B0C0E;   /* near-black, faint blue cast — never #000 */
  --bg-2:          #0E0F12;   /* raised base / body gradient floor */
  --surface:       #131417;   /* cards, code, inputs */
  --surface-2:     #191B1F;   /* nested / raised surface */
  --surface-3:     #202329;   /* hover fill */

  --text:          #EDEEEA;   /* primary — never #fff */
  --text-2:        #9A9E98;   /* secondary workhorse */
  --text-3:        #63675F;   /* tertiary / captions / disabled */

  --hairline:      rgba(255,255,255,.09);  /* the primary structural device */
  --hairline-2:    rgba(255,255,255,.16);  /* hover / emphasis edge */
  --hairline-solid:#22262B;                /* opaque variant for crisp seams */

  /* One rationed accent: a colder, clinical evolution of the brand mint.
     Held to < ~8% of any surface. = "verified / active cursor / confirm". */
  /* Monochrome: no hue. Emphasis comes from contrast + weight, not color. */
  --accent:        #F4F5F2;   /* accent == foreground white on dark */
  --accent-2:      #C7C9C4;   /* gradient floor */
  --accent-ink:    #0B0C0E;   /* text sitting ON accent (white) fills */
  --accent-dim:    rgba(255,255,255,.08);  /* tints, callout wash */
  --accent-line:   rgba(255,255,255,.30);  /* accent hairline / focus */

  /* Functional status — grayscale; danger keeps a restrained red for form
     errors only (never green, never on the landing page). */
  --ok:            #E6E8E3;
  --warn:          #CDCFCA;
  --danger:        #F2777A;
  --ok-dim:        rgba(255,255,255,.08);
  --warn-dim:      rgba(255,255,255,.06);
  --danger-dim:    rgba(242,119,122,.12);

  /* Syntax palette — grayscale only */
  --tok-comment:   #6A6E68;
  --tok-kw:        #F0F1EE;
  --tok-str:       #C3C6C0;
  --tok-fn:        #DBDDD8;
  --tok-num:       #B4B7B1;
  --tok-attr:      #A4A7A1;
  --tok-punct:     #7E837B;

  /* --- Type families ----------------------------------------------------- */
  --font-display: "Schibsted Grotesk", "Hanken Grotesk", system-ui, sans-serif;
  --font-body:    "Hanken Grotesk", system-ui, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* --- Modular type scale (fluid; big jumps so hierarchy leads) ---------- */
  --step--1: 0.8125rem;                          /* 13px — mono labels/small */
  --step-0:  1.0625rem;                          /* 17px — body */
  --step-1:  1.25rem;                            /* 20px */
  --step-2:  1.5rem;                             /* 24px */
  --step-3:  clamp(1.75rem, 1.3rem + 1.8vw, 2.25rem);   /* section titles */
  --step-4:  clamp(2.25rem, 1.5rem + 3vw, 3.25rem);     /* big */
  --step-5:  clamp(2.75rem, 1.4rem + 5.6vw, 4.75rem);   /* hero display */

  --lh-tight: 1.04;
  --lh-snug:  1.28;
  --lh-body:  1.65;

  /* --- Spacing scale ----------------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --sp-9: 6rem;
  --section: clamp(4rem, 3rem + 6vw, 8rem);      /* vertical section rhythm */
  --measure: 68ch;                               /* hard cap on prose line */

  /* --- Radius: architectural / precise (small, deliberate) --------------- */
  --r-1: 3px;
  --r-2: 6px;
  --r-3: 10px;
  --r-pill: 999px;

  /* --- Shadow: used sparingly; lines do the work ------------------------- */
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lit: inset 0 1px 0 rgba(255,255,255,.08);   /* "lit from within" */
  --shadow-hero: 0 40px 90px -30px rgba(0,0,0,.7);

  /* --- Motion ------------------------------------------------------------ */
  --ease: cubic-bezier(.2,.7,.2,1);
  --fast: 140ms;
  --med:  240ms;

  /* --- Layout ------------------------------------------------------------ */
  --maxw: 1180px;
  --maxw-prose: 760px;
  --nav-h: 60px;
}

/* --- Light theme: deliberate, from the same tokens ("cleanroom, lit") ---- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:            #F7F8F6;
  --bg-2:          #FBFBFA;
  --surface:       #FFFFFF;
  --surface-2:     #F1F2EF;
  --surface-3:     #E9EBE6;

  --text:          #14161A;
  --text-2:        #565A54;
  --text-3:        #8B8F86;

  --hairline:      rgba(0,0,0,.10);
  --hairline-2:    rgba(0,0,0,.18);
  --hairline-solid:#DCDED7;

  --accent:        #131417;   /* accent == near-black on paper */
  --accent-2:      #34383C;
  --accent-ink:    #FFFFFF;    /* white text on black accent fills */
  --accent-dim:    rgba(0,0,0,.06);
  --accent-line:   rgba(0,0,0,.28);

  --ok:            #4A4E53;
  --warn:          #6B6F67;
  --danger:        #B23A32;
  --ok-dim:        rgba(0,0,0,.05);
  --warn-dim:      rgba(0,0,0,.04);
  --danger-dim:    rgba(178,58,50,.10);

  --tok-comment:   #8A8F86;
  --tok-kw:        #131417;
  --tok-str:       #4A4E53;
  --tok-fn:        #2C2F33;
  --tok-num:       #5A5E63;
  --tok-attr:      #3A3D42;
  --tok-punct:     #6B6F67;

  --shadow-hero: 0 30px 70px -30px rgba(0,0,0,.25);
  --shadow-lit: inset 0 1px 0 rgba(255,255,255,.7);
}

/* Honour OS preference when no explicit toggle is set */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg:#F7F8F6; --bg-2:#FBFBFA; --surface:#FFFFFF; --surface-2:#F1F2EF; --surface-3:#E9EBE6;
    --text:#14161A; --text-2:#565A54; --text-3:#8B8F86;
    --hairline:rgba(0,0,0,.10); --hairline-2:rgba(0,0,0,.18); --hairline-solid:#DCDED7;
    --accent:#131417; --accent-2:#34383C; --accent-ink:#FFFFFF;
    --accent-dim:rgba(0,0,0,.06); --accent-line:rgba(0,0,0,.28);
    --ok:#4A4E53; --warn:#6B6F67; --danger:#B23A32;
    --ok-dim:rgba(0,0,0,.05); --warn-dim:rgba(0,0,0,.04); --danger-dim:rgba(178,58,50,.10);
    --tok-comment:#8A8F86; --tok-kw:#131417; --tok-str:#4A4E53; --tok-fn:#2C2F33;
    --tok-num:#5A5E63; --tok-attr:#3A3D42; --tok-punct:#6B6F67;
    --shadow-hero:0 30px 70px -30px rgba(0,0,0,.25); --shadow-lit:inset 0 1px 0 rgba(255,255,255,.7);
  }
}


/* ============================================================================
   2. RESET + BASE
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  text-underline-offset: 0.18em;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 420;
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05" 1;   /* Hanken lowercase l fix, harmless elsewhere */
  position: relative;
  overflow-x: hidden;
}

img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
svg { fill: currentColor; }

/* Scrollbars: token-colored everywhere (the OS default gray track breaks the
   surfaces), thin on internal panels. scrollbar-color inherits from html. */
html { scrollbar-color: var(--surface-3) transparent; }
.docs-nav, .toc, .code pre, .table-wrap, .app-side, .textarea { scrollbar-width: thin; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: var(--lh-snug);
  letter-spacing: -0.02em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--step-5); line-height: var(--lh-tight); letter-spacing: -0.035em; font-weight: 620; }
h2 { font-size: var(--step-3); letter-spacing: -0.025em; }
h3 { font-size: var(--step-1); letter-spacing: -0.015em; }

p { color: var(--text-2); }
p strong, strong { color: var(--text); font-weight: 600; }

a { color: var(--accent); text-decoration: none; transition: color var(--fast) var(--ease); }
a:hover { color: var(--text); }

ul, ol { padding-left: 1.15em; }
li { color: var(--text-2); }

hr { border: 0; border-top: 1px solid var(--hairline); margin: var(--sp-6) 0; }

::selection { background: var(--accent-dim); color: var(--text); }

/* Designed focus ring (identity, not just a11y) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }

/* Inline code */
:not(pre) > code, .code-inline {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.12em 0.4em;
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip-to-content — hidden until keyboard focus */
.skip-link {
  position: absolute; left: var(--sp-4); top: calc(-1 * var(--sp-9)); z-index: 200;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem; font-weight: 560;
  color: var(--accent-ink); background: var(--accent);
  border-radius: var(--r-2);
  transition: top var(--fast) var(--ease);
}
.skip-link:focus-visible { top: var(--sp-3); color: var(--accent-ink); }


/* ============================================================================
   3. LAYOUT — container, seam, grids, sections
   ============================================================================ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}
.container--wide { max-width: 1320px; }
.container--narrow { max-width: 920px; }

/* Section rhythm — vary density with the modifiers, don't uniform-pad. */
.section { padding-block: var(--section); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 2rem + 3vw, 4rem); }
.section--flush-top { padding-top: 0; }
.section + .section { border-top: 1px solid var(--hairline); }  /* hairline pacing */

/* THE SEAM — Cleanroom's signature. An asymmetric 2-col lockup hung off a
   single full-height hairline (the DSL boundary / sealed edge). Content sits
   in cols; the rule is inert until an interactive child lights it. */
.seam {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  align-items: start;
  position: relative;
}
.seam::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--sp-5)); bottom: calc(-1 * var(--sp-5));
  left: calc(50% - 0.5px);
  width: 1px;
  background: var(--hairline);
  pointer-events: none;
}
.seam--reverse { grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); }

/* General grids */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* Editorial 12-col lockup for asymmetric marketing sections */
.editorial { display: grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap: clamp(1rem,3vw,2rem); align-items: start; }
.col-lede { grid-column: 1 / 7; }
.col-art  { grid-column: 7 / -1; }

.stack { display: flex; flex-direction: column; }
.stack-2 { gap: var(--sp-2); } .stack-3 { gap: var(--sp-3); }
.stack-4 { gap: var(--sp-4); } .stack-5 { gap: var(--sp-5); } .stack-6 { gap: var(--sp-6); }
.row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }


/* ============================================================================
   4. BACKGROUND ATMOSPHERE — hairline grid, dots, grain, glow.
   Applied on <body> by default: a felt (not seen) column grid + fine grain.
   Opt into a hero glow with .glow. All fixed/pointer-events:none.
   ============================================================================ */

/* Faint full-bleed column grid — signals the page is built on a grid. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--hairline) 1px, transparent 1px);
  background-size: 80px 100%;
  -webkit-mask: linear-gradient(180deg, #000, transparent 70%);
          mask: linear-gradient(180deg, #000, transparent 70%);
  opacity: 0.5;
}

/* Fine film grain — the tactile "why does theirs look expensive" layer. */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
:root[data-theme="light"] body::after,
:root:not([data-theme="dark"]) body::after { mix-blend-mode: multiply; opacity: 0.035; }

/* Keep real content above the atmosphere */
body > * { position: relative; z-index: 1; }

/* Tasteful single-hue glow, bleeding from one corner. Add to a section. */
.glow { position: relative; }
.glow::before {
  content: "";
  position: absolute; z-index: -1; pointer-events: none;
  top: -18%; left: 8%; width: 60%; height: 60%;
  background: radial-gradient(55% 55% at 30% 20%, var(--accent-dim), transparent 70%);
  filter: blur(90px);
}

/* Utility background textures for panels */
.bg-dots {
  background-image: radial-gradient(var(--hairline) 1px, transparent 1px);
  background-size: 22px 22px;
}
.bg-grid {
  background-image:
    linear-gradient(var(--hairline) 1px, transparent 1px),
    linear-gradient(to right, var(--hairline) 1px, transparent 1px);
  background-size: 32px 32px;
}


/* ============================================================================
   5. TYPE UTILITIES — eyebrow, index, meta, kbd, badge, stat, rules
   Mono is a LABELING SYSTEM here, not just for code.
   ============================================================================ */

/* Uppercase mono eyebrow — loosen tracking so it doesn't smear */
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-2);
}
.eyebrow::before {   /* short accent tick that anchors the label */
  content: ""; width: 1.4em; height: 1px; background: var(--accent); flex: none;
}
.eyebrow--plain::before { display: none; }

/* Numbered section index — "01 · TRANSFORM" spec-sheet numbering */
.index {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.index b, .index .n { color: var(--accent); font-weight: 500; }

/* Generic mono metadata (versions, regions, footnotes) */
.meta {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.dim { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums lining-nums; }

/* Section head block (eyebrow + title + lead) */
.section-head { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 46ch; margin-bottom: var(--sp-7); }
.section-head--wide { max-width: 62ch; }
.section-title { font-size: var(--step-3); }
.section-lead { font-size: var(--step-1); color: var(--text-2); line-height: var(--lh-snug); max-width: var(--measure); text-wrap: pretty; }

/* Lede paragraph (hero/intro body) */
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--text-2); max-width: 52ch; }

/* kbd — physical keycap */
kbd, .kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1;
  padding: 0.32em 0.5em;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-bottom-width: 2px;
  border-radius: var(--r-2);
  box-shadow: var(--shadow-lit);
  vertical-align: middle;
}

/* Badge — status only, styled as part of the type system (no candy pill) */
.badge {
  display: inline-flex; align-items: center; gap: 0.45em;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.3em 0.6em;
  border: 1px solid var(--hairline);
  border-radius: var(--r-1);
  color: var(--text-2);
  background: var(--surface);
}
.badge--accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-dim); }
.badge--warn { color: var(--text-2); border-color: var(--hairline-2); background: var(--surface-2); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* Oversized numerals / stats as graphic anchors */
.stat { display: flex; flex-direction: column; gap: var(--sp-1); }
.stat-num {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-num .unit { color: var(--accent); }
.stat-label { font-family: var(--font-mono); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }

/* Rules / dividers */
.rule { height: 1px; background: var(--hairline); border: 0; width: 100%; }
.rule--accent { background: var(--accent); }
.divider { border-top: 1px solid var(--hairline); }


/* ============================================================================
   6. BUTTONS
   ============================================================================ */
.btn {
  --_pad-y: 0.62rem; --_pad-x: 1.05rem;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 560;
  line-height: 1;
  padding: var(--_pad-y) var(--_pad-x);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  color: var(--text);
  background: var(--surface-2);
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              background var(--fast) var(--ease),
              color var(--fast) var(--ease);
  box-shadow: var(--shadow-lit), var(--shadow-1);
}
.btn:hover { transform: translateY(-1px); border-color: var(--hairline-2); background: var(--surface-3); color: var(--text); }
.btn:active { transform: translateY(0); }

/* Primary — solid accent, "lit from within", crisp (no glow/arrow-slide) */
.btn--primary {
  color: var(--accent-ink);
  background: linear-gradient(var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.4);
}
.btn--primary:hover { color: var(--accent-ink); background: var(--accent); border-color: transparent; }

/* Secondary — bordered on surface */
.btn--secondary { background: var(--surface-2); }

/* Ghost — text-only until hover */
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--hairline); color: var(--text); }

.btn--sm { --_pad-y: 0.42rem; --_pad-x: 0.75rem; font-size: 0.85rem; }
.btn--lg { --_pad-y: 0.8rem; --_pad-x: 1.4rem; font-size: 1.02rem; }
.btn--block { display: flex; width: 100%; }
.btn--mono { font-family: var(--font-mono); font-weight: 500; letter-spacing: -0.01em; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }


/* ============================================================================
   7. NAVIGATION — sticky, hairline-ruled, blurred
   ============================================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
          backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  height: var(--nav-h);
  display: flex; align-items: center; gap: var(--sp-5);
}
.nav-brand {
  display: inline-flex; align-items: center; gap: 0.55em;
  font-family: var(--font-display); font-weight: 620; font-size: 1.05rem;
  letter-spacing: -0.03em; color: var(--text);
}
.nav-brand:hover { color: var(--text); }
.logo {
  width: 26px; height: 26px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-2);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  font-family: var(--font-mono); font-weight: 700; font-size: 15px;
  color: var(--accent);
}
.nav-links { display: flex; align-items: center; gap: var(--sp-2); margin-left: var(--sp-5); }
.nav-link {
  font-size: 0.92rem; color: var(--text-2); padding: 0.4rem 0.7rem; border-radius: var(--r-2);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"] { color: var(--text); }
.nav-spacer { flex: 1 1 auto; }
.nav-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* Mobile toggle (hidden on desktop) */
.nav-toggle { display: none; }

/* Secondary nav CTA drops on narrow viewports so the bar never crowds */
@media (max-width: 640px) { .nav-cta-2 { display: none; } }


/* ============================================================================
   8. HERO — asymmetric lockup, code/media as hero, ~60% breathing room
   ============================================================================ */
.hero { padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem) clamp(2.5rem, 2rem + 2.5vw, 4rem); position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 4.5rem);
  align-items: center;
}
.hero-copy { display: flex; flex-direction: column; gap: var(--sp-5); max-width: 38rem; }
.hero-title { font-size: clamp(2rem, 1.2rem + 2.2vw, 2.5rem); line-height: 1.1; letter-spacing: -0.03em; }
.hero-title .accent {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
}
.hero-deck { font-size: var(--step-1); line-height: 1.45; color: var(--text-2); max-width: 42ch; text-wrap: pretty; }
.hero-actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-2); }
.hero-meta { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-3); }
.hero-media { position: relative; }

/* Cursor-reactive accent spotlight (JS sets --mx/--my). One surface only. */
.spotlight { position: relative; }
.spotlight::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--accent-dim), transparent 62%);
  opacity: 0; transition: opacity var(--med) var(--ease);
}
.spotlight:hover::after { opacity: 1; }


/* ============================================================================
   9. CARDS — feature / capability / pillar / trust / doc-track
   Vary weight + size; don't ship 3 identical boxes. Structure from lines.
   ============================================================================ */
.card {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.card--interactive:hover { border-color: var(--hairline-2); transform: translateY(-2px); }
.card-index { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.card-title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 560; letter-spacing: -0.015em; color: var(--text); }
.card-body { font-size: 0.98rem; color: var(--text-2); line-height: 1.55; text-wrap: pretty; }

/* A mono "mark" replaces generic lucide icons: a small ruled glyph slot. */
.card-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  background: var(--surface-2);
  font-family: var(--font-mono); font-size: 15px; color: var(--accent);
}

/* Lead feature: one large, others secondary (breaks the equal-3 slop) */
.card--lead { padding: var(--sp-6); gap: var(--sp-4); background: var(--surface); }
.card--lead .card-title { font-size: var(--step-2); }

/* Trust / pillar: accent left-edge encodes "featured/secure" (no gradient ring) */
.card--pillar { border-left: 2px solid var(--accent); }

/* Doc-track card (links into /docs sections) */
.card--doc { }
.card--doc .card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.card--doc .card-title::after { content: "→"; color: var(--text-3); font-family: var(--font-mono); transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
.card--doc:hover .card-title::after { transform: translateX(3px); color: var(--accent); }

/* Feature grid list rows (dense, hairline-separated alternative to cards) */
.feature-rows { border: 1px solid var(--hairline); border-radius: var(--r-3); overflow: hidden; background: var(--surface); }
.feature-row { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-5); }
.feature-row + .feature-row { border-top: 1px solid var(--hairline); }


/* ============================================================================
   10. DEVICE FRAME + DSL SPECIMEN
   Show the product flat & legible (no 15° tilt). The frame is a UI object.
   ============================================================================ */
.frame {
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-hero);
}
.frame-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}
.frame-dots { display: flex; gap: 6px; flex: none; }
.frame-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--hairline); }
.frame-url {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.frame-top-accent { height: 2px; background: var(--accent); }   /* Cleanroom accent top-hairline */
.frame-body { display: block; }
.frame-body img, .frame-body video { width: 100%; display: block; }
.frame-caption { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-3); margin-top: var(--sp-3); letter-spacing: 0.04em; }

/* Annotated DSL specimen — spec-sheet proof of "declarative JSON only".
   Real code with mono side-notes + a thin accent leader (the redline idea,
   recolored to the brand accent). */
.specimen { position: relative; }
.specimen .anno {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--accent);
  letter-spacing: 0.03em;
  border-left: 2px solid var(--accent-line); padding-left: var(--sp-3);
}
.anno-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.anno-list li { color: var(--text-2); font-size: 0.85rem; padding-left: var(--sp-4); position: relative; }
.anno-list li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 8px; height: 1px; background: var(--accent); }


/* ============================================================================
   11. CODE BLOCK + SYNTAX TOKENS — crafted, filename header, copy affordance
   ============================================================================ */
.code {
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
  overflow: hidden;
  background: var(--surface);
  font-family: var(--font-mono);
  box-shadow: var(--shadow-1);
}
.code--hero { box-shadow: var(--shadow-hero); }
.code-head {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.6rem 0.9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
}
.code-dots { display: flex; gap: 6px; }
.code-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 1px solid var(--hairline); }
.code-name { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-2); letter-spacing: 0.03em; }
.code-lang { margin-left: auto; font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.code-copy {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--text-3); background: transparent; border: 1px solid transparent;
  padding: 0.2rem 0.45rem; border-radius: var(--r-1); cursor: pointer;
  opacity: 0; transition: opacity var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.code-lang + .code-copy { margin-left: var(--sp-2); }
.code:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--accent); border-color: var(--hairline); }
.code pre {
  margin: 0; padding: var(--sp-5);
  font-size: 0.82rem; line-height: 1.75; tab-size: 2;
  color: var(--text); overflow-x: auto;
}
.code pre code { font-size: inherit; padding: 0; border: 0; background: none; white-space: pre; }

/* Optional gutter (line numbers) */
.code--gutter pre { padding-left: 0; }
.code .ln { display: inline-block; width: 2.5em; margin-right: 1em; text-align: right; color: var(--text-3); user-select: none; }

/* Command block with $ gutter */
.code--cmd pre::before { content: "$ "; color: var(--accent); }

/* Syntax token classes */
.tok-comment { color: var(--tok-comment); font-style: italic; }
.tok-kw      { color: var(--tok-kw); }
.tok-str     { color: var(--tok-str); }
.tok-fn      { color: var(--tok-fn); }
.tok-num     { color: var(--tok-num); }
.tok-attr    { color: var(--tok-attr); }
.tok-punct   { color: var(--tok-punct); }
.tok-op      { color: var(--tok-punct); }


/* ============================================================================
   12. DOCS SHELL — sidebar nav / prose / on-this-page TOC (3-col)
   ============================================================================ */
.docs {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 200px;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: start;
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
  padding-block: var(--sp-8);
}

/* Left: section nav */
.docs-nav {
  position: sticky; top: calc(var(--nav-h) + var(--sp-4));
  align-self: start; max-height: calc(100vh - var(--nav-h) - var(--sp-6));
  overflow-y: auto; font-size: 0.9rem;
  padding-right: var(--sp-3);
}
.docs-nav-group { margin-bottom: var(--sp-5); }
.docs-nav-title { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); margin-bottom: var(--sp-2); }
.docs-nav-link {
  display: block; padding: 0.32rem 0 0.32rem 0.8rem;
  color: var(--text-2); border-left: 2px solid var(--hairline);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.docs-nav-link:hover { color: var(--text); border-color: var(--hairline-2); }
.docs-nav-link[aria-current="page"] { color: var(--text); border-color: var(--accent); }

/* Right: on-this-page */
.toc {
  position: sticky; top: calc(var(--nav-h) + var(--sp-4));
  align-self: start; max-height: calc(100vh - var(--nav-h) - var(--sp-6));
  overflow-y: auto; font-size: 0.82rem;
}
.toc-title { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); margin-bottom: var(--sp-3); }
.toc-link {
  display: block; padding: 0.25rem 0 0.25rem 0.75rem;
  color: var(--text-3); border-left: 2px solid transparent;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.toc-link:hover { color: var(--text-2); }
.toc-link[aria-current="true"] { color: var(--text); border-color: var(--accent); }
.toc-link--sub { padding-left: 1.5rem; }

/* Center: prose column with capped measure */
.docs-main { min-width: 0; }


/* ============================================================================
   13. PROSE — headings rhythm, lists, tables, callouts, blockquote
   ============================================================================ */
.prose { max-width: var(--maxw-prose); color: var(--text); font-size: 1rem; line-height: var(--lh-body); }
.prose > * + * { margin-top: 1.1em; }

.prose h1 { font-size: var(--step-4); margin-top: 0; }
.prose h2 {
  font-size: 1.5rem; letter-spacing: -0.02em; margin-top: 2.4em;
  scroll-margin-top: calc(var(--nav-h) + var(--sp-5));
  padding-bottom: 0.35em; border-bottom: 1px solid var(--hairline);
}
.prose h3 { font-size: 1.15rem; margin-top: 1.9em; scroll-margin-top: calc(var(--nav-h) + var(--sp-5)); }
.prose :is(h2, h3) + * { margin-top: 0.7em; }
.prose p { color: var(--text-2); }
/* Monochrome: links are marked by an underline (color no longer distinguishes them) */
.prose a { color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-decoration-thickness: 1px; text-underline-offset: 0.18em; transition: text-decoration-color var(--fast) var(--ease); }
.prose a:hover { color: var(--text); text-decoration-color: var(--text); }
.prose ul, .prose ol { color: var(--text-2); padding-left: 1.3em; }
.prose li { margin-top: 0.4em; }
.prose li::marker { color: var(--text-3); }
.prose ul li::marker { content: "– "; }
.prose strong { color: var(--text); }
.prose img, .prose .frame, .prose .code { margin-block: 1.6em; }

/* Crafted table — hairline rules, mono headers, tabular figures */
.table, .prose table {
  width: 100%; border-collapse: collapse;
  font-size: 0.92rem; margin-block: 1.6em;
}
.table :is(th, td), .prose table :is(th, td) {
  text-align: left; padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}
.table thead th, .prose table thead th {
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3);
  border-bottom-color: var(--hairline-2);
}
.table td, .prose table td { color: var(--text-2); }
.table td.num, .table .num { font-variant-numeric: tabular-nums lining-nums; text-align: right; }
.table tbody tr:hover td { background: var(--surface); }
.table--framed { border: 1px solid var(--hairline); border-radius: var(--r-3); overflow: hidden; }
.table-wrap { overflow-x: auto; }   /* wrap wide tables so body never scrolls */

/* Callout / admonition — accent bar + mono kind label, from the same tokens */
.callout {
  --_c: var(--accent);
  display: grid; grid-template-columns: auto 1fr; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--_c);
  border-radius: var(--r-2);
  background: color-mix(in oklab, var(--_c) 7%, transparent);
  margin-block: 1.6em;
}
.callout-kind {
  font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--_c); grid-row: 1; align-self: start; padding-top: 0.15em;
}
.callout-body { color: var(--text-2); font-size: 0.95rem; }
.callout-body :is(p, ul) { color: var(--text-2); }
.callout-body > * + * { margin-top: 0.5em; }
.callout--info { --_c: var(--accent); }
.callout--warn { --_c: var(--warn); }
.callout--danger { --_c: var(--danger); }

.prose blockquote {
  border-left: 3px solid var(--hairline-2);
  padding-left: var(--sp-4); color: var(--text-2);
  font-style: normal;
}

/* Prev/next docs footer */
.doc-pager { display: flex; justify-content: space-between; gap: var(--sp-4); margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--hairline); }
.doc-pager a { display: flex; flex-direction: column; gap: 0.2em; color: var(--text-2); }
.doc-pager .meta { color: var(--text-3); }


/* ============================================================================
   14. FORMS + DASHBOARD — fields, tabs, switch, key-rows, pills, toast, panel
   The app = the marketing site with live data poured in (same 4 tones + accent).
   ============================================================================ */

/* Panel — the dashboard surface unit */
.panel {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-3);
  overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--hairline);
  background: var(--surface-2);
}
.panel-title { font-family: var(--font-display); font-size: 1rem; font-weight: 560; letter-spacing: -0.01em; color: var(--text); }
.panel-body { padding: var(--sp-5); }
.panel-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--hairline); background: var(--surface-2); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* Field */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field + .field { margin-top: var(--sp-5); }
.label { font-size: 0.85rem; font-weight: 560; color: var(--text); }
.label .req { color: var(--accent); }
.hint { font-size: 0.8rem; color: var(--text-3); }
.field-error { font-size: 0.8rem; color: var(--danger); font-family: var(--font-mono); }

.input, .textarea, .select {
  width: 100%;
  font-family: var(--font-body); font-size: 0.95rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-2);
  padding: 0.6rem 0.75rem;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input--mono { font-family: var(--font-mono); font-size: 0.88rem; }
.textarea { resize: vertical; min-height: 6rem; line-height: 1.55; }
.select { appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%239A9E98' stroke-width='1.4'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center; background-size: 12px;
}
.field--invalid .input, .field--invalid .textarea { border-color: var(--danger); }

/* Input with inline addon (e.g. copyable API key) */
.input-group { display: flex; align-items: stretch; gap: 0; }
.input-group .input { border-radius: var(--r-2) 0 0 var(--r-2); border-right: 0; }
.input-group .btn { border-radius: 0 var(--r-2) var(--r-2) 0; }

/* Tabs */
.tabs { display: flex; gap: 0.2rem; border-bottom: 1px solid var(--hairline); }
.tab {
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 500;
  color: var(--text-2); background: none; border: 0; cursor: pointer;
  padding: 0.6rem 0.9rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { padding-top: var(--sp-5); }

/* Toggle switch (wrap a checkbox) */
.switch { display: inline-flex; align-items: center; gap: var(--sp-3); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 40px; height: 23px; flex: none; border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--hairline);
  position: relative; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.switch-thumb {
  position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--text-2); box-shadow: var(--shadow-1);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.switch input:checked + .switch-track { background: var(--accent); border-color: transparent; }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(17px); background: var(--accent-ink); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-label { font-size: 0.9rem; color: var(--text); }

/* Key-value rows (settings / metadata list) */
.keyrows { border: 1px solid var(--hairline); border-radius: var(--r-3); overflow: hidden; }
.keyrow { display: grid; grid-template-columns: 180px 1fr auto; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-5); }
.keyrow + .keyrow { border-top: 1px solid var(--hairline); }
.keyrow-k { font-size: 0.9rem; color: var(--text-2); }
.keyrow-v { font-family: var(--font-mono); font-size: 0.85rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.keyrow-action { justify-self: end; }

/* Status pill (mono, functional colors only) */
.pill {
  display: inline-flex; align-items: center; gap: 0.4em;
  font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.24em 0.55em; border-radius: var(--r-1);
  border: 1px solid var(--hairline); color: var(--text-2); background: var(--surface);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok { color: var(--text); border-color: var(--hairline-2); background: var(--surface-2); }
.pill--pending { color: var(--text-2); border-color: var(--hairline-2); background: var(--surface-2); }
.pill--danger { color: var(--danger); border-color: var(--danger-dim); background: var(--danger-dim); }

/* Toast */
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); border: 1px solid var(--hairline);
  border-left: 3px solid var(--accent); border-radius: var(--r-2);
  color: var(--text); font-size: 0.9rem; box-shadow: var(--shadow-hero);
}
.toast--ok { border-left-color: var(--ok); }
.toast--warn { border-left-color: var(--warn); }
.toast--danger { border-left-color: var(--danger); }
.toast-close { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; font-family: var(--font-mono); }
.toast-stack { position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 200; display: flex; flex-direction: column; gap: var(--sp-3); max-width: min(360px, calc(100vw - 2rem)); }

/* Empty state (written in the mono micro-label voice) */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; padding: var(--sp-8) var(--sp-5); color: var(--text-3); }
.empty .meta { color: var(--text-3); }

/* Dashboard app shell (sidebar + main) */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.app-side { border-right: 1px solid var(--hairline); padding: var(--sp-5); position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto; background: var(--bg-2); }
.app-main { min-width: 0; padding: var(--sp-6) clamp(1.25rem, 4vw, 2.5rem); }
.app-nav-link { display: flex; align-items: center; gap: var(--sp-3); padding: 0.5rem 0.7rem; border-radius: var(--r-2); color: var(--text-2); font-size: 0.92rem; }
.app-nav-link:hover { background: var(--surface); color: var(--text); }
.app-nav-link[aria-current="page"] { background: var(--surface-2); color: var(--text); }


/* ============================================================================
   15. FOOTER
   ============================================================================ */
.footer { border-top: 1px solid var(--hairline); padding-block: var(--sp-8) var(--sp-7); margin-top: var(--sp-8); }
.footer-inner { max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.25rem, 5vw, 2.5rem); display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: var(--sp-6); }
.footer-brand { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 30ch; }
.footer-col { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-col-title { font-family: var(--font-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); margin-bottom: var(--sp-2); }
.footer-link { color: var(--text-2); font-size: 0.9rem; }
.footer-link:hover { color: var(--text); }
.footer-meta { max-width: var(--maxw); margin: var(--sp-7) auto 0; padding-inline: clamp(1.25rem, 5vw, 2.5rem); display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.footer-meta .meta { color: var(--text-3); }


/* ============================================================================
   16. MOTION UTILITIES — one orchestrated load, then calm. a11y guard.
   ============================================================================ */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.rise { animation: rise 0.7s var(--ease) both; }
/* Stagger direct children of a .rise-group on load */
.rise-group > * { animation: rise 0.7s var(--ease) both; }
.rise-group > *:nth-child(1) { animation-delay: 0.02s; }
.rise-group > *:nth-child(2) { animation-delay: 0.10s; }
.rise-group > *:nth-child(3) { animation-delay: 0.18s; }
.rise-group > *:nth-child(4) { animation-delay: 0.26s; }
.rise-group > *:nth-child(5) { animation-delay: 0.34s; }
.rise-group > *:nth-child(6) { animation-delay: 0.42s; }

/* Hover lift (small, single curve) */
.lift { transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease); }
.lift:hover { transform: translateY(-2px); }

/* Animated link underline */
.u {
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size var(--fast) var(--ease);
}
.u:hover { background-size: 100% 1px; }

/* Blinking mono caret for terminal/DSL moments */
.caret::after { content: "▍"; color: var(--accent); animation: blink 1.1s steps(1) infinite; margin-left: 0.05em; }
@keyframes blink { 50% { opacity: 0; } }

/* Scroll-reveal — sections rise once as they enter the viewport.
   Gated on .js (set in <head>) so content is never hidden without JS,
   and on prefers-reduced-motion so it collapses to static. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0; transform: translateY(14px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  }
  .js .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .rise, .rise-group > * { opacity: 1 !important; transform: none !important; }
}


/* ============================================================================
   17. RESPONSIVE — collapse cleanly to mobile
   ============================================================================ */
@media (max-width: 1080px) {
  .docs { grid-template-columns: 200px minmax(0, 1fr); }
  .toc { display: none; }   /* drop on-this-page first */
}

@media (max-width: 860px) {
  :root { --nav-h: 56px; }

  /* Nav collapses to brand + toggle; links become a stacked sheet */
  .nav-links { display: none; }
  .nav-toggle {
    display: inline-grid; place-items: center; width: 38px; height: 38px;
    background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--r-2);
    color: var(--text); cursor: pointer;
  }
  .nav[data-open="true"] .nav-links {
    display: flex; flex-direction: column; align-items: stretch; gap: var(--sp-1);
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg); border-bottom: 1px solid var(--hairline);
    padding: var(--sp-4) clamp(1.25rem, 5vw, 2.5rem); margin: 0;
  }

  /* Structural grids stack */
  .hero-grid, .seam, .seam--reverse { grid-template-columns: 1fr; }
  .seam::before { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .editorial { grid-template-columns: 1fr; }
  .col-lede, .col-art { grid-column: 1 / -1; }

  .hero-copy { max-width: none; }
  .docs { grid-template-columns: 1fr; padding-block: var(--sp-6); }
  .docs-nav { position: static; max-height: none; margin-bottom: var(--sp-5); padding-right: 0; border-bottom: 1px solid var(--hairline); padding-bottom: var(--sp-4); }

  /* Dashboard shell stacks */
  .app { grid-template-columns: 1fr; }
  .app-side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--hairline); }

  .footer-inner { grid-template-columns: 1fr 1fr; }
  .keyrow { grid-template-columns: 1fr; gap: var(--sp-2); }
  .keyrow-action { justify-self: start; }
}

@media (max-width: 520px) {
  .grid-2 { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 auto; }
}
