/* ============================================================
   UK Grid Live — Styles
   Design tokens follow spec section 5.
   ============================================================ */

:root {
  /* base palette */
  --bg:             #0B0D10;
  --bg-card:        #15181D;
  --bg-elevated:    #1E222A;
  --text-primary:   #F5F7FA;
  --text-secondary: #A8B0BD;
  --text-muted:     #6B7280;
  --border:         #2A2F38;
  --accent:         #5EEAD4;

  /* band colours */
  --band-very-low:   #22C55E;
  --band-low:        #84CC16;
  --band-moderate:   #EAB308;
  --band-high:       #F97316;
  --band-very-high:  #EF4444;

  /* fuel colours */
  --fuel-wind:    #60A5FA;
  --fuel-solar:   #FBBF24;
  --fuel-hydro:   #06B6D4;
  --fuel-nuclear: #A78BFA;
  --fuel-biomass: #84CC16;
  --fuel-gas:     #F97316;
  --fuel-coal:    #4B5563;
  --fuel-imports: #94A3B8;
  --fuel-other:   #6B7280;

  /* spacing */
  --section-gap:   80px;
  --card-padding:  32px;
  --card-radius:   16px;
  --content-max:   1100px;

  /* shadows */
  --shadow-card:  0 4px 16px rgba(0, 0, 0, 0.2);
}

/* -- reset & base --------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

button { font: inherit; cursor: pointer; }

/* Ensure the [hidden] attribute always wins over display rules. */
[hidden] { display: none !important; }

h1, h2, h3, p, ul { margin: 0; }

ul { list-style: none; padding: 0; }

sub { font-size: 0.65em; }

/* -- sticky top nav ------------------------------------------- */

.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(21, 24, 29, 0.85); /* --bg-card with alpha */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.topnav__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  transition: padding 180ms ease;
}
.topnav--shrunk .topnav__inner {
  padding-top: 9px;
  padding-bottom: 9px;
}
.topnav__brand {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.topnav__brand:hover { text-decoration: none; color: var(--accent); }
.topnav__links {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}
.topnav__links::-webkit-scrollbar { display: none; } /* WebKit */
.topnav__link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  transition: color 120ms ease, background 120ms ease;
}
.topnav__link:hover,
.topnav__link.is-active {
  color: var(--accent);
  background: rgba(94, 234, 212, 0.08);
  text-decoration: none;
}

/* Offset so the fixed nav doesn't cover content or jump targets */
body { padding-top: 60px; }
[id] { scroll-margin-top: 76px; }

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- page layout ---------------------------------------------- */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

.section { position: relative; }

.section__title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: var(--card-padding);
  box-shadow: var(--shadow-card);
}

/* -- hero ----------------------------------------------------- */

.section--hero {
  text-align: center;
  padding: 24px 0 16px;
}

.brand {
  text-align: left;
  margin-bottom: 48px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.brand__titles {
  min-width: 0;
}
.brand__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}
.brand__status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--text-muted);
  white-space: nowrap;
}

.hero__body { min-height: 200px; padding-bottom: 8px; }

.hero__number-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.hero__number {
  font-size: 96px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero__unit {
  font-size: 18px;
  color: var(--text-muted);
  font-weight: 400;
}

.hero__interpretation {
  margin-top: 16px;
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 540px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.hero__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.live-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%   { opacity: 0.4; box-shadow: 0 0 0 0 rgba(94, 234, 212, 0.6); }
  50%  { opacity: 1;   box-shadow: 0 0 0 6px rgba(94, 234, 212, 0); }
  100% { opacity: 0.4; box-shadow: 0 0 0 0 rgba(94, 234, 212, 0); }
}

.hero__error,
.section__error {
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px;
  text-align: center;
}

/* -- band pill ------------------------------------------------ */

.band-pill {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: var(--band-moderate);
  color: var(--bg);
}
.band-pill[data-band="very-low"]  { background: var(--band-very-low);  color: var(--bg); }
.band-pill[data-band="low"]       { background: var(--band-low);       color: var(--bg); }
.band-pill[data-band="moderate"]  { background: var(--band-moderate);  color: var(--bg); }
.band-pill[data-band="high"]      { background: var(--band-high);      color: var(--bg); }
.band-pill[data-band="very-high"] { background: var(--band-very-high); color: var(--text-primary); }

/* -- mix section ---------------------------------------------- */

.mix__headline {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  min-height: 1.5em;
}
.mix__headline strong { color: var(--text-primary); font-weight: 600; }

.mix__layout { min-height: 260px; }

.mix__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.mix__chart-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.mix__chart-wrap canvas {
  max-width: 260px;
  max-height: 260px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.legend__item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.legend__name { color: var(--text-secondary); }
.legend__perc { color: var(--text-primary); font-variant-numeric: tabular-nums; font-weight: 500; }

.mix__caption {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-muted);
  min-height: 1.5em;
}

/* -- story section -------------------------------------------- */

.story__chart-wrap {
  position: relative;
  width: 100%;
  height: 320px;
}
.story__content,
.story__skeleton {
  position: absolute;
  inset: 0;
}
.story__content canvas {
  width: 100% !important;
  height: 100% !important;
}

/* -- greenest window callout ---------------------------------- */

.story__attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.story__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.story__legend-swatch {
  display: inline-block;
  width: 12px;
  height: 3px;
  border-radius: 2px;
}

.greenest-callout {
  margin-top: 32px;
  background: linear-gradient(
    135deg,
    rgba(94, 234, 212, 0.08) 0%,
    rgba(94, 234, 212, 0.02) 100%
  );
  border: 1px solid rgba(94, 234, 212, 0.25);
  border-radius: 12px;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
}
.greenest-callout::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.greenest-callout__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.greenest-callout__time {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 8px;
}
.greenest-callout__justification {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* -- projects & activities ------------------------------------ */

.project-strip {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
/* Slim scrollbar styling */
.project-strip::-webkit-scrollbar {
  height: 8px;
}
.project-strip::-webkit-scrollbar-track {
  background: var(--bg-card);
  border-radius: 4px;
}
.project-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.project-strip::-webkit-scrollbar-thumb:hover {
  background: var(--bg-elevated);
}

.project-card {
  flex: 0 0 320px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
}

.project-card__tags {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.project-card__tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
}
.project-card__tag--age {
  background: rgba(94, 234, 212, 0.12);
  color: var(--accent);
}
.project-card__tag--type {
  background: rgba(94, 234, 212, 0.12);
  color: var(--accent);
}

.project-card__title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.project-card__meta {
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-card__meta-row {
  display: flex;
  gap: 8px;
  font-size: 13px;
}
.project-card__meta-row dt {
  color: var(--text-muted);
  min-width: 72px;
}
.project-card__meta-row dd {
  color: var(--text-secondary);
  margin: 0;
}

.project-card__desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 24px;
  flex-grow: 1;
}

.project-card__btn {
  display: inline-block;
  align-self: flex-start;
  background: var(--accent);
  color: var(--bg);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: filter 120ms ease;
}
.project-card__btn:hover {
  filter: brightness(1.05);
  text-decoration: none;
}

/* -- footer --------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border);
  padding-top: 32px;
  padding-bottom: 16px;
}
.footer__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 32px;
  font-size: 13px;
  color: var(--text-muted);
}
.footer__attrib { text-align: right; }
.footer__meta   { grid-column: 1 / -1; }
.footer__link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  text-decoration: none;
}
.footer__link:hover { text-decoration: underline; }

/* -- skeleton loaders ----------------------------------------- */

.skeleton {
  background: var(--bg-elevated);
  background-image: linear-gradient(
    90deg,
    var(--bg-elevated) 0%,
    var(--border) 50%,
    var(--bg-elevated) 100%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton--hero-number { width: 280px; height: 96px; margin: 0 auto 16px; }
.skeleton--hero-pill   { width: 120px; height: 28px; margin: 0 auto 16px; border-radius: 999px; }
.skeleton--hero-line   { width: 360px; height: 20px; margin: 16px auto 0; }
.skeleton--headline    { display: inline-block; width: 320px; height: 22px; }
.skeleton--donut       { width: 240px; height: 240px; border-radius: 50%; }
.skeleton--legend      { width: 240px; height: 240px; }
.skeleton--chart       { width: 100%; height: 100%; }

.mix__skeleton {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
  justify-items: center;
}

/* -- chart fade-in ------------------------------------------- */

.fade-in { animation: fadeIn 400ms ease-out both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- fatal fallback ------------------------------------------- */

.fatal-fallback {
  position: fixed;
  inset: 0;
  background: rgba(11, 13, 16, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.fatal-fallback__inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 40px;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-card);
}
.fatal-fallback h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}
.fatal-fallback p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}
.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
}
.btn:hover { filter: brightness(1.05); }

/* -- modal ---------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 13, 16, 0.7);
  backdrop-filter: blur(4px);
}
.modal__panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 32px 36px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.modal__close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  border-radius: 8px;
}
.modal__close:hover { background: var(--bg-elevated); color: var(--text-primary); }
.modal__title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.modal__body p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.modal__body p:last-child { margin-bottom: 0; }
.modal__body a { color: var(--accent); }
.modal__body strong { color: var(--text-primary); font-weight: 600; }

/* -- history section ------------------------------------------ */

.history__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.history__header .section__title {
  margin-bottom: 0;
}

.history__toggle {
  display: inline-flex;
  background: var(--bg-elevated);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.history__toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  transition: background 120ms ease, color 120ms ease;
}
.history__toggle-btn:hover {
  color: var(--text-primary);
}
.history__toggle-btn--active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.history__toggle-btn--active:hover {
  color: var(--bg);
}

.history__chart-wrap {
  position: relative;
  width: 100%;
  height: 340px;
}
.history__content,
.history__skeleton {
  position: absolute;
  inset: 0;
}
.history__content canvas {
  width: 100% !important;
  height: 100% !important;
}

.history__legend {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 20px;
}
.history-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  width: auto;
}

/* -- regional map --------------------------------------------- */

.region-headline {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  min-height: 1.5em;
}
.region-headline strong { color: var(--text-primary); font-weight: 600; }

.region-map-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 380px;
}

.region-map {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 722.8125 / 1185;
}

.region-map__svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* The GB silhouette image — original is black, recolour via filter to match theme */
.region-map__silhouette-img {
  /* The original SVG is solid black. Use a filter to convert black → --bg-elevated (#1E222A).
     CSS filter brightness/invert can't directly hit a specific colour, but we can
     get close by using the image as-is on the dark theme — black on near-black still
     shows as a subtle silhouette via the slight contrast. To make it pop more, we
     add a brightness boost. */
  filter: brightness(0) invert(0.14);
  pointer-events: none;
}

.region-tile {
  cursor: pointer;
  outline: none;
}
.region-tile__shape {
  transition: filter 150ms ease, stroke-width 150ms ease;
  stroke: var(--bg-card);
  stroke-width: 4;
}
.region-tile__label {
  font-family: "Inter", sans-serif;
  font-size: 26px;
  font-weight: 700;
  fill: #0B0D10;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.region-tile:hover .region-tile__shape,
.region-tile:focus-visible .region-tile__shape {
  filter: brightness(1.15);
  stroke: var(--text-primary);
  stroke-width: 5;
}
.region-tile--active .region-tile__shape {
  stroke: var(--text-primary);
  stroke-width: 6;
}

/* Band fills for dots */
.region-tile[data-band="very-low"]  .region-tile__shape { fill: var(--band-very-low); }
.region-tile[data-band="low"]       .region-tile__shape { fill: var(--band-low); }
.region-tile[data-band="moderate"]  .region-tile__shape { fill: var(--band-moderate); }
.region-tile[data-band="high"]      .region-tile__shape { fill: var(--band-high); }
.region-tile[data-band="very-high"] .region-tile__shape { fill: var(--band-very-high); }

/* For "very high" (red), use light text for contrast */
.region-tile[data-band="very-high"] .region-tile__label { fill: var(--text-primary); }

.region-map__hint {
  font-size: 13px;
  color: var(--text-muted);
}

.skeleton--map {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 722.8125 / 1185;
}

/* -- region popup --------------------------------------------- */

.region-popup {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.region-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 13, 16, 0.7);
  backdrop-filter: blur(4px);
}
.region-popup__panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-card);
}
.region-popup__close {
  position: absolute;
  top: 10px;
  right: 14px;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
  border-radius: 8px;
}
.region-popup__close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.region-popup__name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.region-popup__intensity-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}
.region-popup__intensity {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.region-popup__unit {
  font-size: 14px;
  color: var(--text-muted);
}

.region-popup__mix-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 24px 0 12px;
}
.region-popup__mix {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.region-popup__mix-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.region-popup__mix-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.region-popup__mix-name { color: var(--text-secondary); }
.region-popup__mix-perc {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* -- responsive: mobile --------------------------------------- */

@media (max-width: 768px) {
  :root {
    --section-gap: 48px;
    --card-padding: 20px;
  }
  .page { padding: 32px 16px; }

  .brand { margin-bottom: 32px; flex-direction: column; gap: 12px; }
  .hero__number { font-size: 64px; }
  .hero__unit { font-size: 16px; }
  .hero__interpretation { font-size: 16px; }

  .mix__content,
  .mix__skeleton {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .mix__chart-wrap canvas {
    max-width: 240px;
    max-height: 240px;
  }

  .story__chart-wrap { height: 260px; }

  .greenest-callout { padding: 20px 22px; }
  .greenest-callout__time { font-size: 24px; }
  .greenest-callout__justification { font-size: 14px; }

  .history__chart-wrap { height: 280px; }
  .history__header { flex-direction: column; align-items: flex-start; }

  .footer__grid {
    grid-template-columns: 1fr;
  }
  .footer__attrib,
  .footer__meta { text-align: left; }
  .footer__meta { grid-column: auto; }
}

/* -- energy detective page ------------------------------------ */

.detective {
  max-width: 760px;
}

.detective__back {
  display: inline-block;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}
.detective__back:hover {
  color: var(--accent);
  text-decoration: none;
}

.detective__header {
  margin-bottom: 24px;
}
.detective__title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.detective__subtitle {
  font-size: 18px;
  color: var(--text-secondary);
}

.detective__intro {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 24px 28px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-card);
}
.detective__intro p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.detective__intro p:last-child {
  margin-bottom: 0;
}
.detective__intro strong {
  color: var(--text-primary);
  font-weight: 600;
}
.detective__hint {
  font-size: 13px !important;
  color: var(--text-muted) !important;
  margin-top: 4px;
}

.watt-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.band-section {
  margin-bottom: 36px;
}
.band-section__title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-left: 14px;
  border-left: 4px solid var(--band);
  display: flex;
  align-items: center;
  gap: 8px;
}
.band-section__dot {
  font-size: 14px;
}

.band-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.band-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-left: 3px solid var(--band);
  border-radius: 8px;
}
.band-item__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.band-item__desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}

.detective__footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.detective__footer p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .detective__title { font-size: 28px; }
  .detective__intro { padding: 20px; }
}

/* -- energy calculator page ----------------------------------- */

.calc {
  max-width: 720px;
}

.calc__grid-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 15px;
}
.calc__grid-label { color: var(--text-muted); }
.calc__grid-value {
  color: var(--text-primary);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.calc__grid-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.calc__grid-status:not(:last-child) { margin-bottom: 24px; }

.calc__card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}
.calc__field {
  margin-bottom: 20px;
}
.calc__field:last-of-type { margin-bottom: 0; }
.calc__label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.calc__select,
.calc__input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
}
.calc__select:focus,
.calc__input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.calc__wattage-readout {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.calc__results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  background: var(--bg-elevated);
  border-radius: var(--card-radius);
  padding: 28px;
  margin-bottom: 36px;
}
.calc__result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.calc__result-label {
  font-size: 13px;
  color: var(--text-muted);
}
.calc__result-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.calc__result-value--flash {
  animation: calcFlash 400ms ease-out;
}
@keyframes calcFlash {
  0%   { color: var(--accent); }
  100% { color: var(--text-primary); }
}
.calc__result-unit {
  font-size: 13px;
  color: var(--text-secondary);
}

.calc__comparisons-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}
.calc__comparisons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.calc__comparison {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.calc__comparison-icon {
  font-size: 28px;
}
.calc__comparison-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.calc__comparison-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.calc__footnote {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

@media (max-width: 768px) {
  .calc__results { grid-template-columns: 1fr; gap: 20px; }
  .calc__comparisons { grid-template-columns: 1fr; }
  .calc__result { flex-direction: row; align-items: baseline; justify-content: space-between; text-align: left; }
}

/* -- glossary page -------------------------------------------- */

.glossary {
  max-width: 900px;
}
.glossary__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.glossary__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  padding: 20px 22px;
}
.glossary__card--wide {
  grid-column: 1 / -1;
}
.glossary__term {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.glossary__def {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.glossary__def strong { color: var(--text-primary); font-weight: 600; }
.glossary__def em { color: var(--text-primary); font-style: italic; }
.glossary__rs {
  list-style: none;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.glossary__rs li {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-secondary);
  padding-left: 16px;
  position: relative;
}
.glossary__rs li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.glossary__rs strong { color: var(--text-primary); font-weight: 600; }

@media (max-width: 768px) {
  .glossary__grid { grid-template-columns: 1fr; }
}

/* -- reduced motion ------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .live-indicator { animation: none; opacity: 1; }
  .skeleton { animation: none; background: var(--bg-elevated); }
}
