/* ──────────────────────────────────────────────────────────────
   Hallmark · macrostructure: Bento Grid · genre: editorial
   critique: P5 H4 E5 S4 R5 V5
   Nav N9 knobs: wordmark sans600 · text+arrow CTA · tight
   Ft5 knobs: sentence42ch · wordmark under · hairline
   Hero: centered display · fixed-height (not full viewport)
   T4 knobs: bento stat cells · display weight600 · mono qualifier
   F3 knobs: topic-count cells · mono counts · no rules
   T1 knobs: quote cells · body medium · signed attribution
   C1 knobs: pill chips · coral solid primary · arrow adornment
   C4 knobs: reveal after-fold · viewport bottom · hairline
   contrast: pass (46–50) · nav: N9 · footer: Ft5 · slop: pass (51–55)
   honest: pass (56) · chrome: pass (57) · tokens: pass (58)
   responsive: pass (59) · icons: pass (60) · mobile: pass (36, 59, 61–69)
   Motion: tile-fade · sticky-cta-reveal · underline-slide
   ────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

@layer reset, base, components;

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

@layer base {
  html, body { overflow-x: clip; }
  html { scroll-behavior: smooth; }
  body {
    background: var(--color-paper);
    color: var(--color-ink);
    font-family: var(--font-body);
    font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
  }
  img { display: block; max-width: 100%; height: auto; }
  a { color: inherit; }
  :focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }
  .muted { color: var(--color-muted); }
  .label {
    font-family: var(--font-label);
    font-size: 0.75rem;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
  }
  .tnum { font-variant-numeric: tabular-nums; }
}

@layer components {
  /* ── N9 edge-aligned minimal ── */
  .nav-edge {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--page-gutter);
  }
  .nav-edge .wordmark {
    font-weight: 600;
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    letter-spacing: var(--tracking-tight);
    text-decoration: none;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .nav-edge .wordmark .dot { color: var(--color-accent); }
  .nav-links { display: flex; gap: var(--space-lg); align-items: center; }
  .nav-links a {
    font-family: var(--font-label);
    font-size: 0.75rem;
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    text-decoration: none;
    position: relative;
    padding-bottom: 2px;
  }
  .nav-links a::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    width: 100%; height: 1px;
    background: var(--color-ink);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--dur-short) var(--ease-out);
  }
  .nav-links a:hover::after, .nav-links a:focus-visible::after { transform: scaleX(1); transform-origin: left; }
  .nav-links .nav-cta { color: var(--color-accent); }
  .nav-hide-sm { display: inline; }

  /* ── Hero: centered, fixed-height ── */
  .hero-fixed {
    text-align: center;
    padding: clamp(2.5rem, 6vh, 4rem) var(--page-gutter) clamp(3.5rem, 10vh, 6rem);
    max-width: 56rem;
    margin-inline: auto;
  }
  .hero-fixed .kicker { color: var(--color-accent); margin-bottom: var(--space-md); text-align: left; }
  .hero-fixed h1 {
    font-size: var(--text-display);
    font-weight: var(--display-weight);
    line-height: var(--lh-tight);
    letter-spacing: var(--tracking-display);
    text-wrap: balance;
    overflow-wrap: anywhere;
    min-width: 0;
  }
  .hero-fixed .chip-row { justify-content: flex-start; }
  .hero-fixed .lede {
    font-size: clamp(1.05rem, 1.6vw, 1.2rem);
    color: var(--color-ink-2);
    max-width: 46ch;
    margin: var(--space-lg) auto 0;
  }

  /* ── Chips ── */
  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    justify-content: center;
    margin-top: var(--space-xl);
  }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    min-height: 48px;
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--color-ink);
    background: transparent;
    color: var(--color-ink);
    font-family: var(--font-label);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: var(--radius-pill);
    transition: background var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out), border-color var(--dur-short) var(--ease-out);
  }
  .chip:hover { background: var(--color-ink); color: var(--color-paper); }
  .chip:active { transform: translateY(1px); }
  .chip:disabled, .chip[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
  .chip .arrow { transition: transform var(--dur-short) var(--ease-out); }
  .chip:hover .arrow { transform: translateX(4px); }
  .chip--solid {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
  }
  .chip--solid:hover { background: var(--color-ink); border-color: var(--color-ink); }

  /* ── Bento grid ── */
  .bento-wrap { max-width: 76rem; margin-inline: auto; padding: 0 var(--page-gutter); }
  .bento {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: minmax(150px, auto);
    grid-auto-flow: dense;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
  }
  .cell {
    background: var(--color-paper-2);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--space-sm);
    overflow: hidden;
    min-width: 0;
  }
  .cell .cell-label { color: var(--color-muted); }
  .span-2x1 { grid-column: span 2; }
  .span-1x2 { grid-row: span 2; }
  .span-2x2 { grid-column: span 2; grid-row: span 2; }
  .span-3x1 { grid-column: span 3; }
  .span-4x1 { grid-column: span 4; }

  /* photo cells: image fills the cell */
  .cell--photo { padding: 0; position: relative; }
  .cell--photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
  }
  .cell--photo .plate-note {
    position: absolute;
    left: var(--space-sm);
    bottom: var(--space-sm);
    z-index: 1;
    color: oklch(98% 0.005 50);
    background: oklch(20% 0.01 35 / 0.55);
    padding: var(--space-3xs) var(--space-xs);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-pill);
  }

  /* stat cells */
  .cell .stat-num {
    font-size: clamp(2.75rem, 6vw, 4.5rem);
    font-weight: 600;
    line-height: 1;
    letter-spacing: var(--tracking-display);
    font-variant-numeric: tabular-nums;
  }
  .cell .stat-num small { font-size: 0.4em; color: var(--color-accent); font-weight: 500; }
  .cell .stat-sub { color: var(--color-ink-2); font-size: 0.9375rem; }
  .cell h3 {
    font-size: clamp(1.15rem, 2vw, 1.4rem);
    font-weight: 600;
    letter-spacing: var(--tracking-tight);
    line-height: var(--lh-snug);
  }
  .cell p { font-size: 0.9375rem; color: var(--color-ink-2); }
  .cell .big-count {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 600;
    letter-spacing: var(--tracking-display);
    font-variant-numeric: tabular-nums;
    line-height: 1;
  }
  .cell .big-count span { color: var(--color-accent); }
  .cell--accent { background: var(--color-accent); color: var(--color-accent-ink); }
  .cell--accent .cell-label, .cell--accent p, .cell--accent .stat-sub { color: oklch(98% 0.005 50 / 0.85); }
  .cell--accent .stat-num small { color: var(--color-accent-ink); }
  .cell--dark { background: var(--color-ink); color: var(--color-paper); }
  .cell--dark .cell-label, .cell--dark p { color: oklch(96.5% 0.005 50 / 0.75); }

  /* quote cells */
  .cell blockquote {
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.45;
    font-weight: 500;
    letter-spacing: var(--tracking-tight);
  }
  .cell .attribution { color: var(--color-muted); font-size: 0.8125rem; font-family: var(--font-label); }
  .cell .attribution b { color: var(--color-ink); font-weight: 500; }
  .cell--dark .attribution { color: oklch(96.5% 0.005 50 / 0.6); }
  .cell--dark .attribution b { color: var(--color-paper); }

  .cell a.cell-link {
    text-decoration: none;
    font-family: var(--font-label);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-accent);
    display: inline-flex;
    gap: 0.4em;
    align-items: center;
  }
  .cell a.cell-link:hover .arrow { transform: translateX(4px); }
  .cell a.cell-link .arrow { transition: transform var(--dur-short) var(--ease-out); }

  .section-head {
    max-width: 76rem;
    margin: var(--section-gap) auto var(--space-xl);
    padding: 0 var(--page-gutter);
  }
  .section-head .kicker { color: var(--color-accent); margin-bottom: var(--space-xs); }
  .section-head h2 {
    font-size: var(--text-display-s);
    font-weight: var(--display-weight);
    letter-spacing: var(--tracking-display);
    line-height: var(--lh-tight);
    max-width: 22ch;
    overflow-wrap: anywhere;
    min-width: 0;
  }

  /* ── C4 sticky bar ── */
  .cta-sticky {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 40;
    min-height: var(--bar-height);
    padding: var(--space-sm) var(--page-gutter);
    background: var(--color-paper);
    border-top: 1px solid var(--color-rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    transform: translateY(110%);
    transition: transform var(--dur-long) var(--ease-out);
  }
  .cta-sticky.is-visible { transform: translateY(0); }
  .cta-sticky .reassure { color: var(--color-muted); font-size: 0.8125rem; }
  .cta-sticky .reassure b { color: var(--color-ink); font-weight: 600; }
  .cta-sticky .actions { display: flex; gap: var(--space-sm); flex-shrink: 0; }
  .cta-sticky .chip { min-height: 44px; padding: 0.55rem 1.1rem; }

  /* ── Footer ── */
  .foot-statement {
    background: var(--color-paper-2);
    margin-top: var(--section-gap);
    padding: var(--section-gap) var(--page-gutter) calc(var(--bar-height) + var(--space-2xl));
  }
  .foot-statement .inner { max-width: 76rem; margin-inline: auto; }
  .foot-statement .sentence {
    font-size: clamp(1.6rem, 3.5vw, 2.5rem);
    font-weight: 600;
    line-height: var(--lh-snug);
    max-width: 42ch;
    letter-spacing: var(--tracking-display);
  }
  .foot-statement .meta {
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-rule);
    color: var(--color-muted);
    font-size: 0.8125rem;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm) var(--space-lg);
  }
  .foot-statement .meta a { text-decoration: none; }
  .foot-statement .meta a:hover { color: var(--color-ink); }

  /* ── motion: tile-fade ── */
  .fade { opacity: 0; transform: translateY(10px); transition: opacity var(--dur-long) var(--ease-out), transform var(--dur-long) var(--ease-out); }
  .fade.is-in { opacity: 1; transform: none; }
}

/* ── responsive ── */
@media (max-width: 768px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(130px, auto); }
  .span-3x1, .span-4x1 { grid-column: span 2; }
  .span-2x2 { grid-column: span 2; grid-row: span 2; }
  .nav-hide-sm { display: none; }
  .cta-sticky .reassure { display: none; }
  .cta-sticky { justify-content: center; }
}
@media (max-width: 480px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .span-2x1, .span-3x1, .span-4x1, .span-2x2 { grid-column: span 1; }
  .span-1x2, .span-2x2 { grid-row: span 1; }
  .cell--photo { min-height: 240px; }
  .nav-links { gap: var(--space-md); }
  .cta-sticky .actions { width: 100%; }
  .cta-sticky .chip { flex: 1; justify-content: center; padding-inline: 0.6rem; font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
  .fade { opacity: 1; transform: none; }
  .cta-sticky { transform: none; }
}
