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

:root {
  --bg: #ffffff;
  --surface: #f2f2f2;
  --surface-2: #e2e2e2;
  --ink: #111111;
  --muted: #545454;
  --faint: #8a8a8a;
  --line: #cfcfcf;
  --rule: #111111;
  --focus: #111111;

  --accent: #ffd200;
  --accent-ink: #111111;
  --tag-fg: #111111;
  --btn-bg: #111111;
  --btn-fg: #ffd200;

  --hero-bg: #ffd200;
  --hero-fg: #111111;
  --hero-muted: #3d3500;

  --alert-yellow: #ffd200;
  --alert-red: #c4161c;

  --map-land: #ececec;
  --map-water: #d6dde3;
  --map-road: #ffffff;
  --map-label: #545454;
  --map-grid: #6b6b6b;
  --mark: #111111;
  --mark-halo: #ffffff;

  --heat-1: #fff0a0;
  --heat-2: #ffd200;
  --heat-3: #ff9f1c;
  --heat-4: #e5560b;
  --heat-5: #8c2300;

  --display: "Big Shoulders Display", "Atkinson Hyperlegible", sans-serif;
  --sans: "Atkinson Hyperlegible", sans-serif;
  --mono: "Red Hat Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --surface: #1a1a1a;
    --surface-2: #272727;
    --ink: #f2f2f2;
    --muted: #a9a9a9;
    --faint: #5a5a5a;
    --line: #343434;
    --rule: #ffd200;
    --focus: #ffd200;
    --accent-ink: #ffd200;
    --btn-bg: #ffd200;
    --btn-fg: #111111;
    --alert-red: #ff6b6b;
    --map-land: #1f1f1f;
    --map-water: #10161b;
    --map-road: #2e2e2e;
    --map-label: #a9a9a9;
    --map-grid: #8f8f8f;
    --mark: #ffffff;
    --mark-halo: #111111;
    --heat-1: #3d3400;
    --heat-2: #7a6400;
    --heat-3: #c29400;
    --heat-4: #ffc21a;
    --heat-5: #fff07a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --surface: #1a1a1a;
  --surface-2: #272727;
  --ink: #f2f2f2;
  --muted: #a9a9a9;
  --faint: #5a5a5a;
  --line: #343434;
  --rule: #ffd200;
  --focus: #ffd200;
  --accent-ink: #ffd200;
  --btn-bg: #ffd200;
  --btn-fg: #111111;
  --alert-red: #ff6b6b;
  --map-land: #1f1f1f;
  --map-water: #10161b;
  --map-road: #2e2e2e;
  --map-label: #a9a9a9;
  --map-grid: #8f8f8f;
  --mark: #ffffff;
  --mark-halo: #111111;
  --heat-1: #3d3400;
  --heat-2: #7a6400;
  --heat-3: #c29400;
  --heat-4: #ffc21a;
  --heat-5: #fff07a;
  color-scheme: dark;
}

/* Base */

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

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.4 var(--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: 0;
  cursor: pointer;
}

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

[hidden] { display: none !important; }

.small { font-size: 13px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-weight: 500; 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);
  background: transparent;
  color: var(--ink);
  font: 700 15px/1 var(--sans);
  text-decoration: none;
}

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

.masthead { padding: 16px 16px 12px; background: var(--bg); }

.masthead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.title {
  font: 800 34px/1 var(--display);
  letter-spacing: .01em;
  text-transform: uppercase;
}

.masthead p { margin-top: 4px; }

.grid-strip,
.slider-bar {
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 12px;
}

.grid-strip { margin: 0 16px 16px; border-top: 3px solid var(--rule); }

.map-wrap { position: relative; height: 60svh; }
#map { position: absolute; inset: 0; background: var(--map-land); }

.slider-bar { margin: 16px; }

.panel { padding: 0 16px 32px; }

@media (min-width: 900px) {
  body {
    display: grid;
    grid-template-columns: 360px 1fr;
    grid-template-rows: auto 1fr;
    height: 100svh;
    overflow: hidden;
  }
  .masthead { grid-column: 1; grid-row: 1; border-right: 1px solid var(--ink); }
  .panel {
    grid-column: 1;
    grid-row: 2;
    overflow-y: auto;
    border-right: 1px solid var(--ink);
    padding-top: 4px;
  }
  .map-wrap { grid-column: 2; grid-row: 1 / 3; height: auto; }
  .grid-strip { position: fixed; top: 16px; right: 16px; width: 320px; margin: 0; z-index: 3; }
  .slider-bar { position: fixed; left: 376px; right: 16px; bottom: 16px; margin: 0; z-index: 3; }
  .maplibregl-ctrl-bottom-right { bottom: var(--slider-space, 0px); }
}

/* Grid strip */

.grid-when { font-size: 13px; color: var(--muted); }

.grid-figs {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.grid-figs dt { font-size: 12px; color: var(--muted); }

.grid-figs dd {
  font: 700 18px/1.3 var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.grid-figs dd.low,
.grid-alert { color: var(--alert-red); }

.grid-alert { font-size: 12px; font-weight: 700; margin-top: 4px; }

.grid-other { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Layer switch */

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

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

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

/* Notice card */

.hero {
  display: block;
  width: 100%;
  padding: 16px;
  margin-bottom: 16px;
  border: 3px solid var(--hero-fg);
  background: var(--hero-bg);
  color: var(--hero-fg);
  text-align: left;
}

.eyebrow,
.unit {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero .eyebrow,
.hero .unit,
.hero .count-label,
.hero .window { color: var(--hero-muted); }

.hero-title {
  display: block;
  margin-top: 4px;
  font: 800 34px/1 var(--display);
  letter-spacing: .01em;
  text-transform: uppercase;
}

.count-label {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 4px;
}

.countdown > span { display: block; }

.digits {
  display: block;
  font: 700 clamp(34px, 9vw, 46px)/1 var(--mono);
  font-variant-numeric: tabular-nums;
}

.unit { font-size: 11px; margin-top: 4px; }

.window { display: block; margin-top: 12px; }

/* 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);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

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

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

.datebox .day { display: block; font: 700 22px/1.1 var(--mono); }
.datebox .month { display: block; font-size: 12px; color: var(--muted); }

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

.tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  background: var(--accent);
  color: var(--tag-fg);
  font-size: 12px;
  font-weight: 700;
}

.count { font: 700 15px/1 var(--mono); font-variant-numeric: tabular-nums; }

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

/* Since 2018 */

.body { margin-bottom: 16px; }

.heading {
  margin-bottom: 8px;
  font: 800 24px/1 var(--display);
  letter-spacing: .01em;
  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: 500 12px/1 var(--mono);
  color: var(--muted);
  text-align: center;
}

.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;
}

/* Footer */

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

.foot-heading { font-size: 13px; font-weight: 700; color: var(--ink); margin-top: 8px; }

.sources { display: grid; gap: 4px; }
.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: 15px; }

.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: 0;
  background: var(--accent);
}

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: 0;
  background: var(--accent);
}

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

.tick {
  position: absolute;
  top: 0;
  height: 20px;
  padding-left: 4px;
  border-left: 1px solid var(--faint);
  font: 500 12px/20px var(--mono);
  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(--ink);
  border-radius: 0;
  background: var(--bg);
  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: 0 0 0 auto; width: 480px; height: 100svh; max-height: none; }
}

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

.detail-title {
  margin: 4px 52px 8px 0;
  font: 800 28px/1 var(--display);
  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: 13px; font-weight: 700; margin-top: 8px; }

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

.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) {
  border: 1px solid var(--ink);
  border-radius: 0;
  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 12px/1.4 var(--sans);
}

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

.maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact-show { padding: 12px 52px 12px 12px; }

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

.maplibregl-ctrl-attrib-button,
.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: 0;
  background: var(--bg);
  color: var(--ink);
  box-shadow: none;
  font: 400 13px/1.4 var(--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: 15px; font-weight: 700; }
.popup-town { color: var(--muted); }
.popup p { margin-top: 4px; }
.popup .btn-secondary { margin-top: 8px; }
