/* ==========================================================================
   MindFeast — homepage
   Hand-authored modern CSS. No framework.
   Every color is a named token; the token block is the back-port surface
   for MindFeast-Design-System/tokens/tokens.css.
   Accessibility target: WCAG 2.1 AA. All text/ground pairs measured.
   ========================================================================== */

@layer tokens, reset, base, components, sections, motion;

/* Self-hosted brand typefaces. The roman files are variable fonts so the
   browser can render every weight used by the design without synthesizing. */
@font-face {
  font-family: "EB Garamond";
  src: url("../assets/fonts/eb-garamond-roman.f12bc30ca94a.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
}

@font-face {
  font-family: "EB Garamond";
  src: url("../assets/fonts/eb-garamond-italic.985f75b87984.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("../assets/fonts/outfit-roman.fdf9c509a809.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

/* --------------------------------------------------------------------------
   TOKENS
   -------------------------------------------------------------------------- */
@layer tokens {
  :root {
    color-scheme: light dark;

    /* ---- Brand (immutable identity) ---- */
    --mf-teal:  #1B3A4B;
    --mf-gold:  #C49A3C;   /* decorative on light grounds; text-safe on night */
    --mf-sage:  #7B9E87;
    --mf-cream: #F5F0E8;

    /* ---- Derived ramps (deliberate additions, nameable) ----
       clay: sampled from the slide terracottas (skirt / officer's lapels).
       One hue family, two AA-safe stops.                                  */
    --mf-clay-700: #8E4430;   /* clay as TEXT on light grounds  — 6.1:1 on cream */
    --mf-clay-300: #D49571;   /* clay as TEXT on night grounds  — 7.0:1 on night */
    --mf-sage-700: #44604F;   /* sage as TEXT on light grounds  — 6.1:1 on cream */
    --mf-bronze:   #7F5E1A;   /* gold's job on light grounds    — 5.3:1 on cream */

    /* night ramp, from the design system, kept */
    --mf-night-900: #0F1A22;
    --mf-night-800: #16242E;
    --mf-night-700: #1B2C36;
    --mf-night-line:#2A3A45;

    /* paper ramp */
    --mf-paper:     #F8F6F3;
    --mf-paper-line:#E2DED7;
    --mf-ink-muted: #52616B;  /* 5.9:1 on paper */
    --mf-cloud:     #93A3AD;  /* 6.8:1 on night */

    /* ---- Semantic: light (default) ---- */
    --bg:            var(--mf-paper);
    --surface:       #FFFFFF;
    --surface-warm:  var(--mf-cream);
    --text:          var(--mf-teal);
    --text-muted:    var(--mf-ink-muted);
    --border:        var(--mf-paper-line);
    --accent:        var(--mf-gold);      /* fills, rules, marks ONLY on light */
    --accent-ink:    var(--mf-bronze);    /* links + accent text, AA-safe */
    --clay-ink:      var(--mf-clay-700);  /* journal / founder voice */
    --sage-ink:      var(--mf-sage-700);  /* open-source / nature voice */
    --btn-bg:        var(--mf-teal);
    --btn-fg:        var(--mf-cream);
    --focus:         var(--mf-teal);
    --shadow-card:   0 1px 2px rgb(27 58 75 / .06), 0 12px 32px -12px rgb(27 58 75 / .14);

    /* ---- Type ----
       EB Garamond (OFL): display + reading face — the living-books voice.
       Outfit (OFL): the wordmark's voice — labels, buttons, nav only.      */
    --font-serif: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
    --font-ui: "Outfit", "Avenir Next", system-ui, sans-serif;

    --fs-hero: clamp(2.5rem, 4.3vw + .8rem, 4.25rem);
    --fs-h2:   clamp(1.9rem, 2.4vw + .8rem, 3rem);
    --fs-h3:   clamp(1.35rem, .8vw + 1.1rem, 1.65rem);
    --fs-body: clamp(1.1rem, .2vw + 1.02rem, 1.2rem);
    --fs-small:.95rem;
    --fs-caption:.9rem;
    --fs-meta:.85rem;
    --fs-label:.8rem;

    --space-eyebrow-heading: .2rem;
    --space-card-label-heading: .4rem;

    /* ---- Rhythm ---- */
    --section-pad: clamp(4.5rem, 9vw, 7.5rem);
    --container: min(1180px, 92vw);
    --radius-card: 14px;
    --radius-btn: 999px;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg:           var(--mf-night-900);
      --surface:      var(--mf-night-800);
      --surface-warm: var(--mf-night-700);
      --text:         var(--mf-cream);
      --text-muted:   var(--mf-cloud);
      --border:       var(--mf-night-line);
      --accent:       var(--mf-gold);
      --accent-ink:   var(--mf-gold);      /* 6.7:1 on night — text-safe here */
      --clay-ink:     var(--mf-clay-300);
      --sage-ink:     var(--mf-sage);      /* 6.0:1 on night */
      --btn-bg:       var(--mf-gold);
      --btn-fg:       var(--mf-night-900); /* 6.7:1 on gold */
      --focus:        var(--mf-gold);
      --shadow-card:  0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .6);
    }
  }

  :root[data-theme="light"] {
    color-scheme: light;
    --bg: var(--mf-paper); --surface: #FFFFFF; --surface-warm: var(--mf-cream);
    --text: var(--mf-teal); --text-muted: var(--mf-ink-muted); --border: var(--mf-paper-line);
    --accent: var(--mf-gold); --accent-ink: var(--mf-bronze);
    --clay-ink: var(--mf-clay-700); --sage-ink: var(--mf-sage-700);
    --btn-bg: var(--mf-teal); --btn-fg: var(--mf-cream);
    --shadow-card: 0 1px 2px rgb(27 58 75 / .06), 0 12px 32px -12px rgb(27 58 75 / .14);
  }

  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: var(--mf-night-900); --surface: var(--mf-night-800); --surface-warm: var(--mf-night-700);
    --text: var(--mf-cream); --text-muted: var(--mf-cloud); --border: var(--mf-night-line);
    --accent: var(--mf-gold); --accent-ink: var(--mf-gold);
    --clay-ink: var(--mf-clay-300); --sage-ink: var(--mf-sage);
    --btn-bg: var(--mf-gold); --btn-fg: var(--mf-night-900);
    --shadow-card: 0 1px 2px rgb(0 0 0 / .4), 0 16px 40px -16px rgb(0 0 0 / .6);
  }
}

/* --------------------------------------------------------------------------
   RESET
   -------------------------------------------------------------------------- */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; }
  img, svg, video { display: block; max-width: 100%; }
  [hidden] { display: none !important; }
  input, button, textarea, select { font: inherit; }
  button { cursor: pointer; }
}

/* --------------------------------------------------------------------------
   BASE
   -------------------------------------------------------------------------- */
@layer base {
  html { scroll-behavior: smooth; }
  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-serif);
    font-size: var(--fs-body);
    line-height: 1.65;
    overflow-x: hidden;
  }

  h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    line-height: 1.12;
    text-wrap: balance;
  }
  h1 { font-weight: 500; }
  p { text-wrap: pretty; }

  a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
  a:hover { text-decoration-thickness: 2px; }

  :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 3px;
    border-radius: 2px;
  }

  ::selection { background: var(--mf-gold); color: var(--mf-night-900); }

  .container { width: var(--container); margin-inline: auto; }

  .skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    background: var(--btn-bg); color: var(--btn-fg);
    padding: .6rem 1.2rem; border-radius: 0 0 8px 8px;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-small);
    text-decoration: none; transition: top .2s;
  }
  .skip-link:focus { top: 0; }

  .visually-hidden {
    position: absolute; width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip-path: inset(50%); overflow: hidden; white-space: nowrap;
  }

  /* Eyebrow labels — Outfit, the wordmark's register */
  .eyebrow {
    display: flex; align-items: center; gap: .65rem;
    font-family: var(--font-ui); font-weight: 600;
    font-size: var(--fs-label); letter-spacing: .2em; text-transform: uppercase;
    color: var(--accent-ink);
  }
  .eyebrow .spark { width: .8em; height: .8em; fill: var(--accent); flex: none; }
  .eyebrow--clay { color: var(--clay-ink); }
  .eyebrow--clay .spark { fill: var(--clay-ink); }
  .eyebrow--sage { color: var(--sage-ink); }
  .eyebrow--sage .spark { fill: var(--sage-ink); }

  @media (max-width: 520px) {
    .eyebrow { letter-spacing: .15em; }
  }

  .section-head { max-width: 46rem; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
  .section-head h2 { font-size: var(--fs-h2); margin: var(--space-eyebrow-heading) 0 .9rem; }
  .section-head .dek { color: var(--text-muted); font-size: calc(var(--fs-body) * 1.05); }
}

/* --------------------------------------------------------------------------
   COMPONENTS
   -------------------------------------------------------------------------- */
@layer components {
  .btn {
    display: inline-flex; align-items: center; gap: .55rem;
    font-family: var(--font-ui); font-weight: 600; font-size: 1rem;
    padding: .8rem 1.7rem; border-radius: var(--radius-btn);
    text-decoration: none; border: 1px solid transparent;
    transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease;
  }
  .btn:hover { transform: translateY(-1px); }
  .btn:active { transform: translateY(0); }
  /* Disabled state — e.g. a submit button gated on Turnstile (js/site.js). */
  .btn:disabled, .btn[disabled] {
    opacity: .55; cursor: not-allowed; box-shadow: none;
  }
  .btn:disabled:hover, .btn[disabled]:hover { transform: none; }

  .btn--primary {
    background: var(--btn-bg); color: var(--btn-fg);
    box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--btn-bg) 60%, transparent);
  }
  .btn--primary:hover { background: color-mix(in srgb, var(--btn-bg) 88%, var(--text) 12%); }

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

  .btn--sm { padding: .55rem 1.25rem; font-size: .92rem; }

  .arrow-link {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-small);
    text-decoration: none; letter-spacing: .01em;
  }
  .arrow-link::after { content: " \2192"; transition: margin-left .18s ease; }
  .arrow-link:hover { text-decoration: underline; }
  .arrow-link:hover::after { margin-left: .25em; }
}

/* --------------------------------------------------------------------------
   HEADER
   -------------------------------------------------------------------------- */
@layer sections {
  .site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
  }
  .header-inner {
    display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
    padding-block: .7rem;
  }
  .brand {
    display: inline-flex; border-radius: 8px;
    padding: .35rem .7rem; margin-left: -.7rem;
  }
  /* Theme-matched lockup: teal/gold on light, cream on dark */
  .brand .logo-dark { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .brand .logo-light { display: none; }
    :root:not([data-theme="light"]) .brand .logo-dark { display: block; }
  }
  :root[data-theme="dark"] .brand .logo-light { display: none; }
  :root[data-theme="dark"] .brand .logo-dark { display: block; }
  .brand img { height: clamp(4rem, 1.6rem + 5vw, 7rem); width: auto; }

  .site-nav { margin-left: auto; }
  .site-nav ul {
    display: flex; gap: clamp(1rem, 2.5vw, 2rem);
    list-style: none; padding: 0;
  }
  .site-nav a {
    font-family: var(--font-ui); font-weight: 600; font-size: 1rem;
    color: var(--text); text-decoration: none;
    padding-block: .3rem;
  }
  .site-nav a:hover { color: var(--accent-ink); }

  .header-actions { display: flex; align-items: center; gap: .9rem; }

  .nav-toggle {
    display: none; place-items: center;
    width: 2.75rem; height: 2.75rem; padding: 0;
    background: none; color: var(--text);
    border: 1px solid var(--border); border-radius: 50%;
  }
  .nav-toggle:hover { border-color: var(--text-muted); }
  .nav-toggle__icon { display: grid; gap: 4px; width: 1.2rem; }
  .nav-toggle__icon span {
    display: block; width: 100%; height: 2px;
    background: currentColor; border-radius: 999px;
    transform-origin: center; transition: transform .18s ease, opacity .18s ease;
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon span:first-child {
    transform: translateY(6px) rotate(45deg);
  }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle__icon span:last-child {
    transform: translateY(-6px) rotate(-45deg);
  }

  .theme-toggle {
    background: none; border: 1px solid var(--border); border-radius: 50%;
    width: 2.4rem; height: 2.4rem; display: grid; place-items: center;
    color: var(--text);
  }
  .theme-toggle:hover { border-color: var(--text-muted); }
  .theme-toggle svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
  /* The icon shows the theme you'd switch TO: moon on light pages, sun on dark */
  .theme-toggle .icon-sun { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  }
  :root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
  :root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

  @media (max-width: 700px) {
    .site-nav { order: 3; width: 100%; margin-left: 0; }
    .site-nav ul { justify-content: space-between; }
    .site-nav a { font-size: .95rem; }
    .header-actions { margin-left: auto; }
  }

  /* Narrow phones: centered logo above compact controls and a menu */
  @media (max-width: 425px) {
    .header-inner { flex-direction: column; align-items: center; gap: .7rem; padding-block: 1rem .9rem; }
    .brand { margin-left: 0; }
    .header-actions { order: 1; margin-left: 0; }
    .site-nav { order: 2; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav li { text-align: center; }
    .site-nav a { display: block; padding: .6rem 1rem; }
    html.nav-enhanced .nav-toggle { display: grid; }
    html.nav-enhanced .site-nav:not(.is-open) { display: none; }
  }

  /* ------------------------------------------------------------------------
     HERO — the König painting, night in both themes
     ------------------------------------------------------------------------ */
  .hero {
    position: relative; isolation: isolate; overflow: hidden;
    background: var(--mf-night-900);
    /* local theme: the hero is always night */
    --text: var(--mf-cream);
    --text-muted: #C9CDD3;          /* 9.8:1 on the darkened painting */
    --accent-ink: var(--mf-gold);
    --btn-bg: var(--mf-gold);
    --btn-fg: var(--mf-night-900);
    --focus: var(--mf-gold);
    color: var(--text);
  }
  .hero-art {
    position: absolute; inset: 0; z-index: -2;
    width: 100%; height: 100%; object-fit: cover;
    object-position: 62% 18%;        /* keep the star field and the town lights */
  }
  .hero::before {
    /* legibility scrim: deep night at the text edge, painting breathes right */
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
      linear-gradient(101deg,
        rgb(11 17 24 / .94) 0%,
        rgb(11 17 24 / .82) 34%,
        rgb(11 17 24 / .44) 60%,
        rgb(11 17 24 / .12) 100%),
      linear-gradient(to top, rgb(11 17 24 / .75) 0%, transparent 32%);
  }
  .hero-inner {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(2rem, 5vw, 4rem); align-items: center;
    padding-block: clamp(4.5rem, 9vw, 8rem) clamp(5.5rem, 10vw, 8rem);
  }
  .hero h1 {
    font-size: var(--fs-hero); line-height: 1.08;
    margin: var(--space-eyebrow-heading) 0 1.6rem; max-width: 15.5em;
    text-shadow: 0 2px 24px rgb(11 17 24 / .55);
  }
  .hero h1 em { font-style: italic; color: color-mix(in srgb, var(--mf-cream) 82%, var(--mf-gold) 18%); }
  .hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
  .hero .btn--ghost { --text: var(--mf-cream); color: var(--mf-cream); border-color: rgb(245 240 232 / .5); }
  .hero .btn--ghost:hover { border-color: var(--mf-cream); background: rgb(245 240 232 / .1); }

  .proof-line {
    display: flex; flex-wrap: wrap; align-items: center; gap: .7rem;
    margin-top: 1.6rem;
    font-size: calc(var(--fs-body) * .95);
    color: var(--text-muted);
  }
  .proof-line .spark { width: .5em; height: .5em; fill: var(--mf-gold); flex: none; }

  /* The slide fan — real slides rising under the painted stars */
  .slide-fan {
    position: relative; display: flex; justify-content: center; align-items: flex-end;
    padding-top: 1rem; min-height: 100%;
  }
  .slide-fan figure { position: relative; flex: none; }
  .slide-fan img {
    width: clamp(9.5rem, 15vw, 14rem); height: auto;
    border-radius: 18px;
    border: 1px solid rgb(245 240 232 / .28);
    box-shadow:
      0 0 0 1px rgb(11 17 24 / .5),
      0 24px 48px -12px rgb(0 0 0 / .65),
      0 4px 90px -8px rgb(196 154 60 / .22);   /* faint gold cast: a lit screen at night */
    transition: transform .35s ease;
  }
  .slide-fan .fan-a { transform: rotate(-8.5deg) translate(1.6rem, -1.1rem); z-index: 1; }
  .slide-fan .fan-b { transform: rotate(-.5deg) translateY(.4rem) scale(1.12); z-index: 3; }
  .slide-fan .fan-c { transform: rotate(8deg) translate(-1.6rem, -.8rem); z-index: 2; }
  .slide-fan figure:hover img { transform: translateY(-.6rem); }

  .hero-credit {
    position: absolute; right: 0; bottom: 0; left: 0;
  }
  .hero-credit p {
    width: var(--container); margin-inline: auto; padding-block: .8rem;
    font-size: var(--fs-meta); font-style: italic; color: #C9CDD3;
    text-align: right;
  }
  .hero-credit a { color: inherit; }

  @media (max-width: 860px) {
    .hero-inner { grid-template-columns: 1fr; padding-bottom: clamp(6rem, 12vw, 8rem); }
    .hero h1 { max-width: none; }
    .slide-fan { padding-top: 2.5rem; }
    .slide-fan img { width: clamp(8rem, 26vw, 11rem); }
    .hero-credit p { text-align: left; }
  }

  /* ------------------------------------------------------------------------
     PILLARS — set like a book page
     ------------------------------------------------------------------------ */
  .pillars { padding-block: var(--section-pad); }
  .pillars-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: clamp(2.5rem, 6vw, 5.5rem); row-gap: clamp(2.5rem, 5vw, 4rem);
  }
  .pillar-mark { display: flex; align-items: baseline; gap: 1.1rem; margin-bottom: .9rem; }
  .pillar-mark .numeral {
    font-family: var(--font-serif); font-style: italic;
    font-size: 2.1rem; line-height: 1; color: var(--accent-ink);
  }
  .pillar-mark::after {
    content: ""; flex: 1; height: 1px; align-self: center;
    background: linear-gradient(to right, var(--accent), transparent);
  }
  .pillar h3 { font-size: var(--fs-h3); font-weight: 700; margin-bottom: .5rem; }
  .pillar p { color: var(--text-muted); font-size: calc(var(--fs-body) * .97); }

  @media (max-width: 700px) {
    .pillars-grid { grid-template-columns: 1fr; }
  }

  /* ------------------------------------------------------------------------
     SEE IT WORK — the before/after moment
     ------------------------------------------------------------------------ */
  .see-it {
    background: var(--surface-warm);
    border-block: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  .see-it-grid {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: clamp(2.5rem, 6vw, 5rem); align-items: center;
  }

  .phone {
    position: relative; margin-inline: auto;
    width: clamp(15rem, 24vw, 19rem); aspect-ratio: 1080 / 1920;
    border-radius: 34px; border: 9px solid var(--mf-night-800);
    outline: 1px solid var(--border);
    background: var(--mf-night-900);
    box-shadow: var(--shadow-card), 0 40px 80px -30px rgb(0 0 0 / .35);
    overflow: hidden;
  }
  /* Slides crossfade under JS control (js/site.js) so Wagtail can render any
     number of <img> children — the count is not capped by CSS keyframes. */
  .phone img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity .8s ease;
  }
  .phone img.active { opacity: 1; }
  html:not(.js) .phone img:first-child { opacity: 1; }
  .phone-caption {
    margin-top: 1.2rem; text-align: center;
    font-size: var(--fs-caption); font-style: italic; color: var(--text-muted);
  }

  .see-it .lede { color: var(--text-muted); margin: 1rem 0 2.2rem; max-width: 38rem; }
  .see-it h2 { font-size: var(--fs-h2); margin-top: var(--space-eyebrow-heading); max-width: 16ch; }

  .steps { list-style: none; padding: 0; display: grid; gap: 1.5rem; counter-reset: step; }
  .steps li { display: grid; grid-template-columns: 3.2rem 1fr; gap: 1.1rem; }
  .steps li::before {
    counter-increment: step; content: counter(step);
    font-family: var(--font-serif); font-style: italic; font-size: 1.9rem; line-height: 1;
    color: var(--accent-ink);
    border-top: 1px solid var(--accent);
    padding-top: .5rem; text-align: left;
    /* optical alignment: drop the rule to the heading's cap height, not its line box */
    margin-top: .3rem;
  }
  .steps h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: .25rem; }
  .steps p { color: var(--text-muted); font-size: calc(var(--fs-body) * .93); }
  .steps .fine { font-size: var(--fs-caption); margin-top: .35rem; }
  .steps--standalone {
    width: 92vw; max-width: 41rem;
    margin: clamp(2rem, 4vw, 3rem) auto;
  }

  @media (max-width: 860px) {
    .see-it-grid { grid-template-columns: 1fr; }
    .see-it-grid > .see-it-copy { order: -1; }
  }

  /* ------------------------------------------------------------------------
     PRODUCT FAMILY
     ------------------------------------------------------------------------ */
  .products { padding-block: var(--section-pad); }
  .product-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1.2rem, 2.5vw, 2rem);
  }
  .product-card {
    --card-accent: var(--accent);
    --card-accent-ink: var(--accent-ink);
    position: relative;
    display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 2rem 1.9rem 1.7rem;
    box-shadow: var(--shadow-card);
  }
  .product-card::before {
    content: ""; position: absolute; top: -1px; left: 1.9rem; right: 1.9rem; height: 3px;
    background: linear-gradient(to right, var(--card-accent), color-mix(in srgb, var(--card-accent) 15%, transparent));
    border-radius: 0 0 3px 3px;
  }
  .product-card--sage { --card-accent: var(--mf-sage); --card-accent-ink: var(--sage-ink); }
  .product-card--clay { --card-accent: var(--clay-ink); --card-accent-ink: var(--clay-ink); }

  .product-tag {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase;
    color: var(--card-accent-ink); margin-bottom: var(--space-card-label-heading);
  }
  .product-card h3 { font-size: var(--fs-h3); font-weight: 700; margin-bottom: .6rem; }
  .product-card h3 a { color: inherit; text-decoration: none; }
  .product-card h3 a:hover { text-decoration: underline; text-decoration-color: var(--card-accent-ink); text-decoration-thickness: 2px; }
  .product-card .promise { font-style: italic; margin-bottom: .8rem; }
  .product-card .about { color: var(--text-muted); font-size: calc(var(--fs-body) * .92); margin-bottom: 1.4rem; }
  .product-card .app-badge {
    width: 3rem; height: 3rem; border-radius: 12px;
    position: absolute; top: 1.6rem; right: 1.6rem;
    box-shadow: 0 2px 8px rgb(0 0 0 / .15);
  }
  .product-meta {
    margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  }
  .product-meta .terms { font-size: var(--fs-meta); color: var(--text-muted); }
  .product-card .arrow-link { color: var(--card-accent-ink); }

  @media (max-width: 900px) {
    .product-grid { grid-template-columns: 1fr; max-width: 34rem; }
  }

  /* ------------------------------------------------------------------------
     JOURNAL
     ------------------------------------------------------------------------ */
  .journal {
    background: var(--surface-warm);
    border-block: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  .journal .section-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem 2.5rem; max-width: none; }
  .journal .section-head > div { max-width: 44rem; }
  .journal .section-head .arrow-link { margin-left: auto; margin-bottom: .4rem; color: var(--clay-ink); }

  .journal-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(2rem, 4vw, 3.5rem);
  }
  .essay { display: flex; flex-direction: column; }
  .essay .cat {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--clay-ink);
    margin-bottom: var(--space-card-label-heading);
  }
  .essay h3 { font-size: calc(var(--fs-h3) * 1.05); line-height: 1.2; margin-bottom: .6rem; }
  .essay h3 a { color: var(--text); text-decoration: none; }
  .essay h3 a:hover { text-decoration: underline; text-decoration-color: var(--clay-ink); text-decoration-thickness: 2px; }
  .essay .dek { font-style: italic; color: var(--text-muted); font-size: calc(var(--fs-body) * .93); margin-bottom: 1rem; }
  .essay .byline {
    margin-top: auto; font-family: var(--font-ui); font-size: var(--fs-meta); font-weight: 600;
    letter-spacing: .04em; color: var(--text-muted);
  }

  @media (max-width: 860px) {
    .journal-grid { grid-template-columns: 1fr; max-width: 36rem; }
  }

  /* ------------------------------------------------------------------------
     FOUNDER NOTE
     ------------------------------------------------------------------------ */
  .founder { padding-block: var(--section-pad); }
  .founder-inner { max-width: 42rem; margin-inline: auto; }
  .founder .eyebrow { justify-content: center; }
  .founder-inner p { margin-bottom: 1.3rem; font-size: calc(var(--fs-body) * 1.08); }
  .founder-inner .opening { margin-top: 2rem; }
  .founder-inner .opening::first-letter {
    font-size: 3.2em; line-height: .82; float: left;
    padding: .08em .12em 0 0; color: var(--accent-ink);
  }
  .founder-sig { margin-top: 2rem; display: flex; align-items: baseline; gap: 1.5rem; flex-wrap: wrap; }
  .founder-sig .name { font-size: 1.5rem; font-style: italic; }
  .founder-sig .role { font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta); letter-spacing: .06em; color: var(--text-muted); }

  /* ------------------------------------------------------------------------
     FOOTER — the night sky returns
     ------------------------------------------------------------------------ */
  .site-footer {
    background: var(--mf-night-900);
    --text: var(--mf-cream); --text-muted: var(--mf-cloud);
    --accent-ink: var(--mf-gold); --focus: var(--mf-gold);
    color: var(--text);
  }
  /* The night sky returns — a pure painting band; all text sits on solid ground below */
  .footer-band {
    height: clamp(9rem, 16vw, 14rem);
    background-image:
      linear-gradient(to bottom, rgb(15 26 34 / .25), transparent 40%, var(--mf-night-900)),
      url("../assets/img/konig-sky-2000.b1f2e6eccea9.jpg");
    background-size: cover;
    background-position: center 30%;
  }
  .footer-inner { padding-block: clamp(2.5rem, 5vw, 4rem) 2rem; }
  .footer-grid {
    display: grid; grid-template-columns: minmax(0, 4fr) repeat(2, minmax(0, 3fr));
    gap: clamp(2rem, 5vw, 4rem);
    padding-bottom: 3rem; border-bottom: 1px solid rgb(245 240 232 / .18);
  }
  .footer-brand img { width: clamp(7rem, 10vw, 8.5rem); margin-bottom: 1.2rem; }
  .footer-brand p { color: var(--text-muted); font-size: .97rem; max-width: 24rem; }

  /* .footer-h added in the Wagtail port: the footer group headings render as
     <h2 class="footer-h"> so document heading order stays sequential */
  .site-footer h4,
  .site-footer .footer-h {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .2em; text-transform: uppercase; color: var(--mf-gold);
    margin-bottom: 1.1rem;
  }
  .site-footer ul { list-style: none; padding: 0; display: grid; gap: .55rem; }
  .site-footer ul a { color: var(--mf-cream); text-decoration: none; font-size: .97rem; }
  .site-footer ul a:hover { color: var(--mf-gold); text-decoration: underline; }
  .site-footer ul .soon { color: var(--text-muted); font-size: .97rem; }

  .footer-legal {
    display: flex; flex-wrap: wrap; gap: .8rem 2rem; justify-content: space-between;
    padding-top: 1.6rem;
    font-size: var(--fs-meta); color: var(--text-muted);
  }
  .footer-legal .credit { font-style: italic; max-width: 46rem; }
  .footer-legal a { color: inherit; }

  @media (max-width: 780px) {
    .footer-grid { grid-template-columns: 1fr; gap: 2.2rem; }
  }
}

/* --------------------------------------------------------------------------
   MOTION — scroll reveals; everything degrades to visible
   -------------------------------------------------------------------------- */
@layer motion {
  html.js .reveal {
    opacity: 0; transform: translateY(18px);
    transition: opacity .7s ease, transform .7s ease;
    transition-delay: var(--d, 0s);
  }
  html.js .reveal.in { opacity: 1; transform: none; }

  /* ?static=1 — screenshot/test hook: render final state immediately */
  html.static .reveal { opacity: 1; transform: none; transition: none; }
  html.static .phone img { transition: none; }
  html.static .phone img:first-child { opacity: 1; }

  @media (prefers-reduced-motion: reduce) {
    html.js .reveal { opacity: 1; transform: none; transition: none; }
    .phone img { transition: none; }
    .phone img:first-child { opacity: 1; }
    .btn, .slide-fan img, .arrow-link::after { transition: none; }
  }
}

/* ==========================================================================
   PRODUCT DETAIL PAGE (product-lock-screen.html)
   ========================================================================== */
@layer sections {
  .breadcrumb {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta);
    padding-top: 1.6rem;
  }
  .breadcrumb ol { list-style: none; display: flex; gap: .6rem; padding: 0; }
  .breadcrumb li + li::before { content: "\2192"; margin-right: .6rem; color: var(--text-muted); }
  .breadcrumb a { color: var(--accent-ink); text-decoration: none; }
  .breadcrumb a:hover { text-decoration: underline; }
  .breadcrumb [aria-current] { color: var(--text-muted); }

  /* ---- Product hero: copy left, tablet right ---- */
  .product-hero { padding-block: clamp(2.5rem, 5vw, 4.5rem) var(--section-pad); }
  .product-hero-grid {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(2.5rem, 5vw, 4.5rem); align-items: center;
  }
  .product-hero h1 { font-size: var(--fs-hero); margin: var(--space-eyebrow-heading) 0 1.2rem; }
  .product-hero .lede { color: var(--text-muted); font-size: calc(var(--fs-body) * 1.06); margin-bottom: 1.8rem; max-width: 34rem; }

  /* Landscape tablet frame — same family as .phone, wider bezel */
  .tablet {
    aspect-ratio: 2560 / 1440;
    border-radius: 26px; border: 11px solid var(--mf-night-800);
    outline: 1px solid var(--border);
    background: var(--mf-night-900);
    box-shadow: var(--shadow-card), 0 40px 80px -30px rgb(0 0 0 / .35);
    overflow: hidden;
  }
  .tablet img { width: 100%; height: 100%; object-fit: cover; }
  .tablet-caption {
    margin-top: 1.1rem; text-align: center;
    font-size: var(--fs-caption); font-style: italic; color: var(--text-muted);
  }

  @media (max-width: 860px) {
    .product-hero-grid { grid-template-columns: 1fr; }
  }

  /* ---- Slide modes gallery ---- */
  .modes {
    background: var(--surface-warm);
    border-block: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  /* Four across; a leftover pair on the last row centers itself. */
  .modes-grid {
    display: grid; grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: clamp(1.4rem, 3vw, 2.4rem);
  }
  .modes-grid .mode { grid-column: span 2; }
  .modes-grid .mode:nth-child(4n + 1):nth-last-child(2) { grid-column: 3 / span 2; }
  .mode { display: flex; flex-direction: column; }
  .mode img {
    width: 100%; height: auto;
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.2rem;
  }
  .mode .mode-name {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--accent-ink);
    margin-bottom: .4rem;
  }
  .mode h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: .45rem; }
  .mode p { color: var(--text-muted); font-size: calc(var(--fs-body) * .88); }

  @media (max-width: 980px) {
    .modes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modes-grid .mode,
    .modes-grid .mode:nth-child(4n + 1):nth-last-child(2) { grid-column: auto; }
    .modes-grid .mode:nth-child(odd):last-child { grid-column: 1 / -1; justify-self: center; max-width: 24rem; }
  }
  @media (max-width: 520px) { .modes-grid { grid-template-columns: 1fr; max-width: 21rem; } }

  /* ---- Parent controls checklist ---- */
  .controls { padding-block: var(--section-pad); }
  .controls-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(1.8rem, 4vw, 3rem) clamp(2.5rem, 6vw, 5rem);
  }
  .control { display: grid; grid-template-columns: 1.4rem 1fr; gap: .9rem; }
  .control .spark { width: 1rem; height: 1rem; fill: var(--accent); margin-top: .45rem; }
  .control h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: .35rem; }
  .control p { color: var(--text-muted); font-size: calc(var(--fs-body) * .93); }
  @media (max-width: 700px) { .controls-grid { grid-template-columns: 1fr; } }

  /* ---- Authoring + tinkerers duo ---- */
  .authoring {
    background: var(--surface-warm);
    border-block: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  .duo {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(2.5rem, 6vw, 5rem); align-items: start;
  }
  .duo .main p { color: var(--text-muted); margin-bottom: 1rem; max-width: 36rem; }
  .duo .main h2 { font-size: var(--fs-h2); margin: var(--space-eyebrow-heading) 0 1.1rem; }
  .aside-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); padding: 1.8rem 1.7rem;
    box-shadow: var(--shadow-card);
    border-top: 3px solid var(--sage-ink);
  }
  .aside-card h3 {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--sage-ink);
    margin-bottom: 1rem;
  }
  .aside-card ul { list-style: none; padding: 0; display: grid; gap: .8rem; }
  .aside-card li { color: var(--text-muted); font-size: calc(var(--fs-body) * .9); padding-left: 1.1rem; position: relative; }
  .aside-card li::before { content: "\2013"; position: absolute; left: 0; color: var(--sage-ink); }
  @media (max-width: 860px) { .duo { grid-template-columns: 1fr; } }

  /* ---- Ownership band: always night ---- */
  .own-band {
    /* night-800 so the band still reads as a distinct plate on the dark theme */
    background: var(--mf-night-800);
    border-block: 1px solid var(--mf-night-line);
    --text: var(--mf-cream); --text-muted: var(--mf-cloud);
    --accent-ink: var(--mf-gold); --focus: var(--mf-gold);
    --btn-bg: var(--mf-gold); --btn-fg: var(--mf-night-900);
    color: var(--text);
    padding-block: clamp(3.5rem, 7vw, 5.5rem);
    text-align: center;
  }
  .own-band .eyebrow { justify-content: center; }
  .own-band h2 { font-size: var(--fs-h2); margin: var(--space-eyebrow-heading) auto .9rem; }
  .own-band p { color: var(--text-muted); max-width: 44rem; margin: 0 auto 1.8rem; }
  .own-band .proof-line { justify-content: center; margin-top: 1.6rem; }
  .own-band .proof-line .spark { fill: var(--mf-gold); }

  /* ---- FAQ ---- */
  .faq { padding-block: var(--section-pad); }
  .faq-list { max-width: 46rem; display: grid; gap: 0; }
  .faq details { border-bottom: 1px solid var(--border); }
  .faq details:first-child { border-top: 1px solid var(--border); }
  .faq summary {
    cursor: pointer; list-style: none;
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    font-family: var(--font-serif); font-weight: 700; font-size: 1.25rem;
    padding: 1.1rem 0;
  }
  .faq summary::-webkit-details-marker { display: none; }
  .faq summary::after {
    content: "+"; font-family: var(--font-serif); font-size: 1.4rem; font-weight: 400;
    color: var(--accent-ink); flex: none; transition: rotate .2s ease;
  }
  .faq details[open] summary::after { rotate: 45deg; }
  .faq details p { color: var(--text-muted); padding-bottom: 1.2rem; max-width: 42rem; }
  .faq .help-line { margin-top: 2rem; color: var(--text-muted); }

  /* ---- Cross-links ---- */
  .also {
    background: var(--surface-warm);
    border-top: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  .also .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 52rem; }
  @media (max-width: 700px) { .also .product-grid { grid-template-columns: 1fr; max-width: 34rem; } }
}

/* ==========================================================================
   JOURNAL INDEX (journal.html) — the founder's register: serif, clay, print
   ========================================================================== */
@layer sections {
  /* Masthead — set like a periodical's front page */
  /* Masthead over König's sunset — the journal's daylight answer to the
     homepage's night. The frosted plate flips with the theme: cream plate +
     ink text on light, night plate + cream text on dark. Painting unscrimmed. */
  .journal-mast {
    position: relative; isolation: isolate; overflow: hidden;
    text-align: center;
    background: var(--mf-night-900);
    --plate-bg: rgb(245 240 232 / .88);
    --plate-bg-opaque: rgb(245 240 232 / .97);
    --plate-border: rgb(27 58 75 / .16);
    --mast-muted: #47545D;  /* ink-muted darkened a step: 5.6:1 through the cream plate */
    --mast-text-shadow: none;
    color: var(--text);
    padding-block: clamp(5rem, 9vw, 7rem) clamp(3rem, 5.5vw, 4.5rem);
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .journal-mast {
      --plate-bg: rgb(15 26 34 / .82);
      --plate-bg-opaque: rgb(15 26 34 / .95);
      --plate-border: rgb(245 240 232 / .18);
      --mast-muted: #D8D3C9;
      --mast-text-shadow: 0 2px 20px rgb(11 17 24 / .5);
    }
  }
  :root[data-theme="dark"] .journal-mast {
    --plate-bg: rgb(15 26 34 / .82);
    --plate-bg-opaque: rgb(15 26 34 / .95);
    --plate-border: rgb(245 240 232 / .18);
    --mast-muted: #D8D3C9;
    --mast-text-shadow: 0 2px 20px rgb(11 17 24 / .5);
  }
  .mast-art {
    position: absolute; inset: 0; z-index: -2;
    width: 100%; height: 100%; object-fit: cover; object-position: center 35%;
  }
  /* Whisper vignette only — the plate carries the contrast, the painting
     keeps its voice. Bottom fade eases the seam into the filter bar. */
  .journal-mast::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(to top, rgb(15 26 34 / .32), transparent 24%);
  }

  /* The frosted night plate — the feature graphic's move, at masthead scale.
     Contrast is guaranteed by the plate, independent of the artwork behind. */
  .journal-mast .container {
    width: auto; max-width: min(46rem, 92vw);
    background: var(--plate-bg);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid var(--plate-border);
    border-radius: 22px;
    padding: 2.4rem clamp(1.5rem, 4vw, 3rem) 2.2rem;
    box-shadow: 0 24px 60px -24px rgb(0 0 0 / .55);
  }
  @supports not (backdrop-filter: blur(1px)) {
    .journal-mast .container { background: var(--plate-bg-opaque); }
  }
  .journal-mast .eyebrow {
    justify-content: center;
    /* ink/cream (theme text), not clay: max contrast on the plate.
       Clay stays in the spark and the link underlines. */
    color: var(--text);
    text-shadow: var(--mast-text-shadow);
  }
  .journal-mast h1 {
    font-size: clamp(2.4rem, 4.5vw, 3.6rem);
    margin: var(--space-eyebrow-heading) 0 1rem;
    text-shadow: var(--mast-text-shadow);
  }
  .mast-promise {
    font-style: italic; color: var(--mast-muted);
    font-size: calc(var(--fs-body) * 1.12);
    max-width: 38rem; margin: 0 auto 1.4rem;
  }
  .mast-links {
    display: flex; justify-content: center; gap: 2rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-caption);
  }
  .mast-links a { color: var(--text); text-decoration: underline; text-decoration-color: var(--clay-ink); text-underline-offset: 4px; }
  .mast-links a:hover { color: var(--clay-ink); }

  /* Founder introduction — the journal remains visually distinct while the
     writer receives a deliberate, human introduction before the archive. */
  .journal-index .journal-mast .container {
    padding-block: clamp(2.4rem, 4vw, 3rem);
  }
  .journal-index .journal-mast h1 { margin-top: 0; }

  .founder-welcome {
    padding-block: clamp(2.8rem, 5vw, 4.5rem);
    background: var(--surface-warm);
    border-bottom: 1px solid var(--border);
  }
  .founder-welcome__inner {
    max-width: 62rem; margin-inline: auto;
    display: grid;
    grid-template-columns: clamp(13rem, 22vw, 18rem) minmax(0, 1fr);
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
  }
  .founder-welcome__photo-wrap { position: relative; margin: 0; }
  .founder-welcome__photo-wrap::after {
    content: ""; position: absolute; inset: 0; z-index: 2;
    border: 1px solid color-mix(in srgb, var(--clay-ink) 55%, transparent);
    border-radius: var(--radius-card); pointer-events: none;
  }
  .founder-welcome__photo {
    position: relative; z-index: 1; display: block;
    /* height:auto so the CMS image's width/height attributes don't fix the
       box height and defeat aspect-ratio (the comp img had no attributes). */
    width: 100%; height: auto; aspect-ratio: 4 / 5;
    object-fit: cover; object-position: 55% center;
    border-radius: var(--radius-card); border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
  }
  .founder-welcome__kicker {
    display: flex; align-items: center; gap: .65rem;
    margin-bottom: .65rem;
    color: var(--clay-ink);
    font-family: var(--font-ui); font-size: var(--fs-label); font-weight: 600;
    letter-spacing: .18em; text-transform: uppercase;
  }
  .founder-welcome__kicker .spark {
    width: .72rem; height: .72rem; fill: var(--accent);
  }
  .founder-welcome h2 {
    margin: 0 0 .9rem;
    font-size: clamp(2rem, 3.4vw, 2.8rem);
  }
  .founder-welcome__lede {
    max-width: 38rem; margin-bottom: 1rem;
    color: var(--text);
    font-size: calc(var(--fs-body) * 1.05); line-height: 1.65;
  }
  .founder-welcome__aside {
    max-width: 38rem; margin-bottom: 1.25rem;
    color: var(--text-muted);
    font-size: calc(var(--fs-body) * .92);
  }
  .founder-welcome + .container {
    margin-top: clamp(1.8rem, 3.5vw, 3rem);
  }
  @media (max-width: 700px) {
    .founder-welcome__inner { grid-template-columns: 1fr; gap: 2.2rem; }
    .founder-welcome__photo-wrap {
      width: min(78vw, 19rem); margin-inline: auto;
    }
    .founder-welcome__copy { text-align: center; }
    .founder-welcome__kicker { justify-content: center; }
    .founder-welcome__lede,
    .founder-welcome__aside { margin-inline: auto; }
  }

  /* Double rule — the print journal's horizon line */
  .double-rule {
    border: none; height: 5px; margin: 0;
    border-block: 1px solid color-mix(in srgb, var(--clay-ink) 55%, transparent);
  }
  /* Let the filter block breathe below the masthead painting */
  .journal-mast + .container { margin-top: clamp(1.8rem, 3.5vw, 3rem); }

  /* Category filter */
  .filter-row {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: .4rem 1.8rem;
    padding-block: 1.2rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta);
    letter-spacing: .12em; text-transform: uppercase;
  }
  .filter-row a {
    color: var(--text-muted); text-decoration: none;
    padding-block: .25rem; border-bottom: 2px solid transparent;
  }
  .filter-row a:hover { color: var(--clay-ink); }
  .filter-row a[aria-current] { color: var(--clay-ink); border-bottom-color: var(--clay-ink); }

  /* Featured essay */
  .featured {
    display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: clamp(2rem, 5vw, 4rem); align-items: center;
    padding-block: clamp(2.5rem, 5vw, 4rem);
  }
  .featured-figure { margin: 2rem 0 0; }
  .featured-figure img {
    width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover;
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
  }
  .featured-figure figcaption {
    margin-top: .7rem; font-size: var(--fs-meta); font-style: italic; color: var(--text-muted);
  }
  .featured h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.12; margin: .8rem 0 .9rem; }
  .featured h2 a { color: var(--text); text-decoration: none; }
  .featured h2 a:hover { text-decoration: underline; text-decoration-color: var(--clay-ink); text-decoration-thickness: 2px; }
  .featured .dek { font-style: italic; color: var(--text-muted); font-size: calc(var(--fs-body) * 1.02); margin-bottom: 1.1rem; }
  @media (max-width: 860px) { .featured { grid-template-columns: 1fr; } }

  /* Essay meta line — shared by featured + rows */
  .essay-meta {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta);
    letter-spacing: .04em; color: var(--text-muted);
    display: flex; flex-wrap: wrap; gap: .35rem .6rem; align-items: center;
  }
  .essay-meta .sep { color: var(--clay-ink); }

  /* Category line */
  .cat-line { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
  .cat-line .cat {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--clay-ink);
  }

  /* The list — a table of contents, not a card wall */
  .essay-rows { list-style: none; padding: 0; margin: 0; max-width: 56rem; }
  .essay-rows li {
    border-top: 1px solid var(--border);
    padding-block: clamp(1.6rem, 3vw, 2.4rem);
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(1.2rem, 3vw, 2.4rem); align-items: center;
  }
  .row-thumb {
    width: clamp(9.5rem, 22vw, 17rem); aspect-ratio: 4 / 3; height: auto;
    object-fit: cover; border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
  }
  /* At full width the list widens just enough that the thumbnails' left
     edges align with the featured image's left edge:
     featured-figure left = (container - 4rem gap) * 5fr/11fr from the right,
     i.e. 6/11 + gap from the left; add the 17rem thumb width. */
  @media (min-width: 1284px) {
    .essay-rows { max-width: calc((100% - 4rem) * 6 / 11 + 4rem + 17rem); }
  }

  /* Narrow screens: thumbnail stacks above the title, full width */
  @media (max-width: 640px) {
    .essay-rows li { grid-template-columns: 1fr; gap: 1.1rem; }
    .row-thumb { order: -1; width: 100%; max-width: 26rem; aspect-ratio: 3 / 2; }
  }
  .essay-rows li:last-child { border-bottom: 1px solid var(--border); }
  .essay-rows h2 { font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.18; margin: .6rem 0 .55rem; }
  .essay-rows h2 a { color: var(--text); text-decoration: none; }
  .essay-rows h2 a:hover { text-decoration: underline; text-decoration-color: var(--clay-ink); text-decoration-thickness: 2px; }
  .essay-rows .dek { font-style: italic; color: var(--text-muted); font-size: calc(var(--fs-body) * .95); margin-bottom: .8rem; max-width: 44rem; }

  .journal-body { padding-bottom: var(--section-pad); }

  /* Pagination */
  .pagination {
    display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
    max-width: 50rem; padding-top: 2rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-caption);
  }
  .pagination .pages { color: var(--text-muted); }

  /* Email capture — honest and quiet */
  .subscribe {
    background: var(--surface-warm);
    border-block: 1px solid var(--border);
    padding-block: clamp(3rem, 6vw, 4.5rem);
  }
  .subscribe-inner { max-width: 40rem; margin-inline: auto; text-align: center; }
  .subscribe .eyebrow { justify-content: center; }
  .subscribe h2 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); margin: var(--space-eyebrow-heading) 0 .6rem; }
  .subscribe p { color: var(--text-muted); margin-bottom: 1.5rem; }
  .subscribe-form { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }
  .subscribe-form input[type="email"] {
    flex: 1 1 16rem; max-width: 22rem;
    font-family: var(--font-serif); font-size: 1rem;
    padding: .75rem 1.1rem;
    border: 1px solid var(--border); border-radius: var(--radius-btn);
    background: var(--surface); color: var(--text);
  }
  .subscribe-form input[type="email"]::placeholder { color: var(--text-muted); }
  .subscribe .consent {
    display: flex; gap: .55rem; justify-content: center; align-items: baseline;
    margin-top: 1rem; font-size: var(--fs-meta); color: var(--text-muted);
  }
  .subscribe .consent input { accent-color: var(--clay-ink); }
  /* Consent line and the Turnstile widget each get their own row. */
  .subscribe-form .consent,
  .subscribe-form .cf-turnstile { flex-basis: 100%; }
  .subscribe-form .cf-turnstile {
    display: flex; justify-content: center;
    margin-top: -.35rem;  /* pull it up against the flex row-gap, toward consent */
  }
}

/* ==========================================================================
   JOURNAL ARTICLE (journal-article.html) — the reading experience
   ========================================================================== */
@layer sections {
  /* ---- Article header: centered, quiet; the index owns the sunset ---- */
  .article-head {
    max-width: 46rem; margin-inline: auto; text-align: center;
    padding-block: clamp(3rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  }
  .article-head .kicker {
    display: flex; justify-content: center; align-items: center; gap: .8rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase;
  }
  .article-head .kicker a { color: var(--clay-ink); text-decoration: none; }
  .article-head .kicker a:hover { text-decoration: underline; }
  .article-head h1 {
    font-size: clamp(2.3rem, 4vw, 3.4rem);
    margin: var(--space-eyebrow-heading) 0 1rem;
  }
  .article-head .dek {
    font-style: italic; color: var(--text-muted);
    font-size: calc(var(--fs-body) * 1.1);
    max-width: 38rem; margin: 0 auto 1.6rem;
  }
  .article-byline {
    display: flex; justify-content: center; align-items: center; gap: .9rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-caption);
    color: var(--text-muted);
  }
  .article-byline img {
    width: 2.6rem; height: 2.6rem; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--border);
  }
  .article-byline .name { color: var(--text); }
  .article-byline .sep { color: var(--clay-ink); }

  /* ---- Feature image: the article's lead visual (same Wagtail field as the
     index thumbnail), wider than the reading column, credited. ---- */
  .article-feature { max-width: 72rem; margin: 0 auto clamp(2.5rem, 5vw, 4rem); }
  .article-feature img {
    width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover;
    border-radius: var(--radius-card);
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .article-feature figcaption {
    margin-top: .8rem; text-align: center;
    font-size: var(--fs-caption); font-style: italic; color: var(--text-muted);
  }
  @media (max-width: 700px) {
    .article-feature img { aspect-ratio: 3 / 2; }
  }

  /* ---- Figures ---- */
  .fig-wide { max-width: 58rem; margin: clamp(2rem, 4vw, 3rem) auto; }
  .fig-wide img {
    width: 100%; height: auto; border-radius: var(--radius-card);
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .fig-inset { max-width: 17rem; margin: clamp(2rem, 4vw, 2.8rem) auto; }
  .fig-inset img {
    width: 100%; height: auto; border-radius: 16px;
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .fig-wide figcaption, .fig-inset figcaption {
    margin-top: .8rem; text-align: center;
    font-size: var(--fs-caption); font-style: italic; color: var(--text-muted);
  }

  /* ---- The reading column ---- */
  .prose {
    width: 92vw; max-width: 41rem; margin-inline: auto;
    font-size: calc(var(--fs-body) * 1.06);
    line-height: 1.72;
  }
  .prose p, .prose ul, .prose ol { margin-bottom: 1.35em; }
  .prose h2 {
    font-size: 1.75rem; font-weight: 700;
    margin: 2.2em 0 .7em;
  }
  .prose .opening::first-letter {
    font-size: 3.4em; line-height: .82; float: left;
    padding: .08em .12em 0 0; color: var(--accent-ink);
  }
  .prose blockquote {
    margin: 1.8em 0; padding: .2em 0 .2em 1.4em;
    border-left: 3px solid var(--clay-ink);
    font-style: italic; color: var(--text-muted);
  }
  .prose blockquote cite { display: block; margin-top: .5em; font-size: .88em; font-style: normal; }

  .pullquote {
    max-width: 34rem; margin: clamp(2.2rem, 4vw, 3rem) auto;
    text-align: center;
    font-family: var(--font-serif); font-style: italic;
    font-size: clamp(1.5rem, 2.2vw, 1.9rem); line-height: 1.35;
    color: var(--text);
  }
  .pullquote::before, .pullquote::after {
    content: ""; display: block; width: 5rem; height: 1px;
    background: var(--clay-ink); margin: 1.1rem auto;
  }

  /* Dinkus — three sparks, a section's breath */
  .dinkus {
    display: flex; justify-content: center; gap: 1.1rem;
    margin: clamp(2.2rem, 4vw, 3rem) auto;
  }
  .dinkus .spark { width: .65rem; height: .65rem; fill: var(--accent); }

  /* ---- End matter ---- */
  .article-tags {
    max-width: 41rem; margin: 2.5rem auto 0;
    display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  }
  .article-tags a {
    font-family: var(--font-ui); font-weight: 600; font-size: .8rem;
    letter-spacing: .05em; text-decoration: none;
    color: var(--clay-ink);
    border: 1px solid color-mix(in srgb, var(--clay-ink) 45%, transparent);
    border-radius: 999px; padding: .3rem .95rem;
  }
  .article-tags a:hover { background: color-mix(in srgb, var(--clay-ink) 10%, transparent); }

  .author-card {
    max-width: 41rem; margin: clamp(2.5rem, 5vw, 3.5rem) auto 0;
    display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-card);
    padding: 1.6rem 1.8rem;
  }
  .author-card img {
    width: 4.5rem; height: 4.5rem; border-radius: 50%; object-fit: cover;
  }
  .author-card .who {
    font-family: var(--font-ui); font-weight: 600; font-size: .95rem;
    margin-bottom: .3rem;
  }
  .author-card .who span { color: var(--text-muted); font-weight: 600; }
  .author-card p { color: var(--text-muted); font-size: calc(var(--fs-body) * .88); }
  .author-card .arrow-link { color: var(--clay-ink); }
  @media (max-width: 520px) {
    .author-card { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  }

  .article-body { padding-bottom: var(--section-pad); }

  /* ---- Related essays ---- */
  .related {
    background: var(--surface-warm);
    border-top: 1px solid var(--border);
    padding-block: clamp(3.5rem, 7vw, 5.5rem);
  }
}

/* ==========================================================================
   PRODUCTS INDEX (products.html)
   ========================================================================== */
@layer sections {
  /* Centered page head — shared by the products index and the generic
     IndexPage (help.html, help-lock-screen.html) */
  .products-head, .index-head {
    max-width: 46rem; margin-inline: auto; text-align: center;
    padding-block: clamp(3rem, 6vw, 4.5rem) clamp(2.5rem, 5vw, 3.5rem);
  }
  .products-head .eyebrow, .index-head .eyebrow { justify-content: center; }
  .products-head h1, .index-head h1 { font-size: clamp(2.3rem, 4vw, 3.4rem); margin: var(--space-eyebrow-heading) 0 1rem; }
  .products-head .dek, .index-head .dek { color: var(--text-muted); font-size: calc(var(--fs-body) * 1.08); }

  /* Free-form StreamField body between the page head and the card grids.
     Headings here are centered section furniture, not mid-essay heads;
     running prose stays left-aligned. This page only. */
  .products-body {
    /* Tighten toward the dek above; open up before the card grid below. */
    margin-top: calc(-1 * clamp(1.5rem, 3vw, 2rem));
    padding-bottom: clamp(2.2rem, 4vw, 3rem);
  }
  .products-body > .prose:first-child > :first-child { margin-top: 0; }
  /* Match the page head's column, not the 41rem article measure. */
  .products-body .prose { max-width: 46rem; }
  .products-body .prose h2 {
    font-size: var(--fs-h2);
    font-weight: 400;
    text-align: center;
    /* Fill the measure before wrapping instead of balancing both lines
       short — keeps the heading's widest line as wide as the dek. */
    text-wrap: pretty;
    margin: 2.5rem 0 .9rem;
  }

  /* Planned products — flagged, quieter, no store CTA (spec GF-9) */
  .planned {
    background: var(--surface-warm);
    border-top: 1px solid var(--border);
    padding-block: var(--section-pad);
  }
  .product-card--planned {
    background: transparent;
    border-style: dashed;
    box-shadow: none;
  }
  .product-card--planned::before { display: none; }
  .product-card--planned .product-tag { color: var(--text-muted); }
  .product-card--planned .terms { margin-left: auto; }
}

/* ==========================================================================
   SHARE ROW — plain links to share endpoints; no SDKs, no trackers, ever
   ========================================================================== */
@layer sections {
  .share-row {
    max-width: 41rem; margin: 2rem auto 0;
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.4rem;
    padding-top: 1.4rem; border-top: 1px solid var(--border);
    font-family: var(--font-ui); font-size: var(--fs-caption); font-weight: 600;
  }
  .share-row .label {
    letter-spacing: .16em; text-transform: uppercase; font-size: var(--fs-label);
    color: var(--text-muted);
  }
  .share-row .icon-btn {
    display: inline-grid; place-items: center;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    background: none; border: 1px solid var(--border);
    color: var(--clay-ink); text-decoration: none; padding: 0;
    transition: background-color .15s ease, border-color .15s ease;
  }
  .share-row .icon-btn:hover {
    border-color: var(--clay-ink);
    background: color-mix(in srgb, var(--clay-ink) 10%, transparent);
  }
  .share-row .icon-btn svg {
    width: 1.1rem; height: 1.1rem;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
  }
  .share-row .icon-btn svg.brand-icon { fill: currentColor; stroke: none; }
  .share-row .copy-check { display: none; }
  .share-row .copied .copy-glyph { display: none; }
  .share-row .copied .copy-check { display: block; }
  .share-row .native-share[hidden] { display: none; }
}

/* ==========================================================================
   CONTACT (contact.html) — the one page with real form components
   ========================================================================== */
@layer sections {
  .contact-grid {
    display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(2.5rem, 6vw, 5rem); align-items: start;
    padding-bottom: var(--section-pad);
  }
  @media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }

  .form-field { margin-bottom: 1.4rem; }
  .form-field label {
    display: block; margin-bottom: .45rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-caption);
  }
  .form-field .optional { color: var(--text-muted); font-weight: 600; font-size: .8rem; }
  .form-field input, .form-field textarea {
    width: 100%;
    font-family: var(--font-serif); font-size: 1.05rem;
    padding: .75rem 1rem;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); color: var(--text);
  }
  .form-field textarea { min-height: 11rem; resize: vertical; }
  .form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-muted); }

  /* Validation — native, styled; fires only after the user has interacted */
  .form-field input:user-invalid, .form-field textarea:user-invalid {
    border-color: var(--clay-ink);
  }
  .form-field .field-error {
    display: none; margin-top: .4rem;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta);
    color: var(--clay-ink);
  }
  .form-field input:user-invalid ~ .field-error,
  .form-field textarea:user-invalid ~ .field-error { display: block; }

  /* Honeypot (spec GF-3): visually gone, still in the POST for the server */
  .hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

  .contact-aside {
    background: var(--surface-warm); border: 1px solid var(--border);
    border-radius: var(--radius-card); padding: 1.9rem 1.8rem;
  }
  .contact-aside h2 {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--accent-ink);
    margin-bottom: 1.1rem;
  }
  .contact-aside p { color: var(--text-muted); font-size: calc(var(--fs-body) * .92); margin-bottom: 1rem; }
  .contact-aside p:last-child { margin-bottom: 0; }

  /* Thank-you state — shown via ?sent=1 in the comp; a real view in Wagtail */
  .sent-note {
    display: none;
    border: 1px solid var(--sage-ink); border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--sage-ink) 8%, transparent);
    padding: 1.5rem 1.7rem; margin-bottom: 2rem;
  }
  .sent-note h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: .3rem; }
  .sent-note p { color: var(--text-muted); }
  html.sent .sent-note { display: block; }
  html.sent .contact-form { display: none; }

  /* ==========================================================================
     ABOUT (about.html) — the StandardPage/prose exemplar
     ========================================================================== */
  .about-portrait { max-width: 21rem; margin: clamp(2rem, 4vw, 2.8rem) auto; }
  .about-portrait img {
    width: 100%; height: auto; border-radius: var(--radius-card);
    border: 1px solid var(--border); box-shadow: var(--shadow-card);
  }
  .about-portrait figcaption {
    margin-top: .8rem; text-align: center;
    font-size: var(--fs-caption); font-style: italic; color: var(--text-muted);
  }
  .page-cta {
    display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
    padding-block: clamp(2rem, 4vw, 3rem) var(--section-pad);
  }

  /* ==========================================================================
     404 — lost among the stars
     ========================================================================== */
  /* The full painting, uncropped (width 100%, natural height), fading into
     the night ground below it. Content floats on a soft frosted vignette. */
  body:has(main.lost) { background: var(--mf-night-900); }
  .lost {
    position: relative; display: grid; min-height: 100vh;
    background: var(--mf-night-900);
    --text: var(--mf-cream); --text-muted: #D8D3C9;
    --accent-ink: var(--mf-gold); --focus: var(--mf-gold);
    --btn-bg: var(--mf-gold); --btn-fg: var(--mf-night-900);
    color: var(--text); text-align: center;
  }
  .lost-art { grid-area: 1 / 1; width: 100%; height: auto; }
  .lost::before {
    /* gradient sized to the image box: same width, same aspect ratio */
    content: ""; position: absolute; top: 0; left: 0;
    width: 100%; aspect-ratio: 3431 / 2806; z-index: 0;
    background: linear-gradient(to bottom, transparent 45%, var(--mf-night-900));
  }
  /* Viewport-height stage keeps the plate centered on the SCREEN, not the
     (taller) painting; sticky lets the painting scroll past beneath it. */
  .lost-stage {
    grid-area: 1 / 1; position: sticky; top: 0; z-index: 1;
    height: 100svh; display: grid; place-items: center;
  }
  .lost-inner {
    padding: 2.8rem clamp(1.5rem, 5vw, 3.5rem); max-width: 38rem; margin: 2rem;
    background: rgb(15 26 34 / .8);   /* gold kicker needs 4.5:1 through the frost */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 26px;
  }
  .lost-brand { display: inline-block; margin-bottom: 1.6rem; }
  .lost-brand img { width: clamp(5rem, 8vw, 6.5rem); height: auto; margin-inline: auto; }
  .lost .code {
    font-family: var(--font-ui); font-weight: 600;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    letter-spacing: .3em; text-transform: uppercase; color: var(--mf-gold);
  }
  .lost h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 1rem 0 .8rem; }
  .lost p { color: var(--text-muted); margin-bottom: 1.8rem; }
  .lost .hero-actions { justify-content: center; }
}

/* ==========================================================================
   INDEX PAGE (help.html, help-lock-screen.html) — the generic lister
   One template, any depth: intro up top, child pages beneath, set like a
   book's table of contents. The help hub lists its sections; a section
   lists its guides. Only the copy is help-specific — a table of contents,
   not a card wall, same as the journal archive.
   ========================================================================== */
@layer sections {
  .index-list { max-width: 46rem; margin-inline: auto; padding-bottom: var(--section-pad); }

  .index-rows { list-style: none; margin: 0; padding: 0; }
  .index-rows > li {
    --row-ink: var(--accent-ink);
    border-top: 1px solid var(--border);
    padding-block: clamp(1.5rem, 3vw, 2.1rem);
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 1.5rem; align-items: baseline;
  }
  .index-rows > li:last-child { border-bottom: 1px solid var(--border); }
  /* Row voices mirror the product-card accents (default gold; sage; clay) */
  .index-rows > .row--sage { --row-ink: var(--sage-ink); }
  .index-rows > .row--clay { --row-ink: var(--clay-ink); }

  .index-rows .row-label {
    grid-column: 1 / -1;
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-label);
    letter-spacing: .18em; text-transform: uppercase; color: var(--row-ink);
    margin-bottom: var(--space-card-label-heading);
  }
  .index-rows h2 { font-size: clamp(1.45rem, 2.2vw, 1.9rem); line-height: 1.18; }
  .index-rows h2 a { color: var(--text); text-decoration: none; }
  .index-rows h2 a:hover { text-decoration: underline; text-decoration-color: var(--row-ink); text-decoration-thickness: 2px; }
  /* Child count, set like a page number in a contents list */
  .index-rows .row-meta {
    font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-meta);
    letter-spacing: .04em; color: var(--text-muted); white-space: nowrap;
  }
  .index-rows .dek {
    grid-column: 1 / -1;
    font-style: italic; color: var(--text-muted);
    font-size: calc(var(--fs-body) * .95);
    margin-top: .55rem; max-width: 40rem;
  }

  /* Numbered contents — the guides within one section. The numeral is the
     steps/pillars family: italic serif, accent ink. */
  .index-rows--numbered { counter-reset: guide; }
  .index-rows--numbered > li { grid-template-columns: 2.7rem minmax(0, 1fr); }
  .index-rows--numbered > li::before {
    counter-increment: guide; content: counter(guide);
    font-family: var(--font-serif); font-style: italic;
    font-size: 1.7rem; line-height: 1; color: var(--accent-ink);
  }
  .index-rows--numbered .dek { grid-column: 2 / -1; }

  .index-foot {
    margin-top: 2rem; color: var(--text-muted);
    font-size: calc(var(--fs-body) * .95);
  }

  @media (max-width: 560px) {
    .index-rows > li { grid-template-columns: minmax(0, 1fr); }
    .index-rows .row-meta { grid-column: 1 / -1; margin-top: .35rem; }
    .index-rows--numbered > li { grid-template-columns: 2.2rem minmax(0, 1fr); }
  }
}

/* --------------------------------------------------------------------------
   SITE ADDITIONS (Wagtail port) — blocks with no comp equivalent.
   Token-driven, same voice as the rest of the file.
   -------------------------------------------------------------------------- */
@layer components {
  /* Gallery block */
  .gallery-grid {
    display: grid; gap: 1.4rem;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    width: 92vw; max-width: 58rem; margin: 2.5rem auto;
  }
  .gallery-grid img { width: 100%; height: auto; }
  .gallery-grid figcaption {
    font-size: var(--fs-caption); color: var(--text-muted); margin-top: .6rem;
  }

  /* Embed block */
  .embed-block { width: 92vw; max-width: 58rem; margin: 2.5rem auto; }
  .embed-block iframe {
    width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0;
    border-radius: var(--radius-card);
  }

  /* Testimonial block */
  .testimonial {
    width: 92vw; max-width: 41rem; margin: 2.5rem auto;
    padding: 1.6rem 1.8rem;
    background: var(--surface-warm); border-radius: var(--radius-card);
  }
  .testimonial blockquote p {
    font-family: var(--font-serif); font-style: italic; font-size: 1.25rem;
  }
  .testimonial figcaption {
    margin-top: .8rem; font-size: var(--fs-small); color: var(--text-muted);
  }
}

/* Server-rendered states for the ported forms (the comps used :user-invalid
   and an html.sent preview hook; the real backend renders these instead).
   Deliberately UNLAYERED: the base `.sent-note`/`.field-error { display:none }`
   rules live in the `sections` layer, which outranks `components`; unlayered
   rules beat every layer, so these reliably win and reveal the elements. */
.form-field .field-error--server { display: block; }
.sent-note--show { display: block; }
