/* ============================================================
   LUMEN — THE AMERICAN ROOFTOP
   A night→day atlas of US rooftop solar potential
   ============================================================ */

@font-face {
  font-family: "ABC Arizona Serif";
  src: url("../fonts/ABCArizonaSerif-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Pelikan";
  src: url("../fonts/ABCPelikan-Book.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Pelikan";
  src: url("../fonts/ABCPelikan-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "ABC Pelikan Mono";
  src: url("../fonts/ABCPelikanMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Lumen brand */
  --paper: #fbfaf4;
  --white: #ffffff;
  --ink: #191d1b;
  --graphite: #1a1a1a;
  --yellow: #dfff5e;
  --yellow-tint: #ecffb2;
  --yellow-deep: #b8d150;
  --yellow-text: #697635;
  --sky: #b1e5ff;
  --sky-deep: #68a2cd;
  --concrete: #9fa38f;
  --concrete-light: #e7e8e3;
  --coral: #ef7d64;

  /* night palette */
  --night: #0e110e;
  --night-2: #151915;
  --night-3: #1d231d;
  --night-line: rgba(223, 255, 94, 0.16);
  --night-text: #f2f2ea;
  --night-muted: #9aa194;

  --serif: "ABC Arizona Serif", "Times New Roman", Times, serif;
  --sans: "ABC Pelikan", Inter, ui-sans-serif, system-ui, sans-serif;
  --mono: "ABC Pelikan Mono", "Roboto Mono", ui-monospace, SFMono-Regular, monospace;

  --vh100: 100vh;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (height: 100dvh) {
  :root { --vh100: 100dvh; }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  background: var(--night);
  color: var(--night-text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 1.6s ease;
}
body.day { background: var(--paper); color: var(--ink); }

button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; padding: 0; }
a { color: inherit; }
.mono { font-family: var(--mono); }

::selection { background: var(--yellow); color: var(--graphite); }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--night);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 26px;
  transition: opacity 0.9s ease, visibility 0.9s;
}
#loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
#loader img { width: 150px; opacity: 0.96; }
#loader .bar {
  width: 168px; height: 2px; background: rgba(223, 255, 94, 0.18);
  overflow: hidden; border-radius: 2px;
}
#loader .bar i {
  display: block; height: 100%; width: 0%;
  background: var(--yellow);
  transition: width 0.35s ease;
}
#loader .load-note {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--night-muted);
}

/* ---------- fixed map stage ---------- */
#stage {
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}
body.explore-mode #stage { pointer-events: auto; }
#stage canvas { outline: none; }
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 90% at 50% 42%, rgba(14, 17, 14, 0) 52%, rgba(14, 17, 14, 0.62) 100%);
  transition: opacity 1.4s ease;
}
body.day #vignette { opacity: 0; }

#map-tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  max-width: 290px;
  background: rgba(17, 20, 17, 0.94);
  border: 1px solid rgba(223, 255, 94, 0.28);
  border-radius: 6px;
  padding: 11px 13px 11px;
  font-size: 13px; line-height: 1.45;
  color: var(--night-text);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
#map-tooltip.on { opacity: 1; transform: none; }
body.day #map-tooltip {
  background: rgba(255, 255, 255, 0.97); color: var(--ink);
  border-color: rgba(25, 29, 27, 0.2);
  box-shadow: 0 16px 44px rgba(17, 20, 18, 0.18);
}
#map-tooltip .tt-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--night-muted); margin: 0 0 3px;
}
body.day #map-tooltip .tt-kicker { color: #6c7165; }
#map-tooltip .tt-name { font-weight: 500; font-size: 14px; margin: 0 0 6px; }
#map-tooltip .tt-row { display: flex; justify-content: space-between; gap: 18px; }
#map-tooltip .tt-row b { font-family: var(--mono); font-weight: 400; }
#map-tooltip .tt-hint {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid rgba(223,255,94,.18);
  font-size: 11px; color: var(--night-muted);
}
body.day #map-tooltip .tt-hint { border-top-color: rgba(25,29,27,.14); color: #6c7165; }

/* ---------- masthead ---------- */
#masthead {
  position: fixed; top: 0; left: 0; right: 0; z-index: 90;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px 14px;
  pointer-events: none;
}
#masthead > * { pointer-events: auto; }
#masthead .logo { display: flex; align-items: center; }
#masthead .logo img { height: 26px; display: block; }
#masthead .logo .logo-day { display: none; }
body.day #masthead .logo .logo-night { display: none; }
body.day #masthead .logo .logo-day { display: block; }

#scene-nav { display: flex; align-items: center; gap: 7px; }
#scene-nav button {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
}
#scene-nav button i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(242, 242, 234, 0.32);
  transition: all 0.3s ease;
}
body.day #scene-nav button i { background: rgba(25, 29, 27, 0.26); }
#scene-nav button.active i { background: var(--yellow); transform: scale(1.5); }
body.day #scene-nav button.active i { background: var(--ink); }
#scene-nav button:hover i { background: var(--yellow); }
body.day #scene-nav button:hover i { background: var(--ink); }

.mast-right { display: flex; align-items: center; gap: 10px; }

#era-toggle {
  display: flex; align-items: center;
  border: 1px solid rgba(242, 242, 234, 0.22);
  border-radius: 999px; padding: 3px;
  background: rgba(14, 17, 14, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#era-toggle button {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--night-muted);
  border-radius: 999px; padding: 5px 11px;
  transition: all 0.25s ease;
  white-space: nowrap;
}
#era-toggle button:hover { color: var(--night-text); }
#era-toggle button.active { background: var(--yellow); color: var(--graphite); }
body.day #era-toggle {
  border-color: rgba(25, 29, 27, 0.18);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.day #era-toggle button { color: #6c7165; }
body.day #era-toggle button:hover { color: var(--ink); }
body.day #era-toggle button.active { background: var(--graphite); color: var(--yellow); }

#skip-explore {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--night-muted);
  border: 1px solid rgba(242, 242, 234, 0.22);
  border-radius: 999px; padding: 8px 14px;
  background: rgba(14, 17, 14, 0.5);
  backdrop-filter: blur(6px);
  transition: all 0.25s ease;
}
#skip-explore:hover { color: var(--graphite); background: var(--yellow); border-color: var(--yellow); }
body.day #skip-explore { display: none; }

/* ---------- story steps ---------- */
#story { position: relative; z-index: 10; pointer-events: none; }
.step {
  min-height: 150vh;
  display: flex; align-items: center;
  padding: 0 6vw;
  position: relative;
}
.step[data-scene="title"] { min-height: 116vh; align-items: center; }
.step[data-scene="dawn"] { min-height: 130vh; }

.card {
  pointer-events: auto;
  max-width: 470px;
  background: rgba(16, 19, 16, 0.78);
  border: 1px solid rgba(242, 242, 234, 0.12);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 10px;
  padding: 30px 32px 28px;
  opacity: 0; transform: translateY(34px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out),
    background 1s ease, border-color 1s ease, color 1s ease;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.step.active .card, .step.passed .card { opacity: 1; transform: none; }
.step .card.right { margin-left: auto; }
.step .card.center { margin: 0 auto; text-align: center; }

body.day .card {
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(25, 29, 27, 0.12);
  box-shadow: 0 30px 80px rgba(17, 20, 18, 0.16);
  color: var(--ink);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body.day .card .eyebrow { color: var(--yellow-text); }
body.day .card p { color: rgba(25, 29, 27, 0.82); }
body.day .card p strong { color: var(--ink); }
body.day .card .fineprint { border-top-color: rgba(25, 29, 27, 0.12); color: #6c7165; }

.card .eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--yellow);
  margin: 0 0 14px;
}
.card h2 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(26px, 3vw, 36px); line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.card p { margin: 0 0 12px; color: rgba(242, 242, 234, 0.84); font-size: 15.5px; }
.card p:last-child { margin-bottom: 0; }
.card p strong { color: var(--night-text); font-weight: 500; }
.card .yellow { color: var(--yellow); }
.card .sky { color: var(--sky); }
.card .figure { margin: 18px 0 6px; }
.card .fineprint {
  margin-top: 16px; padding-top: 12px;
  border-top: 1px solid rgba(242, 242, 234, 0.1);
  font-size: 11.5px; color: var(--night-muted);
}

/* hero */
#hero-card {
  max-width: 760px;
  border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none;
  text-align: center; margin: 0 auto;
  padding: 56px 40px;
  background: radial-gradient(ellipse 62% 58% at 50% 50%, rgba(10, 13, 10, 0.72), rgba(10, 13, 10, 0.32) 58%, transparent 75%);
}
#hero-card .eyebrow { color: var(--sky); margin-bottom: 22px; }
#hero-card h1 {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(42px, 7.4vw, 96px);
  line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 26px;
  text-wrap: balance;
}
#hero-card h1 em { font-style: italic; color: var(--yellow); }
#hero-card .standfirst {
  font-size: clamp(16px, 1.6vw, 19px);
  color: rgba(242, 242, 234, 0.82);
  max-width: 560px; margin: 0 auto;
  text-wrap: balance;
}
#scroll-cue {
  position: absolute; bottom: 7vh; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--night-muted);
  opacity: 0; transition: opacity 1.2s ease 0.8s;
  pointer-events: none;
}
.step.active #scroll-cue { opacity: 1; }
#scroll-cue .line {
  width: 1px; height: 44px;
  background: linear-gradient(var(--yellow), transparent);
  animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue {
  0%, 100% { transform: scaleY(0.55); opacity: 0.4; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 1; transform-origin: top; }
}
@media (prefers-reduced-motion: reduce) { #scroll-cue .line { animation: none; } }

/* big numbers */
.bignum {
  font-family: var(--serif); font-weight: 300;
  font-size: clamp(54px, 6.4vw, 86px);
  line-height: 1; letter-spacing: -0.02em;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 12px;
  margin: 4px 0 10px;
}
.bignum .unit {
  font-family: var(--mono); font-size: 16px; letter-spacing: 0.06em;
  color: var(--night-muted);
}
.statline { display: flex; gap: 26px; margin-top: 18px; flex-wrap: wrap; }
.statline .stat .v {
  font-family: var(--mono); font-size: 19px; color: var(--night-text);
  display: block;
}
.statline .stat .v.yellow { color: var(--yellow); }
.statline .stat .v.sky { color: var(--sky); }
.statline .stat .k {
  font-size: 11.5px; color: var(--night-muted);
  letter-spacing: 0.02em;
}

/* in-card source credit (Act IV — press-ready frame) */
.card-credit {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(242, 242, 234, 0.14);
}
.card-credit .credit-logo {
  height: 21px; width: auto; display: block;
  margin: 0 0 10px;
  opacity: 0.96;
}
.card-credit .credit-cite {
  margin: 0;
  font-size: 11px; line-height: 1.55;
  color: var(--night-muted);
}
.card-credit .credit-cite strong { color: rgba(242, 242, 234, 0.92); font-weight: 500; }
.card-credit .credit-cite em { font-style: italic; }
.card-credit .credit-line {
  display: block; margin-top: 7px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--yellow);
}
.fineprint.no-rule { border-top: 0; padding-top: 0; margin-top: 12px; }
body.day .card-credit { border-top-color: rgba(25, 29, 27, 0.14); }
body.day .card-credit .credit-cite { color: #6c7165; }
body.day .card-credit .credit-cite strong { color: var(--ink); }

/* tier list (Act V) */
.tier-list { margin: 16px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.tier-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "head gw" "states gw";
  align-items: center;
  column-gap: 12px; row-gap: 2px;
  padding: 10px 13px;
  border-radius: 8px;
  border-left: 3px solid;
  background: rgba(242, 242, 234, 0.05);
}
.tier-row.tr1 { border-color: var(--yellow); background: rgba(223, 255, 94, 0.1); }
.tier-row.tr2 { border-color: var(--sky); background: rgba(177, 229, 255, 0.08); }
.tier-row.tr3 { border-color: var(--sky-deep); background: rgba(104, 162, 205, 0.08); }
.tier-head {
  grid-area: head;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.09em;
  text-transform: uppercase;
}
.tr1 .tier-head { color: var(--yellow); }
.tr2 .tier-head { color: var(--sky); }
.tr3 .tier-head { color: #8fb8d6; }
.tier-states {
  grid-area: states;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.03em;
  color: var(--night-text);
}
.tier-gw { grid-area: gw; font-size: 11.5px; color: var(--night-muted); text-align: right; }
.tier-gw b { font-family: var(--mono); font-weight: 400; font-size: 14px; color: var(--night-text); display: block; }

/* tier chip in explorer detail panel */
.tier-chip {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 999px; padding: 5px 12px 5px 9px;
  font-size: 12px; font-weight: 500;
  margin: 2px 8px 8px 0;
}
.tier-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tier-chip.tc1 { background: var(--yellow); color: var(--graphite); }
.tier-chip.tc2 { background: var(--sky); color: var(--graphite); }
.tier-chip.tc3 { background: var(--concrete-light); color: #33372f; }

/* proof image (Act III — LiDAR rooftop suitability) */
.proof-figure { margin: 14px 0 4px; }
.proof-figure img {
  display: block; width: 100%; height: auto;
  max-height: 208px; object-fit: cover; object-position: center;
  border-radius: 8px;
  border: 1px solid rgba(242, 242, 234, 0.18);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
}
.proof-figure figcaption {
  margin-top: 10px;
  font-size: 11.5px; line-height: 1.5; color: var(--night-muted);
}
.proof-figure .cool { color: var(--sky); font-weight: 500; }
.proof-figure .hot { color: var(--coral); font-weight: 500; }
.proof-figure .fig-credit {
  display: block; margin-top: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  color: rgba(154, 161, 148, 0.8);
}
body.day .proof-figure img { border-color: rgba(25, 29, 27, 0.16); }
body.day .proof-figure figcaption { color: #6c7165; }

/* charts inside cards */
.chart { width: 100%; }
.chart text { font-family: var(--mono); }
.chart .axis-label { fill: var(--night-muted); font-size: 10px; letter-spacing: 0.06em; }

/* ---------- explorer ---------- */
#explorer-step { min-height: 100vh; min-height: var(--vh100); }
#explorer-ui {
  position: fixed; inset: 0; z-index: 40;
  pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: opacity 0.7s ease, visibility 0.7s;
}
body.explore-mode #explorer-ui { opacity: 1; visibility: visible; }
#explorer-ui > * { pointer-events: auto; }

/* control rail */
#control-rail {
  position: absolute; top: 64px; left: 22px;
  display: flex; flex-direction: column; gap: 10px;
  width: 264px;
}
.panel {
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(25, 29, 27, 0.12);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(17, 20, 18, 0.14);
  color: var(--ink);
}
#search-panel { position: relative; z-index: 6; } /* results must paint over sibling panels */
#search-box { display: flex; align-items: center; gap: 9px; padding: 11px 13px; position: relative; }
#search-box svg { width: 15px; height: 15px; stroke: #6c7165; flex: none; }
#search-input {
  border: 0; outline: 0; background: none; width: 100%;
  font: inherit; font-size: 14px; color: var(--ink);
}
#search-input::placeholder { color: #9aa194; }
#search-kbd {
  font-family: var(--mono); font-size: 10px; color: #9aa194;
  border: 1px solid rgba(25, 29, 27, 0.16); border-radius: 4px;
  padding: 2px 5px; flex: none;
}
#search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 320px; overflow: auto;
  display: none;
  z-index: 5;
}
#search-results.on { display: block; }
.sr-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%;
  padding: 9px 13px; text-align: left;
  font-size: 13.5px;
  border-bottom: 1px solid rgba(25, 29, 27, 0.07);
}
.sr-item:last-child { border-bottom: 0; }
.sr-item:hover, .sr-item.sel { background: var(--yellow-tint); }
.sr-item .sr-type {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: #6c7165; flex: none;
}
.sr-item .sr-val { font-family: var(--mono); font-size: 12px; color: #6c7165; flex: none; }
.sr-empty { padding: 12px 13px; font-size: 13px; color: #6c7165; }

.panel-section { padding: 13px 15px; }
.panel-section + .panel-section { border-top: 1px solid rgba(25, 29, 27, 0.1); }
.panel-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: #6c7165;
  margin: 0 0 9px;
}
.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg-note {
  margin: 9px 0 0; font-size: 10.5px; line-height: 1.5; color: #6c7165;
}
.seg-note b { color: #4d5248; font-weight: 500; }
.seg button {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em;
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(25, 29, 27, 0.16);
  color: #4d5248;
  transition: all 0.18s ease;
}
.seg button:hover { border-color: var(--ink); color: var(--ink); }
.seg button.active { background: var(--graphite); color: var(--yellow); border-color: var(--graphite); }
.seg button.active.sky-mode { color: var(--sky); }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.toggle-row .lbl { font-size: 13px; color: var(--ink); }
.switch {
  width: 38px; height: 21px; border-radius: 999px;
  background: rgba(25, 29, 27, 0.16);
  position: relative; transition: background 0.2s ease;
  flex: none;
}
.switch i {
  position: absolute; top: 2.5px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; transition: transform 0.22s var(--ease-out);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
}
.switch.on { background: var(--graphite); }
.switch.on i { transform: translateX(16px); background: var(--yellow); }

#legend-panel .ramp {
  height: 8px; border-radius: 4px; margin: 4px 0 5px;
  border: 1px solid rgba(25, 29, 27, 0.1);
}
#legend-panel .legend-row {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10.5px; color: #6c7165;
}
#legend-note { font-size: 11px; color: #6c7165; margin: 8px 0 0; line-height: 1.45; }

/* breadcrumbs */
#crumbs {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  padding: 7px 9px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.03em;
  white-space: nowrap;
}
#crumbs button {
  padding: 3px 8px; border-radius: 5px; color: #4d5248;
}
#crumbs button:hover { background: var(--yellow-tint); color: var(--ink); }
#crumbs button:last-child { color: var(--ink); font-weight: 500; }
#crumbs .sep { color: #b0b4a8; }

/* detail panel */
#detail-panel {
  position: absolute; top: 64px; right: 22px; bottom: 22px;
  width: 348px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#detail-scroll { overflow-y: auto; overscroll-behavior: contain; }
#detail-panel .det-head { padding: 18px 20px 0; }
#detail-panel .det-kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: #6c7165;
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 34px 6px 0;
}
#detail-panel .det-kicker .rank { color: var(--yellow-text); }
#detail-panel h3 {
  font-family: var(--serif); font-weight: 300;
  font-size: 30px; line-height: 1.05; letter-spacing: -0.01em;
  margin: 0 0 2px;
}
#detail-panel .det-sub { font-size: 12.5px; color: #6c7165; margin: 0 0 4px; }
.det-big {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--serif); font-size: 44px; font-weight: 300;
  letter-spacing: -0.01em; line-height: 1;
  margin: 10px 0 2px;
}
.det-big .unit { font-family: var(--mono); font-size: 13px; color: #6c7165; }
.det-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: rgba(25, 29, 27, 0.1);
  border-block: 1px solid rgba(25, 29, 27, 0.1);
  margin: 14px 0 0;
}
.det-grid .cell { background: rgba(255,255,255,0.95); padding: 10px 20px 11px; }
.det-grid .cell .v { font-family: var(--mono); font-size: 16.5px; display: block; color: var(--ink); }
.det-grid .cell .k { font-size: 11px; color: #6c7165; line-height: 1.35; display: block; margin-top: 2px; }
.det-section { padding: 14px 20px 4px; }
.det-section:last-child { padding-bottom: 18px; }
.det-section h4 {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.13em;
  text-transform: uppercase; color: #6c7165; font-weight: 400;
  margin: 0 0 10px;
}
.mini-row {
  width: 100%;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.6fr) auto;
  align-items: center; gap: 9px;
  padding: 4px 0; text-align: left;
  font-size: 12.5px;
}
.mini-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.mini-row .bar { height: 7px; border-radius: 3.5px; background: rgba(25, 29, 27, 0.08); overflow: hidden; }
.mini-row .bar i { display: block; height: 100%; border-radius: 3.5px; background: var(--yellow-deep); }
.mini-row .vv { font-family: var(--mono); font-size: 11px; color: #4d5248; white-space: nowrap; }
button.mini-row:hover .nm { color: var(--yellow-text); }
button.mini-row:hover .bar i { background: var(--yellow-text); }

.show-all {
  margin-top: 9px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em;
  color: var(--yellow-text);
  border-bottom: 1px solid transparent;
}
.show-all:hover { border-bottom-color: var(--yellow-text); }
.state-table {
  width: 100%; border-collapse: collapse;
  font-size: 11.5px;
}
.state-table th {
  font-family: var(--mono); font-weight: 400; font-size: 9.5px;
  letter-spacing: 0.08em; text-transform: uppercase; color: #6c7165;
  text-align: right; padding: 2px 4px 6px;
  border-bottom: 1px solid rgba(25, 29, 27, 0.14);
}
.state-table th:first-child { text-align: left; padding-left: 0; }
.state-table td {
  font-family: var(--mono); font-size: 11px;
  text-align: right; padding: 4px 4px;
  border-bottom: 1px solid rgba(25, 29, 27, 0.06);
  color: #33372f;
  white-space: nowrap;
}
.state-table td:first-child {
  font-family: var(--sans); text-align: left; padding-left: 0;
  color: var(--ink); font-size: 12px;
  max-width: 110px; overflow: hidden; text-overflow: ellipsis;
}
.state-table tr[data-abbr] { cursor: pointer; }
.state-table tr[data-abbr]:hover td { background: var(--yellow-tint); }

.size-defs {
  margin: 7px 0 0; font-size: 10px; color: #8a8f83; line-height: 1.4;
}

.cs-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--sky); color: var(--graphite);
  border-radius: 999px; padding: 5px 12px 5px 9px;
  font-size: 12px; font-weight: 500;
  margin: 2px 0 8px;
}
.cs-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--graphite); }
.cs-none {
  display: inline-block; font-size: 12px; color: #6c7165;
  margin: 2px 0 8px;
}
.econ-compare { margin: 4px 0 10px; }
.econ-compare .ec-row { display: flex; align-items: center; gap: 9px; margin: 7px 0; }
.econ-compare .ec-lbl { font-size: 11.5px; color: #4d5248; width: 108px; flex: none; }
.econ-compare .ec-bar { flex: 1; height: 9px; border-radius: 4.5px; background: rgba(25,29,27,0.07); position: relative; }
.econ-compare .ec-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4.5px; }
.econ-compare .ec-val { font-family: var(--mono); font-size: 11px; width: 72px; text-align: right; flex: none; }
.verdict {
  border-radius: 8px; padding: 10px 13px; font-size: 12.5px; line-height: 1.45;
  background: var(--yellow-tint); color: var(--ink);
  margin-top: 10px;
}
.verdict.weak { background: var(--concrete-light); }

/* explorer footer bar */
#explorer-footbar {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em;
  color: #6c7165;
  white-space: nowrap;
}
#explorer-footbar button {
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(25, 29, 27, 0.16);
  color: #4d5248;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em;
  text-transform: uppercase;
}
#explorer-footbar button:hover { background: var(--graphite); color: var(--yellow); border-color: var(--graphite); }
#explorer-footbar .dot { color: #c2c5ba; }

/* methodology modal */
#method-modal {
  position: fixed; inset: 0; z-index: 120;
  display: none; align-items: center; justify-content: center;
  padding: 4vh 4vw;
}
#method-modal.on { display: flex; }
#method-modal .scrim { position: absolute; inset: 0; background: rgba(14, 17, 14, 0.6); backdrop-filter: blur(4px); }
#method-modal .sheet {
  position: relative; z-index: 1;
  width: min(760px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--paper); color: var(--ink);
  border-radius: 12px;
  padding: 40px 46px 38px;
  box-shadow: 0 50px 140px rgba(0, 0, 0, 0.5);
}
#method-modal h2 {
  font-family: var(--serif); font-weight: 300; font-size: 32px;
  letter-spacing: -0.015em; margin: 0 0 6px;
}
#method-modal h3 {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em;
  text-transform: uppercase; color: #6c7165; font-weight: 400;
  margin: 26px 0 8px;
}
#method-modal p, #method-modal li { font-size: 14px; line-height: 1.6; color: #33372f; }
#method-modal a { color: var(--yellow-text); }
#method-modal .close {
  position: sticky; top: 0; float: right; margin: -28px -30px 0 0;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--concrete-light);
  font-size: 17px; line-height: 1;
}
#method-modal .close:hover { background: var(--yellow); }

/* mobile interact toggle — only for narrow touch devices */
#touch-toggle {
  display: none !important;
  position: absolute; top: 108px; right: 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--graphite); color: var(--yellow);
  padding: 9px 14px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  #detail-panel { width: 318px; }
  #control-rail { width: 240px; }
}
@media (max-width: 820px) {
  #masthead { padding: 13px 16px 10px; }
  #masthead .logo img { height: 21px; }
  #scene-nav { display: none; }
  #skip-explore { display: none; }
  #era-toggle button { padding: 5px 8px; font-size: 9.5px; }
  .step { padding: 0 18px; min-height: 130vh; }
  .card { padding: 24px 22px 22px; max-width: 100%; }
  .step .card.right { margin: 0 auto; }

  #control-rail {
    top: auto; left: 10px; right: 10px; bottom: 10px;
    width: auto;
    flex-direction: column-reverse;
  }
  /* search sits at the bottom of the screen — open results upward */
  #search-results {
    top: auto; bottom: calc(100% + 6px);
    max-height: min(46vh, 340px);
  }
  #control-rail .panel-section { padding: 10px 12px; }
  #crumbs { top: 56px; left: 10px; transform: none; max-width: calc(100vw - 20px); overflow-x: auto; }
  #detail-panel {
    top: auto; left: 10px; right: 10px; bottom: 10px;
    width: auto; max-height: 46vh;
    transform: translateY(calc(100% + 12px));
    transition: transform 0.4s var(--ease-out);
  }
  body.sheet-open #detail-panel { transform: none; }
  body.sheet-open #control-rail { transform: translateY(calc(100% + 12px)); transition: transform 0.4s var(--ease-out); }
  #control-rail { transition: transform 0.4s var(--ease-out); }
  #explorer-footbar { display: none; }
  #detail-panel .det-close { display: grid; }
  #detail-panel .det-kicker { margin-right: 34px; }

  .card { padding: 22px 20px 20px; }
  .tier-head { font-size: 9.5px; letter-spacing: 0.06em; }
  .tier-states { font-size: 12px; }
  .tier-gw { font-size: 10.5px; }
  .tier-gw b { font-size: 13px; }

  #method-modal { padding: 3vh 3vw; }
  #method-modal .sheet { padding: 28px 22px 26px; max-height: 90vh; }
  #method-modal .close { margin: -14px -8px 0 0; }
}
@media (max-width: 820px) and (pointer: coarse) {
  #touch-toggle { display: block !important; }
}
@media (max-width: 400px) {
  #masthead { padding: 12px 10px 9px; gap: 8px; }
  #masthead .logo img { height: 17px; }
  #era-toggle button { padding: 4px 6px; font-size: 9px; letter-spacing: 0.03em; }
}

#detail-panel .det-close {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(25, 29, 27, 0.07);
  font-size: 15px;
  z-index: 2;
}
#detail-panel .det-close:hover { background: var(--yellow); }

/* focus visibility */
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
body.day :focus-visible { outline-color: var(--yellow-text); }
