/* Deliberately minimal. Structure only - restyle later. */

:root {
  --bg: #05070d;
  /* Sidebar and panel sit on a frosted scrim so the text stays readable
     over bright terrain. Raise the last number for more opacity; swap to
     rgba(255,255,255,0.10) for a white scrim (and darken --ink to suit). */
  /* Marker icon colours. Read by app.js at startup and applied to the
     3D icon materials, so the palette lives here with everything else.
     Changing one needs a page reload, not just a repaint. */
  --icon-place:    #c8402f;
  --icon-mountain: #d98b3a;
  --icon-dive:     #3f9dc4;
  --icon-water:    #3f9dc4;
  --icon-poi:      #c9a227;
  --icon-cluster:  #e8ecf4;

  --glass: rgba(12, 17, 27, 0.55);
  --glass-edge: rgba(255, 255, 255, 0.14);
  --ink: #e8ecf4;
  --ink-dim: #8b97ad;
  --line: rgba(255, 255, 255, 0.12);
  --sidebar-w: 290px;
  --panel-w: 340px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

#globe { position: fixed; inset: 0; }

/* ---------- Site title ---------- */

#siteTitle {
  position: fixed;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 2;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* ---------- Sidebar ---------- */

#sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--sidebar-w);
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;

  background: var(--glass);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-left: 1px solid var(--glass-edge);
}

#sidebarScroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 64px 16px 20px;
}

#sidebarScroll::-webkit-scrollbar { width: 8px; }
#sidebarScroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}
#sidebarScroll::-webkit-scrollbar-track { background: transparent; }
#sidebarScroll { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.18) transparent; }

/* ---------- Totals ---------- */

#totals {
  display: flex;
  align-items: baseline;
}
#totals .stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
#totals .stat + .stat {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
#totals .big {
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
#totals .unit { font-size: 12px; color: var(--ink-dim); }

/* ---------- Block headings ---------- */

.block h2 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
}
.block h2 .ico {
  width: 21px;
  height: 21px;
  flex: none;
  color: var(--ink-dim);
}
.block ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ---------- Continents ---------- */

.continent {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 4px;
  cursor: pointer;
}
.continent:hover { background: rgba(255, 255, 255, 0.06); }
.continent.active { background: rgba(255, 255, 255, 0.1); }

.continent .swatch { width: 10px; height: 10px; border-radius: 50%; }
.continent .label { font-size: 14px; }
.continent .count {
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- Extremes ---------- */

.extreme {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 10px;
  padding: 7px 9px;
  border-radius: 4px;
  cursor: pointer;
}
.extreme:hover { background: rgba(255, 255, 255, 0.06); }

.extreme .label {
  grid-column: 1 / -1;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.extreme .place { font-size: 14px; }
.extreme .value {
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------- Slide-in detail panel ---------- */

#panel {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--panel-w);
  max-width: 88vw;
  height: 100%;
  padding: 22px 20px;
  overflow-y: auto;
  background: var(--glass);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  z-index: 3;
}
#panel.open { transform: translateX(0); }

#panelClose {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  color: var(--ink-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

#panel .eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
#panel h2 { margin: 0 0 4px; font-size: 21px; font-weight: 600; }
#panel .coords {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
}
#panel .desc { color: var(--ink-dim); font-size: 14px; }

#panel .photos { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
#panel figure { margin: 0; }
#panel img { width: 100%; border-radius: 5px; display: block; }
#panel figcaption { margin-top: 5px; font-size: 12px; color: var(--ink-dim); }

.missing {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 5px;
  font-size: 12px;
  color: var(--ink-dim);
}

#loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-dim);
  z-index: 4;
  pointer-events: none;
}
#loading.done { display: none; }

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

/* ---------- Cursor tooltip (screen-space picking) ---------- */

#tip {
  position: fixed;
  z-index: 5;
  max-width: 260px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(8, 12, 20, 0.94);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
#tip.show { opacity: 1; }
#tip .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
#tip em { color: var(--ink-dim); font-style: normal; font-size: 12px; }
#tip .more {
  display: block;
  margin-top: 4px;
  color: var(--ink-dim);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Panel: several entries at once ---------- */

#panel .stack {
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
#panel .entry + .entry {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
