/* FTW x OlmoEarth 2025. Ink-dark map so the embedding colours carry the page; one accent band
   (the spectrum) borrowed from the data itself. */
:root {
  --ink: #05090b;
  --panel: rgba(10, 18, 21, 0.82);
  --line: rgba(239, 234, 220, 0.12);
  --text: #efeadc;
  --muted: rgba(239, 234, 220, 0.62);
  --accent: #34c6b0;
  --spectrum: linear-gradient(90deg, #e3487a, #b04fd8, #6d5cf0, #3a8fe6, #34c6b0, #9bd35a, #f2a541);
  --font-heading: 'Sora', ui-sans-serif, sans-serif;
  --font-body: 'Manrope', ui-sans-serif, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --panel-w: 320px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 500 13px/1.45 var(--font-body);
  color: var(--text);
  overflow: hidden;
  background:
    radial-gradient(1000px 700px at 70% 40%, rgba(32, 72, 80, 0.4), transparent 65%),
    radial-gradient(800px 600px at 0% 100%, rgba(109, 92, 240, 0.12), transparent 60%),
    var(--ink);
}
#stars, #map { position: absolute; inset: 0; width: 100%; height: 100%; }
a { color: var(--text); text-decoration-color: rgba(239, 234, 220, 0.4); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); }

/* ---- panel ---- */
#panel {
  position: absolute;
  top: 16px; left: 16px;
  width: var(--panel-w);
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 20px 18px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  scrollbar-width: thin;
  animation: rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
#panel > * { animation: rise 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#panel > :nth-child(2) { animation-delay: 70ms; }
#panel > :nth-child(3) { animation-delay: 140ms; }
#panel > :nth-child(4) { animation-delay: 210ms; }
#panel > :nth-child(5) { animation-delay: 280ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { #panel, #panel > * { animation: none; } }

.eyebrow {
  margin: 0 0 6px;
  font: 600 10px/1.3 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 { margin: 0 0 8px; font: 600 20px/1.2 var(--font-heading); letter-spacing: -0.02em; }
h2 {
  margin: 0 0 8px;
  font: 600 10px/1 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.lede { margin: 0 0 12px; color: var(--muted); }
.spectrum { height: 4px; border-radius: 2px; background: var(--spectrum); opacity: 0.9; }
section, footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.fine { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.mono { font: 500 11px/1.4 var(--font-mono); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 3px; border-radius: 9px; background: rgba(0, 0, 0, 0.35); }
.seg button, .chips button {
  font: 600 12px/1 var(--font-body);
  color: var(--text);
  border: 0;
  cursor: pointer;
  transition: background-color 120ms, color 120ms;
}
.seg button { padding: 8px 0; border-radius: 7px; background: transparent; color: var(--muted); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed='true'] { background: var(--text); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 7px 10px; border-radius: 999px; background: rgba(239, 234, 220, 0.08); border: 1px solid var(--line); }
.chips button:hover { background: rgba(52, 198, 176, 0.18); border-color: rgba(52, 198, 176, 0.5); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 10px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend[hidden], .ramp-legend[hidden] { display: none; }
.ramp-legend { margin-top: 10px; }
.ramp { height: 10px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.ramp-labels { display: flex; justify-content: space-between; margin-top: 4px; font-size: 11px; color: var(--muted); }
.range { display: grid; grid-template-columns: auto 1fr 3.2em; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.range input { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.range input:disabled { opacity: 0.35; cursor: default; }
.range output { text-align: right; color: var(--text); }
.range:has(input:disabled) output { color: var(--muted); }

.facts { display: grid; gap: 8px; }
.facts div { display: grid; grid-template-columns: 92px 1fr; align-items: baseline; gap: 8px; }
.facts b { font: 600 14px/1.2 var(--font-heading); }
.facts span { color: var(--muted); font-size: 12px; }
footer #zoom { margin: 0; color: var(--accent); }

/* ---- map chrome ---- */
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.92); }
.ctrl-globe {
  background: no-repeat center / 18px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23efeadc' stroke-width='1.6'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18'/%3E%3C/svg%3E") !important;
}
.maplibregl-ctrl-attrib, .maplibregl-ctrl-scale { background: rgba(5, 9, 11, 0.7) !important; color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-scale { border-color: var(--muted); }
.popup .maplibregl-popup-content {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: 500 12px/1.5 var(--font-body);
  backdrop-filter: blur(10px);
}
.popup .maplibregl-popup-tip { display: none; }
.popup .pair { display: flex; align-items: center; gap: 6px; margin: 4px 0; color: var(--muted); }
.popup .mono { color: var(--muted); font-size: 10px; word-break: break-all; }
i.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }

#perf {
  position: absolute; right: 56px; top: 10px; margin: 0; padding: 8px 10px;
  font: 500 11px/1.4 var(--font-mono); color: var(--accent);
  background: rgba(5, 9, 11, 0.8); border: 1px solid var(--line); border-radius: 8px; pointer-events: none;
}

/* ---- phones: the panel becomes a bottom sheet ---- */
@media (max-width: 760px) {
  #panel {
    top: auto; left: 8px; right: 8px; bottom: 8px;
    width: auto;
    max-height: 42vh;
    padding: 14px 14px 10px;
  }
  h1 { font-size: 17px; }
  .lede, .facts { display: none; }
}
