/*
 * Hazen Studio design system
 * ──────────────────────────
 * One stylesheet for every site under hazenstudio.com: the portfolio, the
 * MacLC website and each live demo. Served at /hazen/hazen.css and documented
 * in docs/design-system.md.
 *
 * - Everything sits in the cascade layers Tailwind CSS v4 uses (theme, base,
 *   components, utilities), declared in Tailwind's order. Tailwind's preflight
 *   then resets elements before the hz-* components apply, Tailwind utilities
 *   override the components, and a site's unlayered CSS overrides everything.
 *   Link this file FIRST in <head>, before any other stylesheet.
 * - Colours follow the theme on <html data-theme="light|dark">, set before
 *   first paint by the snippet in the docs. Without JavaScript they follow
 *   prefers-color-scheme. Any element can carry data-theme to force a theme on
 *   its subtree.
 * - One accent per site, picked with <html data-accent="violet">. The default
 *   is amber, MacLC's highlight. Accent fills always take --hz-on-accent
 *   (near-black) text; --hz-accent-text is the contrast-safe variant for text
 *   on the page. Every pair passes WCAG AA in both themes.
 */

/* ─── Fonts ────────────────────────────────────────────────────────────────
   Geist (text and UI), Geist Mono (labels and figures) and Instrument Serif
   (the italic emphasis in headlines). Self-hosted, SIL Open Font License. */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/hazen/fonts/geist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/hazen/fonts/geist-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/hazen/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/hazen/fonts/geist-mono-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/hazen/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/hazen/fonts/instrument-serif-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/hazen/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/hazen/fonts/instrument-serif-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Same-origin page loads cross-fade (portfolio ⇄ demos ⇄ MacLC). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

@layer theme, base, components, utilities;

/* ═══ Tokens ═════════════════════════════════════════════════════════════ */
@layer base {
  /* ─── Primitives ─── */
  :root {
    /* Neutrals: MacLC's measured greys. */
    --hz-ink-950: #0a0a0b;
    --hz-ink-900: #111113;
    --hz-ink-850: #161618;
    --hz-ink-800: #1c1c1f;
    --hz-ink-700: #26262a;
    --hz-paper-0: #ffffff;
    --hz-paper-50: #fbfbfd;
    --hz-paper-100: #f5f5f7;
    --hz-paper-200: #efeff1;
    --hz-paper-300: #e3e3e7;

    /* The twelve accent fills (OKLCH L≈0.80, C≈0.16), for swatches and
       cross-project references. Sites use --hz-accent, never these. */
    --hz-amber: #ff9a3c;
    --hz-gold: #e8b616;
    --hz-lime: #a0d157;
    --hz-green: #56db8f;
    --hz-teal: #02d9d1;
    --hz-cyan: #0ed4f6;
    --hz-sky: #76c7ff;
    --hz-indigo: #a7baff;
    --hz-violet: #c7adff;
    --hz-magenta: #f695ee;
    --hz-rose: #ff9cb3;
    --hz-coral: #ffa28a;

    /* Type */
    --hz-font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
      sans-serif;
    --hz-font-mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
      monospace;
    --hz-font-serif: "Instrument Serif", ui-serif, Georgia, "Times New Roman", serif;

    --hz-text-display: clamp(3rem, 1.75rem + 5.6vw, 7rem);
    --hz-text-h1: clamp(2.5rem, 1.9rem + 2.8vw, 4.25rem);
    --hz-text-h2: clamp(2rem, 1.6rem + 1.9vw, 3.25rem);
    --hz-text-h3: clamp(1.375rem, 1.2rem + 0.75vw, 1.75rem);
    --hz-text-h4: 1.25rem;
    --hz-text-lead: clamp(1.125rem, 1.05rem + 0.3vw, 1.3125rem);
    --hz-text-body: 1.0625rem;
    --hz-text-sm: 0.9375rem;
    --hz-text-xs: 0.8125rem;
    --hz-text-eyebrow: 0.75rem;

    --hz-leading-display: 0.95;
    --hz-leading-h1: 1.02;
    --hz-leading-h2: 1.08;
    --hz-leading-h3: 1.2;
    --hz-leading-body: 1.6;
    --hz-leading-sm: 1.5;

    --hz-tracking-display: -0.045em;
    --hz-tracking-h1: -0.035em;
    --hz-tracking-h2: -0.025em;
    --hz-tracking-h3: -0.015em;
    --hz-tracking-eyebrow: 0.14em;

    /* Space: 4 px steps, Tailwind-style names (--hz-space-4 = 16 px). */
    --hz-space-1: 4px;
    --hz-space-2: 8px;
    --hz-space-3: 12px;
    --hz-space-4: 16px;
    --hz-space-5: 20px;
    --hz-space-6: 24px;
    --hz-space-8: 32px;
    --hz-space-10: 40px;
    --hz-space-12: 48px;
    --hz-space-16: 64px;
    --hz-space-20: 80px;
    --hz-space-24: 96px;
    --hz-space-32: 128px;

    /* Radius */
    --hz-radius-xs: 6px;
    --hz-radius-sm: 8px;
    --hz-radius-md: 12px;
    --hz-radius-lg: 16px;
    --hz-radius-xl: 20px;
    --hz-radius-2xl: 28px;
    --hz-radius-full: 9999px;

    /* Motion: MacLC's ease-out; exits run faster than entrances. */
    --hz-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --hz-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --hz-dur-fast: 150ms;
    --hz-dur: 220ms;
    --hz-dur-slow: 400ms;
    --hz-dur-reveal: 700ms;

    /* Layout */
    --hz-page-max: 75rem;
    --hz-text-max: 42.5rem;
    --hz-gutter: clamp(1rem, 0.55rem + 1.9vw, 2rem);
    --hz-section-y: clamp(4.5rem, 3rem + 6vw, 8rem);
    --hz-header-h: 4rem;

    /* Stacking */
    --hz-z-header: 100;
    --hz-z-overlay: 150;
    --hz-z-modal: 200;
    --hz-z-studio: 250;
    --hz-z-skip: 300;

    /* Default accent: amber (MacLC's exact brand values). */
    --hz-accent: #ff9a3c;
    --hz-accent-strong: #ff7a1a;
    --hz-accent-text-dark: #ff9a3c;
    --hz-accent-text-light: #9c5210;
    --hz-on-accent: var(--hz-ink-950);
  }

  /* ─── Accent presets ─── */
  [data-accent="amber"] {
    --hz-accent: #ff9a3c;
    --hz-accent-strong: #ff7a1a;
    --hz-accent-text-dark: #ff9a3c;
    --hz-accent-text-light: #9c5210;
  }
  [data-accent="gold"] {
    --hz-accent: #e8b616;
    --hz-accent-strong: #d2a408;
    --hz-accent-text-dark: #e3b842;
    --hz-accent-text-light: #806201;
  }
  [data-accent="lime"] {
    --hz-accent: #a0d157;
    --hz-accent-strong: #8bbe36;
    --hz-accent-text-dark: #a3cf68;
    --hz-accent-text-light: #4f7102;
  }
  [data-accent="green"] {
    --hz-accent: #56db8f;
    --hz-accent-strong: #2ec97a;
    --hz-accent-text-dark: #6ad895;
    --hz-accent-text-light: #007742;
  }
  [data-accent="teal"] {
    --hz-accent: #02d9d1;
    --hz-accent-strong: #10c4bc;
    --hz-accent-text-dark: #02d9d1;
    --hz-accent-text-light: #04726e;
  }
  [data-accent="cyan"] {
    --hz-accent: #0ed4f6;
    --hz-accent-strong: #07bfde;
    --hz-accent-text-dark: #0ed4f6;
    --hz-accent-text-light: #097082;
  }
  [data-accent="sky"] {
    --hz-accent: #76c7ff;
    --hz-accent-strong: #3cb5fe;
    --hz-accent-text-dark: #76c7ff;
    --hz-accent-text-light: #016da1;
  }
  [data-accent="indigo"] {
    --hz-accent: #a7baff;
    --hz-accent-strong: #8ea5fe;
    --hz-accent-text-dark: #a7baff;
    --hz-accent-text-light: #4f61b6;
  }
  [data-accent="violet"] {
    --hz-accent: #c7adff;
    --hz-accent-strong: #b793fe;
    --hz-accent-text-dark: #c7adff;
    --hz-accent-text-light: #7555ad;
  }
  [data-accent="magenta"] {
    --hz-accent: #f695ee;
    --hz-accent-strong: #e57fdd;
    --hz-accent-text-dark: #f09be8;
    --hz-accent-text-light: #954a8f;
  }
  [data-accent="rose"] {
    --hz-accent: #ff9cb3;
    --hz-accent-strong: #fe799d;
    --hz-accent-text-dark: #ff9cb3;
    --hz-accent-text-light: #a84460;
  }
  [data-accent="coral"] {
    --hz-accent: #ffa28a;
    --hz-accent-strong: #ff8162;
    --hz-accent-text-dark: #ffa28a;
    --hz-accent-text-light: #a9482f;
  }

  /* ─── Semantic colours: light ─── */
  :root,
  [data-theme="light"] {
    color-scheme: light;
    --hz-dark: 0;
    --hz-bg: var(--hz-paper-50);
    --hz-bg-raise: var(--hz-paper-100);
    --hz-surface: var(--hz-paper-0);
    --hz-surface-2: var(--hz-paper-200);
    --hz-line: rgb(0 0 0 / 0.08);
    --hz-line-strong: rgb(0 0 0 / 0.16);
    --hz-text: rgb(0 0 0 / 0.92);
    --hz-text-2: rgb(0 0 0 / 0.65);
    --hz-text-3: rgb(0 0 0 / 0.55);
    --hz-material: rgb(251 251 253 / 0.78);
    --hz-material-solid: rgb(255 255 255 / 0.94);
    /* Status colours stay at 4.5:1 on their own 12 % tint, not just on white. */
    --hz-success: #006b3b;
    --hz-warning: #735800;
    --hz-danger: #b3261e;
    --hz-info: #01649a;
    --hz-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);
    --hz-shadow-md: 0 1px 2px rgb(0 0 0 / 0.04), 0 10px 28px -8px rgb(0 0 0 / 0.12);
    --hz-shadow-lg: 0 2px 6px rgb(0 0 0 / 0.04), 0 28px 64px -18px rgb(0 0 0 / 0.2);
  }

  /* ─── Semantic colours: dark (system preference, then explicit) ─── */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --hz-dark: 1;
      --hz-bg: var(--hz-ink-950);
      --hz-bg-raise: var(--hz-ink-900);
      --hz-surface: var(--hz-ink-850);
      --hz-surface-2: var(--hz-ink-800);
      --hz-line: rgb(255 255 255 / 0.08);
      --hz-line-strong: rgb(255 255 255 / 0.16);
      --hz-text: rgb(255 255 255 / 0.92);
      --hz-text-2: rgb(255 255 255 / 0.65);
      --hz-text-3: rgb(255 255 255 / 0.52);
      --hz-material: rgb(10 10 11 / 0.75);
      --hz-material-solid: rgb(22 22 24 / 0.94);
      --hz-success: #6ad895;
      --hz-warning: #e3b842;
      --hz-danger: #ffa098;
      --hz-info: #76c7ff;
      --hz-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
      --hz-shadow-md: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -8px rgb(0 0 0 / 0.55);
      --hz-shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 28px 64px -18px rgb(0 0 0 / 0.75);
    }
  }

  [data-theme="dark"] {
    color-scheme: dark;
    --hz-dark: 1;
    --hz-bg: var(--hz-ink-950);
    --hz-bg-raise: var(--hz-ink-900);
    --hz-surface: var(--hz-ink-850);
    --hz-surface-2: var(--hz-ink-800);
    --hz-line: rgb(255 255 255 / 0.08);
    --hz-line-strong: rgb(255 255 255 / 0.16);
    --hz-text: rgb(255 255 255 / 0.92);
    --hz-text-2: rgb(255 255 255 / 0.65);
    --hz-text-3: rgb(255 255 255 / 0.52);
    --hz-material: rgb(10 10 11 / 0.75);
    --hz-material-solid: rgb(22 22 24 / 0.94);
    --hz-success: #6ad895;
    --hz-warning: #e3b842;
    --hz-danger: #ffa098;
    --hz-info: #76c7ff;
    --hz-shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --hz-shadow-md: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -8px rgb(0 0 0 / 0.55);
    --hz-shadow-lg: 0 2px 6px rgb(0 0 0 / 0.3), 0 28px 64px -18px rgb(0 0 0 / 0.75);
  }

  /* ─── Derived tokens ───
     Re-declared on every element that sets a theme or an accent, so a nested
     data-theme or data-accent resolves against its own values. --hz-dark
     (0 or 1) switches the accent text between its light and dark variants. */
  :root,
  [data-theme],
  [data-accent] {
    --hz-accent-text: color-mix(
      in srgb,
      var(--hz-accent-text-dark) calc(var(--hz-dark) * 100%),
      var(--hz-accent-text-light)
    );
    --hz-accent-soft: color-mix(in srgb, var(--hz-accent) calc(14% + 4% * var(--hz-dark)), transparent);
    --hz-accent-line: color-mix(in srgb, var(--hz-accent) 45%, transparent);
    --hz-success-soft: color-mix(in srgb, var(--hz-success) 12%, transparent);
    --hz-warning-soft: color-mix(in srgb, var(--hz-warning) 12%, transparent);
    --hz-danger-soft: color-mix(in srgb, var(--hz-danger) 12%, transparent);
    --hz-info-soft: color-mix(in srgb, var(--hz-info) 12%, transparent);
    --hz-focus: var(--hz-accent-text);
  }
}

/* ═══ Base ═══════════════════════════════════════════════════════════════ */
@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--hz-bg);
  }

  body {
    margin: 0;
    /* Hero glows are wider than the page on purpose: never let them scroll. */
    overflow-x: clip;
    background: var(--hz-bg);
    color: var(--hz-text);
    font-family: var(--hz-font-sans);
    font-size: var(--hz-text-body);
    line-height: var(--hz-leading-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-weight: 600;
    line-height: var(--hz-leading-h3);
    letter-spacing: var(--hz-tracking-h3);
    text-wrap: balance;
  }

  p,
  li,
  figcaption {
    text-wrap: pretty;
  }

  a {
    color: var(--hz-accent-text);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
  }

  img,
  video,
  canvas {
    max-width: 100%;
    height: auto;
  }

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

  input[type="checkbox"],
  input[type="radio"],
  input[type="range"],
  progress {
    accent-color: var(--hz-accent);
  }

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

  time,
  output,
  data {
    font-variant-numeric: tabular-nums;
  }

  ::selection {
    background: color-mix(in srgb, var(--hz-accent) 38%, transparent);
  }

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

  [id] {
    scroll-margin-top: calc(var(--hz-header-h) + 1rem);
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }

  /* Important declarations in an early layer outrank later layers and
     unlayered CSS: reduced motion wins over all site styles. */
  @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;
    }
  }

  @media print {
    :root,
    [data-theme] {
      color-scheme: light;
      --hz-bg: #fff;
      --hz-bg-raise: #fff;
      --hz-surface: #fff;
      --hz-surface-2: #f4f4f5;
      --hz-line: #d4d4d8;
      --hz-line-strong: #a1a1aa;
      --hz-text: #111;
      --hz-text-2: #3f3f46;
      --hz-text-3: #52525b;
      --hz-dark: 0;
    }
    hz-studio,
    .hz-no-print {
      display: none !important;
    }
  }
}

/* ═══ Components ═════════════════════════════════════════════════════════ */
@layer components {
  /* ─── Layout ─── */
  .hz-container {
    width: 100%;
    max-width: calc(var(--hz-page-max) + 2 * var(--hz-gutter));
    margin-inline: auto;
    padding-inline: var(--hz-gutter);
  }
  .hz-container--text {
    max-width: calc(var(--hz-text-max) + 2 * var(--hz-gutter));
  }
  .hz-section {
    padding-block: var(--hz-section-y);
  }

  /* ─── Type ─── */
  .hz-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    margin: 0;
    font-family: var(--hz-font-mono);
    font-size: var(--hz-text-eyebrow);
    font-weight: 500;
    line-height: 1.3;
    letter-spacing: var(--hz-tracking-eyebrow);
    text-transform: uppercase;
    color: var(--hz-text-3);
  }
  .hz-eyebrow--accent {
    color: var(--hz-accent-text);
  }
  /* "01 —" chapter index before an eyebrow label. */
  .hz-eyebrow__index {
    color: var(--hz-accent-text);
  }

  .hz-display,
  .hz-h1,
  .hz-h2,
  .hz-h3 {
    margin: 0;
    font-weight: 600;
    text-wrap: balance;
    color: var(--hz-text);
  }
  .hz-display {
    font-size: var(--hz-text-display);
    line-height: var(--hz-leading-display);
    letter-spacing: var(--hz-tracking-display);
  }
  .hz-h1 {
    font-size: var(--hz-text-h1);
    line-height: var(--hz-leading-h1);
    letter-spacing: var(--hz-tracking-h1);
  }
  .hz-h2 {
    font-size: var(--hz-text-h2);
    line-height: var(--hz-leading-h2);
    letter-spacing: var(--hz-tracking-h2);
  }
  .hz-h3 {
    font-size: var(--hz-text-h3);
    line-height: var(--hz-leading-h3);
    letter-spacing: var(--hz-tracking-h3);
  }
  .hz-lead {
    margin: 0;
    font-size: var(--hz-text-lead);
    line-height: 1.55;
    color: var(--hz-text-2);
    text-wrap: pretty;
  }
  .hz-caption {
    font-size: var(--hz-text-xs);
    line-height: var(--hz-leading-sm);
    color: var(--hz-text-3);
  }

  /* The studio's signature: one or two words of a headline set in
     Instrument Serif italic. Use sparingly, once per headline at most. */
  .hz-em {
    font-family: var(--hz-font-serif);
    font-style: italic;
    font-weight: 400;
    font-size: 1.08em;
    letter-spacing: -0.01em;
    line-height: inherit;
  }
  .hz-em--accent {
    color: var(--hz-accent-text);
  }

  .hz-link {
    color: var(--hz-accent-text);
    text-decoration: underline;
    text-decoration-color: var(--hz-accent-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    transition: text-decoration-color var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-link:hover {
    text-decoration-color: currentColor;
  }

  /* Long-form reading: lessons, articles, legal pages. */
  .hz-prose {
    max-width: 68ch;
    color: var(--hz-text-2);
    font-size: var(--hz-text-body);
    line-height: 1.7;
  }
  .hz-prose > * + * {
    margin-top: 1.1em;
  }
  .hz-prose :is(h2, h3, h4) {
    color: var(--hz-text);
    margin-top: 2em;
  }
  .hz-prose h2 {
    font-size: 1.75rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
  }
  .hz-prose h3 {
    font-size: 1.3125rem;
    line-height: 1.3;
  }
  .hz-prose :is(h2, h3, h4) + * {
    margin-top: 0.6em;
  }
  .hz-prose strong {
    color: var(--hz-text);
    font-weight: 600;
  }
  .hz-prose a {
    color: var(--hz-accent-text);
    text-decoration-color: var(--hz-accent-line);
  }
  .hz-prose :is(ul, ol) {
    padding-left: 1.3em;
  }
  .hz-prose li + li {
    margin-top: 0.4em;
  }
  .hz-prose li::marker {
    color: var(--hz-accent-text);
  }
  .hz-prose blockquote {
    margin-inline: 0;
    padding: 0.2em 0 0.2em 1.2em;
    border-left: 2px solid var(--hz-accent);
    font-family: var(--hz-font-serif);
    font-style: italic;
    font-size: 1.3em;
    line-height: 1.4;
    color: var(--hz-text);
  }
  .hz-prose code {
    padding: 0.1em 0.35em;
    border-radius: var(--hz-radius-xs);
    background: var(--hz-surface-2);
    color: var(--hz-text);
  }
  .hz-prose hr {
    border: 0;
    border-top: 1px solid var(--hz-line);
    margin-block: 2.5em;
  }

  /* ─── Buttons ─── */
  .hz-btn {
    --_bg: transparent;
    --_fg: var(--hz-text);
    --_line: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 20px;
    border: 1px solid var(--_line);
    border-radius: var(--hz-radius-full);
    background: var(--_bg);
    color: var(--_fg);
    font-family: var(--hz-font-sans);
    font-size: var(--hz-text-sm);
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.005em;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition:
      transform var(--hz-dur-fast) var(--hz-ease-out),
      background-color var(--hz-dur-fast) var(--hz-ease-out),
      border-color var(--hz-dur-fast) var(--hz-ease-out),
      color var(--hz-dur-fast) var(--hz-ease-out),
      box-shadow var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-btn:hover {
    transform: translateY(-1px);
  }
  .hz-btn:active {
    transform: translateY(0);
  }
  .hz-btn:disabled,
  .hz-btn[aria-disabled="true"] {
    opacity: 0.45;
    pointer-events: none;
  }
  .hz-btn svg {
    width: 1.1em;
    height: 1.1em;
    flex: none;
  }
  .hz-btn--primary {
    --_bg: var(--hz-accent);
    --_fg: var(--hz-on-accent);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
  }
  .hz-btn--primary:hover {
    --_bg: var(--hz-accent-strong);
    box-shadow: 0 8px 24px -8px var(--hz-accent-line);
  }
  .hz-btn--secondary {
    --_bg: var(--hz-surface);
    --_line: var(--hz-line-strong);
  }
  .hz-btn--secondary:hover {
    --_bg: var(--hz-surface-2);
  }
  .hz-btn--ghost {
    --_fg: var(--hz-text-2);
  }
  .hz-btn--ghost:hover {
    --_bg: var(--hz-surface-2);
    --_fg: var(--hz-text);
  }
  .hz-btn--sm {
    min-height: 36px;
    padding: 6px 14px;
    font-size: var(--hz-text-xs);
  }
  .hz-btn--lg {
    min-height: 52px;
    padding: 12px 28px;
    font-size: var(--hz-text-body);
  }
  .hz-btn--block {
    width: 100%;
  }

  .hz-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius-full);
    background: transparent;
    color: var(--hz-text-2);
    cursor: pointer;
    transition:
      background-color var(--hz-dur-fast) var(--hz-ease-out),
      color var(--hz-dur-fast) var(--hz-ease-out),
      border-color var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-icon-btn:hover {
    background: var(--hz-surface-2);
    color: var(--hz-text);
    border-color: var(--hz-line-strong);
  }
  .hz-icon-btn svg {
    width: 18px;
    height: 18px;
  }

  /* ─── Surfaces ─── */
  .hz-card {
    position: relative;
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius-lg);
    background: var(--hz-surface);
    color: var(--hz-text);
  }
  .hz-card--pad {
    padding: clamp(1.25rem, 1rem + 1vw, 2rem);
  }
  .hz-card--raised {
    box-shadow: var(--hz-shadow-sm);
  }
  .hz-card--interactive {
    transition:
      transform var(--hz-dur) var(--hz-ease-out),
      border-color var(--hz-dur) var(--hz-ease-out),
      box-shadow var(--hz-dur) var(--hz-ease-out);
  }
  .hz-card--interactive:hover {
    transform: translateY(-2px);
    border-color: var(--hz-line-strong);
    box-shadow: var(--hz-shadow-md);
  }
  .hz-card--accent {
    border-color: var(--hz-accent-line);
    background: linear-gradient(180deg, var(--hz-accent-soft), transparent 60%), var(--hz-surface);
  }

  .hz-divider {
    height: 1px;
    margin: 0;
    border: 0;
    background: var(--hz-line);
  }

  /* ─── Chips and badges ─── */
  .hz-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 2px 10px;
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius-full);
    background: color-mix(in srgb, var(--hz-surface-2) 70%, transparent);
    color: var(--hz-text-2);
    font-family: var(--hz-font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
  }
  .hz-chip--accent {
    border-color: var(--hz-accent-line);
    background: var(--hz-accent-soft);
    color: var(--hz-accent-text);
  }
  .hz-chip svg {
    width: 12px;
    height: 12px;
  }

  /* ─── Statistic ─── */
  .hz-stat {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
  }
  .hz-stat__value {
    font-size: var(--hz-text-h2);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    color: var(--hz-text);
  }
  .hz-stat__label {
    font-size: var(--hz-text-sm);
    color: var(--hz-text-2);
  }

  /* ─── Segmented control (filters, tabs) ─── */
  .hz-segmented {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--hz-line);
    border-radius: var(--hz-radius-full);
    background: var(--hz-bg-raise);
  }
  .hz-segmented > :is(button, a) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    border: 0;
    border-radius: var(--hz-radius-full);
    background: transparent;
    color: var(--hz-text-2);
    font-size: var(--hz-text-xs);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition:
      background-color var(--hz-dur-fast) var(--hz-ease-out),
      color var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-segmented > :is(button, a):hover {
    color: var(--hz-text);
  }
  .hz-segmented > :is([aria-pressed="true"], [aria-selected="true"], [aria-current="page"], .is-active) {
    background: var(--hz-surface);
    color: var(--hz-text);
    box-shadow: var(--hz-shadow-sm), inset 0 0 0 1px var(--hz-line);
  }

  /* ─── Forms ─── */
  .hz-field {
    display: grid;
    gap: 6px;
  }
  .hz-label {
    font-size: var(--hz-text-sm);
    font-weight: 500;
    color: var(--hz-text);
  }
  .hz-help {
    font-size: var(--hz-text-xs);
    color: var(--hz-text-3);
  }
  .hz-error {
    font-size: var(--hz-text-xs);
    color: var(--hz-danger);
  }
  .hz-input,
  .hz-select,
  .hz-textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--hz-line-strong);
    border-radius: var(--hz-radius-md);
    background: var(--hz-surface);
    color: var(--hz-text);
    font-size: var(--hz-text-body);
    line-height: 1.4;
    transition:
      border-color var(--hz-dur-fast) var(--hz-ease-out),
      box-shadow var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-textarea {
    min-height: 120px;
    resize: vertical;
  }
  .hz-input::placeholder,
  .hz-textarea::placeholder {
    color: var(--hz-text-3);
  }
  .hz-input:focus,
  .hz-select:focus,
  .hz-textarea:focus {
    outline: none;
    border-color: var(--hz-accent-text);
    box-shadow: 0 0 0 3px var(--hz-accent-soft);
  }
  .hz-input[aria-invalid="true"],
  .hz-textarea[aria-invalid="true"] {
    border-color: var(--hz-danger);
  }

  /* ─── Answer option (quizzes, single/multiple choice) ─── */
  .hz-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border: 1px solid var(--hz-line-strong);
    border-radius: var(--hz-radius-md);
    background: var(--hz-surface);
    color: var(--hz-text);
    font-size: var(--hz-text-sm);
    text-align: left;
    cursor: pointer;
    transition:
      border-color var(--hz-dur-fast) var(--hz-ease-out),
      background-color var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-option:hover {
    border-color: var(--hz-text-3);
  }
  .hz-option:is([aria-checked="true"], [aria-pressed="true"], .is-selected) {
    border-color: var(--hz-accent-text);
    background: var(--hz-accent-soft);
  }
  .hz-option.is-correct {
    border-color: var(--hz-success);
    background: var(--hz-success-soft);
  }
  .hz-option.is-incorrect {
    border-color: var(--hz-danger);
    background: var(--hz-danger-soft);
  }

  /* ─── Callouts ─── */
  .hz-callout {
    --_tone: var(--hz-accent-text);
    --_soft: var(--hz-accent-soft);
    padding: 16px 20px;
    border: 1px solid color-mix(in srgb, var(--_tone) 30%, transparent);
    border-radius: var(--hz-radius-lg);
    background: var(--_soft);
    color: var(--hz-text);
  }
  .hz-callout__title {
    margin: 0 0 4px;
    font-weight: 600;
    /* A touch of the text colour keeps 4.5:1 on the tinted background with
       every tone, in both themes. */
    color: color-mix(in srgb, var(--_tone) 78%, var(--hz-text));
  }
  .hz-callout--info {
    --_tone: var(--hz-info);
    --_soft: var(--hz-info-soft);
  }
  .hz-callout--success {
    --_tone: var(--hz-success);
    --_soft: var(--hz-success-soft);
  }
  .hz-callout--warning {
    --_tone: var(--hz-warning);
    --_soft: var(--hz-warning-soft);
  }
  .hz-callout--danger {
    --_tone: var(--hz-danger);
    --_soft: var(--hz-danger-soft);
  }

  /* ─── Progress ─── */
  .hz-progress {
    --hz-progress: 0%;
    position: relative;
    height: 6px;
    overflow: hidden;
    border-radius: var(--hz-radius-full);
    background: var(--hz-surface-2);
  }
  .hz-progress::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--hz-progress);
    border-radius: inherit;
    background: var(--hz-accent);
    transition: width var(--hz-dur-slow) var(--hz-ease-out);
  }

  /* ─── Table ─── */
  .hz-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--hz-text-sm);
    font-variant-numeric: tabular-nums;
  }
  .hz-table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--hz-line-strong);
    color: var(--hz-text-3);
    font-family: var(--hz-font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-align: left;
    text-transform: uppercase;
  }
  .hz-table td {
    padding: 12px;
    border-bottom: 1px solid var(--hz-line);
    color: var(--hz-text-2);
  }

  .hz-kbd {
    display: inline-block;
    min-width: 1.6em;
    padding: 1px 6px;
    border: 1px solid var(--hz-line-strong);
    border-bottom-width: 2px;
    border-radius: var(--hz-radius-xs);
    background: var(--hz-surface);
    font-family: var(--hz-font-mono);
    font-size: 0.75rem;
    text-align: center;
  }

  /* ─── Site chrome ─── */
  .hz-header {
    position: sticky;
    top: 0;
    z-index: var(--hz-z-header);
    height: var(--hz-header-h);
    border-bottom: 1px solid var(--hz-line);
    background: var(--hz-material);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
  }
  .hz-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 6px 14px;
    border-radius: var(--hz-radius-full);
    color: var(--hz-text-2);
    font-size: var(--hz-text-sm);
    text-decoration: none;
    transition:
      background-color var(--hz-dur-fast) var(--hz-ease-out),
      color var(--hz-dur-fast) var(--hz-ease-out);
  }
  .hz-nav-link:hover {
    color: var(--hz-text);
  }
  .hz-nav-link:is([aria-current="page"], [aria-current="true"], .is-active) {
    background: var(--hz-surface-2);
    color: var(--hz-text);
    font-weight: 500;
  }
  .hz-footer {
    border-top: 1px solid var(--hz-line);
    padding-block: 40px;
    color: var(--hz-text-3);
    font-size: var(--hz-text-sm);
  }
  .hz-skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: var(--hz-z-skip);
    padding: 10px 16px;
    border-radius: var(--hz-radius-full);
    background: var(--hz-accent);
    color: var(--hz-on-accent);
    font-weight: 500;
    text-decoration: none;
    transform: translateY(-200%);
  }
  .hz-skip-link:focus {
    transform: none;
  }
}

/* ═══ Utilities ══════════════════════════════════════════════════════════ */
@layer utilities {
  .hz-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .hz-tabular {
    font-variant-numeric: tabular-nums;
  }
  .hz-mono {
    font-family: var(--hz-font-mono);
  }
  .hz-serif {
    font-family: var(--hz-font-serif);
  }

  /* Soft accent bloom behind a hero: <div class="hz-glow" aria-hidden="true">
     inside a position:relative, isolation:isolate container. It spans the
     container's width and never overflows it; move the bloom sideways with
     --hz-glow-x (default 50%) and vertically with top/bottom. */
  .hz-glow {
    position: absolute;
    z-index: -1;
    inset-inline: 0;
    top: -18rem;
    height: 36rem;
    background: radial-gradient(
      min(35rem, 70%) 18rem at var(--hz-glow-x, 50%) 50%,
      color-mix(in srgb, var(--hz-accent) calc(22% + 10% * var(--hz-dark)), transparent),
      transparent
    );
    pointer-events: none;
  }

  /* Faint engineering grid that fades towards the edges. */
  .hz-grid-bg {
    background-image:
      linear-gradient(var(--hz-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--hz-line) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 30%, transparent 75%);
  }

  /* Scroll reveal. Native scroll-driven animation where supported (no
     JavaScript); elsewhere /hazen/hazen.js marks the elements still below
     the fold with .hz-reveal-pending and reveals each one as it enters the
     viewport. Content is never hidden without JavaScript or under reduced
     motion. */
  @keyframes hz-reveal {
    from {
      opacity: 0;
      transform: translateY(24px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: view()) {
      [data-hz-reveal] {
        animation: hz-reveal linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 45%;
      }
    }
    @supports not (animation-timeline: view()) {
      [data-hz-reveal].hz-reveal-pending {
        transition:
          opacity var(--hz-dur-reveal) var(--hz-ease-out),
          transform var(--hz-dur-reveal) var(--hz-ease-out);
        transition-delay: var(--hz-delay, 0ms);
      }
      [data-hz-reveal].hz-reveal-pending:not(.is-revealed) {
        opacity: 0;
        transform: translateY(24px);
      }
    }
  }

  /* Reading progress bar: <div class="hz-scroll-progress" aria-hidden="true">.
     Scroll-linked in CSS; hazen.js drives --hz-scroll where unsupported. */
  .hz-scroll-progress {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: calc(var(--hz-z-header) + 1);
    height: 2px;
    background: var(--hz-accent);
    transform-origin: 0 50%;
    transform: scaleX(var(--hz-scroll, 0));
    pointer-events: none;
  }
  @keyframes hz-scroll-progress {
    from {
      transform: scaleX(0);
    }
    to {
      transform: scaleX(1);
    }
  }
  @supports (animation-timeline: scroll()) {
    .hz-scroll-progress {
      animation: hz-scroll-progress linear both;
      animation-timeline: scroll(root block);
    }
  }
}
