/* Source Serif 4 (Adobe, SIL Open Font License: fonts/OFL-source-serif-4.txt), self-hosted: headings only */
@font-face {
  font-family: "Source Serif 4"; src: url("/fonts/source-serif-4-latin-wght.woff2?v=1") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #faf8f4;
  --fg: #1d2327;
  --ink: #13202a;
  --muted: #5d6870;
  --card: #fff;
  --border: #e3ddd2;
  --accent: #1c5d99;
  --accent-dark: #143f6b;
  --brand: #13294b;       /* the hero band */
  --cream: #f7f0e3;       /* alternate section bands */
  --gold: #f5b83d;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 4px 14px rgba(16, 32, 48, 0.06);
  --warn-bg: #fff6e0;
  --warn-border: #e8c46a;
  --radius: 8px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; background: var(--bg); }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2, h3 { color: var(--ink); letter-spacing: -0.01em; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.sub { margin: 0 0 0.75rem; color: var(--muted); }

.search { display: flex; gap: 0.5rem; max-width: 640px; }
.search input {
  flex: 1; min-width: 0; padding: 0.6rem 0.75rem; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.search button, button {
  padding: 0.6rem 1rem; font-size: 1rem; border: 0; border-radius: var(--radius);
  background: var(--accent); color: #fff; cursor: pointer;
}
.search button:disabled { opacity: 0.6; cursor: progress; }
.status { min-height: 1.3em; margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; }
.status.error { color: #a4262c; }

select { font-size: 0.9rem; padding: 0.2rem; }

.muted { color: var(--muted); }

/* year bar chart: rows of stacked horizontal bars */
.bars { display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; }
.bar-row { display: grid; grid-template-columns: 3em minmax(0, 1fr) 2.5em; gap: 0.4rem; align-items: center; }
.bar-track { display: flex; height: 14px; background: #eef0f2; border-radius: 3px; overflow: hidden; }
.bar-seg { height: 100%; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; }

.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 520px; }
.table-scroll.fit table { min-width: 0; }  /* few, short columns: fit the phone instead of scrolling */

.more-link { margin: 0.8rem 0 0; font-weight: 600; }

.caveats {
  margin: 0.5rem 0 1rem;
  padding: 0.5rem 0.75rem 0.5rem 1.5rem;
  background: #fff8e6;
  border-left: 3px solid #d9a400;
  font-size: 0.85rem;
  color: #4a3b00;
}
.caveats li + li { margin-top: 0.35rem; }

/* ---- content pages ---- */
.content-page .page-header, .content-page .page-main { max-width: 860px; margin: 0 auto; padding: 1rem; }
.content-page .page-header { padding-top: 2rem; }
.content-page .page-header > p:not(.crumbs) { font-size: 1.08rem; color: #3d4852; }
.content-page .page-main { padding-bottom: 3rem; line-height: 1.6; }
.content-page h1 { margin: 0.2rem 0 0.6rem; font-size: clamp(1.6rem, 3.5vw, 2.2rem); line-height: 1.2; letter-spacing: -0.02em; }
.content-page h2 { margin: 2.2rem 0 0.6rem; font-size: 1.35rem; }
.content-page h3 { font-size: 1.1rem; }
.content-page table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.95rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.content-page th, .content-page td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid #e8ebee; }
.content-page th { background: #f1f4f7; color: #3d4852; font-weight: 600; font-size: 0.88rem; }
.content-page tbody tr:last-child td { border-bottom: 0; }
.content-page td { font-variant-numeric: tabular-nums; }

.content-page .page-main { min-height: 40vh; }
.crumbs { margin: 0; font-size: 0.9rem; }
.crumbs a { text-decoration: none; font-weight: 600; }
.content-page .caveats:empty { display: none; }
.button, a.button:visited {
  display: inline-block; padding: 0.65rem 1.15rem; border-radius: 8px;
  background: var(--accent); color: #fff; text-decoration: none; font-weight: 600; box-shadow: var(--shadow);
}
.button:hover { background: var(--accent-dark); color: #fff; }
@media (max-width: 480px) {
  .content-page h1 { font-size: 1.3rem; }
  .content-page th, .content-page td { padding: 0.25rem 0.3rem; font-size: 0.85rem; }
}

.small { font-size: 0.8rem; }

/* ---- site header and navigation (every page) ---- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1100; }  /* above Leaflet controls (1000) */
.topbar-in {
  max-width: 1400px; margin: 0 auto; padding: 0.6rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; flex-wrap: wrap;
}
.logo { display: inline-flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--ink);
  font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.logo:hover { color: var(--ink); }
.logo-mark { width: 30px; height: 30px; flex: none; }
.topnav { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; }
.topnav a { display: block; padding: 0.4rem 0.7rem; border-radius: 8px; color: #33414c; text-decoration: none;
  font-weight: 500; font-size: 0.95rem; }
.topnav a:hover { background: #eef2f6; color: var(--ink); }
.nav-toggle, .menu-btn { display: none; }  /* the phone menu's switch (no JS): only at phone widths */
@media (max-width: 760px) {
  .topbar-in { flex-wrap: nowrap; }
  .nav-toggle { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; }
  .menu-btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.8rem; border: 1px solid var(--border);
    border-radius: 8px; font-weight: 600; font-size: 0.95rem; color: var(--ink); cursor: pointer; user-select: none; }
  .menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 16px; height: 2px; background: currentColor;
    border-radius: 1px; position: relative; }
  .menu-bars::before, .menu-bars::after { content: ""; position: absolute; left: 0; }
  .menu-bars::before { top: -5px; }
  .menu-bars::after { top: 5px; }
  .nav-toggle:focus-visible + .menu-btn { outline: 2px solid var(--accent); outline-offset: 2px; }
  .nav-toggle:checked + .menu-btn { background: var(--cream); }
  .topnav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--card); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 0.4rem 0.6rem 0.8rem; }
  .nav-toggle:checked ~ .topnav { display: flex; }
  .topnav a { padding: 0.7rem 0.8rem; font-size: 1.02rem; }
}

/* ---- home: banded sections, hero, tool cards ---- */
.band { padding: 3rem 0; }
.band-in { max-width: 1400px; margin: 0 auto; padding: 0 1rem; }
.band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.15; margin: 0 0 0.5rem; }
.band-lede { color: var(--muted); font-size: 1.05rem; max-width: 62ch; margin: 0 0 1.5rem; }
.band h3 { font-size: 1rem; margin: 1.6rem 0 0.6rem; }
  /* the map panel's small card headings */

.hero-band { background: var(--brand); color: #e3e9f2;
  background-image: radial-gradient(1200px 500px at 85% -10%, rgba(245, 184, 61, 0.18), transparent 60%); }
.hero { padding-top: 3.5rem; padding-bottom: 3rem; }
  /* desktop only (see the <picture> media query) */
@media (min-width: 1000px) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 3rem; align-items: center; }
}
.hero h1 { color: #fff; font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.08; max-width: 22ch; margin: 0.9rem 0 0.8rem; }
.hero .sub { font-size: 1.12rem; max-width: 60ch; color: #c8d3e3; margin: 0 0 1.6rem; }
.eyebrow { display: inline-block; margin: 0; padding: 0.25rem 0.75rem; border-radius: 999px; background: rgba(255, 255, 255, 0.1);
  color: var(--gold); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em; }
.hero .search { max-width: 680px; }
.hero .search input { padding: 0.95rem 1.1rem; font-size: 1.05rem; border: 0; border-radius: 10px; }
.hero .search button { padding: 0.95rem 1.5rem; font-weight: 700; border-radius: 10px; background: var(--gold); color: var(--ink); }
.hero .search button:hover { background: #f8cb6a; }
.hero .status { color: #c8d3e3; }
.hero .status.error { color: #ffd2cc; }

.stats { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 2.5rem 0 0; padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.14); }
.stats div { display: flex; flex-direction: column-reverse; }
.stats dd { margin: 0; font-family: var(--serif); font-size: 1.9rem; font-weight: 600; color: #fff; line-height: 1.1;
  font-variant-numeric: tabular-nums; }
.stats dt { color: #a8b8cf; font-size: 0.85rem; }

.tools-band { background: var(--cream); }
.tool-cards { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tool-card { display: flex; flex-direction: column; gap: 0.35rem; height: 100%; padding: 1.4rem; background: var(--card);
  border: 1px solid var(--border); border-radius: 14px; text-decoration: none; color: var(--fg);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.tool-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--fg); }
.tool-icon { width: 44px; height: 44px; border-radius: 12px; background: #e4edf7; display: grid; place-items: center;
  margin-bottom: 0.4rem; }
.tool-icon svg { width: 24px; height: 24px; fill: var(--accent); }
.tool-name { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.tool-text { color: var(--muted); }

  /* clear the sticky header */

.data-note { margin: 0 0 1.2rem; font-size: 0.88rem; color: var(--muted); max-width: 110ch; }
.data-note strong { color: var(--fg); }

.browse-all { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.browse-all > summary { cursor: pointer; display: inline-block; font-weight: 600; color: var(--accent-dark);
  padding: 0.55rem 1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.browse-all > summary:hover { border-color: var(--accent); }
.browse-all[open] > summary { margin-bottom: 0.5rem; }

@media (max-width: 480px) {
  .band { padding: 2.25rem 0; }
  .band-in { padding: 0 0.75rem; }
  .hero { padding-top: 2.25rem; padding-bottom: 2.25rem; }
  .hero .sub { font-size: 1.02rem; }
  .hero .search { flex-direction: column; }
  .stats { gap: 1rem 1.5rem; }
  .stats div { flex: 1 1 40%; }
  .stats dd { font-size: 1.45rem; }
}

/* ---- link cards ---- */
.tiles { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 0.6rem; }
.tile { display: block; height: 100%; padding: 0.75rem 0.9rem; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile-name { display: block; color: var(--ink); font-weight: 600; line-height: 1.3; }
.tile-meta:empty { display: none; }
.tile-meta { display: block; margin-top: 0.2rem; color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.page-main .tiles { margin: 1rem 0; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* ---- site footer (every page) ---- */
.map-credit { max-width: 1400px; margin: 0 auto; padding: 0 1rem 1rem; color: var(--muted); font-size: 0.75rem; }
.site-foot { background: var(--cream); color: var(--muted); padding: 2.5rem 1rem 1.5rem; font-size: 0.9rem;
  border-top: 1px solid var(--border); }
.foot-in { max-width: 1368px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1.5rem; }
.site-foot .logo, .site-foot .logo:hover { color: var(--ink); }
.foot-about p { max-width: 36ch; }
.foot-h { margin: 0 0 0.5rem; color: var(--ink); font-weight: 600; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.06em; }
.site-foot ul { list-style: none; margin: 0; padding: 0; }
.site-foot li { margin: 0 0 0.35rem; }
.site-foot a:not(.logo) { color: #3d4852; text-decoration: none; }
.site-foot a:not(.logo):hover { color: var(--accent-dark); text-decoration: underline; }
.foot-note { max-width: 1368px; margin: 2rem auto 0; padding-top: 1rem; border-top: 1px solid var(--border);
  font-size: 0.78rem; color: var(--muted); }
@media (max-width: 720px) {
  .foot-in { grid-template-columns: 1fr 1fr; }
  .foot-about { grid-column: 1 / -1; }
}

/* "In short" summary box */
.summary { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 0.4rem 1.1rem 0.6rem; margin: 0.5rem 0 1rem; }
.content-page .summary h2 { margin: 0.6rem 0 0.3rem; font-size: 1.1rem; }
.summary ul { margin: 0; padding-left: 1.2rem; }
.summary li { margin: 0.2rem 0; }

/* related pages: chip groups instead of link walls */
.related { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.rel-group { margin: 0 0 1rem; }
.content-page .rel-group h3 { margin: 0 0 0.5rem; font-size: 0.95rem; color: #3d4852; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips a { display: inline-block; padding: 0.3rem 0.7rem; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); text-decoration: none; font-size: 0.9rem; color: var(--ink); }
.chips a:hover { border-color: var(--accent); color: var(--accent-dark); }
.more-chips { margin-top: 0.4rem; }
.more-rows { margin: 0.5rem 0 1rem; }
.more-chips summary, .more-rows summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; font-weight: 600; margin-bottom: 0.4rem; }

/* "On this page" contents for long pages */
.toc { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 0.6rem 1rem; margin: 0 0 1rem; }
.toc-h { margin: 0 0 0.3rem; font-weight: 600; font-size: 0.85rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.05em; }
.toc ol { margin: 0; padding-left: 1.2rem; columns: 2; column-gap: 2rem; font-size: 0.92rem; }
.toc li { margin: 0.15rem 0; break-inside: avoid; }
@media (max-width: 640px) {
  .toc ol { columns: 1; }
}
.content-page h2[id] { scroll-margin-top: 4.5rem; }  /* clear the sticky header when jumping to a section */

/* ---- content pages: header band, stat tiles, quiet data note ---- */
.content-page .page-header { background: var(--cream); padding-bottom: 2rem; margin-bottom: 1.5rem;
  box-shadow: 0 0 0 100vmax var(--cream); clip-path: inset(0 -100vmax); }  /* full-width band, text column kept */
.content-page .page-header h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.12; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
.button.ghost, a.button.ghost:visited { background: var(--card); color: var(--accent-dark); box-shadow: none;
  border: 1px solid var(--border); }
.button.ghost:hover { background: var(--card); color: var(--accent-dark); border-color: var(--accent); }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin: 1.5rem 0 0; }
.stat-tiles div { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.9rem 1rem; }
.stat-tiles dd { order: 1; margin: 0; font-family: var(--serif); font-size: 1.75rem; font-weight: 600; line-height: 1.15;
  color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tiles dt { order: 2; color: var(--muted); font-size: 0.88rem; }
.stat-tiles dd.stat-sub { order: 3; font-family: inherit; font-size: 0.82rem; font-weight: 600; color: var(--accent-dark); }
.page-main .data-note { font-size: 0.85rem; color: var(--muted); margin: 0 0 1.5rem; }
.about-data { margin-top: 0.3rem; }
.about-data summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.about-data .caveats { margin-top: 0.5rem; }
@media (max-width: 480px) {
  .stat-tiles { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .stat-tiles dd { font-size: 1.35rem; }
  .header-actions .button { width: 100%; text-align: center; }
}

/* key-facts box (a guide's short answer) */
.key-facts { background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--gold);
  border-radius: 12px; padding: 0.2rem 1.3rem 0.6rem; margin: 0 0 1.5rem; box-shadow: var(--shadow); }
.content-page .key-facts h2 { margin-top: 1rem; font-size: 1.3rem; }
/* ---- solar site additions ---- */
.hero-card { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 14px;
  padding: 1.2rem 1.4rem; margin-top: 2rem; }
.hero-card h2 { color: #fff; font-size: 1.3rem; margin: 0 0 0.3rem; }
.hero-card p { color: #c8d3e3; font-size: 0.9rem; margin: 0 0 1rem; }
.hero-card .bars { font-size: 0.85rem; color: #e3e9f2; gap: 6px; }
.hero-card .bar-track { background: rgba(255, 255, 255, 0.12); height: 16px; }
.bar-row.wide { grid-template-columns: 11.5em minmax(0, 1fr) 3em; }
@media (min-width: 1000px) { .hero-card { margin-top: 0; } }
.calc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.8rem 1rem;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.2rem; margin: 0 0 1.5rem; }
.calc-form label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.calc-form input, .calc-form select { font-size: 1rem; padding: 0.5rem 0.6rem; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; font-weight: 400; }
.calc-form .hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.calc-form button { align-self: end; font-weight: 700; }
.result-box { background: var(--card); border: 1px solid var(--border); border-top: 4px solid var(--gold);
  border-radius: 12px; padding: 0.4rem 1.3rem 1rem; margin: 0 0 1.5rem; box-shadow: var(--shadow); }
.content-page .page-header .search { margin-top: 1rem; }
.sponsored-note { font-size: 0.8rem; color: var(--muted); }
/* sponsored listing card (only rendered when a listing is configured) */
.featured { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--gold); border-radius: 10px;
  padding: 0.5rem 1.1rem 0.7rem; margin: 1rem 0; }
.eyebrow-dark { margin: 0.3rem 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: #8a5a00; }
.featured-name { margin: 0.2rem 0; font-size: 1.1rem; font-weight: 600; }
