:root {
  --bg: #0F1214;
  --panel: #13171A;
  --raised: #1C2126;
  --line: #262C32;
  --line-2: #2E353C;
  --text: #E8EAED;
  --muted: #B4BCC5;
  --faint: #9AA3AD;
  --amber: #F2B45C;
  --blue: #6CC4E8;
  --topbar: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, sans-serif;
  display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--topbar); flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--amber); }
.brand span { color: var(--text); font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 18px; white-space: nowrap; }

.modes { margin-left: auto; display: flex; background: var(--raised); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; }
.modes button { height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; color: #C9CFD6; cursor: pointer; font-size: 13px; font-weight: 500; }
.modes button.active { background: var(--amber); color: var(--bg); }

.search { position: relative; display: flex; align-items: center; gap: 8px; height: 38px; width: 240px; padding: 0 12px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 10px; color: var(--faint); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); font-size: 14px; }
.search ul { position: absolute; top: 42px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: #171B1F; border: 1px solid var(--line-2); border-radius: 10px; z-index: 20; max-height: 300px; overflow-y: auto; }
.search li { padding: 10px; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 14px; }
.search li[aria-selected="true"], .search li:hover { background: #2A3138; }

/* ---------- layout ---------- */
.layout { flex: 1 1 auto; display: flex; min-height: 0; }
.panel {
  width: 360px; flex: 0 0 auto; overflow-y: auto;
  padding: 24px 20px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px;
}
.eyebrow { font-size: 12px; letter-spacing: 1.2px; color: var(--amber); font-weight: 600; }
.intro h1 { margin: 8px 0; font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: 26px; line-height: 1.2; }
.intro p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--muted); }
.label { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; color: var(--faint); margin-bottom: 8px; }

.stories { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stories button {
  width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left;
  padding: 12px; min-height: 44px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); background: transparent;
}
.stories button[aria-current="true"] { border-color: var(--amber); background: #1F252B; }
.stories .num { flex: 0 0 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; background: #2A3138; }
.stories button[aria-current="true"] .num { background: var(--amber); color: var(--bg); }
.stories .title { display: block; font-weight: 600; font-size: 15px; }
.stories .text { display: none; margin-top: 4px; font-size: 13px; line-height: 1.5; color: var(--muted); }
.stories button[aria-current="true"] .text { display: block; }

.pager { display: none; gap: 10px; }
.pager button { flex: 1; height: 46px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--raised); cursor: pointer; font-weight: 500; }
.pager button.primary { border: 0; background: var(--amber); color: var(--bg); font-weight: 600; }

/* ---------- maps ---------- */
.maps { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; background: #1d2a33; }
.map { position: absolute; inset: 0; }
.map.top { clip-path: inset(0 50% 0 0); }
.map.top .maplibregl-canvas { background: transparent; }

.badge { position: absolute; top: 16px; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(15,18,20,0.85); font-size: 13px; color: var(--muted); pointer-events: none; }
.badge b { color: var(--text); }
.badge.left { left: 16px; }
.badge.right { right: 16px; }
.dot { width: 10px; height: 10px; border-radius: 5px; }
.dot.amber { background: var(--amber); } .dot.blue { background: var(--blue); }
.amber-text { color: var(--amber); }

.swipe-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgba(0,0,0,0.6); z-index: 6; pointer-events: none; }
.swipe-handle {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 7;
  width: 48px; height: 48px; border-radius: 24px; border: 2px solid #fff; background: var(--bg); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: ew-resize; touch-action: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
}
.swipe-handle:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.fade { position: absolute; left: 50%; bottom: 48px; transform: translateX(-50%); z-index: 7; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 12px; background: rgba(15,18,20,0.9); font-size: 13px; font-weight: 600; }
.fade input { width: 220px; accent-color: var(--amber); }


/* controls were moved out of the bottom map (see app.js); keep them above both maps */
.maps > .maplibregl-control-container > div { z-index: 7; }

/* MapLibre controls in the dark theme */
.maplibregl-ctrl-group { background: #171B1F; border: 1px solid var(--line-2); }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: rgba(15,18,20,0.85) !important; color: var(--muted); font-size: 11px; }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-scale { background: rgba(15,18,20,0.85); color: #C9CFD6; border-color: #C9CFD6; }
.maplibregl-popup-content { background: #171B1F; color: var(--text); border: 1px solid #333B43; border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.maplibregl-popup-tip { border-top-color: #171B1F !important; border-bottom-color: #171B1F !important; }
.maplibregl-popup-close-button { color: var(--faint); font-size: 18px; width: 32px; height: 32px; }
.popup-title { font-weight: 600; color: var(--amber); margin-bottom: 4px; }

.story-pin { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.story-pin .pin-shape { width: 30px; height: 30px; margin-bottom: 4px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: #2A3138; border: 2px solid var(--bg); box-shadow: 0 2px 6px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; }
.story-pin .pin-shape span { transform: rotate(45deg); font-size: 13px; font-weight: 600; color: var(--text); }
.story-pin.active .pin-shape { background: var(--amber); }
.story-pin.active .pin-shape span { color: var(--bg); }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .brand span { font-size: 16px; }
  .search { position: absolute; top: calc(var(--topbar) + 56px); left: 12px; right: 12px; width: auto; z-index: 9; }
  .layout { flex-direction: column-reverse; }
  .panel { width: auto; max-height: 42vh; border-right: 0; border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 16px; gap: 12px; }
  .intro p, .intro h1 { display: none; }
  .stories button { display: none; }
  .stories button[aria-current="true"] { display: flex; border: 0; background: transparent; padding: 0; }
  .pager { display: flex; }
  .badge { top: 12px; font-size: 12px; }
  .badge.left { left: 12px; } .badge.right { right: 12px; }
  .badge .long { display: none; }
  .fade input { width: 150px; }
}
