/* IGRM — archival-paper institutional, production polish.
   Palette: paper #FAFAF7 · ink #12233D · rule #D8D6CE · muted #5C6675
   State colors (data-driven, the page's only accent):
     calm #1E6E67 · elevated #B07C1F · severe #A2361F
   Dark scheme keeps the same identity on night paper. */

/* Night paper is the committed default; light is a persisted choice. */
:root {
  --paper: #0E141E;
  --surface: #141C29;
  --ink: #EAE8E0;
  --muted: #97A0B0;
  --rule: #26303F;
  --rule-soft: #1C2532;
  --calm: #3AA396;
  --elevated: #D9A43B;
  --severe: #D96548;
  --state: var(--calm);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 32px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] {
  --paper: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #12233D;
  --muted: #5C6675;
  --rule: #D8D6CE;
  --rule-soft: #E7E5DD;
  --calm: #1E6E67;
  --elevated: #B07C1F;
  --severe: #A2361F;
  --shadow: 0 1px 2px rgba(18, 35, 61, 0.04), 0 8px 28px rgba(18, 35, 61, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.wrap { max-width: 980px; margin: 0 auto; padding: 0 24px; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color 160ms ease; }
a:hover { color: var(--state); }
:focus-visible { outline: 2px solid var(--state); outline-offset: 2px; }
::selection { background: var(--state); color: var(--paper); }

h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 600; margin: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -0.015em; }
h2 { font-size: 1.2rem; letter-spacing: -0.01em; }

.mono-eyebrow {
  font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 4px; font-weight: 500;
}
.tagline { color: var(--muted); margin: 8px 0 0; max-width: 52ch; }
.section-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 14px; max-width: 68ch; }
.empty { color: var(--muted); font-style: italic; }

/* Masthead — sticky glass */
.masthead {
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--rule);
  padding: 22px 0 18px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}
.masthead-row { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.mast-links { display: flex; gap: 4px; font-size: 0.88rem; flex-wrap: wrap; }
.mast-links a {
  text-decoration: none; color: var(--muted);
  padding: 6px 12px; border-radius: 999px;
  transition: color 160ms ease, background 160ms ease;
}
.mast-links a:hover { color: var(--ink); background: var(--rule-soft); }
.theme-btn {
  font: inherit; font-size: 0.82rem; color: var(--muted);
  background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; padding: 5px 13px; cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }

/* Instrument — the hero card */
.instrument {
  display: grid; grid-template-columns: minmax(240px, 1fr) 1.35fr;
  gap: 48px; padding: 36px 40px; margin: 36px 0;
  background: var(--surface);
  border: 1px solid var(--rule-soft);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.big-number {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 300;
  font-size: clamp(4.5rem, 12vw, 7.5rem);
  line-height: 0.95;
  margin: 10px 0 6px;
  color: var(--state);
  font-variant-numeric: tabular-nums;
  transition: color 500ms ease;
}
.delta { font-size: 1rem; color: var(--muted); margin: 0 0 20px; font-variant-numeric: tabular-nums; }
.nowcast { font-size: 0.8rem; color: var(--muted); margin-top: 10px; max-width: 46ch; }
.nowcast .prov { color: var(--elevated); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; font-size: 0.72rem; }
.nowcast-channels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.nowcast-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 3px 9px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; color: var(--muted); font-size: 0.74rem; }
.nowcast-chip:hover { border-color: var(--elevated); color: var(--ink); }
.nowcast-chip .nc-score { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Signature: the band scale */
.band { position: relative; max-width: 320px; }
.band-track {
  height: 5px; border-radius: 3px;
  background: linear-gradient(90deg, var(--calm), var(--elevated), var(--severe));
  opacity: 0.9;
}
.band-tick {
  position: absolute; top: -6px; left: 0;
  width: 3px; height: 17px; border-radius: 2px; background: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--paper) 70%, transparent);
  transition: left 600ms cubic-bezier(0.22, 1, 0.36, 1);
}
.band-labels {
  display: flex; justify-content: space-between;
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-top: 8px;
}

/* Component rows */
.components { display: flex; flex-direction: column; justify-content: center; }
.component-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 16px; align-items: baseline;
  padding: 11px 10px; margin: 0 -10px;
  border-bottom: 1px dashed var(--rule);
  border-radius: 8px;
  transition: background 160ms ease;
}
.component-row:hover { background: var(--rule-soft); }
.component-row:last-child { border-bottom: none; }
a.component-row { text-decoration: none; color: inherit; cursor: pointer; }
.component-name { font-size: 0.95rem; }
.component-score {
  font-family: "Fraunces", Georgia, serif; font-weight: 600;
  font-size: 1.35rem; font-variant-numeric: tabular-nums;
}
.component-delta { font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.up { color: var(--severe); }
.down { color: var(--calm); }
.flat { color: var(--muted); }

/* Sections */
.chart-section, .note-section, .archive-section { padding: 40px 0; border-bottom: 1px solid var(--rule-soft); }
.archive-section:last-of-type { border-bottom: none; }

.chart-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px; }
.ranges { display: flex; gap: 6px; }
.range-btn, .toggle {
  font: inherit; font-size: 0.8rem; padding: 5px 13px;
  background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; cursor: pointer; color: var(--muted);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease, transform 80ms ease;
}
.range-btn:hover, .toggle:hover { color: var(--ink); border-color: var(--muted); }
.range-btn:active, .toggle:active { transform: scale(0.97); }
.range-btn.is-active { border-color: var(--ink); color: var(--ink); background: var(--rule-soft); }
.toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.toggle { font-size: 0.78rem; padding: 4px 11px; }
.toggle.is-on { border-color: var(--state); color: var(--state); background: color-mix(in srgb, var(--state) 8%, transparent); }
.chart-wrap { margin-top: 10px; }

/* Note */
.note { max-width: 64ch; }
.note h3 { font-family: "Fraunces", Georgia, serif; }

/* Tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 9px 14px 9px 10px; border-bottom: 1px solid var(--rule-soft); font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { padding-left: 10px; }
th { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: var(--rule-soft); }
td a { color: var(--state); }

/* Footer */
.footer { padding: 32px 24px 48px; color: var(--muted); font-size: 0.85rem; }
.fine { font-size: 0.78rem; }

/* At-a-glance mover strip */
.glance {
  margin: 20px 0 -12px; padding: 10px 16px;
  border: 1px solid var(--rule-soft); border-radius: 10px;
  background: var(--surface); color: var(--muted); font-size: 0.9rem;
}
.glance b { color: var(--ink); }

/* Subscribe modal — centered, dimmed backdrop */
.subscribe-overlay[hidden] { display: none; }
.subscribe-overlay {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 24px;
}
.subscribe {
  width: min(440px, 100%);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 16px; padding: 26px 28px; box-shadow: var(--shadow);
  animation: rise 400ms cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
}
.subscribe-title { font-size: 1.35rem; margin: 4px 0 0; }
.subscribe-fine { font-size: 0.75rem; color: var(--muted); margin: 10px 0 0; }
.subscribe-done { font-size: 0.9rem; color: var(--calm); margin: 12px 0 0; }
.subscribe-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.subscribe-close:hover { color: var(--ink); }
.subscribe-copy { font-size: 0.88rem; color: var(--muted); margin: 4px 0 12px; }
.subscribe form { display: flex; gap: 8px; }
.subscribe input[type="email"] {
  flex: 1; min-width: 0; font: inherit; font-size: 0.85rem;
  padding: 8px 12px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--paper); color: var(--ink);
}
.subscribe input[type="email"]:focus { outline: 2px solid var(--state); border-color: transparent; }
.subscribe button[type="submit"] {
  font: inherit; font-size: 0.85rem; font-weight: 500;
  padding: 8px 14px; border: none; border-radius: 8px;
  background: var(--state); color: var(--paper); cursor: pointer;
  transition: filter 150ms ease;
}
.subscribe button[type="submit"]:hover { filter: brightness(1.12); }
.subscribe-alt { font-size: 0.78rem; margin: 10px 0 0; }
.subscribe-alt a { color: var(--muted); }

/* Entrance */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main > section { animation: rise 500ms cubic-bezier(0.22, 1, 0.36, 1) both; }
main > section:nth-child(2) { animation-delay: 60ms; }
main > section:nth-child(3) { animation-delay: 120ms; }
main > section:nth-child(4) { animation-delay: 180ms; }
main > section:nth-child(5) { animation-delay: 240ms; }

@media (max-width: 720px) {
  .instrument { grid-template-columns: 1fr; gap: 26px; padding: 26px 22px; }
  .masthead { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .big-number, .band-tick, main > section { transition: none; animation: none; }
}

/* 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; }
main > section.reveal { animation: none; }

/* Reading progress bar */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--calm), var(--state));
  z-index: 60; transition: width 120ms linear;
}

/* Card hover lift */
.instrument, .glance {
  transition: transform 220ms cubic-bezier(0.22,1,0.36,1), box-shadow 220ms ease,
              background 300ms ease, border-color 300ms ease;
}
.instrument:hover { transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.25), 0 16px 44px rgba(0,0,0,0.4); }

/* Smooth theme crossfade */
body, .masthead, .instrument, .glance, .subscribe {
  transition: background-color 300ms ease, color 300ms ease, border-color 300ms ease;
}


/* 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; }
}

main, .masthead { animation: igrm-pagein 420ms cubic-bezier(0.22,1,0.36,1) both; }
@media (prefers-reduced-motion: reduce) { main, .masthead { animation: none; } }


/* Elevation v1.1: designed light on the headline (2026-08-04) */
.big-number { text-shadow: 0 0 44px color-mix(in srgb, var(--state) 32%, transparent); }
.component-row:hover { box-shadow: inset 2px 0 0 var(--state); }

/* ==== Elevation v1.2, 2026-08-04: the cinematic pass, unmissable.
   Layers-register: dimensional aurora, gradient ink, dramatic hero. ==== */
body::before {
  content: ""; position: fixed; inset: -40%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45% 38% at 12% 8%, color-mix(in srgb, var(--calm) 11%, transparent), transparent 68%),
    radial-gradient(40% 34% at 88% 15%, color-mix(in srgb, var(--severe) 8%, transparent), transparent 70%),
    radial-gradient(50% 45% at 75% 92%, color-mix(in srgb, var(--elevated) 6%, transparent), transparent 72%);
  filter: blur(34px) saturate(1.1);
  animation: aurora 28s ease-in-out infinite alternate;
}
@keyframes aurora {
  from { transform: translate3d(-3%, -2%, 0) rotate(-1deg) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) rotate(1.5deg) scale(1.08); }
}
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
:root[data-theme="light"] body::before { opacity: 0.55; filter: blur(30px); }

.masthead .mono-eyebrow {
  background: linear-gradient(90deg, var(--calm), var(--elevated), var(--severe));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700;
}
.instrument {
  position: relative; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--state) 14%, var(--rule-soft));
  box-shadow: var(--shadow);
}
.instrument::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 80% at 18% 20%, color-mix(in srgb, var(--state) 9%, transparent), transparent 60%);
}
.big-number {
  font-size: clamp(5rem, 13vw, 8rem);
  text-shadow: 0 2px 28px color-mix(in srgb, var(--state) 16%, transparent);
}
.band-track { height: 6px; }

h2 { position: relative; }
.chart-section h2::after, .archive-section h2::after, .note-section h2::after {
  content: ""; display: block; width: 56px; height: 2px; margin-top: 8px;
  background: linear-gradient(90deg, var(--state), transparent); border-radius: 2px;
}


/* v1.3: sparklines in component rows; band tick breathes */
.component-row { grid-template-columns: 1fr auto auto auto; }
.spark { justify-self: end; opacity: 0.9 }
@keyframes tickpulse { 0%,100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--paper) 70%, transparent), 0 0 8px color-mix(in srgb, var(--state) 28%, transparent);} 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--paper) 70%, transparent), 0 0 16px color-mix(in srgb, var(--state) 45%, transparent);} }
.band-tick { animation: tickpulse 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .band-tick { animation: none; } }
::-webkit-scrollbar { width: 10px; height: 10px }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 6px }
::-webkit-scrollbar-thumb:hover { background: var(--muted) }
