/* ============================================================
   SAUI — main.css  (Global styles)
   ============================================================ */

@layer base, component, utility;

/* ================================================================
   BASE — design tokens, reset, global typography
   ================================================================ */

@layer base {

  @font-face {
    font-family: 'Lora-Fallback';
    src: local('Georgia');
    size-adjust: 97%;
    ascent-override: 88%;
    descent-override: 22%;
    line-gap-override: 0%;
  }

  /* ----------------------------------------------------------
     Design tokens
     ---------------------------------------------------------- */

  :root {
    /* Colors — light */
    --c-bg:            oklch(97% 0.008 80);
    --c-surface:       oklch(93% 0.010 80);
    --c-border:        oklch(87% 0.015 80);
    --c-text:          oklch(14% 0.000 0);
    --c-text-muted:    oklch(50% 0.010 80);
    --c-accent:        oklch(46% 0.120 240);
    --c-accent-hover:  oklch(40% 0.140 240);
    --c-accent-subtle: oklch(94% 0.040 240);
    --c-code-bg:       oklch(17% 0.020 240);
    --c-code-text:     oklch(88% 0.030 200);

    /* Typography */
    --font-serif: 'Lora', 'Lora-Fallback', Georgia, 'Bitstream Charter', serif;
    --font-sans:  system-ui, -apple-system, sans-serif;
    --font-mono:  ui-monospace, 'Cascadia Code', 'Fira Code', monospace;

    /* Fluid type scale */
    --text-xs:   clamp(0.70rem, 1.2vw, 0.75rem);
    --text-sm:   clamp(0.80rem, 1.5vw, 0.875rem);
    --text-base: clamp(1.00rem, 1.8vw, 1.125rem);
    --text-lg:   clamp(1.15rem, 2.5vw, 1.40rem);
    --text-xl:   clamp(1.40rem, 3.2vw, 1.75rem);
    --text-2xl:  clamp(1.50rem, 4.0vw, 2.10rem);
    --text-3xl:  clamp(1.80rem, 5.0vw, 2.80rem);
    --text-4xl:  clamp(2.20rem, 7.0vw, 3.80rem);

    /* Leading */
    --leading-tight: 1.15;
    --leading-snug:  1.35;
    --leading-prose: 1.72;

    /* Spacing — 8pt grid */
    --sp-1:  0.25rem;
    --sp-2:  0.50rem;
    --sp-3:  0.75rem;
    --sp-4:  1.00rem;
    --sp-5:  1.50rem;
    --sp-6:  2.00rem;
    --sp-7:  3.00rem;
    --sp-8:  4.00rem;
    --sp-9:  6.00rem;
    --sp-10: 8.00rem;

    /* Layout */
    --max-width:   1400px;
    --gutter:      clamp(1.25rem, 5vw, 3.50rem);
    --prose-width: 68ch;
    --nav-height:  64px;

    /* Borders */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --border:    1px solid var(--c-border);

    /* Transitions */
    --t-fast: 150ms cubic-bezier(0.25, 1, 0.5, 1);
    --t-base: 250ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Hero network graph */
    --hero-line: oklch(86% 0.018 230);
    --hero-node: oklch(82% 0.028 235);

    /* Statement section (home page) */
    --c-statement-bg:       oklch(10% 0.030 245);
    --c-statement-dot:      oklch(28% 0.055 242);
    --c-statement-eyebrow:  oklch(48% 0.09 240);
    --c-statement-line:     oklch(92% 0.005 80);
    --c-statement-line-alt: oklch(68% 0.13 240);
  }

  /* Dark mode */
  @media (prefers-color-scheme: dark) {
    :root {
      --leading-prose: 1.78;
      --c-bg:            oklch(13% 0.015 250);
      --c-surface:       oklch(18% 0.018 250);
      --c-border:        oklch(28% 0.020 250);
      --c-text:          oklch(90% 0.008 80);
      --c-text-muted:    oklch(62% 0.010 200);
      --c-accent:        oklch(66% 0.130 240);
      --c-accent-hover:  oklch(73% 0.150 240);
      --c-accent-subtle: oklch(22% 0.055 240);
      --c-code-bg:       oklch(10% 0.025 240);
      --c-code-text:     oklch(88% 0.030 200);
      --hero-line:       oklch(22% 0.025 245);
      --hero-node:       oklch(26% 0.035 242);
    }
  }

  /* ----------------------------------------------------------
     Reset
     ---------------------------------------------------------- */

  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }

  html {
    font-size: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    hanging-punctuation: first last;
  }

  /* ----------------------------------------------------------
     Base typography
     ---------------------------------------------------------- */

  body {
    background-color: var(--c-bg);
    color: var(--c-text);
    font-family: var(--font-serif);
    font-size: var(--text-base);
    line-height: var(--leading-prose);
    min-block-size: 100dvh;
    display: block;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-optical-sizing: auto;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: var(--leading-tight);
    text-wrap: balance;
    color: var(--c-text);
  }

  h1 { font-size: var(--text-4xl); letter-spacing: -0.02em; }
  h2 { font-size: var(--text-3xl); letter-spacing: -0.01em; }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }
  h5, h6 { font-size: var(--text-lg); }

  p { text-wrap: pretty; }

  strong { font-weight: 600; }

  em { font-style: italic; }

  /* ----------------------------------------------------------
     Links
     ---------------------------------------------------------- */

  a {
    color: var(--c-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color var(--t-fast);
  }

  a:hover { color: var(--c-accent-hover); }

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

  /* ----------------------------------------------------------
     Lists
     ---------------------------------------------------------- */

  ul, ol { padding-inline-start: var(--sp-5); }
  li { margin-block-start: var(--sp-2); }

  /* Description lists */
  dl { display: grid; grid-template-columns: 1fr; gap: var(--sp-2) var(--sp-5); }
  dt { font-weight: 600; font-family: var(--font-sans); font-size: var(--text-sm); padding-block-start: 0.15em; }
  dd { color: var(--c-text-muted); }

  @media (width >= 480px) {
    dl { grid-template-columns: auto 1fr; }
  }

  /* ----------------------------------------------------------
     Code
     ---------------------------------------------------------- */

  code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--c-surface);
    border: var(--border);
    border-radius: var(--radius-sm);
    padding: 0.1em 0.35em;
  }

  pre {
    background-color: var(--c-code-bg);
    color: var(--c-code-text);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.65;
    padding: var(--sp-5) var(--sp-6);
    border-radius: var(--radius-md);
    overflow-x: auto;
  }

  pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: inherit;
    color: inherit;
  }

  /* ----------------------------------------------------------
     Media
     ---------------------------------------------------------- */

  img, picture, video, canvas, svg {
    display: block;
    max-inline-size: 100%;
  }

  /* ----------------------------------------------------------
     Misc
     ---------------------------------------------------------- */

  hr {
    border: none;
    border-block-start: var(--border);
    margin-block: var(--sp-8);
  }

  ::selection {
    background-color: var(--c-accent);
    color: oklch(99% 0.004 80);
  }

  input, button, textarea, select { font: inherit; }
}

/* ================================================================
   COMPONENT — site chrome, sections, widgets
   ================================================================ */

@layer component {

  /* ----------------------------------------------------------
     Site header + navigation
     ---------------------------------------------------------- */

  body > header {
    position: sticky;
    inset-block-start: 0;
    z-index: 100;
    background-color: var(--c-bg);
    border-block-end: var(--border);
    block-size: var(--nav-height);
    display: flex;
    align-items: center;
  }

  body > header nav {
    inline-size: 100%;
    max-inline-size: var(--max-width);
    margin-inline: auto;
    padding-inline: var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-6);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  body > header nav::-webkit-scrollbar { display: none; }

  /* Brand */
  body > header nav > a {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-text);
    text-decoration: none;
    flex-shrink: 0;
    transition: color var(--t-fast);
  }

  body > header nav > a:hover { color: var(--c-accent); }

  .site-logo {
    display: block;
    overflow: visible;
  }

  .site-logo__wordmark {
    font-family: 'Fraunces', 'Lora-Fallback', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    font-variation-settings: 'opsz' 30;
    letter-spacing: 0.04em;
    transition: font-variation-settings var(--t-base);
  }

  body > header nav > a:hover .site-logo__wordmark,
  body > header nav > a:focus-visible .site-logo__wordmark {
    font-variation-settings: 'opsz' 9;
  }

  /* Nav links */
  body > header nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--sp-2) var(--sp-5);
  }

  body > header nav ul a {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-block-size: 44px;
    padding-inline: var(--sp-1);
    background-image: linear-gradient(var(--c-accent), var(--c-accent));
    background-size: 0 1px;
    background-repeat: no-repeat;
    background-position: 4px 30px;
    transition: color var(--t-fast), background-size var(--t-fast);
  }

  body > header nav ul a:hover,
  body > header nav ul a[aria-current="page"] {
    color: var(--c-accent);
    background-size: calc(100% - 2 * var(--sp-1)) 1px;
  }

  /* ----------------------------------------------------------
     Mobile nav toggle (hamburger)
     ---------------------------------------------------------- */

  .nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-text);
    flex-shrink: 0;
    transition: color var(--t-fast);
  }

  .nav-toggle:hover { color: var(--c-accent); }

  .nav-toggle:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  @media (width < 800px) {
    .nav-toggle { display: flex; }
    body > header nav ul { display: none; }
    .lang-switch { display: none; }
  }

  /* ----------------------------------------------------------
     Language switcher
     ---------------------------------------------------------- */

  .lang-switch {
    font-size: var(--text-xs);
    font-family: var(--font-mono);
    color: var(--c-text-muted);
    letter-spacing: 0.06em;
    text-decoration: none;
    padding: 0.15em 0.4em;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    transition: color var(--t-fast), border-color var(--t-fast);
    white-space: nowrap;
  }

  .lang-switch:hover {
    color: var(--c-accent);
    border-color: var(--c-accent);
  }

  /* ----------------------------------------------------------
     Mobile nav — full-screen typographic overlay
     ---------------------------------------------------------- */

  .mobile-nav {
    position: fixed;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    max-inline-size: 100%;
    max-block-size: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: var(--c-bg);
    overflow-y: auto;
    z-index: 200;
    opacity: 1;
    transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  @starting-style {
    .mobile-nav[open] { opacity: 0; }
  }

  .mobile-nav.is-closing { opacity: 0; }

  .mobile-nav::backdrop { display: none; }

  .mobile-nav__inner {
    display: flex;
    flex-direction: column;
    min-block-size: 100%;
    padding-block: var(--sp-4) var(--sp-9);
    padding-inline: var(--gutter);
  }

  .mobile-nav__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    block-size: var(--nav-height);
    flex-shrink: 0;
    margin-block-end: var(--sp-7);
  }

  .mobile-nav__brand {
    font-family: 'Fraunces', 'Lora-Fallback', Georgia, serif;
    font-size: 20px;
    font-weight: 700;
    font-variation-settings: 'opsz' 30;
    letter-spacing: 0.04em;
    color: var(--c-text);
  }

  .mobile-nav__close {
    display: flex;
    align-items: center;
    justify-content: center;
    inline-size: 44px;
    block-size: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--c-text-muted);
    transition: color var(--t-fast);
    border-radius: var(--radius-sm);
  }

  .mobile-nav__close:hover { color: var(--c-text); }

  .mobile-nav__close:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 3px;
  }

  .mobile-nav__list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .mobile-nav__list li { border-block-start: var(--border); }
  .mobile-nav__list li:last-child { border-block-end: var(--border); }

  .mobile-nav__list a {
    display: flex;
    align-items: baseline;
    gap: var(--sp-4);
    padding-block: var(--sp-5);
    text-decoration: none;
    color: var(--c-text);
    transition: color var(--t-fast);
  }

  .mobile-nav__list a:hover,
  .mobile-nav__list a[aria-current="page"] { color: var(--c-accent); }

  .mobile-nav__list a:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
  }

  .mobile-nav__num {
    font-family: var(--font-serif);
    font-size: var(--text-sm);
    font-variant-numeric: oldstyle-nums;
    color: var(--c-text-muted);
    transition: color var(--t-fast);
    flex-shrink: 0;
    min-inline-size: 2ch;
  }

  .mobile-nav__list a:hover .mobile-nav__num,
  .mobile-nav__list a[aria-current="page"] .mobile-nav__num { color: var(--c-accent); }

  .mobile-nav__label {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  @keyframes mobile-nav-item-enter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .mobile-nav[open] .mobile-nav__list li {
    animation: mobile-nav-item-enter 340ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .mobile-nav[open] .mobile-nav__list li:nth-child(1) { animation-delay:  50ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(2) { animation-delay:  80ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(3) { animation-delay: 110ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(4) { animation-delay: 140ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(5) { animation-delay: 170ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(6) { animation-delay: 200ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(7) { animation-delay: 230ms; }
  .mobile-nav[open] .mobile-nav__list li:nth-child(8) { animation-delay: 260ms; }

  @media (prefers-reduced-motion: reduce) {
    .mobile-nav { transition: none; }
    .mobile-nav.is-closing { opacity: 1; }
    .mobile-nav[open] .mobile-nav__list li { animation: none; opacity: 1; transform: none; }
  }

  /* ----------------------------------------------------------
     Skip navigation
     ---------------------------------------------------------- */

  .skip-link {
    position: absolute;
    inset-block-start: var(--sp-2);
    inset-inline-start: var(--sp-2);
    z-index: 999;
    padding: var(--sp-2) var(--sp-4);
    background: var(--c-accent);
    color: oklch(98% 0.005 80);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-decoration: none;
    translate: 0 -150%;
    transition: translate var(--t-fast);
  }

  .skip-link:focus-visible {
    translate: 0 0;
  }

  /* ----------------------------------------------------------
     Main
     ---------------------------------------------------------- */

  main {
    inline-size: 100%;
  }

  /* ----------------------------------------------------------
     Footer
     ---------------------------------------------------------- */

  body > footer {
    border-block-start: var(--border);
    padding-block: var(--sp-6);
    padding-inline: var(--gutter);
  }

  body > footer p {
    max-inline-size: var(--max-width);
    margin-inline: auto;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    text-align: center;
  }

  /* ----------------------------------------------------------
     Article layout (all content pages)
     ---------------------------------------------------------- */

  article {
    max-inline-size: calc(var(--max-width) + 2 * var(--gutter));
    margin-inline: auto;
    padding-inline: var(--gutter);
    padding-block-end: var(--sp-7);
  }

  @media (width >= 700px) {
    article { padding-block-end: var(--sp-10); }
  }

  .lead {
    font-size: var(--text-lg);
    color: var(--c-text-muted);
    line-height: var(--leading-snug);
    font-style: italic;
  }

  /* Generic prose sections (no class = article content) */
  article > section:not([class]) {
    max-inline-size: var(--prose-width);
    margin-inline: auto;
    padding-block: var(--sp-7);
    border-block-start: var(--border);
    text-align: start;
  }

  article > section:not([class]):first-child {
    border-block-start: none;
    padding-block-start: var(--sp-7);
  }

  @media (width >= 700px) {
    article > section:not([class]):first-child { padding-block-start: var(--sp-9); }
  }

  article > section:not([class]) h2 {
    margin-block-end: var(--sp-5);
    font-size: var(--text-2xl);
  }

  article > section:not([class]) h3, article > section:not([class]) h4 {
    font-size: var(--text-xl);
    margin-block-start: var(--sp-6);
    margin-block-end: var(--sp-3);
  }

  article > section:not([class]) p + p {
    margin-block-start: var(--sp-4);
  }

  article > section:not([class]) ul,
  article > section:not([class]) ol,
  article > section:not([class]) dl,
  article > section:not([class]) pre {
    margin-block: var(--sp-5);
  }

  /* ----------------------------------------------------------
     Shared keyframe: hero enter (page-hero + arch-hero)
     ---------------------------------------------------------- */

  @keyframes hero-enter {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ----------------------------------------------------------
     Nav cards (home explore + cases listing)
     ---------------------------------------------------------- */

  .nav-cards {
    padding-block: var(--sp-6);
    border-block-start: var(--border);
  }

  @media (width >= 700px) {
    .nav-cards { padding-block: var(--sp-9); }
  }

  .nav-cards h2 {
    font-size: var(--text-xs);
    font-family: var(--font-sans);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--c-text-muted);
    margin-block-end: var(--sp-5);
    text-align: center;
  }

  .nav-cards ul {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: var(--sp-4);
    list-style: none;
    padding: 0;
  }

  .nav-cards li a {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-5);
    background-color: var(--c-surface);
    border: var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    block-size: 100%;
    transition:
      border-color var(--t-fast),
      box-shadow var(--t-fast),
      transform var(--t-fast);
  }

  .nav-cards li a:hover {
    border-color: var(--c-accent);
    box-shadow: 0 4px 16px -4px color-mix(in oklch, var(--c-accent) 20%, transparent);
    transform: translateY(-2px);
  }

  .nav-cards li a:active {
    transform: translateY(0);
  }

  .nav-cards li a:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 3px;
    border-radius: var(--radius-md);
  }

  .nav-cards li a h2,
  .nav-cards li a h3 {
    font-size: var(--text-lg);
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--c-accent);
    text-transform: none;
    letter-spacing: 0;
    margin-block-end: 0;
  }

  .nav-cards li a p {
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    line-height: 1.55;
  }

  /* ----------------------------------------------------------
     Buttons
     ---------------------------------------------------------- */

  .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-5);
    background-color: var(--c-accent);
    color: oklch(98% 0.005 80);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    text-decoration: none;
    border: 2px solid var(--c-accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition:
      background-color var(--t-fast),
      border-color var(--t-fast),
      color var(--t-fast),
      transform var(--t-fast);
  }

  .btn:hover {
    background-color: var(--c-accent-hover);
    border-color: var(--c-accent-hover);
    color: oklch(98% 0.005 80);
    transform: translateY(-1px);
  }

  .btn:active {
    transform: translateY(0);
  }

  .btn:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 4px;
  }

  .btn:disabled,
  .btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
  }

  .demo-link {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--c-accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    letter-spacing: -0.01em;
    transition: color var(--t-fast), text-underline-offset var(--t-fast);
  }

  .demo-link:hover {
    color: var(--c-accent-hover);
    text-underline-offset: 7px;
  }

  .demo-link:focus-visible {
    outline: 2px solid var(--c-accent);
    outline-offset: 4px;
    border-radius: 2px;
  }

  .btn--secondary {
    background-color: transparent;
    color: var(--c-accent);
  }

  .btn--secondary:hover {
    background-color: var(--c-accent-subtle);
    border-color: var(--c-accent);
    color: var(--c-accent);
  }

  /* ----------------------------------------------------------
     12-column grid utility
     ---------------------------------------------------------- */

  .grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: clamp(1rem, 2vw, 1.5rem);
  }

  .col-4, .col-6, .col-8, .col-10, .col-12 { grid-column: span 12; }

  @media (width >= 768px) {
    .col-4  { grid-column: span 4; }
    .col-6  { grid-column: span 6; }
    .col-8  { grid-column: span 8; }
    .col-10 { grid-column: span 10; }
    .col-12 { grid-column: span 12; }
  }

  /* ----------------------------------------------------------
     Page hero — shared across all content pages
     ---------------------------------------------------------- */

  .page-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-block-size: 30vh;
    padding-block: var(--sp-7);
    padding-inline: var(--gutter);
    border-block-end: var(--border);
  }

  .page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
      radial-gradient(ellipse 80% 60% at 50% 120%, var(--c-accent-subtle) 0%, transparent 65%),
      radial-gradient(circle, var(--c-border) 1px, transparent 1px);
    background-size: 100% 100%, 32px 32px;
    opacity: 0.8;
    pointer-events: none;
  }

  .page-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--sp-4);
    max-inline-size: var(--prose-width);
    animation: hero-enter 0.9s cubic-bezier(0.16, 1, 0.3, 1) 80ms both;
  }

  .page-hero__content h1 { margin: 0; }
  .page-hero__content .lead { max-inline-size: 52ch; margin: 0; }

  .page-hero__breadcrumb {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--c-text-muted);
  }

  .page-hero__breadcrumb a {
    color: var(--c-text-muted);
    text-decoration: none;
    transition: color var(--t-fast);
  }

  .page-hero__breadcrumb a:hover { color: var(--c-accent); }

  @media (width >= 600px) {
    .page-hero {
      padding-block: var(--sp-10);
      min-block-size: 44vh;
    }
  }

  /* Split hero — integrated animated line graphic on the right (top-level
     pages). The SVG is borderless and theme-aware: it bleeds into the hero
     rather than sitting in a framed image. Stacks under content on mobile. */
  .page-hero--split {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: var(--sp-5);
    text-align: start;
  }

  .page-hero--split .page-hero__content { align-items: flex-start; }

  .page-hero__figure {
    position: relative;
    z-index: 0;
    inline-size: 100%;
    max-inline-size: 460px;
  }

  .hero-gfx {
    display: block;
    inline-size: 100%;
    block-size: auto;
    overflow: visible;
  }

  /* Graphic primitives — coloured from theme tokens so they adapt to
     light/dark and merge with the hero's own palette. */
  .hg-edge   { fill: none; stroke: var(--hero-line); stroke-width: 1.5; }
  .hg-edge--accent {
    stroke: var(--c-accent);
    opacity: 0.55;
    stroke-dasharray: 5 7;
    animation: hg-flow 1.5s linear infinite;
  }
  .hg-node   { fill: var(--hero-node); animation: hg-pulse 3.4s ease-in-out infinite; }
  .hg-node:nth-of-type(3n)   { animation-delay: -1.1s; }
  .hg-node:nth-of-type(3n+1) { animation-delay: -2.3s; }
  .hg-core   {
    fill: var(--c-accent);
    opacity: 0.62;
    transform-box: fill-box;
    transform-origin: center;
    animation: hg-core-pulse 3.8s ease-in-out infinite;
  }
  .hg-ring   {
    fill: none;
    stroke: var(--c-accent);
    stroke-width: 1.4;
    transform-box: fill-box;
    transform-origin: center;
    animation: hg-ring 3.8s ease-out infinite;
  }
  .hg-stroke { fill: none; stroke: var(--hero-node); stroke-width: 1.6; stroke-linecap: round; }
  .hg-fill   { fill: var(--c-surface); stroke: var(--hero-line); stroke-width: 1.5; }
  .hg-caret  { fill: var(--c-accent); animation: hg-blink 1.1s steps(1) infinite; }
  .hg-label  {
    fill: var(--c-text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .hg-label--accent { fill: var(--c-accent); }
  .hg-label--dim    { fill: var(--c-text-muted); opacity: 0.6; font-size: 11px; }
  .hg-label--hub    { fill: var(--c-surface); font-size: 10px; }
  .hg-block         { fill: var(--c-accent); opacity: 0.5; }
  .hg-arrow         { fill: var(--c-accent); }
  .hg-check         { fill: none; stroke: var(--c-accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .hg-cross         { fill: none; stroke: var(--c-text-muted); stroke-width: 1.8; stroke-linecap: round; opacity: 0.65; }
  .hg-block--dim    { fill: var(--c-text-muted); opacity: 0.14; animation: hg-fade 3.6s ease-in-out infinite; }
  .hg-block--ghost  {
    fill: none;
    stroke: var(--hero-line);
    stroke-width: 1.5;
    stroke-dasharray: 4 5;
    opacity: 0.6;
    animation: hg-flow 2.4s linear infinite;
  }

  @keyframes hg-flow       { to { stroke-dashoffset: -24; } }
  @keyframes hg-pulse      { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
  @keyframes hg-core-pulse { 0%, 100% { opacity: 0.5; transform: scale(1); } 50% { opacity: 0.82; transform: scale(1.12); } }
  @keyframes hg-ring       { 0% { opacity: 0.45; transform: scale(0.5); } 70% { opacity: 0; transform: scale(1.5); } 100% { opacity: 0; } }
  @keyframes hg-blink      { 50% { opacity: 0; } }
  @keyframes hg-fade       { 0%, 100% { opacity: 0.08; } 50% { opacity: 0.2; } }

  @media (prefers-reduced-motion: reduce) {
    .hero-gfx * { animation: none !important; }
    .hg-edge--accent { stroke-dasharray: none; opacity: 0.4; }
  }

  @media (width >= 900px) {
    .page-hero--split {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 0.82fr);
      align-items: center;
      gap: var(--sp-7);
      inline-size: 100%;
      max-inline-size: var(--max-width);
      margin-inline: auto;
    }
    .page-hero--split .page-hero__content { max-inline-size: 54ch; }
    .page-hero__figure {
      max-inline-size: none;
      align-self: stretch;
      display: flex;
      align-items: center;
      animation: hero-enter 0.9s cubic-bezier(0.16, 1, 0.3, 1) 160ms both;
    }
  }

  /* Nav-cards first child: suppress double border when hero provides separator */
  article > .nav-cards:first-child { border-block-start: none; }

  /* ----------------------------------------------------------
     Overdrive: global scroll animations
     ---------------------------------------------------------- */

  @supports (animation-timeline: scroll()) {

    @keyframes prop-para-rise {
      from { opacity: 0; transform: translateY(20px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    article pre {
      animation: prop-para-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 50%;
    }

    @media (prefers-reduced-motion: reduce) {
      article pre { animation: none; opacity: 1; transform: none; }
    }
  }
}

/* ================================================================
   FEEDBACK FORM
   ================================================================ */

@layer component {

  #feedback-form {
    display: grid;
    gap: var(--sp-4);
    max-inline-size: 52ch;
  }

  .feedback-field {
    display: grid;
    gap: var(--sp-2);
  }

  .feedback-field label {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--c-text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  .feedback-field textarea {
    inline-size: 100%;
    min-block-size: 7rem;
    padding: var(--sp-3) var(--sp-4);
    font: inherit;
    font-size: var(--text-sm);
    line-height: var(--leading-prose);
    color: var(--c-text);
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    resize: vertical;
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
  }

  .feedback-field textarea:focus {
    outline: none;
    border-color: var(--c-accent);
    box-shadow: 0 0 0 3px var(--c-accent-subtle);
  }

  .feedback-field textarea::placeholder {
    color: var(--c-text-muted);
    opacity: 0.6;
  }

  .feedback-flash {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    border: var(--border);
  }

  .feedback-flash--success {
    background: var(--c-accent-subtle);
    border-color: color-mix(in oklch, var(--c-accent) 40%, var(--c-border));
    color: var(--c-accent);
  }

  .feedback-flash--error {
    background: oklch(95% 0.04 25);
    border-color: oklch(55% 0.18 25);
    color: oklch(35% 0.14 25);
  }

  @media (prefers-color-scheme: dark) {
    .feedback-flash--error {
      background: oklch(18% 0.04 25);
      border-color: oklch(60% 0.18 25);
      color: oklch(80% 0.10 25);
    }
  }

  .feedback-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
  }

  /* Dim button while htmx request is in flight */
  #feedback-form.htmx-request .btn {
    opacity: 0.55;
    pointer-events: none;
    cursor: wait;
  }

  .feedback-done {
    padding: var(--sp-4) var(--sp-5);
    background: var(--c-surface);
    border: var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
    color: var(--c-text-muted);
    max-inline-size: 52ch;
  }

  .feedback-done p { margin: 0; }
}

/* ================================================================
   UTILITY
   ================================================================ */

@layer utility {

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

  @media (prefers-reduced-motion: reduce) {
    .site-logo__wordmark { transition: none; }
    body > header nav ul a { transition: color var(--t-fast); background-size: 0 1px; }
    body > header nav ul a[aria-current="page"] { background-size: calc(100% - 2 * var(--sp-1)) 1px; }
  }

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