/* =====================================================================
   Energy state-page stylesheet
   Editorial minimal, system fonts, no JS dependencies.
   ===================================================================== */

:root {
  --bg:        #fafaf7;
  --paper:    #ffffff;
  --rule:     #e8e4dc;
  --ink:      #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-mute: #767270;
  --accent:   #0d4f5c;
  --accent-h: #0a3e48;
  --warm:     #5a3a2e;
  --gold:     #a07c2c;
  --bad:      #b04030;
  --good:     #2c7a5a;

  --serif: Charter, "Iowan Old Style", "Source Serif Pro", "Source Serif 4",
           Georgia, "Times New Roman", serif;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
           "Helvetica Neue", Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --measure: 38rem;
  --wide:    62rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--accent-h); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.1; }
h2 { font-size: 1.5rem;  line-height: 1.2; margin-top: 3.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.125rem; line-height: 1.3; margin-top: 2rem;   margin-bottom: 0.5rem; }

p { margin: 0 0 1rem; }
small { color: var(--ink-mute); font-size: 0.85rem; }

/* ---------------------- Layout ---------------------- */
.container {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.prose { max-width: var(--measure); }

/* Site nav: minimal */
.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 1rem 0;
  background: var(--bg);
}
.site-header .container {
  display: flex; align-items: baseline; justify-content: space-between;
}
.site-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.125rem; letter-spacing: -0.02em;
  color: var(--ink); text-decoration: none;
}
.site-nav a {
  color: var(--ink-soft); text-decoration: none;
  margin-left: 1.5rem; font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); }

/* Breadcrumbs */
.crumbs {
  font-size: 0.85rem; color: var(--ink-mute);
  margin: 1.5rem 0 0; padding: 0;
  list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.crumbs li::after { content: "›"; margin-left: 0.4rem; color: var(--rule); }
.crumbs li:last-child::after { content: ""; }
.crumbs a { color: var(--ink-mute); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------------------- Hero ---------------------- */
.hero { padding: 2rem 0 1rem; }
.hero .eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.75rem;
}
.hero h1 { margin-bottom: 1.25rem; }
.hero .lede {
  font-family: var(--serif);
  font-size: 1.25rem; line-height: 1.5;
  color: var(--ink-soft);
  max-width: var(--measure);
}
.hero .lede strong { color: var(--ink); font-weight: 600; }

/* ---------------------- Stat grid ---------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  margin: 2.5rem 0 0;
  background: var(--paper);
}
.stat {
  padding: 1.25rem 1.25rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat-label {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.5rem;
  display: block;
}
.stat-value {
  font-family: var(--serif);
  font-size: 1.75rem; line-height: 1.1;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  display: block;
}
.stat-sub {
  font-size: 0.8rem; color: var(--ink-mute);
  margin-top: 0.25rem;
  display: block;
}
.stat-sub.up   { color: var(--bad); }
.stat-sub.down { color: var(--good); }

/* ---------------------- Tables ---------------------- */
.tbl-wrap { overflow-x: auto; margin: 1.5rem 0 2rem; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
table.data th {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-mute); font-weight: 500;
  border-bottom: 1px solid var(--ink);
  background: var(--bg);
  position: sticky; top: 0;
}
table.data td.num { text-align: right; }
table.data tr:hover td { background: rgba(13, 79, 92, 0.04); }
table.data tr:last-child td { border-bottom: none; }

.fuel-pip {
  display: inline-block;
  width: 0.6rem; height: 0.6rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.pip-renewable { background: var(--accent); }
.pip-fossil    { background: var(--warm); }
.pip-nuclear   { background: var(--gold); }
.pip-other     { background: #999; }

.badge {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-family: var(--mono); letter-spacing: 0.05em; text-transform: uppercase;
  border-radius: 999px;
  background: var(--bg); border: 1px solid var(--rule);
  color: var(--ink-soft);
}
.badge.retired { background: #f5e6e3; color: var(--bad); border-color: #e6c8c2; }

/* ---------------------- Charts ---------------------- */
.chart-row {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  align-items: center;
  margin: 1.5rem 0 2.5rem;
}
@media (max-width: 640px) {
  .chart-row { grid-template-columns: 1fr; }
  .chart-row > svg { margin: 0 auto; display: block; }
}

.chart-donut-center {
  font-family: var(--serif); font-weight: 600;
  font-size: 1.6rem; fill: var(--ink);
  font-variant-numeric: tabular-nums;
}
.chart-donut-sub {
  font-family: var(--mono); font-size: 0.65rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  fill: var(--ink-mute);
}
.chart-spark { display: block; }
.chart-spark-label {
  font-family: var(--mono); font-size: 0.65rem;
  fill: var(--ink-mute);
  font-variant-numeric: tabular-nums;
}
.chart-bar { width: 100%; height: auto; }
.chart-bar-label {
  font-family: var(--mono); font-size: 0.7rem;
  font-weight: 600;
  alignment-baseline: middle;
}

.legend {
  display: flex; flex-wrap: wrap; gap: 0 1.5rem;
  margin: 0.75rem 0 0; padding: 0;
  list-style: none;
  font-size: 0.85rem; color: var(--ink-soft);
}

/* ---------------------- Section frames ---------------------- */
.section { padding: 1rem 0; }
.section h2 + p { color: var(--ink-soft); max-width: var(--measure); }
.section-meta {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 0.25rem;
}

/* FAQ */
.faq details {
  border-top: 1px solid var(--rule);
  padding: 1.1rem 0;
}
.faq details:last-of-type { border-bottom: 1px solid var(--rule); }
.faq summary {
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 0; top: -0.1rem;
  font-family: var(--sans); font-weight: 300;
  font-size: 1.5rem; color: var(--ink-mute);
  transition: transform 0.15s ease;
}
.faq details[open] summary::after { content: "−"; }
.faq details > p {
  margin-top: 0.75rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 2rem 0 3rem;
  font-size: 0.85rem;
  color: var(--ink-mute);
}
.site-footer p { margin: 0 0 0.4rem; }

/* Print */
@media print {
  .site-header, .site-footer, .site-nav { display: none; }
  body { background: white; }
  .stats { box-shadow: none; }
}

/* ---------------------- Live "Right now" section ---------------------- */
.live { padding: 1rem 0 0.5rem; }
.live-head {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: 0.5rem;
}
.live-head h2 { margin-top: 2.5rem; }

.live-pulse {
  font-family: var(--mono);
  font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin-top: 2.5rem;
}
.live-pulse .dot {
  width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(44, 122, 90, 0.55);
  animation: livePulse 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0    rgba(44, 122, 90, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(44, 122, 90, 0);    }
  100% { box-shadow: 0 0 0 0    rgba(44, 122, 90, 0);    }
}

.live-source {
  color: var(--ink-soft);
  max-width: var(--measure);
  margin-bottom: 1rem;
}

.live-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0;
  margin: 1rem 0 1.5rem;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--rule);
  background: rgba(13, 79, 92, 0.025);
}
.live-stat {
  padding: 1rem 1.1rem;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.live-stat-label {
  font-family: var(--mono);
  font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 0.4rem; display: block;
}
.live-stat-value {
  font-family: var(--serif);
  font-size: 1.45rem; line-height: 1.1; font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: block;
}
.live-stat-value.status-good     { color: var(--good); }
.live-stat-value.status-caution  { color: var(--gold); }
.live-stat-value.status-warn     { color: var(--warm); }
.live-stat-value.status-bad      { color: var(--bad); }
.live-stat-sub {
  font-size: 0.78rem; color: var(--ink-mute);
  margin-top: 0.2rem; display: block;
}

.live-spark { margin: 1rem 0 0.5rem; }
.live-spark h3 { margin-bottom: 0.5rem; }
.chart-spark-demand { display: block; max-width: 100%; }
