:root {
  --ink: #1a1714;
  --ink-soft: #3d362e;
  --mute: #6b6256;
  --plaster: #efe4d2;
  --paper: #f6efe2;
  --card: #fffaf1;
  --ochre: #c8963e;
  --brick: #9a4034;
  --slate: #24303c;
  --copper: #b56a32;
  --verdigris: #2c6b5e;
  --sky: #8eb4c4;
  --grid: #2c5f8a;
  --line: #d8ccb6;
  --ok: #2c6b5e;
  --warn: #b56a32;
  --shadow: 0 18px 50px rgba(36, 28, 16, 0.12);
  --serif: "Besley", "Source Serif 4", Georgia, serif;
  --sans: "Atkinson Hyperlegible", "Source Sans 3", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #f3e2bf 0%, transparent 55%),
    var(--paper);
  font-family: var(--sans);
  line-height: 1.45;
}
img { max-width: 100%; display: block; }
button, .btn {
  font-family: inherit;
  cursor: pointer;
}
a { color: var(--verdigris); }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 12px 22px;
  background: rgba(246, 239, 226, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand span { color: var(--mute); font-size: 0.82rem; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.nav a, .nav button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.88rem;
}
.nav a:hover, .nav button:hover { background: #efe3cc; }
.nav a:focus-visible, .nav button:focus-visible, .chip:focus-visible, .pin:focus-visible {
  outline: 3px solid var(--ochre);
  outline-offset: 2px;
}

.wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hero {
  padding: 36px 0 10px;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brick);
  margin: 0 0 10px;
}
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  max-width: 18ch;
}
.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 0 22px;
}
.scene-switch {
  display: inline-flex;
  background: #efe3cc;
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 18px;
}
.scene-switch button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink-soft);
}
.scene-switch button[aria-pressed="true"] {
  background: var(--slate);
  color: #f6efe2;
}

.map-stage {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #2a241c;
}
.map-stage img.base,
.map-stage img.dusk {
  width: 100%;
  height: auto;
  transition: opacity 0.6s ease;
}
.map-stage img.dusk {
  position: absolute; inset: 0;
  opacity: 0;
  pointer-events: none;
}
.map-stage.evening img.dusk { opacity: 1; }
.map-stage.evening img.base { opacity: 0.15; }

.hotspots, .flows {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.flows { pointer-events: none; }
.flow {
  fill: none;
  stroke: var(--verdigris);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 7 8;
  opacity: 0;
  animation: none;
}
.flow.on {
  opacity: 0.95;
  animation: dash 1.6s linear infinite;
}
.flow.grid { stroke: var(--grid); }
.flow.batt { stroke: var(--copper); }
@keyframes dash { to { stroke-dashoffset: -30; } }

.pin {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  border: 0;
  background: #fffaf1;
  color: var(--ink);
  padding: 5px 9px 5px 6px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(26, 23, 20, 0.18);
  white-space: nowrap;
}
.pin i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--verdigris);
  display: inline-block;
}
.pin[data-role="produce"] i { background: var(--ochre); }
.pin[data-role="consume"] i { background: var(--verdigris); }
.pin[data-role="peak"] i { background: var(--copper); }
.pin[data-role="idle"] i { background: #b8ad99; }
.pin[hidden] { display: none !important; }
.pin[aria-pressed="true"] {
  background: var(--slate);
  color: #f6efe2;
}
.para { font-family: var(--sans); font-weight: 700; }

.legend-bar {
  display: flex; flex-wrap: wrap; gap: 14px;
  padding: 10px 4px 0;
  font-size: 0.82rem;
  color: var(--mute);
}
.legend-bar b { color: var(--ink-soft); font-weight: 700; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.sw.y { background: var(--ochre); }
.sw.g { background: var(--verdigris); }
.sw.o { background: var(--copper); }
.sw.b { background: var(--grid); }

.hours {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 16px 0 8px;
}
.hours button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: left;
}
.hours button small {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--mute);
}
.hours button[aria-pressed="true"] {
  border-color: var(--slate);
  background: #24303c;
  color: #f6efe2;
}
.hours button[aria-pressed="true"] small { color: #c9bfae; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 22px;
  margin: 18px 0 48px;
}
@media (max-width: 880px) {
  .grid-2, .hours { grid-template-columns: 1fr; }
  .pin { font-size: 0; padding: 7px; }
  .pin i { margin: 0; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.panel img { width: 100%; height: 190px; object-fit: cover; }
.panel .body { padding: 16px 18px 18px; }
.panel h2 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 6px;
  font-size: 1.55rem;
}
.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 8px;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  background: #efe3cc;
  color: var(--ink-soft);
}
.tag.y { background: #f3e0b0; }
.tag.g { background: #d5ebe4; }
.tag.o { background: #f3d8c2; }
.tag.b { background: #d5e4f2; }
.meter {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--verdigris);
  border: 1px dashed var(--verdigris);
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
}

.decision {
  background: var(--slate);
  color: #f3eadc;
  border-radius: 16px;
  padding: 18px;
}
.decision h3 {
  font-family: var(--serif);
  font-weight: 500;
  margin: 0 0 8px;
  font-size: 1.3rem;
}
.decision ol { margin: 0; padding-left: 1.15rem; }
.decision li { margin: 6px 0; }
.decision .now {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #3b4754;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #e2c48a;
}

section.block { padding: 10px 0 54px; }
section.block h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  margin: 0 0 8px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 16px;
}
@media (max-width: 880px) { .cards { grid-template-columns: 1fr; } }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.card .num {
  font-family: var(--serif);
  font-size: 1.8rem;
  color: var(--brick);
  line-height: 1;
  margin-bottom: 6px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 880px) { .split { grid-template-columns: 1fr; } }
.before { background: #f6e6de; border: 1px solid #e3b8a8; border-radius: 14px; padding: 16px; }
.after { background: #dceee7; border: 1px solid #9cc9ba; border-radius: 14px; padding: 16px; }
.before h3, .after h3 { margin: 0 0 8px; font-family: var(--serif); font-weight: 500; }

.cta {
  background: var(--slate);
  color: #f6efe2;
  border-radius: 18px;
  padding: 22px;
}
.cta h2 { color: #f6efe2; }
.cta ol { margin: 10px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ochre);
  color: #1a1714;
  border: 0;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 700;
}
.btn.ghost {
  background: transparent;
  color: #f6efe2;
  border: 1px solid #8a7b64;
}

.script {
  margin-top: 18px;
  border-top: 1px dashed #6b6256;
  padding-top: 12px;
  color: #d7cbb6;
  font-size: 0.92rem;
}
.note {
  font-size: 0.82rem;
  color: var(--mute);
  margin-top: 10px;
}

footer.site {
  border-top: 1px solid var(--line);
  padding: 22px 0 36px;
  color: var(--mute);
  font-size: 0.82rem;
}

.schema-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 22px;
  margin: 18px 0 48px;
}
@media (max-width: 980px) { .schema-grid { grid-template-columns: 1fr; } }

.site-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 8px 0;
  background: #fff;
}
.site-card .row1, .site-card .row2 {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.site-card .row1 { grid-template-columns: 1.4fr 1fr auto; }
.site-card .row2 { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
.site-card label { display: flex; flex-direction: column; gap: 3px; font-size: 0.68rem; color: var(--mute); letter-spacing: 0.04em; text-transform: uppercase; }
.site-card input, .site-card select {
  border: 1px solid var(--line);
  background: #fffaf1;
  border-radius: 8px;
  padding: 6px 7px;
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--ink);
}
.site-card input[type="checkbox"] { width: 16px; height: 16px; }
@media (max-width: 720px) {
  .site-card .row1, .site-card .row2 { grid-template-columns: 1fr 1fr; }
}
.flags { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; }
.flags label { display: flex; align-items: center; gap: 6px; font-size: 0.92rem; }

.verdict {
  border-radius: 16px;
  padding: 16px 18px;
  background: var(--slate);
  color: #f3eadc;
}
.verdict h2 { font-family: var(--serif); font-weight: 500; margin: 0 0 6px; color: #f6efe2; }
.bar {
  height: 10px; background: #efe3cc; border-radius: 999px; overflow: hidden; margin-top: 4px;
}
.bar > span { display: block; height: 100%; background: var(--verdigris); }
.alloc-row { margin: 8px 0; font-size: 0.9rem; }
.alloc-row em { float: right; font-style: normal; font-family: var(--mono); }
.warn { color: var(--copper); }
.msg-block { color: #c45c4a; }
.pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #e2c48a;
  color: #1a1714;
  padding: 2px 8px;
  border-radius: 999px;
}

@media print {
  .top, .nav, .actions, .hours, .scene-switch, .no-print { display: none !important; }
  body { background: #fff; }
  .map-stage { box-shadow: none; }
  section.block { break-inside: avoid; }
  .schema-grid { display: block; }
  .schema-form { display: none !important; }
}
