/* ============================================================================
   PREVIOUSLY — D3 DESIGN TOKENS · CINEMATIC HYBRID, DARK-COMMITTED
   ----------------------------------------------------------------------------
   Status: OPT-IN layer (James, 2026-10-15 — D3 locked 14:05–14:07 PT,
   build-online order 14:35 PT). Spec: ~/workspace/ui-overhaul-gate1-2026-10-15/
   TOKENS-D3.md, reconciled against the locked Gate #1 D3 sketch (sketch
   values win on conflict — see REPORT.md in the live-build program home).

   OPT-IN — a page converts by doing exactly two things:
     1. Put the attribute on the root element:
          <html lang="en" data-theme="d3">
     2. Link this file (after the page's existing fonts.css link):
          <link rel="stylesheet" href="/css/design-tokens-d3.css?v=20261015d3b">
   Nothing in this file applies without data-theme="d3" on <html>: every
   token and every rule below is scoped under :root[data-theme="d3"] or
   html[data-theme="d3"]. Unconverted pages are byte-for-byte unaffected.
   This file edits NO shared file (design-tokens.css / theme-desert.css /
   tokens.css / brand-tokens.css / pv-*.css are untouched).

   FONTS: Fraunces + Inter are self-hosted by the existing /css/fonts.css
   (@font-face, variable, font-display:swap) which every page already links.
   This file declares NO @font-face — it only names the families.

   SCHEME LAW: ONE pinned dark scheme. Converted pages set
   color-scheme: dark (below) and pin every color through these vars, so
   the OS prefers-color-scheme flip can never restyle them.

   COLOR LAW: brick #C0391B is THE one accent. Drift red the drift red is BANNED
   in this layer and appears nowhere below. Raw brick is ~3.4:1 on the
   ground — fills / rules / display-size type ONLY, never small text;
   small accent text uses --d3-accent-text #E0684B.

   ROLLBACK: delete this file + the /d3-proof/ route. Nothing else exists
   to undo — no page has been converted by this layer's delivery.
   ========================================================================== */

:root[data-theme="d3"] {
  color-scheme: dark;

  /* ---- Color · warm dark surfaces (depth = surface steps, inset darker) ---- */
  --d3-ground: #171310;        /* page ground — warm near-black (ember) */
  --d3-surface-1: #241C15;     /* cards, reading surface, bands */
  --d3-surface-2: #2E241B;     /* raised elements, hover states, rail cards */
  --d3-inset: #0D0A07;         /* data wells, Short Version, score wells */

  /* ---- Color · text (cream is a TEXT tone only, never a background) ---- */
  --d3-text: #F4EFE6;          /* primary   — 16.13:1 on ground */
  --d3-text-2: #CBBFA9;        /* secondary — 10.17:1 on ground */
  --d3-text-3: #A2937D;        /* muted     —  6.16:1 on ground (meta/labels) */

  /* ---- Color · the one accent ---- */
  --d3-accent: #C0391B;        /* brick — fills, rules, tags, display kickers */
  --d3-accent-text: #E0684B;   /* lifted tint — ONLY brick for small text (5.50:1 on ground) */
  --d3-accent-deep: #A93212;   /* hover/pressed fill (cream on it: 5.82:1) */

  /* ---- Color · lines & scrims ---- */
  --d3-line: #3A2E21;          /* warm hairline borders on dark */
  --d3-scrim-strong: rgba(13, 10, 7, .95);  /* hero text zone, bottom-weighted */
  --d3-scrim-mid: rgba(13, 10, 7, .55);
  --d3-scrim-none: rgba(13, 10, 7, 0);

  /* ---- Type ---- */
  --d3-font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --d3-font-ui: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --d3-size-page-title: 56px;      /* phone override below: 34px */
  --d3-size-section: 26px;         /* phone: 20px */
  --d3-size-lead: 46px;            /* phone: 30px */
  --d3-size-card: 20px;            /* phone: 18px */
  --d3-size-body: 17.5px;
  --d3-leading-body: 1.65;
  --d3-size-meta: 12px;
  --d3-size-data: 16px;
  --d3-measure: 66ch;              /* article reading measure */

  /* ---- Spacing · 8pt base ---- */
  --d3-space-1: 8px;
  --d3-space-2: 16px;
  --d3-space-3: 24px;
  --d3-section-rhythm: 64px;       /* phone: 40px */
  --d3-card-pad: 20px;
  --d3-gutter: 24px;               /* phone: 16px */
  --d3-gutter-dense: 12px;         /* dense magazine grid */

  /* ---- Shape & motion ---- */
  --d3-radius: 2px;                /* squared. No pills, ever. */
  --d3-motion: 160ms ease-out;

  background: var(--d3-ground);
}

@media (max-width: 700px) {
  :root[data-theme="d3"] {
    --d3-size-page-title: 34px;
    --d3-size-section: 20px;
    --d3-size-lead: 30px;
    --d3-size-card: 18px;
    --d3-section-rhythm: 40px;
    --d3-gutter: 16px;
  }
}

/* ============================ BASE / CHROME ============================ */

html[data-theme="d3"] body {
  margin: 0;
  background: var(--d3-ground);
  color: var(--d3-text);
  font-family: var(--d3-font-ui);
  font-size: var(--d3-size-body);
  line-height: var(--d3-leading-body);
  -webkit-font-smoothing: antialiased;
}

html[data-theme="d3"] ::selection {
  background: var(--d3-accent);
  color: var(--d3-text);
}

html[data-theme="d3"] a { color: var(--d3-accent-text); text-decoration: none; }
html[data-theme="d3"] a:hover { text-decoration: underline; text-underline-offset: 3px; }

html[data-theme="d3"] :focus-visible {
  outline: 2px solid var(--d3-accent-text);
  outline-offset: 2px;
}

/* Masthead — slim, on ground; wordmark left; brick rule beneath */
html[data-theme="d3"] .d3-masthead {
  background: var(--d3-ground);
  border-bottom: 2px solid var(--d3-accent);
}
html[data-theme="d3"] .d3-masthead-in {
  max-width: 1280px; margin: 0 auto; padding: 14px var(--d3-gutter);
  display: flex; align-items: baseline; gap: var(--d3-space-3); flex-wrap: wrap;
}
html[data-theme="d3"] .d3-wordmark {
  font-family: var(--d3-font-display); font-weight: 700; font-size: 28px;
  line-height: 1; color: var(--d3-text); letter-spacing: -.01em;
}
html[data-theme="d3"] .d3-wordmark em { font-style: normal; color: var(--d3-accent); }
html[data-theme="d3"] .d3-nav { display: flex; gap: 20px; flex-wrap: wrap; }
html[data-theme="d3"] .d3-nav a {
  font-family: var(--d3-font-ui); font-size: var(--d3-size-meta); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--d3-text-2);
}
html[data-theme="d3"] .d3-nav a:hover { color: var(--d3-text); text-decoration: none; }

html[data-theme="d3"] .d3-wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--d3-gutter); }
html[data-theme="d3"] .d3-section { margin-top: var(--d3-section-rhythm); }
html[data-theme="d3"] .d3-section-head {
  border-top: 2px solid var(--d3-accent); padding-top: 14px; margin-bottom: 20px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
html[data-theme="d3"] .d3-section-title {
  font-family: var(--d3-font-display); font-weight: 600;
  font-size: var(--d3-size-section); line-height: 1.15; margin: 0; color: var(--d3-text);
}

/* ============================ LABELS / TYPE ============================ */

html[data-theme="d3"] .d3-kicker {
  font-family: var(--d3-font-ui); font-size: var(--d3-size-meta); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--d3-accent-text);
  margin: 0 0 10px;
}
html[data-theme="d3"] .d3-meta {
  font-family: var(--d3-font-ui); font-size: var(--d3-size-meta);
  text-transform: uppercase; letter-spacing: .08em; color: var(--d3-text-3);
}
html[data-theme="d3"] .d3-page-title {
  font-family: var(--d3-font-display); font-weight: 600;
  font-size: var(--d3-size-page-title); line-height: 1.05; letter-spacing: -.015em;
  margin: 0; color: var(--d3-text); text-wrap: pretty;
}
html[data-theme="d3"] .d3-display em,
html[data-theme="d3"] .d3-page-title em,
html[data-theme="d3"] .d3-lead-headline em {
  font-style: italic; font-weight: 500; /* the ONE italic accent line (AURIX mix) */
}
html[data-theme="d3"] .d3-deck { color: var(--d3-text-2); font-size: 19px; line-height: 1.55; }

/* Tag — squared brick chip, never a pill. Cream on brick = 4.77:1. */
html[data-theme="d3"] .d3-tag {
  display: inline-block; background: var(--d3-accent); color: var(--d3-text);
  font-family: var(--d3-font-ui); font-size: var(--d3-size-meta); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; padding: 4px 8px;
  border-radius: var(--d3-radius);
}

/* ============================ HERO ON PHOTO ============================
   Photography IS the surface. Scrim ONLY behind the text zone,
   bottom-weighted; it deepens to --d3-scrim-strong where text sits
   (worst case, over a pure-white photo area: cream 15.73:1,
   accent-text 5.36:1 — computed, see REPORT.md). */

html[data-theme="d3"] .d3-hero { position: relative; overflow: hidden; background: var(--d3-inset); }
html[data-theme="d3"] .d3-hero img {
  display: block; width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0;
}
html[data-theme="d3"] .d3-hero-copy {
  position: relative; z-index: 1; min-height: 420px;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 96px var(--d3-gutter) 28px;
  background: linear-gradient(to top, var(--d3-scrim-strong) 0%, var(--d3-scrim-strong) 22%, var(--d3-scrim-mid) 58%, var(--d3-scrim-none) 82%);
}
html[data-theme="d3"] .d3-lead-headline {
  font-family: var(--d3-font-display); font-weight: 700;
  font-size: var(--d3-size-lead); line-height: 1.08; letter-spacing: -.015em;
  margin: 0 0 12px; color: var(--d3-text); text-wrap: pretty; max-width: 22ch;
}
html[data-theme="d3"] .d3-lead-headline a { color: var(--d3-text); }
html[data-theme="d3"] .d3-hero .d3-deck { max-width: 58ch; margin: 0; }
html[data-theme="d3"] .d3-photo-credit {
  font-size: var(--d3-size-meta); letter-spacing: .08em; text-transform: uppercase;
  color: var(--d3-text-3); margin-top: 10px;
}

/* ============================ DENSE MAGAZINE CARD ============================ */

html[data-theme="d3"] .d3-grid {
  display: grid; gap: var(--d3-gutter-dense);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
html[data-theme="d3"] .d3-card {
  background: var(--d3-surface-1); border: 1px solid var(--d3-line);
  border-radius: var(--d3-radius); overflow: hidden;
  transition: background var(--d3-motion);
}
html[data-theme="d3"] .d3-card:hover { background: var(--d3-surface-2); }
html[data-theme="d3"] .d3-card img { display: block; width: 100%; aspect-ratio: 16/10; object-fit: cover; }
html[data-theme="d3"] .d3-card-body { padding: var(--d3-card-pad); }
html[data-theme="d3"] .d3-card-headline {
  font-family: var(--d3-font-display); font-weight: 550;
  font-size: var(--d3-size-card); line-height: 1.25; margin: 8px 0 10px; color: var(--d3-text);
}
html[data-theme="d3"] .d3-card-headline a { color: var(--d3-text); }
html[data-theme="d3"] .d3-card p { color: var(--d3-text-2); font-size: 15.5px; line-height: 1.55; margin: 0 0 10px; }

/* ============================ NUMBERED DATA RAIL ============================ */

html[data-theme="d3"] .d3-rail { display: grid; gap: var(--d3-gutter-dense); }
html[data-theme="d3"] .d3-rail-card {
  background: var(--d3-surface-1); border: 1px solid var(--d3-line);
  border-radius: var(--d3-radius); padding: var(--d3-card-pad);
  display: flex; gap: 18px; align-items: baseline;
  transition: background var(--d3-motion);
}
html[data-theme="d3"] .d3-rail-card:hover { background: var(--d3-surface-2); }
html[data-theme="d3"] .d3-rail-num {
  font-family: var(--d3-font-display); font-weight: 700; font-size: 34px; line-height: 1;
  color: var(--d3-accent); /* large display numeral — brick is legal at this size */
}
html[data-theme="d3"] .d3-rail-label {
  font-family: var(--d3-font-display); font-weight: 600; font-size: 20px; color: var(--d3-text); margin: 0;
}
html[data-theme="d3"] .d3-rail-card p { color: var(--d3-text-2); font-size: 15px; line-height: 1.5; margin: 4px 0 0; }

/* ============================ ARTICLE READING ============================ */

html[data-theme="d3"] .d3-article { background: var(--d3-surface-1); border: 1px solid var(--d3-line); border-radius: var(--d3-radius); padding: 28px var(--d3-gutter); }
html[data-theme="d3"] .d3-article-headline {
  font-family: var(--d3-font-display); font-weight: 700; font-size: var(--d3-size-lead);
  line-height: 1.1; letter-spacing: -.015em; margin: 0 0 14px; color: var(--d3-text); text-wrap: pretty;
}
html[data-theme="d3"] .d3-byline { color: var(--d3-text-3); font-size: var(--d3-size-meta); text-transform: uppercase; letter-spacing: .08em; }
html[data-theme="d3"] .d3-byline strong { color: var(--d3-text-2); font-weight: 600; }
html[data-theme="d3"] .d3-prose { max-width: var(--d3-measure); }
html[data-theme="d3"] .d3-prose p {
  font-size: var(--d3-size-body); line-height: var(--d3-leading-body);
  color: var(--d3-text); margin: 0 0 1.4em;
}
html[data-theme="d3"] .d3-prose p.d3-lede { color: var(--d3-text); font-size: 19.5px; }
html[data-theme="d3"] .d3-pull {
  border-left: 3px solid var(--d3-accent); padding: 4px 0 4px 20px; margin: 32px 0;
}
html[data-theme="d3"] .d3-pull-num {
  font-family: var(--d3-font-display); font-weight: 700; font-size: 52px; line-height: 1; color: var(--d3-accent);
  display: block; margin-bottom: 8px; /* oversized brick numeral — display use */
}
html[data-theme="d3"] .d3-pull p { color: var(--d3-text-2); font-size: 16px; line-height: 1.55; margin: 0; max-width: 46ch; }
/* The Short Version — inset well */
html[data-theme="d3"] .d3-well {
  background: var(--d3-inset); border: 1px solid var(--d3-line);
  border-radius: var(--d3-radius); padding: var(--d3-card-pad); margin: 32px 0;
}
html[data-theme="d3"] .d3-well-title {
  font-size: var(--d3-size-meta); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--d3-accent-text); margin: 0 0 10px;
}
html[data-theme="d3"] .d3-well p { color: var(--d3-text); font-size: 16.5px; line-height: 1.6; margin: 0; }

/* ============================ DATA / SCOREBOARD ============================ */

html[data-theme="d3"] .d3-score-line {
  font-family: var(--d3-font-ui); font-weight: 700; font-size: clamp(30px, 5vw, 44px);
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--d3-text); line-height: 1.15;
}
html[data-theme="d3"] .d3-score-sub { color: var(--d3-text-3); font-size: 14px; margin-top: 6px; }
html[data-theme="d3"] .d3-table {
  width: 100%; border-collapse: collapse; background: var(--d3-inset);
  font-family: var(--d3-font-ui); font-size: var(--d3-size-data); font-variant-numeric: tabular-nums;
}
html[data-theme="d3"] .d3-table caption {
  text-align: left; padding: 14px 16px 0; color: var(--d3-text-2);
  font-size: var(--d3-size-meta); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
}
html[data-theme="d3"] .d3-table th {
  text-align: left; color: var(--d3-text-3); font-size: var(--d3-size-meta); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; padding: 12px 16px; border-bottom: 1px solid var(--d3-line);
}
html[data-theme="d3"] .d3-table td { color: var(--d3-text); padding: 12px 16px; border-bottom: 1px solid var(--d3-line); }
html[data-theme="d3"] .d3-table td.d3-num, html[data-theme="d3"] .d3-table th.d3-num { text-align: right; }
html[data-theme="d3"] .d3-table td.d3-dim { color: var(--d3-text-2); }
html[data-theme="d3"] .d3-table tr:last-child td { border-bottom: 0; }

/* TONIGHT band */
html[data-theme="d3"] .d3-tonight {
  background: var(--d3-surface-1); border-top: 2px solid var(--d3-accent);
  padding: 16px var(--d3-gutter); color: var(--d3-text-2);
  font-size: 15px; font-variant-numeric: tabular-nums;
}
html[data-theme="d3"] .d3-tonight strong { color: var(--d3-text); text-transform: uppercase; letter-spacing: .08em; font-size: var(--d3-size-meta); margin-right: 12px; }

/* ============================ BUTTONS / LINKS ============================ */

html[data-theme="d3"] .d3-btn {
  display: inline-block; font-family: var(--d3-font-ui); font-size: 15px; font-weight: 600;
  padding: 11px 20px; border-radius: var(--d3-radius); border: 1px solid transparent;
  transition: background var(--d3-motion), border-color var(--d3-motion);
  cursor: pointer; text-decoration: none;
}
html[data-theme="d3"] .d3-btn:hover { text-decoration: none; }
html[data-theme="d3"] .d3-btn-primary { background: var(--d3-accent); color: var(--d3-text); }
html[data-theme="d3"] .d3-btn-primary:hover { background: var(--d3-accent-deep); }
html[data-theme="d3"] .d3-btn-ghost { background: transparent; color: var(--d3-text); border-color: var(--d3-line); }
html[data-theme="d3"] .d3-btn-ghost:hover { background: var(--d3-surface-2); }
html[data-theme="d3"] .d3-more-link { font-weight: 600; font-size: 15px; }

/* ============================ FOOTER ============================ */

html[data-theme="d3"] .d3-footer {
  margin-top: var(--d3-section-rhythm); border-top: 1px solid var(--d3-line);
  padding: 24px var(--d3-gutter) 40px; color: var(--d3-text-3); font-size: 14px;
}
html[data-theme="d3"] .d3-footer .d3-wordmark { font-size: 22px; }

@media (prefers-reduced-motion: reduce) {
  html[data-theme="d3"] * { transition: none !important; }
}
