/* Earthdar. An instrument panel for the planet: pale sky-blue field, black type, green controls.
   Rules: square corners everywhere, 1px black rules, and every group of buttons is ONE strip of connected tabs (no gaps, shared borders).
   Nothing sits on the map except what the active tab needs. */

@font-face { font-family: "B612"; font-weight: 100 549; font-display: swap; src: url("/fonts/B612-Regular.ttf") format("truetype"); }
@font-face { font-family: "B612"; font-weight: 550 900; font-display: swap; src: url("/fonts/B612-Bold.ttf") format("truetype"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 100 599; font-display: swap; src: url("/fonts/BarlowSemiCondensed-Medium.ttf") format("truetype"); }
@font-face { font-family: "Barlow Semi Condensed"; font-weight: 600 900; font-display: swap; src: url("/fonts/BarlowSemiCondensed-Bold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 100 549; font-display: swap; src: url("/fonts/IBMPlexMono-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 550 900; font-display: swap; src: url("/fonts/IBMPlexMono-SemiBold.ttf") format("truetype"); }

:root {
  color-scheme: light;
  --sky: #cfe9fb;         /* the page */
  --sky-2: #b4dbf5;       /* idle tabs */
  --paper: #eaf6ff;       /* panels */
  --ink: #000;            /* text and rules */
  --green: #2fb457;       /* active tab, primary action */
  --green-hover: #46cc6e;
  --font: "B612", system-ui, "Segoe UI", Arial, sans-serif;
  --font-head: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --bar: 48px;
}

*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html, body { height: 100%; margin: 0; }
body { background: var(--sky); color: var(--ink); font: 400 1rem/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-underline-offset: .2em; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: stretch; height: var(--bar); border-bottom: 1px solid var(--ink); background: var(--sky); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-right: 1px solid var(--ink); font: 700 1.5rem/1 var(--font-head); letter-spacing: .12em; text-transform: uppercase; text-decoration: none; }
.brand svg { width: 22px; height: 22px; flex: none; }
.spacer { flex: 1; }

/* ---------- connected tabs ---------- */
.tabs { display: flex; align-items: stretch; }
.tabs > :is(a, button) {
  display: flex; align-items: center; justify-content: center; min-width: 88px; padding: 0 18px; margin: 0 0 0 -1px;
  border: 0; border-left: 1px solid var(--ink); border-right: 1px solid var(--ink);
  background: var(--sky-2); color: var(--ink); font: 700 1rem/1 var(--font-head); letter-spacing: .1em; text-transform: uppercase; text-decoration: none; cursor: pointer;
}
.tabs > :is(a, button):first-child { margin-left: 0; }
.tabs > :is(a, button):hover { background: var(--paper); }
.tabs > :is(a, button)[aria-selected="true"], .tabs > :is(a, button)[aria-current="page"] { background: var(--green); }
.tabs > :is(a, button)[aria-selected="true"]:hover { background: var(--green-hover); }
.bar .tabs > :is(a, button) { min-height: 100%; }
.bar .tabs:last-child > :last-child { border-right: 0; }

/* ---------- map stage ---------- */
.stage { position: relative; height: calc(100% - var(--bar)); min-height: 320px; }
#map { position: absolute; inset: 0; }

/* the active layer's own controls: one strip along the bottom-left, nothing else floats on the map */
.dock { position: absolute; left: 12px; bottom: 28px; z-index: 3; display: flex; align-items: stretch; background: var(--sky); border: 1px solid var(--ink); }
.dock .tabs > :is(a, button) { min-height: 40px; min-width: 60px; padding: 0 14px; }
.dock .tabs:first-child > :first-child { border-left: 0; }
.dock .tabs:last-child > :last-child { border-right: 0; }
.readout { display: flex; align-items: center; min-height: 40px; padding: 0 14px; border-left: 1px solid var(--ink); font: 400 .9rem/1 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout b { font-weight: 600; }
.dock input[type="range"] { align-self: center; width: 170px; margin: 0 12px; accent-color: #000; }

.notice { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 4; background: var(--sky); border: 1px solid var(--ink); padding: 8px 14px; font: 400 .9rem/1.3 var(--font-mono); max-width: calc(100% - 24px); }

/* MapLibre's own bits, squared and in the same ink */
.maplibregl-ctrl-group { border-radius: 0 !important; border: 1px solid var(--ink); box-shadow: none !important; background: var(--sky) !important; }
.maplibregl-ctrl-group button { border-radius: 0 !important; }
.maplibregl-ctrl-attrib { background: rgba(207, 233, 251, .92) !important; color: #000 !important; font: 400 11px/1.3 var(--font-mono) !important; }
.maplibregl-ctrl-attrib a { color: #000 !important; }
.maplibregl-popup-content { border-radius: 0 !important; border: 1px solid var(--ink); background: var(--paper); color: #000; padding: 10px 12px; box-shadow: none; font: 400 .9rem/1.4 var(--font); }
.maplibregl-popup-content b { font: 700 1.05rem/1.2 var(--font-head); letter-spacing: .04em; text-transform: uppercase; display: block; }
.maplibregl-popup-content .m { font-family: var(--font-mono); font-size: .85rem; }
.maplibregl-popup-tip { display: none; }
.maplibregl-popup-close-button { font-size: 18px; padding: 0 6px; color: #000; }

/* ---------- plain pages (API, Sources) ---------- */
.page { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }
.page h1 { font: 700 2.4rem/1 var(--font-head); letter-spacing: .04em; text-transform: uppercase; margin: 0 0 18px; }
.page h2 { font: 700 1.3rem/1.1 var(--font-head); letter-spacing: .08em; text-transform: uppercase; margin: 32px 0 8px; border-top: 1px solid var(--ink); padding-top: 14px; }
.page p { margin: 0 0 14px; }
.page code, .page pre { font-family: var(--font-mono); font-size: .9rem; }
.page pre { background: var(--paper); border: 1px solid var(--ink); padding: 12px 14px; overflow-x: auto; margin: 0 0 14px; }
.page table { border-collapse: collapse; width: 100%; margin: 0 0 14px; background: var(--paper); }
.page th, .page td { border: 1px solid var(--ink); padding: 8px 10px; text-align: left; vertical-align: top; }
.page th { background: var(--sky-2); font: 700 .95rem/1.2 var(--font-head); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  :root { --bar: 44px; }
  .brand { padding: 0 10px; font-size: 1.2rem; letter-spacing: .08em; }
  .brand span { display: none; }
  .bar .tabs > :is(a, button) { min-width: 0; padding: 0 12px; font-size: .92rem; }
  .bar .tabs.minor { display: none; }
  .dock { left: 0; right: 0; bottom: 0; border-width: 1px 0 0; overflow-x: auto; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { margin-bottom: 41px; }
  .dock input[type="range"] { width: 110px; }
  .page h1 { font-size: 2rem; }
}
