/* Tanaw Energy map page. Every colour is a token; see DESIGN.md. */

:root {
  /* Series base: docs/tanaw-series/DESIGN.md, section 2 */
  --bg: #ffffff;
  --surface: #f0f0f0;
  --surface-2: #e4e4e4;
  --ink: #111111;
  --muted: #555555;
  --line: #dadada;
  --space: #0b0c0e;
  --on-space: #eceef2;

  /* Energy, the subject colour: interface only, never data */
  --s: #7a6400;
  --s-fill: #ffd200;
  --on-s: #111111;

  /* Map ground */
  --map-land: #ececec;
  --map-water: #d6dde3;
  --map-road: #ffffff;
  --map-label: #545454;
  --map-grid: #6b6b6b;
  --map-boundary: #cfcfcf;
  --mark: #111111;
  --mark-halo: #ffffff;

  /* Data: this week's areas and the history ramp */
  --week-fill: #b0186a;
  --week-label: #ffffff;
  --heat-1: #fde0ef;
  --heat-2: #f7a1c8;
  --heat-3: #e7559b;
  --heat-4: #b0186a;
  --heat-5: #6a0a3f;

  /* Data: Grid view, fuel and voltage */
  --fuel-solar: #c45200;
  --fuel-wind: #00747f;
  --fuel-hydro: #1d5fd1;
  --fuel-pumped: #3a2f9e;
  --fuel-geothermal: #9c3d1f;
  --fuel-biomass: #3b7a1a;
  --fuel-gas: #c41f3a;
  --fuel-coal: #2a2a2a;
  --fuel-oil: #6e4a24;
  --fuel-storage: #8a2fb8;
  --fuel-other: #6b6b6b;
  --kv-500: #0b2f6b;
  --kv-230: #2a5592;
  --kv-115: #4f6f96;
  --kv-69: #6c7d90;

  --font-logo: "Michroma", "Arial Narrow", sans-serif;
  --font-head: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --font-sans: "Atkinson Hyperlegible Next", "Helvetica Neue", Arial, sans-serif;
  --font-num: "Atkinson Hyperlegible Mono", Menlo, monospace;

  --radius: 10px;
  --gutter: 16px;
  --float: 8px;
  --top-space: calc(var(--float) * 2 + 56px);
  --peek: 136px;
  --shadow: 0 2px 12px rgb(0 0 0 / .16);

  color-scheme: light;
}

@media (min-width: 760px) {
  :root { --gutter: 32px; }
}

@media (min-width: 900px) {
  :root { --float: 12px; }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0c0e;
    --surface: #15171b;
    --surface-2: #1e2127;
    --ink: #eceef2;
    --muted: #a4a8b0;
    --line: #272a30;
    --s: #ffd200;
    --on-s: #0b0c0e;
    --map-land: #1f1f1f;
    --map-water: #10161b;
    --map-road: #2e2e2e;
    --map-label: #a9a9a9;
    --map-grid: #8f8f8f;
    --map-boundary: #343434;
    --mark: #ffffff;
    --mark-halo: #111111;
    --week-fill: #e0559b;
    --week-label: #111111;
    --heat-1: #3a0f27;
    --heat-2: #6f1a4a;
    --heat-3: #a8306f;
    --heat-4: #df5c9d;
    --heat-5: #f9b8d6;

    /* Data: Grid view, fuel and voltage */
    --fuel-solar: #ff8b3d;
    --fuel-wind: #2fc8cf;
    --fuel-hydro: #5d9cff;
    --fuel-pumped: #a49cff;
    --fuel-geothermal: #e08560;
    --fuel-biomass: #86c95a;
    --fuel-gas: #ff6b7d;
    --fuel-coal: #e2e2e2;
    --fuel-oil: #caa077;
    --fuel-storage: #d48cff;
    --fuel-other: #9a9a9a;
    --kv-500: #cfe3ff;
    --kv-230: #93b6e6;
    --kv-115: #7d93b0;
    --kv-69: #6f7d8e;
    --shadow: 0 2px 16px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0c0e;
  --surface: #15171b;
  --surface-2: #1e2127;
  --ink: #eceef2;
  --muted: #a4a8b0;
  --line: #272a30;
  --s: #ffd200;
  --on-s: #0b0c0e;
  --map-land: #1f1f1f;
  --map-water: #10161b;
  --map-road: #2e2e2e;
  --map-label: #a9a9a9;
  --map-grid: #8f8f8f;
  --map-boundary: #343434;
  --mark: #ffffff;
  --mark-halo: #111111;
  --week-fill: #e0559b;
  --week-label: #111111;
  --heat-1: #3a0f27;
  --heat-2: #6f1a4a;
  --heat-3: #a8306f;
  --heat-4: #df5c9d;
  --heat-5: #f9b8d6;

  /* Data: Grid view, fuel and voltage */
  --fuel-solar: #ff8b3d;
  --fuel-wind: #2fc8cf;
  --fuel-hydro: #5d9cff;
  --fuel-pumped: #a49cff;
  --fuel-geothermal: #e08560;
  --fuel-biomass: #86c95a;
  --fuel-gas: #ff6b7d;
  --fuel-coal: #e2e2e2;
  --fuel-oil: #caa077;
  --fuel-storage: #d48cff;
  --fuel-other: #9a9a9a;
  --kv-500: #cfe3ff;
  --kv-230: #93b6e6;
  --kv-115: #7d93b0;
  --kv-69: #6f7d8e;
  --shadow: 0 2px 16px rgb(0 0 0 / .6);
  color-scheme: dark;
}

/* Base */

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

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-sans);
}

h1, h2, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--ink); }

button {
  font: inherit;
  color: inherit;
  border-radius: var(--radius);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--s);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.small { font-size: 14px; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-num); font-weight: 400; font-variant-numeric: tabular-nums; }

.icon { display: block; width: 24px; height: 24px; }

.icon-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 600 16px/1 var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
}

/* Layout: phones first, a single scrolling column */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: fixed;
  top: var(--float);
  left: var(--float);
  right: var(--float);
  z-index: 5;
  height: 56px;
  padding: 0 6px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* One-line lockup: typemark at height H, the subject word in Michroma at 0.46 H, a 0.3 H gap, bottoms aligned. */
.lockup {
  --h: 24px;
  --glyph-2: none; /* the mark is under 160 px wide, so only the first glyph shows */
  display: flex;
  align-items: flex-end;
  gap: calc(var(--h) * .3);
  color: var(--ink);
}

.typemark { display: block; flex: none; height: var(--h); width: calc(var(--h) * 407 / 84); }

.lockup-word {
  margin-right: -.32em;
  padding-bottom: calc(var(--h) * 10 / 84);
  font: 400 calc(var(--h) * .46)/1 var(--font-logo);
  letter-spacing: .32em;
  transform: translateY(.18em);
}

@media (min-width: 760px) {
  .lockup { --h: 28px; }
}

@media (max-width: 339px) {
  .lockup-word { display: none; }
}

.topbar-actions { display: flex; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* More menu */

.menu {
  inset: auto;
  margin: 0;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
}

.menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  text-align: left;
}

.menu button:hover { background: var(--surface); }

/* Layout: the map fills the screen at every width; everything else floats over it. */

html, body { height: 100%; overflow: hidden; }

.map-wrap { position: fixed; inset: 0; z-index: 0; }
#map { position: absolute; inset: 0; background: var(--map-land); }

.slider-bar {
  position: fixed;
  z-index: 3;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sheet-handle { display: none; }

/* Phones: the answer floats under the top bar; the lists live in a bottom sheet that opens and closes. */
@media (max-width: 899px) {
  .side { display: contents; }

  #hero {
    position: fixed;
    top: var(--top-space);
    left: var(--float);
    right: var(--float);
    z-index: 2;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  #hero:empty { display: none; }
  #hero .answer { margin-bottom: 0; }

  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 4;
    height: calc(100svh - var(--top-space));
    padding: 0 var(--gutter) 24px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateY(calc(100% - var(--peek)));
    transition: transform .25s ease;
  }
  .panel.is-open { transform: none; overflow-y: auto; }
  /* Grid: the open sheet leaves the top of the map in view, so fuel filters show their effect. */
  .panel.is-grid { height: min(58svh, calc(100svh - var(--top-space))); }
  /* With the Grid sheet open, the legend's total row carries the answer's figures, so the map gets the room. */
  .side:has(.panel.is-grid.is-open) #hero { display: none; }

  .sheet-handle {
    display: grid;
    place-items: center;
    width: calc(100% + var(--gutter) * 2);
    height: 44px;
    margin: 0 calc(var(--gutter) * -1);
    border: 0;
    background: transparent;
    touch-action: none;
  }
  .grip { display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--muted); }

  .slider-bar { left: var(--float); right: var(--float); bottom: calc(var(--peek) + var(--float)); }
  .maplibregl-ctrl-bottom-right { bottom: var(--map-bottom, 0px); }
}

@media (prefers-reduced-motion: reduce) {
  .panel { transition: none; }
}

/* Laptops: one floating panel on the left holds the answer and the lists. */
@media (min-width: 900px) {
  .side {
    position: fixed;
    top: var(--top-space);
    left: var(--float);
    bottom: var(--float);
    z-index: 2;
    width: 392px;
    overflow-y: auto;
    padding: 24px var(--gutter) 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .slider-bar {
    left: calc(392px + var(--float) * 2);
    bottom: var(--float);
    width: min(560px, calc(100vw - 392px - var(--float) * 3 - 76px));
  }
  .maplibregl-ctrl-bottom-right { bottom: var(--slider-space, 0px); }
  /* Open credits stay right of the side panel. */
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact-show { max-width: calc(100vw - 392px - var(--float) * 2 - 32px); }
}

/* Search */

.search { margin-bottom: 16px; }

.search-label { display: block; margin-bottom: 4px; font-weight: 600; }

.search-box { position: relative; }

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--ink);
  pointer-events: none;
}

.search-box input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0 48px 0 44px;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.2 var(--font-sans);
}

.search-clear { position: absolute; top: 50%; right: 2px; transform: translateY(-50%); }

.search-list {
  max-height: 352px;
  margin-top: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.option {
  display: grid;
  align-content: center;
  min-height: 48px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.option:first-child { border-top: 0; }
.option:hover { background: var(--surface-2); }
.option[aria-selected="true"] { background: var(--surface-2); outline: 2px solid var(--ink); outline-offset: -2px; }

.option-name { font-weight: 600; }
.option-sub { font-size: 14px; color: var(--muted); }

.search-status:not(:empty) { margin-top: 8px; color: var(--muted); }

.result {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.result-title { font: 600 18px/1.3 var(--font-sans); }
.result .rows { margin-bottom: 0; }
.result-clear { justify-self: start; }

/* Luzon supply */

.supply { padding-top: 8px; margin-bottom: 24px; }

.supply-status { margin-bottom: 8px; }
.supply-status strong { color: var(--ink); }

.supply-figs { margin-bottom: 8px; }
.fig { display: inline-block; }

.fig-num {
  font: 600 16px/1.4 var(--font-num);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.supply-notes { display: grid; gap: 4px; }
.supply-notes .fig-num { font-size: 14px; font-weight: 400; }

/* Layer switch */

.switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.switch button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}

.switch button[aria-pressed="true"] { background: var(--s-fill); color: var(--on-s); }

/* Headline answer: one sentence for a place and a time */

.answer {
  display: block;
  width: 100%;
  margin-bottom: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

button.answer:hover .answer-meta { color: var(--ink); }

.answer-text {
  display: block;
  font: 800 32px/1.05 var(--font-head);
}

.answer-fig {
  color: var(--s);
  font: 600 .8em/1 var(--font-num);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.answer-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

@media (min-width: 760px) {
  .answer-text { font-size: 44px; }
}

.eyebrow {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

/* Rows */

.rows { display: grid; gap: 8px; margin-bottom: 24px; }

.row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  text-align: left;
}

.row-top { grid-template-columns: 1fr auto; }

.datebox {
  display: block;
  padding: 4px 0;
  border-radius: 6px;
  background: var(--surface-2);
  text-align: center;
}

.datebox .day { display: block; font: 600 22px/1.1 var(--font-num); font-variant-numeric: tabular-nums; }
.datebox .month { display: block; font-size: 14px; color: var(--muted); }

.row-title { display: block; font-weight: 600; }
.row-sub { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  border: 1px solid var(--muted);
  border-radius: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
}

.count { font: 600 16px/1 var(--font-num); font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); margin-bottom: 24px; }

/* Since 2018 */

.body { margin-bottom: 16px; }

.heading {
  margin-bottom: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
  font: 800 28px/1 var(--font-head);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.legend { display: grid; gap: 12px; margin-bottom: 24px; }

.legend-ramp {
  display: grid;
  grid-template-columns: auto repeat(5, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.sw { display: block; height: 16px; }

.range {
  font: 400 14px/1 var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  text-align: center;
}

.grid-note { margin-bottom: 24px; }

.legend-item { display: flex; align-items: center; gap: 8px; }

.sw-mark {
  width: 24px;
  height: 24px;
  border: 3px solid var(--mark);
  outline: 5px solid var(--mark-halo);
  outline-offset: -8px;
}

.sw-approx {
  position: relative;
  width: 24px;
  height: 24px;
  border: 1px dashed var(--ink);
}

.sw-approx::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--heat-3);
  opacity: .45;
}

/* Grid view: plants by fuel, with filters, and the line and substation legend */

.fuel-cols {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 40px 56px 24px;
  gap: 8px;
  align-items: center;
  padding: 0 4px;
}

.fuel-head { padding-bottom: 4px; }

.fuel-num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.fuel-head .fuel-num { font-family: var(--font-sans); }

.fuel-row {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

@media (hover: hover) {
  .fuel-row:hover { background: var(--surface-2); }
}
.fuel-row[aria-pressed="false"] { color: var(--muted); }
.fuel-row .fuel-num { font-size: 14px; }

.fuel-total {
  min-height: 44px;
  margin-bottom: 16px;
  border-top: 1px solid var(--line);
  font-weight: 600;
}

.fuel-total .fuel-num { font-size: 14px; font-weight: 600; }

/* A fuel's colour (set as --sw); a hollow ring when the fuel is hidden or has no capacity. */
.sw-dot {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--sw);
  border-radius: 50%;
  background: var(--sw);
}

.sw-dot.sw-sm { width: 12px; height: 12px; }
.fuel-row[aria-pressed="false"] .sw-dot { background: transparent; }
.sw-ring { --sw: var(--muted); background: transparent; }

.sw-line { display: block; flex: none; width: 32px; }

.sw-sub {
  display: block;
  flex: none;
  width: 10px;
  height: 10px;
  margin: 0 11px;
  border-radius: 50%;
  background: var(--kv-230);
  box-shadow: 0 0 0 1px var(--ink);
}

.detail-fuel { display: flex; align-items: center; gap: 8px; }
.detail-link { margin-top: 16px; }
.detail-note { margin-top: 12px; }

/* Footer */

.foot { padding-top: 8px; border-top: 1px solid var(--line); }
.foot-links { display: flex; gap: 16px; }

.link-btn {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* About */

.lockup-stacked { display: block; width: 240px; height: auto; margin: 40px auto 24px; color: var(--ink); }
#about-dialog .about { gap: 12px; }
#about-dialog a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }

/* Sources dialog */

.about { display: grid; gap: 8px; margin-top: 12px; }

.sources { display: grid; gap: 4px; margin-top: 8px; }
.sources a { display: flex; align-items: center; min-height: 44px; }
.licence { display: block; }

/* Time slider */

.slider-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.slider-label { font-size: 16px; }

.slider-track { position: relative; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--ink); }

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  margin-top: -10px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--s-fill);
}

input[type="range"]::-moz-range-track { height: 4px; background: var(--ink); }

input[type="range"]::-moz-range-thumb {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--s-fill);
}

.ticks { position: relative; height: 24px; }

.tick {
  position: absolute;
  top: 0;
  height: 20px;
  padding-left: 4px;
  border-left: 1px solid var(--muted);
  font: 400 12px/20px var(--font-sans);
  color: var(--muted);
  white-space: nowrap;
}

.tick-now {
  position: absolute;
  top: -12px;
  width: 2px;
  height: 12px;
  margin-left: -1px;
  background: var(--ink);
}

/* Notice detail */

dialog {
  position: fixed;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg);
  box-shadow: var(--shadow);
  color: var(--ink);
  inset: auto 0 0 0;
  width: 100%;
  max-width: none;
  max-height: 80svh;
  overflow-y: auto;
}

dialog::backdrop { background: transparent; }

@media (min-width: 900px) {
  dialog { inset: var(--float) var(--float) var(--float) auto; width: 480px; height: auto; max-height: none; border-radius: var(--radius); }
}

.detail-close { position: absolute; top: 8px; right: 8px; }

.detail-title {
  margin: 4px 52px 8px 0;
  font: 800 28px/1 var(--font-head);
  letter-spacing: .01em;
  text-transform: uppercase;
}

.detail-block { padding: 12px 0; border-top: 1px solid var(--line); }
.detail-block:first-of-type { margin-top: 12px; }

.detail-label { font-size: 14px; font-weight: 600; margin-top: 8px; }

.streets { display: grid; gap: 4px; margin-top: 4px; font-size: 14px; }

.detail-reason { padding: 12px 0 16px; border-top: 1px solid var(--line); }

/* MapLibre controls, popup and attribution */

.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin: 0 16px 16px 0; }

.maplibregl-ctrl-group,
.maplibregl-ctrl-group:not(:empty) {
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: none;
}

.maplibregl-ctrl-group button {
  width: 44px;
  height: 44px;
  border-radius: 0;
  color: var(--ink);
}

.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }

.maplibregl-ctrl-group button:focus,
.maplibregl-ctrl-attrib-button:focus { box-shadow: none; }

.maplibregl-ctrl-group button:focus:first-child,
.maplibregl-ctrl-group button:focus:last-child { border-radius: 0; }

.maplibregl-ctrl-group button:not(:disabled):hover { background: var(--surface); }

.maplibregl-ctrl button .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon,
.maplibregl-ctrl button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon {
  display: grid;
  place-items: center;
  background-image: none;
}

.maplibregl-ctrl.maplibregl-ctrl-attrib {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.4 var(--font-sans);
}

.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact {
  min-height: 44px;
  padding: 0 44px 0 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
}

.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact-show {
  box-sizing: border-box;
  max-width: calc(100vw - 32px);
  padding: 12px 52px 12px 12px;
}

.maplibregl-ctrl-attrib a { color: var(--ink); }

/* MapLibre's own rule shows this button as a block; the extra classes make it a centred grid. */
.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button,
.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
  display: grid;
  place-items: center;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  border-radius: 0;
  background: transparent;
  background-image: none;
  color: var(--ink);
}

.maplibregl-ctrl-attrib-button:hover { background: var(--surface); }

.maplibregl-popup-content {
  padding: 12px 48px 12px 12px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  box-shadow: none;
  font: 400 14px/1.4 var(--font-sans);
}

.maplibregl-popup-tip { display: none; }

.maplibregl-popup-close-button {
  width: 44px;
  height: 44px;
  border-radius: 0;
  font-size: 24px;
  color: var(--ink);
}

.maplibregl-popup-close-button:hover { background: var(--surface); }

.popup-name { font-size: 16px; font-weight: 600; }
.popup-town { color: var(--muted); }
.popup p { margin-top: 4px; }
.popup .btn-secondary { margin-top: 8px; }
