/* GridPulse ZA — styles for the generated history/source pages.
   Loaded after style.vNN.css, which supplies the theme tokens, header,
   footer and card look. Only the page-specific pieces live here. */

/* Links from a chart down into the Data section. They sit in their own
   element because app.js rewrites the chart subtitles with textContent,
   which would strip any markup placed inside them. */
.chart-link { margin: 4px 0 0; font-size: 12.5px; }
.chart-link a { color: var(--accent); text-decoration: none; }
.chart-link a:hover { text-decoration: underline; }

/* The single data-status line under the H1. The amber left bar comes from
   .stale-note in the main sheet; note-ok is the calm everything-is-current
   state of the same element. */
.stale-note.note-ok { border-left-color: var(--grid); color: var(--muted); }

.site-nav { display: flex; gap: 16px; margin-left: auto; }
.site-nav a {
  font-size: 13.5px; color: var(--ink-2); text-decoration: none;
  padding: 5px 2px; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
a.brand { text-decoration: none; color: inherit; }

.page { padding-bottom: 48px; max-width: 860px; }
.crumbs { font-size: 12.5px; color: var(--muted); margin: 18px 0 6px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.page h1 {
  font-size: 30px; margin: 6px 0 10px; line-height: 1.2;
  letter-spacing: -0.4px;
}
.page h2 { font-size: 19px; margin: 30px 0 10px; }
.page h3 { font-size: 15.5px; margin: 18px 0 8px; }
.page p { font-size: 14.5px; line-height: 1.65; color: var(--ink-2); }
.page .lead { font-size: 16px; color: var(--ink); max-width: 70ch; }
.page .hint { font-size: 12.5px; color: var(--muted); margin: -2px 0 10px; }
/* the pickers are the page: keep the first one close to the title.
   Scoped by id so the other page types keep their normal h2 spacing. */
#by-technology { margin-top: 20px; }
.page strong { color: var(--ink); }
.page .note {
  font-size: 12.5px; color: var(--muted); border-left: 3px solid var(--grid);
  padding-left: 11px; margin-top: 26px;
}
.page-foot { margin-top: 34px; font-size: 14px; }
.page-foot a { color: var(--accent); font-weight: 600; }

/* stat strip */
.pstats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin: 20px 0 4px;
}
.pstat {
  border: 1px solid var(--border); border-radius: 11px; padding: 11px 14px;
  background: var(--surface);
}
.pstat .k { display: block; font-size: 11.5px; color: var(--ink-2); }
.pstat .v {
  font-family: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  font-size: 21px; font-weight: 700; color: var(--ink);
}
.pstat .u { font-size: 11px; font-weight: 500; color: var(--ink-2);
  margin-left: 5px; }

/* server-rendered profile chart */
.profile { margin: 18px 0 6px; }
.profile svg { width: 100%; height: auto; display: block; }
.profile .g { stroke: var(--grid); stroke-width: 1; }
.profile .yl { fill: var(--muted); font-size: 10.5px; text-anchor: end; }
.profile .xl { fill: var(--muted); font-size: 10.5px; text-anchor: middle; }
.legend {
  display: flex; flex-wrap: wrap; gap: 4px 13px; margin-top: 9px;
  font-size: 11.5px; color: var(--ink-2);
}
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend i {
  width: 9px; height: 9px; border-radius: 2px; display: inline-block;
}
.ptable tr.hi td { background: var(--wash); font-weight: 600; }

/* province map, real boundaries. Below ~540px it side-scrolls instead of
   shrinking its labels, the same pattern as the records band. */
.zamap { margin: 20px 0 6px; overflow-x: auto; }
.zamap svg { width: 100%; max-width: 660px; min-width: 520px;
  height: auto; display: block; }
.zamap a { cursor: pointer; outline: none; }
.zamap .zp { fill: var(--accent); stroke: var(--surface); stroke-width: 1.2; }
.zamap a:hover .zp, .zamap a:focus .zp {
  fill-opacity: 0.95; stroke: var(--accent-ink); stroke-width: 1.6;
}
.zamap text { pointer-events: none; text-anchor: middle;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3px;
  stroke-linejoin: round; }
.zamap .zl { fill: var(--ink); font-weight: 700; font-size: 14px;
  font-family: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif; }
.zamap .zv { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
/* on darkly shaded provinces the value flips to light with a dark halo,
   otherwise it drowns in the fill. The pdark class comes from the build
   for the capacity shading and from map.vN.js while a province is pinned. */
.zamap a.pdark .zv { fill: #fff; stroke: rgba(10, 8, 20, 0.55); }
.zamap a.pdark .zl { stroke: rgba(10, 8, 20, 0.45); }

/* hover panel under the map */
.map-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  min-height: 46px; margin-top: 10px; padding: 9px 13px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); font-size: 13px; color: var(--ink-2);
}
.map-info strong { color: var(--ink); font-size: 13.5px; }
.map-mix { display: flex; width: 190px; height: 10px; border-radius: 5px;
  overflow: hidden; background: var(--grid); }
.map-mix i { display: block; height: 100%; }
.map-top { font-size: 12px; color: var(--muted); }
.map-info a { color: var(--accent); font-weight: 600; text-decoration: none; }
.map-info a:hover { text-decoration: underline; }

/* per-province capacity mix bar */
.mixbar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  margin: 8px 0 4px; background: var(--grid);
}
.mixbar span { display: block; height: 100%; }
.prov-sec { margin-top: 30px; }
.prov-sec h2 { margin-bottom: 4px; }

/* data tables */
.ptable {
  width: 100%; border-collapse: collapse; margin: 12px 0 8px;
  font-size: 13.5px; display: block; overflow-x: auto;
}
.ptable caption {
  caption-side: top; text-align: left; font-size: 12.5px;
  color: var(--muted); padding-bottom: 7px;
}
.ptable th, .ptable td {
  padding: 7px 12px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--grid);
}
.ptable th:first-child, .ptable td:first-child { text-align: left; }
.ptable thead th {
  color: var(--ink-2); font-weight: 600;
  border-bottom: 1px solid var(--baseline);
}
.ptable td { font-variant-numeric: tabular-nums; color: var(--ink); }
.ptable tfoot td { font-weight: 700; border-top: 1px solid var(--baseline); }
.ptable a { color: var(--accent); text-decoration: none; }
.ptable a:hover { text-decoration: underline; }

/* prev / next */
.prevnext {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-top: 30px; padding-top: 16px;
  border-top: 1px solid var(--grid); font-size: 13.5px;
}
.prevnext a { color: var(--accent); text-decoration: none; }
.prevnext a:hover { text-decoration: underline; }

/* history index */
.yearblock { margin-top: 24px; }
.yearblock h3 { margin: 0 0 8px; font-size: 17px; }
.yearblock h3 a { color: var(--ink); text-decoration: none; }
.yearblock h3 a:hover { color: var(--accent); }
.monthlinks { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; }
.monthlinks a {
  font-size: 13px; color: var(--ink-2); text-decoration: none;
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 11px;
  background: var(--surface);
}
.monthlinks a:hover {
  color: var(--accent-ink); background: var(--accent); border-color: var(--accent);
}

/* sources index */
.srcgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px; margin-top: 16px;
}
.srccard {
  border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px;
  background: var(--surface); text-decoration: none; display: block;
}
.srccard:hover { border-color: var(--accent); background: var(--wash); }
.srccard h3 { margin: 0 0 2px; font-size: 14px; color: var(--ink); }
.srccard .big {
  font-family: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;
  font-size: 21px; font-weight: 700; color: var(--ink); margin: 0;
}
.srccard .u { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.srccard p { margin: 1px 0 0; font-size: 11.5px; }

@media (max-width: 640px) {
  .page h1 { font-size: 24px; }
  /* claw back enough vertical space that "By month" is on the first
     screen, not just below it */
  .crumbs { margin: 12px 0 4px; }
  .page .lead { font-size: 15px; }
  .srcgrid { gap: 8px; margin-top: 12px; }
  .srccard { padding: 9px 11px; }
  .srccard .big { font-size: 19px; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 12.5px; }
  .brand-tag { display: none; }
}
