/* ianpocklington.energy — one stylesheet for every page.
   The control room: near-black surfaces, one green signal colour, mono for
   instrument readouts, Archivo for everything a person reads. */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  color-scheme: dark;
  --bg: #0c1014;
  --bg-2: #10161b;
  --panel: #131a21;
  --panel-2: #182029;
  --ink: #e9efe9;
  --ink-2: #b9c4bb;
  --ink-3: #8f9c92;
  --rule: #27313a;
  --rule-soft: #1b232b;
  --brand: #2fc26f;
  --brand-ink: #062113;
  --warm: #e0a33a;

  --font-sans: 'Archivo', system-ui, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, monospace;

  /* z-scale: content < sticky header < menu < tooltip */
  --z-header: 10;
  --z-menu: 20;
  --z-tooltip: 30;

  --pad: clamp(16px, 4.5vw, 56px);
  --wrap: 1180px;
  --measure: 68ch;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font-sans);
  font-variation-settings: 'wdth' 96;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 1.0625rem;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--brand); color: var(--brand-ink); }

img, svg { max-width: 100%; display: block; }
img { height: auto; }
a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { text-wrap: balance; line-height: 1.08; letter-spacing: -0.02em; font-weight: 750; }
p, li { text-wrap: pretty; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ══════════════ HEADER ══════════════ */
.skip-link { position: absolute; left: -9999px; top: 10px; z-index: var(--z-menu); background: var(--brand); color: var(--brand-ink); padding: 8px 14px; border-radius: 6px; font-weight: 600; }
.skip-link:focus { left: 12px; }
.site-header {
  position: sticky; top: 0; z-index: var(--z-header);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 60px; }
.plate {
  display: flex; align-items: center; gap: 11px; text-decoration: none;
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-2); white-space: nowrap;
}
.plate:hover { color: var(--ink); }
.plate strong { color: var(--ink); font-weight: 600; }
.plate .suffix { color: var(--brand); }

.nav { display: flex; align-items: stretch; gap: 2px; align-self: stretch; }
.nav a {
  display: flex; align-items: center; text-decoration: none;
  font-size: 0.9rem; font-weight: 550; font-variation-settings: 'wdth' 104;
  color: var(--ink-3); padding: 0 clamp(8px, 1.2vw, 14px);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.2s, border-color 0.2s;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }

.menu-toggle {
  display: none; appearance: none; background: none; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 8px; color: var(--ink-2);
  font: 500 0.8rem var(--font-mono); padding: 8px 12px;
}
.menu-toggle:hover { border-color: var(--brand); color: var(--ink); }

@media (max-width: 920px) {
  .menu-toggle { display: inline-flex; gap: 8px; align-items: center; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: var(--z-menu);
    flex-direction: column; gap: 0; padding: 6px var(--pad) 16px;
    background: var(--bg-2); border-bottom: 1px solid var(--rule);
  }
  .nav.open { display: flex; }
  .nav a { padding: 13px 0; border-bottom: 1px solid var(--rule-soft); margin: 0; font-size: 1rem; }
  .nav a[aria-current="page"] { color: var(--brand); border-bottom-color: var(--rule-soft); }
}

/* ══════════════ PAGE HERO ══════════════ */
.page-hero { padding-top: clamp(48px, 9vh, 104px); padding-bottom: clamp(28px, 5vh, 56px); }
.kicker {
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--brand);
  display: inline-flex; gap: 10px; align-items: center;
}
.kicker::before { content: ""; width: 18px; height: 1px; background: var(--brand); }
.page-hero h1 {
  margin-top: 16px;
  font-size: clamp(2.3rem, 5.4vw, 4.3rem); font-weight: 800;
  font-variation-settings: 'wdth' 116; line-height: 1.02; max-width: 17ch;
}
.page-hero h1 em { font-style: normal; color: var(--brand); }
.lede { margin-top: 24px; max-width: 60ch; font-size: clamp(1.08rem, 1.5vw, 1.2rem); color: var(--ink-2); line-height: 1.65; }
.lede strong { color: var(--ink); font-weight: 600; }
.byline { margin-top: 18px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); }

/* staged hero entrance — content is visible by default; JS opts in */
.js .stage { animation: rise 0.7s var(--ease-out) both; }
.js .stage-2 { animation-delay: 0.08s; } .js .stage-3 { animation-delay: 0.16s; } .js .stage-4 { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ══════════════ HOME ══════════════ */
.home-hero { position: relative; padding-top: clamp(40px, 7vh, 88px); overflow: hidden; }
.home-grid { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 56px); align-items: center; }
.home-hero h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.6rem); font-weight: 800; font-variation-settings: 'wdth' 118;
  line-height: 1.0; max-width: 13ch;
}
.home-hero h1 em { font-style: normal; color: var(--brand); }
.grid-drawing { position: relative; width: min(100%, 460px); justify-self: end; }
.grid-drawing svg { width: 100%; height: auto; aspect-ratio: 1000 / 1594; max-height: 76vh; overflow: hidden; }
.grid-drawing path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.grid-drawing .tx400 { stroke: var(--brand); stroke-width: 2.6; opacity: 0.95; }
.grid-drawing .tx275 { stroke: #7fd9a4; stroke-width: 1.7; opacity: 0.5; }
.grid-drawing .ic { stroke: var(--warm); stroke-width: 2.4; opacity: 0.9; }
.grid-drawing .station { fill: var(--warm); }
.js .grid-drawing path { stroke-dasharray: var(--len) var(--len); stroke-dashoffset: var(--len); animation: draw 2.4s var(--ease-out) forwards; animation-delay: var(--delay, 0s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.grid-legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-3);
}
.grid-legend span { display: flex; align-items: center; gap: 8px; }
.grid-legend i { width: 18px; height: 2px; display: inline-block; }

.models { margin-top: clamp(56px, 9vh, 104px); border-top: 1px solid var(--ink); }
.model-row {
  display: grid; grid-template-columns: minmax(180px, 250px) minmax(0, 1fr) minmax(160px, 230px);
  gap: 12px 40px; align-items: baseline; padding: clamp(24px, 4vh, 36px) 0;
  border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit;
  transition: background-color 0.25s;
}
.model-row h2 { font-size: clamp(1.4rem, 2.6vw, 1.95rem); font-variation-settings: 'wdth' 112; }
.model-row p { color: var(--ink-2); max-width: 60ch; }
.model-row p b { color: var(--ink); font-weight: 600; }
.model-row .go { font-family: var(--font-mono); font-size: 0.8rem; color: var(--brand); text-align: right; transition: transform 0.25s var(--ease-out); }
.model-row:hover { color: inherit; }
.model-row:hover h2 { color: var(--brand); }
.model-row:hover .go { transform: translateX(4px); }

/* ══════════════ SECTIONS + PROSE ══════════════ */
section.block { padding-top: clamp(56px, 9vh, 104px); }
.block-head { max-width: var(--measure); }
.block-head h2 { font-size: clamp(1.65rem, 3.2vw, 2.45rem); font-variation-settings: 'wdth' 112; }
.block-head .sub { margin-top: 10px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); }
.prose { max-width: var(--measure); }
.prose > * + * { margin-top: 1.05em; }
.prose p, .prose li { color: var(--ink-2); }
.prose strong, .prose b { color: var(--ink); font-weight: 600; }
.prose h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-variation-settings: 'wdth' 112; margin-top: 2em; color: var(--ink); }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; color: var(--ink); }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li + li { margin-top: 0.45em; }
.prose a { color: var(--ink); }
.prose a:hover { color: var(--brand); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; color: var(--ink); background: var(--panel); padding: 1px 6px; border-radius: 4px; }
.block-head + .prose, .block-head + .fig, .prose + .fig, .fig + .prose, .fig + .fig { margin-top: clamp(26px, 4vh, 40px); }

.two-col { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 64px); align-items: start; margin-top: clamp(26px, 4vh, 40px); }
.two-col > .prose { max-width: none; }

.note {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 18px 22px; font-size: 0.95rem; color: var(--ink-2);
}
.note b { color: var(--ink); }
.note .note-title { font-family: var(--font-mono); font-size: 0.76rem; color: var(--warm); margin-bottom: 6px; display: block; }

/* ══════════════ READOUT (instrument strip) ══════════════ */
.readout {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule);
  margin-top: clamp(28px, 4vh, 40px);
}
.readout > div { padding: 14px 18px 16px 0; }
.readout > div + div { border-left: 1px solid var(--rule); padding-left: 18px; }
.readout dt { font-size: 0.8rem; color: var(--ink-3); line-height: 1.35; }
.readout dd { font-family: var(--font-mono); font-weight: 600; font-size: 1.2rem; color: var(--ink); margin-top: 4px; font-variant-numeric: tabular-nums; }
.readout dd small { font-size: 0.72rem; color: var(--ink-3); font-weight: 400; margin-left: 3px; }
/* fixed two-column readout */
.readout.readout-2 { grid-template-columns: 1fr 1fr; }
.readout.readout-2 > div:nth-child(odd) { border-left: none; padding-left: 0; }
.readout.readout-2 > div:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
@media (max-width: 640px) {
  .readout { grid-template-columns: 1fr 1fr; }
  .readout > div:nth-child(odd) { border-left: none; padding-left: 0; }
  .readout > div:nth-child(even) { border-left: 1px solid var(--rule); padding-left: 16px; }
  .readout > div:nth-child(n+3) { border-top: 1px solid var(--rule-soft); }
}

/* ══════════════ SCENARIO BAR ══════════════ */
.scenario-bar {
  position: sticky; top: 61px; z-index: calc(var(--z-header) - 1);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.scenario-bar .wrap { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; min-height: 54px; padding-top: 8px; padding-bottom: 8px; }
.scenario-bar .lbl { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.scenario-bar .hint { font-size: 0.82rem; color: var(--ink-3); }

/* segmented control */
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg button {
  appearance: none; border: none; background: none; cursor: pointer;
  font: 500 0.8rem var(--font-mono); padding: 8px 14px; color: var(--ink-2);
  transition: background-color 0.15s, color 0.15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.seg button + button { border-left: 1px solid var(--rule); }

/* ══════════════ FIGURES ══════════════ */
.fig { border: 1px solid var(--rule); border-radius: 12px; background: var(--bg-2); padding: clamp(14px, 2.4vw, 26px); }
.fig-head { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.fig-title { font-weight: 650; font-size: 1.06rem; line-height: 1.35; }
.fig-sub { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }
.fig-headline { font-size: 0.98rem; color: var(--ink-2); margin: 2px 0 10px; }
.fig-headline b { color: var(--ink); }
.chart { width: 100%; min-height: 240px; position: relative; }
.chart.loading::after {
  content: "Drawing from model output…"; position: absolute; inset: 0; display: grid; place-items: center;
  font: 0.78rem var(--font-mono); color: var(--ink-3);
}
.legend { display: flex; gap: 6px 16px; flex-wrap: wrap; align-items: center; margin: 4px 0 8px; }
.legend .item { display: inline-flex; gap: 7px; align-items: center; font-size: 0.8rem; color: var(--ink-2); }
.legend .key { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend .key.line { height: 0; width: 16px; border-top: 2px solid; border-radius: 0; background: none !important; }
.legend .key.dash { height: 0; width: 16px; border-top: 2px dashed; border-radius: 0; background: none !important; }
.fig-cap { margin-top: 12px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); line-height: 1.6; max-width: 92ch; }
.fig-cap a { color: var(--ink-2); }

details.table-view { margin-top: 10px; }
details.table-view summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); width: fit-content; }
details.table-view summary:hover { color: var(--brand); }
.table-scroll { overflow: auto; max-height: 340px; margin-top: 10px; border: 1px solid var(--rule); border-radius: 8px; }
.table-scroll table { border-collapse: collapse; font-family: var(--font-mono); font-size: 0.72rem; width: 100%; }
.table-scroll th, .table-scroll td { padding: 5px 12px; text-align: right; border-bottom: 1px solid var(--rule-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-scroll th { position: sticky; top: 0; background: var(--panel); color: var(--ink-2); font-weight: 600; }
.table-scroll td:first-child, .table-scroll th:first-child { text-align: left; }

/* Plotly hover label in the house style */
.js-plotly-plot .hoverlayer .hovertext path { stroke: var(--rule) !important; }

/* photo plates */
.plate-img { margin-top: clamp(26px, 4vh, 40px); }
.plate-img img { width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 12px; background: var(--panel); }
.plate-img figcaption { margin-top: 10px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-3); line-height: 1.6; }
.plate-duo { display: grid; grid-template-columns: 4fr 5fr; gap: clamp(16px, 3vw, 32px); align-items: start; }

/* the map */
.map-wrap { position: relative; height: clamp(440px, 72vh, 720px); border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); background: #0e1216; }
.map-wrap .maplibregl-map { width: 100%; height: 100%; }
.map-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.map-tools label {
  display: inline-flex; gap: 8px; align-items: center; cursor: pointer;
  font-size: 0.82rem; color: var(--ink-2); padding: 6px 12px 6px 10px;
  border: 1px solid var(--rule); border-radius: 999px; user-select: none;
}
.map-tools label:has(input:checked) { border-color: color-mix(in srgb, var(--ink) 35%, var(--rule)); color: var(--ink); }
.map-tools input { accent-color: var(--brand); }
.map-tools i { width: 16px; height: 3px; display: inline-block; }
.maplibregl-popup-content { background: var(--panel) !important; color: var(--ink) !important; border: 1px solid var(--rule); border-radius: 8px !important; font: 0.78rem/1.55 var(--font-mono); padding: 10px 14px !important; }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-close-button { color: var(--ink-3); font-size: 18px; padding: 0 6px; }
.maplibregl-ctrl-attrib { background: rgba(12,16,20,.75) !important; color: var(--ink-3) !important; font-size: 10px !important; }
.maplibregl-ctrl-attrib a { color: var(--ink-2) !important; }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--rule); }
.maplibregl-ctrl-group button + button { border-top-color: var(--rule) !important; }
.maplibregl-ctrl-icon { filter: invert(0.85); }

/* RC network diagram */
.rc-diagram { width: 100%; height: auto; }
.rc-diagram text { font-family: var(--font-mono); font-size: 12.5px; fill: var(--ink-2); }
.rc-diagram .node-label { fill: var(--ink); font-weight: 600; font-size: 13px; }
.rc-diagram .wire { stroke: var(--ink-3); stroke-width: 1.5; fill: none; }
.rc-diagram .res { stroke: var(--ink); stroke-width: 1.5; fill: none; stroke-linejoin: round; }
.rc-diagram .cap { stroke: var(--ink); stroke-width: 2; }
.rc-diagram .node { fill: var(--bg-2); stroke: var(--brand); stroke-width: 2; }
.rc-diagram .gain { stroke: var(--warm); stroke-width: 1.5; fill: none; }
.rc-diagram .gain-label { fill: var(--warm); }
.rc-diagram .ground { stroke: var(--ink-3); stroke-width: 1.5; }

/* spec table */
.spec { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin-top: 4px; }
.spec th, .spec td { padding: 9px 0; border-bottom: 1px solid var(--rule); text-align: left; }
.spec th { font-weight: 500; color: var(--ink-3); font-size: 0.82rem; }
.spec td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.spec td.was { color: var(--ink-3); }
.spec tr > :last-child { text-align: right; }

/* sources list */
.sources { list-style: none; border-top: 1px solid var(--rule); margin-top: 16px; }
.sources li { padding: 11px 0; border-bottom: 1px solid var(--rule-soft); display: grid; grid-template-columns: 44px 1fr; gap: 12px; font-size: 0.9rem; color: var(--ink-2); }
.sources .sid { font-family: var(--font-mono); font-size: 0.78rem; color: var(--brand); padding-top: 2px; }
.sources a { color: var(--ink); }

/* ══════════════ RESEARCH NOTES ══════════════ */
.notes-list { list-style: none; border-top: 1px solid var(--ink); margin-top: clamp(24px, 4vh, 36px); }
.notes-list li { border-bottom: 1px solid var(--rule); }
.notes-list a { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 6px 28px; padding: 22px 0; text-decoration: none; align-items: baseline; }
.notes-list time, .notes-list .topic { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.notes-list h3 { font-size: 1.18rem; font-weight: 650; line-height: 1.3; }
.notes-list p { grid-column: 2; color: var(--ink-2); font-size: 0.95rem; max-width: 64ch; }
.notes-list a:hover h3 { color: var(--brand); }
.notes-list .topic { grid-column: 3; grid-row: 1; text-align: right; }

.article-head { padding-top: clamp(44px, 8vh, 92px); }
.article-head h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; font-variation-settings: 'wdth' 112; line-height: 1.06; max-width: 22ch; margin-top: 14px; }
.article-head .standfirst { margin-top: 20px; max-width: 62ch; font-size: clamp(1.08rem, 1.5vw, 1.2rem); color: var(--ink-2); }
.article-meta { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 6px 20px; font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.back { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); text-decoration: none; }
.back:hover { color: var(--brand); }
.article-body { margin-top: clamp(32px, 5vh, 52px); }
.article-body .fig { margin: clamp(26px, 4vh, 40px) 0; max-width: 860px; }
.draft-flag {
  display: inline-block; margin-top: 18px; font-family: var(--font-mono); font-size: 0.72rem;
  color: var(--warm); border: 1px solid color-mix(in srgb, var(--warm) 45%, transparent); border-radius: 999px; padding: 3px 11px;
}

/* ══════════════ ABOUT ══════════════ */
.about-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(260px, 4fr); gap: clamp(28px, 5vw, 72px); align-items: start; margin-top: clamp(28px, 4vh, 44px); }
.placeholder {
  border: 1px dashed color-mix(in srgb, var(--warm) 55%, var(--rule)); border-radius: 10px;
  padding: 18px 22px; color: var(--ink-3); font-size: 0.95rem;
}
.placeholder b { color: var(--warm); font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500; display: block; margin-bottom: 4px; }
.links { list-style: none; border-top: 1px solid var(--rule); }
.links li { border-bottom: 1px solid var(--rule); }
.links a { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; text-decoration: none; font-weight: 550; }
.links a span { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); font-weight: 400; }
.links a:hover span { color: var(--brand); }

/* ══════════════ SIGNUP + FOOTER ══════════════ */
.signup { margin-top: clamp(72px, 12vh, 136px); border-top: 1px solid var(--ink); }
.signup-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(24px, 5vw, 64px); padding-top: clamp(36px, 6vh, 56px); align-items: start; }
.signup h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); font-variation-settings: 'wdth' 112; max-width: 16ch; }
.signup p { margin-top: 12px; color: var(--ink-2); max-width: 44ch; font-size: 0.98rem; }
.tally-wrap { min-height: 150px; }
.tally-wrap iframe { width: 100%; border: 0; color-scheme: normal; }
.tally-fallback { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-3); margin-top: 8px; }
.tally-fallback a { color: var(--brand); }

.site-footer { margin-top: clamp(48px, 8vh, 80px); border-top: 1px solid var(--rule); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 28px; padding-top: 22px; padding-bottom: 30px; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-3); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-links a { text-decoration: none; color: var(--ink-2); }
.foot-links a:hover { color: var(--brand); }
[data-linkedin][hidden] { display: none !important; }

/* scroll reveal — visible by default; JS opts elements in */
.js .reveal:not(.seen) { opacity: 0; transform: translateY(18px); }
.js .reveal.seen { opacity: 1; transform: none; transition: opacity 0.7s ease, transform 0.7s var(--ease-out); }

/* ══════════════ RESPONSIVE ══════════════ */
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .grid-drawing { width: min(100%, 380px); justify-self: start; }
  .model-row .go { text-align: left; }
  .model-row { grid-template-columns: 1fr; gap: 8px; }
  .two-col, .about-grid, .signup-grid, .plate-duo { grid-template-columns: 1fr; }
  .notes-list a { grid-template-columns: 1fr; gap: 4px; }
  .notes-list p, .notes-list .topic { grid-column: 1; grid-row: auto; text-align: left; }
}
@media (max-width: 560px) {
  body { font-size: 1rem; }
  .plate .full { display: none; }
  .scenario-bar { top: 61px; }
  .seg button { padding: 8px 11px; font-size: 0.76rem; }
  .sources li { grid-template-columns: 34px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; transition-duration: 0.001s !important; }
  .js .reveal:not(.seen) { opacity: 1; transform: none; }
  .js .grid-drawing path { stroke-dashoffset: 0; animation: none; }
}
@media (forced-colors: active) {
  .plate .mark { forced-color-adjust: none; }
}

/* ══════════════ MODEL SCREENSHOTS ══════════════ */
.fig.shot { padding: clamp(10px, 1.6vw, 18px); }
.shot + .shot, .prose + .shot { margin-top: clamp(26px, 4vh, 40px); }
.shot-link { display: block; border-radius: 8px; overflow: hidden; cursor: zoom-in; }
.shot-link img { width: 100%; height: auto; display: block; background: var(--panel); }
.shot .fig-head { margin-bottom: 12px; align-items: center; }
.shot .fig-cap { margin-top: 10px; }
.two-col > .fig.shot { margin-top: 0; }

/* ══════════════ LIVE NATIONAL ENERGY MODEL ══════════════
   The screen itself (live/national_ui.js + .css) is the full model's, copied in
   unchanged; these rules only seat it in the page instead of a full-screen overlay. */
.live-frame { margin-top: clamp(24px, 4vh, 36px); }
.live-map { position: relative; height: clamp(420px, 66vh, 680px); border: 1px solid var(--rule);
  border-radius: 12px 12px 0 0; overflow: hidden; background: #0b0f13; }
.live-map #map { position: absolute; inset: 0; }
.live-loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5;
  background: color-mix(in srgb, #0b0f13 78%, transparent); }
.live-loading[hidden] { display: none; }
.live-loading-card { width: min(440px, 86%); background: var(--panel); border: 1px solid var(--rule);
  border-radius: 12px; padding: 20px 22px; text-align: left; }
.live-loading-card p { margin: 0; font-size: 0.95rem; color: var(--ink); }
.live-loading-track { height: 6px; border-radius: 3px; background: var(--rule-soft); margin: 14px 0 12px; overflow: hidden; }
.live-loading-track i { display: block; height: 100%; width: 6%; background: var(--brand); border-radius: 3px;
  transition: width 0.6s var(--ease-out); }
.live-loading.error .live-loading-track i { background: #e66767; }
.live-loading-note { font-family: var(--font-mono); font-size: 0.72rem !important; color: var(--ink-3) !important; }
.live-start { margin: 0 0 12px; appearance: none; border: 0; border-radius: 8px; background: var(--brand);
  color: var(--brand-ink); font: 600 0.92rem var(--font-sans); padding: 10px 18px; cursor: pointer; }
.live-meta { min-height: 1.2em; }

/* The screen, seated in the page (the full model shows it as an overlay). */
#national-screen.site-embed {
  position: relative; inset: auto; z-index: auto; display: flex; flex-direction: column;
  height: min(980px, 94vh); border-radius: 0 0 12px 12px; border-top: 0; box-shadow: none;
  font-family: system-ui, "Segoe UI", sans-serif; font-size: 13px; line-height: 1.35; color: #e9eef3;
}
#national-screen.site-embed #nat-head { padding-right: 16px; }
#national-screen.site-embed #nat-close,
#national-screen.site-embed #nat-export,
#national-screen.site-embed #nat-controls label:has(#nat-follow) { display: none !important; }
#national-screen.site-embed #nat-actions { grid-template-columns: repeat(5, auto); }
#national-screen.site-embed button { font-family: inherit; }
#national-screen.site-embed .btn { padding: 9px 14px; border: none; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; }
#national-screen.site-embed .btn-ghost { background: #2c333c; color: #cde; }
#national-screen.site-embed .btn-ghost:hover { background: #3a434e; }
#national-screen.site-embed .gear-toggle { cursor: pointer; color: #9cf; font-size: 13px; user-select: none; margin-top: 10px; display: inline-block; }
#national-screen.site-embed input[type=range] { width: 100%; accent-color: var(--brand); }
#national-screen.site-embed input[type=number],
#national-screen.site-embed select { background: #222932; color: #dce5ee; border: 1px solid #3a434e; border-radius: 6px; padding: 4px 6px; font: inherit; }
#national-screen.site-embed a { color: #9cf; }
.nat-analysis-dialog { font-family: system-ui, "Segoe UI", sans-serif; font-size: 13px; color: #e9eef3; background: #181d22; border: 1px solid #313a45; border-radius: 12px; }
.nat-analysis-dialog .nat-report-table { font-size: 12.5px; }
@media (max-width: 900px) {
  #national-screen.site-embed { height: auto; }
  #national-screen.site-embed #nat-body { flex-direction: column; }
  #national-screen.site-embed #nat-side { width: auto; max-height: 440px; border-right: 0; border-bottom: 1px solid #313a45; }
  #national-screen.site-embed #nat-chart { min-height: 760px; }
  #national-screen.site-embed #nat-actions { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════ HOME: open-the-model actions ══════════════ */
.hero-actions { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: center; }
.cta, .cta-ghost {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 650; font-size: 1rem; padding: 14px 24px; border-radius: 10px;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.25s var(--ease-out);
}
.cta { background: var(--brand); color: var(--brand-ink); }
.cta:hover { color: var(--brand-ink); background: #45d483; transform: translateY(-1px); }
.cta span { transition: transform 0.25s var(--ease-out); }
.cta:hover span { transform: translateX(3px); }
.cta-ghost { border: 1px solid var(--rule); color: var(--ink-2); }
.cta-ghost:hover { border-color: var(--brand); color: var(--ink); }
.home-hero .byline { margin-top: 16px; }
