/* Subpage theme matched to the homepage's archival-paper palette
   (style.css): paper / ink / rule / muted, state colors as accents. */
@import url("fonts.css"); /* self-hosted; no third-party requests */
/* Night paper by default, matching the homepage; light is a persisted choice. */
:root {
  --bg: #0E141E; --fg: #EAE8E0; --muted: #97A0B0; --line: #26303F;
  --card: #141C29; --accent: #D96548; --shade: rgba(217, 101, 72, 0.14);
  --ok: #3AA396; --bad: #D96548;
  /* Homepage palette names (style.css): the analysis-page charts read
     these, and until 2026-07-31 they resolved empty here, which crashed
     the gap chart's gradient and greyed every other chart. Keep the two
     sheets' values in step. */
  --ink: #EAE8E0; --rule: #26303F; --rule-soft: #1C2532;
  --calm: #3AA396; --elevated: #D9A43B; --severe: #D96548;
  --state: var(--calm);
}
:root[data-theme="light"] {
  --bg: #FAFAF7; --fg: #12233D; --muted: #5C6675; --line: #D8D6CE;
  --card: #ffffff; --accent: #A2361F; --shade: rgba(162, 54, 31, 0.10);
  --ok: #1E6E67; --bad: #A2361F;
  --ink: #12233D; --rule: #D8D6CE; --rule-soft: #E7E5DD;
  --calm: #1E6E67; --elevated: #B07C1F; --severe: #A2361F;
}
* { box-sizing: border-box; margin: 0; }
a { color: var(--accent); }
body {
  background: var(--bg); color: var(--fg);
  font: 16px/1.55 "Archivo", system-ui, sans-serif;
  max-width: 880px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; }
header h1 { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.01em; }
header h1 a { color: inherit; text-decoration: none; }
nav.masthead { margin-top: 0.5rem; font-size: 0.9rem; }
nav.masthead a { color: var(--accent); text-decoration: none; margin-right: 1rem; }
nav.masthead a.current { border-bottom: 2px solid var(--accent); }
.definition { color: var(--muted); font-size: 0.95rem; margin-top: 0.4rem; max-width: 60ch; }
.asof { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.headline { display: flex; align-items: baseline; gap: 1rem; margin: 2rem 0 0.5rem; }
.headline .num { font-size: 4rem; line-height: 1; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.headline .cap { color: var(--muted); font-size: 0.95rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.75rem; margin: 1.5rem 0 2.5rem; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
  padding: 0.8rem 0.9rem; cursor: pointer;
}
.card.active { border-color: var(--accent); }
.card .score { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.card .label { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 2.2rem 0 0.8rem; border-top: 1px solid var(--line); padding-top: 1.4rem; }
.chart-wrap { overflow-x: auto; position: relative; }
canvas { width: 100%; height: 300px; display: block; }
.chart-note { color: var(--muted); font-size: 0.8rem; margin-top: 0.4rem; }
.tooltip {
  position: absolute; pointer-events: none; display: none;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 0.3rem 0.55rem; font-size: 0.8rem; white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; font-size: 0.8rem; margin-left: 0.75rem; vertical-align: middle; }
.toggle[hidden] { display: none; }
.toggle button { background: var(--card); color: var(--muted); border: 0; padding: 0.25rem 0.7rem; cursor: pointer; font: inherit; }
.toggle button.on { background: var(--accent); color: #fff; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.7rem 0.45rem 0; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td a { color: var(--accent); }
.hit { color: var(--ok); font-weight: 700; }
.miss { color: var(--bad); font-weight: 700; }
.prose { max-width: 68ch; }
.prose h1 { font-size: 1.4rem; margin: 1.5rem 0 0.8rem; }
.prose h2 { font-size: 1.05rem; }
.prose h3 { font-size: 0.95rem; margin: 1.4rem 0 0.5rem; }
.prose p, .prose li { margin: 0.6rem 0; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose code { font: 0.85em/1.4 ui-monospace, Menlo, monospace; background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.25em; }
.prose blockquote { border-left: 3px solid var(--line); margin: 0.8rem 0; padding-left: 1rem; color: var(--muted); }
.prose a { color: var(--accent); }
.empty { color: var(--muted); font-style: italic; }
.kv { color: var(--muted); font-size: 0.85rem; }
code { font: 0.85em/1.4 ui-monospace, Menlo, monospace; background: var(--card); border: 1px solid var(--line); border-radius: 3px; padding: 0 0.3em; }

/* Receipts drill-down: tier badges order presentation only, never a score */
.receipts-list { list-style: none; padding: 0; }
.receipts-list li { padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.receipts-list li:last-child { border-bottom: none; }
.tier-badge {
  display: inline-block; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.1em 0.5em; border-radius: 999px; margin-right: 0.4em;
}
.tier-badge.tier-1, .tier-badge.tier-2 { background: color-mix(in srgb, var(--calm) 20%, transparent); color: var(--calm); }
.tier-badge.tier-3 { background: color-mix(in srgb, var(--elevated) 20%, transparent); color: var(--elevated); }
.tier-badge.tier-4 { background: color-mix(in srgb, var(--severe) 20%, transparent); color: var(--severe); }
.tier-badge.tier-u { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
footer { margin-top: 3rem; border-top: 1px solid var(--line); padding-top: 1rem; color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--accent); }

/* Scroll reveal (reveal.js) */
.reveal { opacity: 0; transform: translateY(12px);
  transition: opacity 550ms cubic-bezier(0.22,1,0.36,1), transform 550ms cubic-bezier(0.22,1,0.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* Reading progress bar */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  z-index: 60; transition: width 120ms linear;
}
body { transition: background-color 300ms ease, color 300ms ease; }
.pane { transition: transform 220ms cubic-bezier(0.22,1,0.36,1), box-shadow 220ms ease; }
.pane:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,0.3); }


/* Ambient background drift, subtle life on the night paper */
body::before {
  content: ""; position: fixed; inset: -50%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 18% 12%, color-mix(in srgb, var(--calm, var(--ok)) 8%, transparent), transparent 70%),
    radial-gradient(50% 42% at 85% 88%, color-mix(in srgb, var(--severe, var(--accent)) 7%, transparent), transparent 70%);
  animation: igrm-drift 36s ease-in-out infinite alternate;
}
@keyframes igrm-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }


/* Cross-page view transitions (Chromium/Safari; graceful elsewhere) */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 240ms; }

/* Page entrance */
@keyframes igrm-pagein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* Sticky glass masthead on subpages, matching the homepage */
body > header {
  position: sticky; top: 0; z-index: 20;
  margin: -2.5rem -1.25rem 1.2rem; padding: 1.3rem 1.25rem 0.9rem;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
body > header ~ * { animation: igrm-pagein 420ms cubic-bezier(0.22,1,0.36,1) both; }
@media (prefers-reduced-motion: reduce) { body > header ~ * { animation: none; } }

/* ---- Design elevation, 2026-08-03: editorial data-design pass. ----
   Same identity (night paper, Fraunces/Archivo), raised craft: one
   modular type scale, table and evidence-list rhythm, designed number
   emphasis. Appended as overrides; frozen after this pass. */
h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.55rem);
  font-weight: 600; letter-spacing: -0.008em;
  margin: 2.6rem 0 0.7rem; padding-top: 1.1rem;
  border-top: 1px solid var(--line);
}
header h1 { font-size: clamp(1.6rem, 3.4vw, 2.05rem); }
header .definition { line-height: 1.65; }
nav.masthead { letter-spacing: 0.01em; }
nav.masthead a { padding: 2px 0; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
thead th {
  font-family: "Archivo", system-ui, sans-serif; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted);
  font-weight: 500; text-align: left; padding: 0.45rem 0.6rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 0.5rem 0.6rem; border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--card) 65%, transparent); }
td.num, th.num { text-align: right; }
.kv { line-height: 1.6; }
.chart-note { line-height: 1.62; max-width: 68ch; }
.card { border-radius: 8px; }
select, button.btn, .btn {
  font: inherit; background: var(--card); color: var(--fg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.3rem 0.6rem;
}

/* ---- Elevation v1.1, 2026-08-04: Layers-informed cinematic depth.
   Dimensional surfaces and designed light, zero new dependencies,
   seriousness intact. Founder-requested second pass; frozen after. ---- */
.card, .pane {
  background: color-mix(in srgb, var(--card) 78%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--line) 80%, var(--accent) 6%);
}
.chart-wrap {
  background: color-mix(in srgb, var(--card) 55%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  border-radius: 10px; padding: 0.9rem 1rem;
}
h2 { position: relative; }
h2::before {
  content: ""; position: absolute; top: -1px; left: 0; width: 44px; height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
nav.masthead a.current {
  text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent);
}
.headline .num {
  text-shadow: 0 0 34px color-mix(in srgb, var(--accent) 30%, transparent);
}
tbody tr:hover { box-shadow: inset 2px 0 0 var(--accent); }
:root[data-theme="light"] .card, :root[data-theme="light"] .pane {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background: var(--card);
}

/* ==== Elevation v1.2: subpage cinematic depth to match the homepage. ==== */
body::before {
  background:
    radial-gradient(50% 42% at 15% 10%, color-mix(in srgb, var(--calm, var(--ok)) 18%, transparent), transparent 68%),
    radial-gradient(44% 38% at 88% 88%, color-mix(in srgb, var(--severe, var(--accent)) 14%, transparent), transparent 70%) !important;
  filter: blur(22px) saturate(1.2);
}
header h1 a { 
  background: linear-gradient(120deg, var(--fg) 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.headline .num { text-shadow: 0 0 44px color-mix(in srgb, var(--accent) 40%, transparent); }
.prov { color: var(--elevated); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.72rem; }
