/* ===========================================================================
   KEEPVIDYA — site styles  (v3, premium / royal elevation)
   Built on keepvidya-theme.css tokens (light/dark via [data-theme] on <html>).
   Plain CSS, no build step. Mobile-first. WCAG 2.1 AA.

   Type is LOCKED: headings = Source Serif 4 (var(--font-heading)),
   body/UI = Source Sans 3 (var(--font-body)). Do not override the family.

   PREMIUM DIRECTION (research-driven — see report):
     · Whitespace is the luxury. Bigger section padding, larger margins,
       fewer elements per screen. Restraint reads as expensive.
       (Apple 80–120px sections · Family "gallery cadence" · Vercel "voids".)
     · Confident display type. Source Serif 4 at a dramatic scale, tight
       tracking (−0.02 to −0.03em) + generous leading on big headings.
       (Apple display ~3–4× body · Linear/Vercel "commanding proportions".)
     · One jewel accent. Copper used sparingly so each moment feels precious.
       (Linear's single teal · Stripe's single indigo.)
     · Hairlines over shadows. Flat, editorial separation; soft/no shadows.
     · Light = warm editorial paper. Dark = cinematic deep ink with a
       barely-there copper glow + lifted surfaces (NOT a flat invert).
       (2026 dark-mode guidance: warm-tonal canvas, 70–80% accent, glow.)
     · Slow, whispered motion. Long easings, subtle reveals; reduced-motion
       fully respected.

   Design-system layers:
     1. Design tokens (spacing scale · type scale · radius · layout · premium)
     2. Base / reset
     3. Layout primitives (.container, .section, .grid, rhythm helpers)
     4. Components (buttons, chips, cards, code window, header, footer)
     5. Home-page sections
     6. Responsive + motion preferences
   =========================================================================== */

/* =========================================================================
   1. DESIGN TOKENS   (color tokens come from keepvidya-theme.css)
   ========================================================================= */
:root {
  /* ---- Type families — alias the LOCKED brand tokens under local names.
     NB: never redefine --font-body in terms of itself (circular → breaks the
     cascade). The brand token --font-body (Source Sans 3) is used directly. ---- */
  --font-head: var(--font-heading);   /* Source Serif 4 */
  --font-ui:   var(--font-body);      /* Source Sans 3  */

  /* ---- Type scale (PREMIUM) ----
     Pushed to a confident editorial scale. Display H1 now reaches ~84px on
     wide screens (Apple/Linear "commanding proportions" — display ~3–4× body),
     H2 ~52px. Tracking is tightened on the big sizes (see h1/h2 rules) and
     leading kept generous so large serif type feels expensive, not cramped. */
  --fs-display: clamp(3.0rem, 1.9rem + 4.9vw, 5.25rem);   /* hero H1  ~48 → 84 */
  --fs-h1:      clamp(2.35rem, 1.7rem + 2.9vw, 3.6rem);   /*          ~38 → 58 */
  --fs-h2:      clamp(1.95rem, 1.5rem + 2.0vw, 3.05rem);  /*          ~31 → 49 */
  --fs-h3:      clamp(1.25rem, 1.1rem + 0.6vw, 1.6rem);   /*          ~20 → 26 */
  --fs-h4:      clamp(1.05rem, 0.98rem + 0.28vw, 1.2rem);
  --fs-lead:    clamp(1.18rem, 1.04rem + 0.6vw, 1.5rem);  /* sub-heads ~19 → 24 */
  --fs-body:    1.0625rem;   /* 17px */
  --fs-sm:      0.9375rem;   /* 15px */
  --fs-xs:      0.8125rem;   /* 13px */
  --fs-eyebrow: 0.76rem;

  /* ---- Spacing scale (8pt rhythm: 4·8·12·16·24·32·48·64·96·128·176) ---- */
  --space-1: 0.25rem;   /*   4 */
  --space-2: 0.5rem;    /*   8 */
  --space-3: 0.75rem;   /*  12 */
  --space-4: 1rem;      /*  16 */
  --space-5: 1.5rem;    /*  24 */
  --space-6: 2rem;      /*  32 */
  --space-7: 3rem;      /*  48 */
  --space-8: 4rem;      /*  64 */
  --space-9: 6rem;      /*  96 */
  --space-10: 8rem;     /* 128 */
  --space-11: 11rem;    /* 176 */

  /* Section vertical rhythm — premium but calm/dense (not stretched).
     Fluid ~64 → 104px. */
  --section-y: clamp(2.75rem, 2.2rem + 2vw, 4rem);
  --section-y-tight: clamp(2rem, 1.7rem + 1.4vw, 3rem);

  /* ---- Radius ---- */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* ---- Layout ---- */
  --maxw: 1240px;          /* container (research sweet-spot 1140–1280) */
  --maxw-text: 44rem;      /* ~64ch measure for prose blocks            */
  --maxw-narrow: 50rem;
  --maxw-prose: 38rem;     /* tighter measure for big centered leads    */
  --gutter: clamp(1.5rem, 0.6rem + 2.6vw, 3rem);   /* side padding 24→48 */
  --header-h: 72px;

  /* Wordmark tracking per brand guide (~0.13em) */
  --track-wordmark: 0.13em;

  /* Elevation — kept subtle; elevation reads by surface, not heavy shadow */
  --ring-1: 0 0 0 1px var(--border);

  /* ---- Premium details ----
     Hairline = the editorial divider. Copper glow = the cinematic accent
     (used only where it earns it). Both adapt per-theme just below. */
  --hairline: var(--border);
  --glow-copper: radial-gradient(60% 60% at 50% 0%,
                   color-mix(in srgb, var(--primary) 16%, transparent),
                   transparent 70%);

  /* Transitions — slower, whispered (premium motion is unhurried) */
  --t-fast: 180ms cubic-bezier(.22,.61,.18,1);
  --t:      320ms cubic-bezier(.22,.61,.18,1);
  --t-slow: 720ms cubic-bezier(.16,.84,.24,1);
}

/* Per-theme premium intensities.
   Dark mode leans into a deeper, warmer canvas + a more present copper glow
   so it reads cinematic rather than inverted. Light stays warm-editorial. */
[data-theme="dark"] {
  --glow-copper: radial-gradient(58% 56% at 50% 0%,
                   color-mix(in srgb, var(--primary) 26%, transparent),
                   transparent 72%);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-5));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--t), color var(--t);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.08;
  margin: 0 0 var(--space-4);
  color: var(--text);
  letter-spacing: -0.02em;
  text-wrap: balance;
}
/* Larger serif wants tighter tracking + a hair more leading to feel premium */
h1 { font-size: var(--fs-h1); letter-spacing: -0.028em; line-height: 1.05; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.026em; line-height: 1.07; }
h3 { font-size: var(--fs-h3); letter-spacing: -0.018em; }
h4 { font-size: var(--fs-h4); letter-spacing: -0.012em; }

p { margin: 0 0 var(--space-4); max-width: var(--maxw-text); }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

:not(pre) > code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.08em 0.4em;
  font-size: 0.86em;
  color: var(--text);
}

img, svg { max-width: 100%; height: auto; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

/* Visible focus for keyboard users everywhere */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Screen-reader-only utility */
.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 link */
.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -64px;
  z-index: 200;
  background: var(--primary);
  color: var(--on-primary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top var(--t-fast);
}
.skip-link:focus { top: var(--space-3); text-decoration: none; }

/* =========================================================================
   3. LAYOUT PRIMITIVES
   ========================================================================= */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-tight); }

/* Alternating surface band (used for products + blog) */
.section--band {
  background: var(--surface-2);
  border-block: 1px solid var(--border);
}

/* Section heading block — more air below the heading group (premium rhythm) */
.section-head { max-width: var(--maxw-narrow); margin-bottom: var(--space-6); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .lead { margin-top: var(--space-5); }
.section-head.center .lead { max-width: var(--maxw-prose); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.2em;     /* wider tracking reads refined */
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: var(--space-5);
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--primary);
  opacity: 0.55;
}
.section-head.center .eyebrow::after {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--primary);
  opacity: 0.55;
}

.lead {
  font-size: var(--fs-lead);
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: var(--maxw-text);
  font-weight: 400;
}
.section-head.center .lead { margin-inline: auto; }

/* Grids — roomier gutters between cards */
.grid { display: grid; gap: var(--space-6); }
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

/* =========================================================================
   4. COMPONENTS
   ========================================================================= */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  padding: 0.95rem 1.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--t-fast), border-color var(--t-fast),
              color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn--primary { background: var(--primary); color: var(--on-primary); }
/* Copper lifts on hover with a soft copper glow — the one jewel moment */
.btn--primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--primary) 34%, transparent);
  transform: translateY(-1px);
}
.btn--primary:active { background: var(--primary-active); transform: translateY(0); box-shadow: none; }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover {
  background: color-mix(in srgb, var(--text) 4%, transparent);
  border-color: var(--primary);
}

.btn--sm { padding: 0.55rem 0.95rem; font-size: var(--fs-xs); }
.btn .icon { width: 1.05em; height: 1.05em; flex: none; }

/* Text link with moving arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--primary);
}
.link-arrow .arrow { transition: transform var(--t-fast); }
.link-arrow:hover { text-decoration: none; }
.link-arrow:hover .arrow { transform: translateX(4px); }

/* ---- Status chips (live / roadmap) ---- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  padding: 0.28rem 0.7rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}
.chip--live { background: var(--primary); color: var(--on-primary); }
.chip--live .dot { background: var(--on-primary); }
.chip--next {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
}
.chip--next .dot { background: var(--text-muted); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* ---- Cards ----
   Premium = flatter & hairline-defined, not shadow-heavy. Generous padding.
   Hover is a quiet lift with a copper-tinted hairline, not a big shadow. */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: clamp(1.75rem, 1.2rem + 1.6vw, 2.5rem);
  transition: border-color var(--t), box-shadow var(--t),
              transform var(--t), background-color var(--t);
}
.card--link:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}
/* In dark, cards lift to a slightly warmer surface on hover for depth */
[data-theme="dark"] .card--link:hover {
  background: color-mix(in srgb, var(--surface) 88%, var(--primary) 5%);
}

/* Make a whole card clickable while keeping one real <a> for a11y */
.card--link .stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* Inline icon tile sizing for product marks */
.tile {
  width: 52px; height: 52px;
  border-radius: 13px;
  flex: none;
  box-shadow: var(--shadow-sm);
}

/* =========================================================================
   HEADER
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--header-h);
}

/* Brand lockup */
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--text);
  flex: none;
}
.brand:hover { text-decoration: none; }
.brand__mark { width: 28px; height: 36px; flex: none; }
.brand__word {
  font-family: var(--font-body);   /* wordmark = Source Sans 3, per guide */
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: var(--track-wordmark);
  color: var(--text);
}

/* Logo light/dark swap */
.theme-light-only { display: block; }
.theme-dark-only  { display: none; }
[data-theme="dark"] .theme-light-only { display: none; }
[data-theme="dark"] .theme-dark-only  { display: block; }

/* Primary nav */
.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: var(--space-1); }
.nav__link {
  display: inline-block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: color var(--t-fast), background-color var(--t-fast);
}
.nav__link:hover,
.nav__link[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}
.nav__link[aria-current="page"] { color: var(--primary); }

/* Header utility cluster */
.header-tools { display: flex; align-items: center; gap: var(--space-1); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--t-fast), background-color var(--t-fast),
              border-color var(--t-fast);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* Theme toggle shows sun in dark, moon in light */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle { display: none; }

/* =========================================================================
   5. HOME SECTIONS
   ========================================================================= */

/* ---- HERO ---------------------------------------------------------------
   Two columns: editorial copy (left) + a real product/code demo (right).
   The right column EARNS its place — it shows DOCNEST's zero-token answer,
   not a restated tagline. (Pattern: Resend/Stripe developer credibility.) */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(54% 48% at 82% 8%,
      color-mix(in srgb, var(--primary) 14%, transparent), transparent 72%);
  pointer-events: none;
  z-index: 0;
}
.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2rem, 1.4rem + 2.6vw, 3.5rem);
  align-items: center;
  padding-block: clamp(1.75rem, 1.4rem + 1.5vw, 2.75rem) var(--section-y);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.4rem 0.85rem 0.4rem 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.hero__badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--primary); flex: none;
}

.hero h1 {
  font-size: var(--fs-display);
  letter-spacing: -0.022em;
  line-height: 1.04;
  margin-bottom: var(--space-5);
}
.hero h1 .accent { color: var(--primary); }
.hero__sub {
  font-size: var(--fs-lead);
  color: var(--text-secondary);
  max-width: 34rem;
  line-height: 1.55;
  margin-bottom: var(--space-7);
}
.hero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.hero__note {
  margin-top: var(--space-6);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.hero__demo { position: relative; }

/* Soft platform/floor under the demo to ground it */
.hero__demo::after {
  content: "";
  position: absolute;
  left: 6%; right: 6%; bottom: -14px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--brand-ink, #1B2A33) 22%, transparent), transparent);
  filter: blur(6px);
  opacity: 0.5;
  z-index: -1;
}

/* ---- Code / terminal window --------------------------------------------- */
.code-window {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.code-window__chrome {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.code-window__dot {
  width: 11px; height: 11px;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
}
.code-window__dot:first-child { background: var(--primary); }
.code-window__title {
  margin-left: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.code-window__body {
  margin: 0;
  padding: clamp(1rem, 0.7rem + 1vw, 1.5rem);
  overflow-x: auto;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.75;
  color: var(--text);
  -moz-tab-size: 2; tab-size: 2;
  white-space: pre;
}
.code-window__body code { font: inherit; color: inherit; background: none; border: none; padding: 0; }

.tok-prompt  { color: var(--text-muted); user-select: none; }
.tok-kw      { color: var(--text-secondary); font-weight: 600; }
.tok-str     { color: var(--text-secondary); }
.tok-comment { color: var(--text-muted); }
.tok-zero    { color: var(--primary); font-weight: 700; }
.tok-pop     { color: var(--primary); font-weight: 600; }

/* small caption row under the demo */
.hero__demo-caption {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.hero__demo-caption .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary); flex: none;
}

/* ---- Trust strip (logos of file/product marks) -------------------------- */
.trust {
  border-top: 1px solid var(--border);
  padding-block: var(--space-6);
}
.trust__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-4) var(--space-7);
}
.trust__label {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.trust__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.trust__item svg { width: 18px; height: 18px; color: var(--primary); }

/* ---- PROBLEM band ------------------------------------------------------- */
.problem { background: var(--surface-2); border-block: 1px solid var(--border); }
.problem__quote {
  max-width: 52rem;
  margin-inline: auto;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1.4rem, 1.05rem + 1.5vw, 2.1rem);
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: var(--text);
  text-wrap: balance;
}
.problem__quote .accent { color: var(--primary); }

/* ---- PLATFORM — bento of four layers + foundation ----------------------- */
.platform-bento {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
.layer-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  min-height: 100%;
}
.layer-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.layer-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.layer-card__num {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.layer-card__layer {
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: var(--space-1);
}
.layer-card__name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-h3);
  margin-bottom: var(--space-2);
}
.layer-card--roadmap { background: transparent; border-style: dashed; box-shadow: none; }
.layer-card--roadmap:hover { transform: none; box-shadow: none; border-color: var(--border-strong); }
.layer-card--roadmap .layer-card__name { color: var(--text-secondary); }
.layer-card__desc { color: var(--text-secondary); font-size: var(--fs-sm); margin: 0; }

/* Foundation plinth spanning full width under the bento */
.foundation {
  margin-top: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  text-align: center;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  color: var(--text);
  font-size: var(--fs-sm);
}
.foundation svg { flex: none; }
.foundation strong { font-family: var(--font-head); font-weight: 600; }

/* ---- PRODUCTS ----------------------------------------------------------- */
.product-card { display: flex; flex-direction: column; height: 100%; }
.product-card__head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.product-card__title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-h3);
  margin: 0 0 2px;
}
.product-card__title a { color: var(--text); }
.product-card__title a:hover { color: var(--primary); text-decoration: none; }
.product-card__tag {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin: 0;
}
.product-card__body { color: var(--text-secondary); flex: 1 1 auto; font-size: var(--fs-sm); }
.product-card__body p { max-width: none; }

.proof {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--primary-subtle);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-block: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.5;
}
.proof p { margin: 0; max-width: none; }
.proof strong { color: var(--primary); font-weight: 700; }
.proof__icon {
  flex: none;
  width: 20px; height: 20px;
  color: var(--primary);
  margin-top: 1px;
}
.product-card__link { margin-top: auto; }

/* ---- WHY LOCAL-FIRST — comparison --------------------------------------- */
.compare {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.compare__row {
  display: grid;
  grid-template-columns: 1fr;
  border-top: 1px solid var(--border);
}
.compare__row:first-child { border-top: none; }
.compare__cell { padding: var(--space-4) var(--space-5); }
.compare__cell--head {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: var(--fs-h4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.compare__cell--cloud {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}
.compare__cell--kv {
  background: var(--surface);
  color: var(--text);
  border-top: 1px solid var(--border);
}
.compare__label {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: var(--space-1);
  display: block;
}
.compare__cell--cloud .compare__label { color: var(--text-muted); }
.compare__cell--kv .compare__label { color: var(--primary); }

/* ---- BLOG teasers ------------------------------------------------------- */
.post-card { display: flex; flex-direction: column; height: 100%; }
.post-card__meta {
  font-size: var(--fs-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: var(--space-4);
}
.post-card__title {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.3;
  margin-bottom: var(--space-3);
}
.post-card__title a { color: var(--text); text-decoration: none; }
.post-card__title a:hover { color: var(--primary); }
.post-card__excerpt { color: var(--text-secondary); font-size: var(--fs-sm); flex: 1 1 auto; }
.post-card__excerpt p { max-width: none; }
.post-card__more {
  margin-top: var(--space-5);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--primary);
}

/* ---- CLOSING CTA -------------------------------------------------------- */
.closing { background: var(--surface-2); border-top: 1px solid var(--border); }
.closing__inner {
  text-align: center;
  max-width: var(--maxw-narrow);
  margin-inline: auto;
}
.closing h2 { font-size: var(--fs-h1); }
.closing .lead { margin: var(--space-4) auto var(--space-7); }
.closing__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }

/* =========================================================================
   FOOTER
   ========================================================================= */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding-block: var(--space-8) var(--space-6);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-7);
  margin-bottom: var(--space-7);
}
.footer-brand .brand { margin-bottom: var(--space-3); }
.footer-brand__motto {
  color: var(--primary);
  font-weight: 600;
  font-family: var(--font-head);
  margin: 0 0 var(--space-3);
}
.footer-brand__mail { display: inline-block; color: var(--link); font-size: var(--fs-sm); }

.footer-col__title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}
.footer-col__list li { margin-bottom: var(--space-2); }
.footer-col__list a {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  text-decoration: none;
}
.footer-col__list a:hover { color: var(--primary); text-decoration: underline; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
}
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--primary); }
.footer-license { max-width: 48ch; }

/* =========================================================================
   5b. SUB-PAGES  (product · docs · blog · about)
   Built from the same primitives — only a few page-specific pieces here.
   ========================================================================= */

/* ---- Breadcrumb ---- */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  font-size: var(--fs-sm); color: var(--text-muted);
  margin-bottom: var(--space-5);
}
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--primary); text-decoration: none; }
.crumbs__sep { opacity: 0.5; }
.crumbs [aria-current="page"] { color: var(--text-secondary); }

/* ---- Generic page header (docs · blog · about) ---- */
.page-hero { position: relative; overflow: hidden; }
.page-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(48% 60% at 84% 0%,
    color-mix(in srgb, var(--primary) 12%, transparent), transparent 70%);
  pointer-events: none; z-index: 0;
}
.page-hero .container { position: relative; z-index: 1; }
.page-head { max-width: var(--maxw-narrow); }
.page-head h1 {
  font-size: clamp(2.6rem, 1.9rem + 3vw, 4rem);
  line-height: 1.04; letter-spacing: -0.028em; margin-bottom: var(--space-4);
}
.page-head .lead { margin-top: 0; }

/* ---- Product hero: copy + at-a-glance ---- */
.phero {
  display: grid; grid-template-columns: 1fr;
  gap: var(--space-7); align-items: start;
}
.phero__idrow {
  display: flex; align-items: center; gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.phero__tile {
  width: 72px; height: 72px; border-radius: 17px; flex: none;
  box-shadow: var(--shadow-sm);
}
.phero h1 { font-size: var(--fs-h1); margin: 0; }
.phero__tagline {
  font-family: var(--font-head); font-weight: 600;
  font-size: var(--fs-lead); color: var(--primary);
  letter-spacing: -0.01em; margin: 0 0 var(--space-4);
}
.phero__sub {
  font-size: var(--fs-lead); color: var(--text-secondary);
  max-width: 38rem; line-height: 1.55; margin-bottom: var(--space-6);
}
.phero__cta { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.phero__aside { align-self: start; }

/* ---- At-a-glance spec table ---- */
.spec {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm);
}
.spec__cap {
  font-size: var(--fs-xs); letter-spacing: 0.12em; text-transform: uppercase;
  font-weight: 700; color: var(--text-muted);
  padding: var(--space-4) var(--space-5) var(--space-3);
}
.spec__row {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: var(--space-4);
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--border);
}
.spec__k { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.spec__v { color: var(--text); font-size: var(--fs-sm); }
.spec__v code { font-size: 0.84em; }

/* ---- Feature card with icon (reuses .card via .grid) ---- */
.feature { display: flex; flex-direction: column; height: 100%; }
.feature__icon {
  width: 46px; height: 46px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-subtle); border: 1px solid var(--primary-border);
  color: var(--primary); margin-bottom: var(--space-4);
}
.feature__icon svg { width: 22px; height: 22px; }
.feature h3 { font-size: var(--fs-h4); margin-bottom: var(--space-2); }
.feature p { color: var(--text-secondary); font-size: var(--fs-sm); margin: 0; max-width: none; }

/* ---- Install line ---- */
.install {
  display: flex; align-items: center; gap: var(--space-4);
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--space-4) var(--space-5);
  font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text);
  overflow-x: auto;
}
.install code { background: none; border: none; padding: 0; white-space: pre; }
.install .tok-prompt { color: var(--text-muted); user-select: none; margin-right: 0.6em; }

/* ---- Related products strip ---- */
.related-card { display: flex; align-items: center; gap: var(--space-4); }
.related-card .tile { width: 44px; height: 44px; border-radius: 11px; box-shadow: var(--shadow-sm); }
.related-card__name {
  font-family: var(--font-head); font-weight: 600;
  font-size: var(--fs-h4); margin: 0 0 1px;
}
.related-card__name a { color: var(--text); }
.related-card__name a:hover { color: var(--primary); text-decoration: none; }
.related-card__tag { font-size: var(--fs-xs); color: var(--text-muted); margin: 0; }

/* ---- Prose (docs · about) ---- */
.prose { max-width: var(--maxw-text); }
.prose > h2 { font-size: var(--fs-h2); margin-top: var(--space-8); margin-bottom: var(--space-4); }
.prose > h2:first-child { margin-top: 0; }
.prose > h3 { font-size: var(--fs-h3); margin-top: var(--space-6); margin-bottom: var(--space-3); }
.prose p { color: var(--text-secondary); }
.prose .bullets { list-style: disc; padding-left: 1.3rem; margin: 0 0 var(--space-5); max-width: var(--maxw-text); }
.prose .bullets li { color: var(--text-secondary); margin-bottom: var(--space-2); }
.prose a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.prose a:hover { color: var(--primary); }

/* ---- Blog list ---- */
.post-list { display: grid; gap: var(--space-5); grid-template-columns: 1fr; }
.post-row {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}
.post-row:hover { border-color: var(--primary-border); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.post-row__meta { font-size: var(--fs-xs); letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.post-row__title { font-family: var(--font-head); font-weight: 600; font-size: var(--fs-h3); margin: 0; }
.post-row__title a { color: var(--text); }
.post-row__title a:hover { color: var(--primary); text-decoration: none; }
.post-row__excerpt { color: var(--text-secondary); font-size: var(--fs-sm); margin: 0; max-width: var(--maxw-text); }

/* ---- Reusable CTA panel (closing of sub-pages) ---- */
.cta-panel {
  text-align: center; background: var(--primary-subtle);
  border: 1px solid var(--primary-border); border-radius: var(--radius-xl);
  padding: clamp(2rem, 1.4rem + 2.2vw, 3.25rem);
}
.cta-panel h2 { font-size: var(--fs-h2); margin-bottom: var(--space-3); }
.cta-panel .lead { margin: 0 auto var(--space-6); max-width: 40rem; }
.cta-panel__btns { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; }

/* Sub-page layout breakpoints */
@media (min-width: 860px) {
  .phero { grid-template-columns: 1.4fr 0.6fr; gap: var(--space-8); }
}

/* =========================================================================
   6. RESPONSIVE
   ========================================================================= */

/* Tablet+ */
@media (min-width: 680px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .platform-bento { grid-template-columns: repeat(2, 1fr); }

  .compare__row { grid-template-columns: 0.9fr 1fr 1fr; }
  .compare__cell--cloud,
  .compare__cell--kv { border-top: none; border-left: 1px solid var(--border); }

  .footer-grid { grid-template-columns: 1.5fr 1fr 1fr 1fr; }
}

/* Desktop */
@media (min-width: 960px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .platform-bento { grid-template-columns: repeat(4, 1fr); }

  /* Hero: copy a touch wider than the demo, classic editorial split */
  .hero__inner { grid-template-columns: 1.04fr 0.96fr; align-items: center; }

  .nav-toggle { display: none; }
}

/* Mobile nav (below 960px the nav collapses behind hamburger) */
@media (max-width: 959px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    margin-left: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t), transform var(--t), visibility var(--t);
  }
  .nav.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--space-3);
  }
  .nav__link {
    display: block;
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    border-radius: var(--radius-sm);
  }
}

/* =========================================================================
   MOTION PREFERENCES
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================================
   ENTRANCE MOTION (subtle, opt-in, respects reduced-motion above)
   ========================================================================= */
@media (prefers-reduced-motion: no-preference) {
  /* Only hide reveals when JS is available (html.js); without JS they show. */
  .js .reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 600ms cubic-bezier(.2,.6,.2,1),
                transform 600ms cubic-bezier(.2,.6,.2,1);
    will-change: opacity, transform;
  }
  .js .reveal.is-visible { opacity: 1; transform: none; }
}
