:root {
  --ink: #020403;
  --panel: rgba(6, 12, 9, 0.78);
  --line: rgba(225, 254, 144, 0.16);
  --mint: #8fe3b8;
  --mint-dim: rgba(170, 225, 196, 0.55);
  --paper: #f3ead6;
  --paper-dim: rgba(243, 234, 214, 0.72);
  --gold: #E1FE90;   /* accents (active layer, onward buttons, legend headings): the header's lime; the gold mineral keeps its own hex */
  --red: #ff3b30;
  /* the site's three families: Inter Tight for titles and big numbers, Geist for running
     text, Geist Mono for labels (uppercase, tracked) */
  --serif: "Inter Tight", "Helvetica Neue", Arial, sans-serif; /* titles (the old name, kept) */
  --text: "Geist", "Helvetica Neue", Arial, sans-serif;        /* running text */
  --mono: "Geist Mono", ui-monospace, monospace;            /* labels */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--text);
  -webkit-font-smoothing: antialiased;
}

canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; cursor: grab; }
canvas#gl:active { cursor: grabbing; }

#grain {
  position: fixed; inset: -50%;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: screen;
  animation: grain 0.9s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); } 60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible { outline: 1px solid var(--mint); outline-offset: 2px; }

/* ---------- left rail ---------- */
#rail {
  position: fixed; top: 64px; left: 0; bottom: 0; width: 380px; /* starts below the header, so nothing scrolls under it */
  padding: 20px 28px 26px 18px; /* content starts where the header's left box does (18px, shared/nav.css) */
  display: flex; flex-direction: column; gap: 34px;
  background: linear-gradient(90deg, rgba(2, 4, 3, 0.92) 0%, rgba(2, 4, 3, 0.6) 75%, rgba(2, 4, 3, 0) 100%);
  pointer-events: none;
}
#rail > * { pointer-events: auto; }

.kicker, .sub, #rail h2, #rail footer, .layer .badge {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint-dim);
}
h1 { font-family: var(--serif); font-weight: 500; font-size: 25px; line-height: 1.1; margin: 10px 0 8px; letter-spacing: -0.015em; }
.sub { letter-spacing: 0.08em; font-size: 8.5px; white-space: nowrap; }

.layers-head { display: grid; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
#rail h2 { font-weight: 400; }
#view { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid rgba(225, 254, 144, 0.3); }
#view button {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  justify-content: center; padding: 8px 10px; color: var(--mint-dim);
  transition: background 0.3s, color 0.3s;
}
#view button + button { border-left: 1px solid rgba(225, 254, 144, 0.3); }
#view button svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; }
#view button:hover { color: var(--paper); }
#view button[aria-checked="true"] { color: var(--ink); background: #E1FE90; }   /* the header's lime */
:root[data-theme="light"] #view button[aria-checked="true"] { color: #ffffff; background: #1f7a4f; }
:root[data-theme="light"] #view, :root[data-theme="light"] #view button + button { border-color: rgba(31, 122, 79, 0.4); }

#layer-list { list-style: none; }
.layer { display: flex; align-items: center; border-bottom: 1px solid var(--line); transition: opacity 0.4s; }
.layer.off { opacity: 0.4; }
.layer .focus {
  flex: 1; display: grid; grid-template-columns: 1fr; align-items: center; gap: 4px 6px;
  text-align: left; padding: 13px 0;
}
.layer .name { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--paper); }
.layer .meta { display: flex; align-items: center; gap: 8px; }
.layer .swatch { display: flex; gap: 3px; }
.layer .swatch i { width: 7px; height: 7px; border-radius: 50%; display: block; }
.layer .badge { font-size: 8px; letter-spacing: 0.14em; padding: 1px 5px; border: 1px solid rgba(170, 225, 196, 0.3); }
.layer .badge.modelled, .layer .badge.illustrative, .layer .badge.mixed { color: #ffd98a; border-color: rgba(255, 217, 138, 0.4); }
.layer .eye { width: 30px; height: 30px; display: grid; place-items: center; color: var(--mint-dim); }
.layer .eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.2; }
.layer .eye:hover { color: var(--paper); }
.layer.active .name { color: var(--gold); }
.layer .focus:hover .name { color: #fff; }

#rail footer { margin-top: auto; display: grid; gap: 8px; font-size: 8.5px; line-height: 1.7; letter-spacing: 0.12em; }
#rail footer .status { color: #ffd98a; opacity: 0.75; }

/* ---------- right panel ---------- */
#panel {
  position: fixed; top: 70px; right: 18px; bottom: 24px; width: 360px; /* right edge on the header's (18px) */
  padding: 28px 28px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s;
}
#panel[hidden] { display: block; transform: translateX(420px); opacity: 0; pointer-events: none; }

.p-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 6px; }
.p-badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; padding: 3px 7px; border: 1px solid rgba(170, 225, 196, 0.35); color: var(--mint); }
.p-badge.modelled, .p-badge.illustrative, .p-badge.mixed { color: #ffd98a; border-color: rgba(255, 217, 138, 0.45); }
.p-name { font-family: var(--serif); font-weight: 500; font-size: 23px; line-height: 1.12; letter-spacing: -0.015em; margin-bottom: 10px; }
.p-summary { font-family: var(--serif); font-weight: 500; font-size: 15.5px; line-height: 1.38; letter-spacing: -0.01em; color: var(--paper-dim); margin-bottom: 22px; }

.p-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; padding: 18px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.p-stat b { display: block; font-family: var(--serif); font-weight: 500; font-size: 23px; line-height: 1.15; letter-spacing: -0.015em; color: var(--paper); font-variant-numeric: tabular-nums; }
.p-stat span { display: block; margin-top: 5px; font-family: var(--mono); font-size: 8.5px; line-height: 1.55; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mint-dim); }
.p-stat.wide { grid-column: span 2; }

.p-section { margin-bottom: 20px; }
.p-section h3 { font-family: var(--mono); font-weight: 400; font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint-dim); margin-bottom: 10px; }
.p-body { font-family: var(--text); font-size: 13.5px; line-height: 1.6; color: var(--paper-dim); margin-bottom: 22px; }

.legend { display: grid; gap: 7px; }
.legend div { display: flex; align-items: center; gap: 10px; font-size: 11px; line-height: 1.45; color: var(--paper-dim); }
.legend i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.legend i.ring { background: none !important; border: 1.5px solid; }
.legend i.diamond, .layer .swatch i.diamond { border-radius: 0; width: 7px; height: 7px; transform: rotate(45deg); margin: 0 1px; }   /* armed groups: the map's diamonds */
.legend i.cross { border-radius: 0; background: none !important; position: relative; }
.legend i.cross::before, .legend i.cross::after { content: ""; position: absolute; left: 4px; top: -1px; width: 1.5px; height: 11px; background: var(--c, #fff); }
.legend i.cross::before { transform: rotate(45deg); } .legend i.cross::after { transform: rotate(-45deg); }

.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--mono); font-size: 8px; fill: var(--mint-dim); letter-spacing: 0.06em; }
.chart .note { font-size: 10px; line-height: 1.55; color: var(--mint-dim); margin-top: 6px; }

.table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--paper-dim); line-height: 1.5; }
.table td:first-child { color: var(--mint); width: 26%; padding-right: 8px; }

.sources { list-style: none; display: grid; gap: 7px; }
.sources a { font-size: 10px; line-height: 1.55; color: var(--mint-dim); text-decoration: none; border-bottom: 1px solid rgba(170, 225, 196, 0.18); }
.sources a:hover { color: var(--paper); }

/* ---------- 3D labels ---------- */
#labels { position: fixed; inset: 0; pointer-events: none; }
.tag {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-dim);
  white-space: nowrap; transition: opacity 0.4s;
  will-change: transform;
}
.tag::before { content: ""; width: 44px; height: 1px; background: rgba(243, 234, 214, 0.4); }
.tag em { font-style: normal; font-family: var(--serif); font-weight: 500; font-size: 14.5px; letter-spacing: -0.01em; color: var(--mint); text-transform: none; }
.tag.left { flex-direction: row-reverse; }
.tag.left::before { margin-left: 0; }
.tag.active { color: var(--gold); }
.tag.active em { color: var(--gold); }

#compass { position: fixed; right: 34px; bottom: 30px; width: 40px; height: 40px; transition: right 0.5s; }
@media (prefers-reduced-motion: reduce) { #compass { transition: none; } }
body.panel-open #compass { right: 410px; }
#compass svg { width: 40px; height: 40px; fill: none; stroke: var(--mint-dim); stroke-width: 1; transition: transform 0.2s linear; }
#compass path { fill: var(--mint-dim); stroke: none; }
#compass span { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-family: var(--mono); font-size: 8px; letter-spacing: 0.2em; color: var(--mint-dim); }

@media (prefers-reduced-motion: reduce) { #grain { animation: none; } }

/* interim logo, top centre */
.logo {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  width: 150px; height: auto;
  pointer-events: none; user-select: none;
  z-index: 5;
}

/* link from the minerals layer to prototype 03 */
.p-cta {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 22px; padding: 13px 16px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none;
  color: var(--ink); background: var(--gold);
  box-shadow: 0 0 24px rgba(225, 254, 144, 0.25);
  transition: box-shadow 0.3s, transform 0.3s;
}
.p-cta:hover { box-shadow: 0 0 36px rgba(225, 254, 144, 0.45); transform: translateY(-1px); }

/* arriving from the intro: the land rises out of the dark, then the interface */
body.intro-in:not(.intro-handoff) canvas#gl { animation: glIn 1.6s ease-out both; } /* no frame to fade from: rise out of black */
#handoff { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover; z-index: 4; pointer-events: none; transition: opacity 1.4s ease; }
#handoff.out { opacity: 0; }
body.intro-in #rail, body.intro-in #labels, body.intro-in #compass { animation: uiIn 1.4s ease 1.8s both; }
body.arriving:not(.intro-in) :is(#rail, #labels, #compass, #poi-layer, #poi-counter, #layer-cta, #panel) { opacity: 0; pointer-events: none; } /* #182 */
@keyframes glIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes uiIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* the selected layers' legend: a box under the layer list, like the panel on the right */
#rail-legend { background: var(--panel); border: 1px solid var(--line); padding: 16px 18px 18px; backdrop-filter: blur(10px); }
#rail-legend[hidden] { display: none; }
#rail-legend .rl-k { font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint-dim); margin-bottom: 14px; }
#rail-legend h3 { font-family: var(--mono); font-weight: 400; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); margin-bottom: 10px; }
#rail-legend .legend div { font-size: 11px; line-height: 1.45; }

/* the way onward from the selected layers: bottom centre */
/* stacked right above the 'Places explored' tag, on the same centre line */
#layer-cta { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); z-index: 20; display: flex; justify-content: center; gap: 12px; animation: ctaIn 0.6s ease both; }
#layer-cta[hidden] { display: none; }
#layer-cta .cta {
  display: inline-flex; align-items: center; gap: 26px; padding: 14px 20px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  color: var(--ink); background: var(--gold); box-shadow: 0 0 26px rgba(225, 254, 144, 0.28);
  transition: box-shadow 0.3s, transform 0.3s;
}
#layer-cta .cta:hover, #layer-cta .cta:focus-visible { box-shadow: 0 0 40px rgba(225, 254, 144, 0.5); transform: translateY(-2px); outline: none; }
@keyframes ctaIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }

/* several selected layers: stacked cards in the right panel, which scrolls */
#panel { overscroll-behavior: contain; scroll-behavior: smooth; }
.p-card { position: relative; }
.p-card + .p-card { margin-top: 30px; padding-top: 28px; border-top: 1px solid rgba(255, 208, 96, 0.35); }
.p-x { margin-left: 12px; font-family: var(--mono); font-size: 18px; line-height: 1; color: var(--mint-dim); }
.p-x:hover, .p-x:focus-visible { color: var(--paper); }
.p-head { align-items: center; }
.p-head .p-badge { margin-left: auto; }
.p-bar { position: sticky; top: -28px; z-index: 2; display: flex; justify-content: space-between; align-items: center; margin: -28px -28px 18px; padding: 12px 28px;
  background: rgba(6, 12, 9, 0.96); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--mint-dim); }
.p-clear { font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid rgba(225, 254, 144, 0.4); }
.p-clear:hover { color: var(--paper); }
#rail-legend .rl + .rl { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
#rail h2 small { display: block; margin-top: 4px; font-size: 8px; letter-spacing: 0.08em; text-transform: none; opacity: 0.8; }

/* the rail scrolls when several legends are open, and stays clear of the in-progress links */
#rail { overflow-y: auto; padding-bottom: 96px !important; scrollbar-width: thin; scrollbar-color: rgba(225, 254, 144, 0.25) transparent; }
.tag i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--mint); }
/* the last layer shown can't be hidden: its eye shakes instead */
.layer .eye.nope { animation: nope 0.36s; }
@keyframes nope { 20%, 60% { transform: translateX(-2px); } 40%, 80% { transform: translateX(2px); } }
@media (prefers-reduced-motion: reduce) { .layer .eye.nope { animation: none; } }

/* ---------- points of interest (draped view) ---------- */
#poi-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8; transition: opacity 0.5s; }
#poi-layer.off { opacity: 0; }
#poi-layer.off .poi { pointer-events: none; }
/* subtle: a small cream dot with a slow pulse; once opened, a hollow ring */
.poi { position: absolute; left: -12px; top: -12px; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; opacity: 0.8; transition: opacity 0.3s; }
.poi::before { content: ""; position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; transform: translate(-50%, -50%); border-radius: 50%; box-sizing: border-box;
  background: #2fb6ff; border: 1.5px solid #f3ead6; box-shadow: 0 0 0 1.5px rgba(2, 4, 3, 0.7), 0 0 10px rgba(47, 182, 255, 0.7); transition: background 0.3s, width 0.2s, height 0.2s; }
.poi .pulse { position: absolute; left: 50%; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; border: 1px solid rgba(47, 182, 255, 0.9); animation: poiPulse 3s ease-out infinite; }
.poi.done::before { background: rgba(2, 4, 3, 0.55); border: 2px solid #2fb6ff; width: 12px; height: 12px; box-shadow: 0 0 0 1.5px rgba(2, 4, 3, 0.7); }
.poi.done .pulse { display: none; }
.poi.lit, .poi:hover, .poi.open, .poi:focus-visible { opacity: 1; outline: none; }
.poi:hover::before, .poi.open::before, .poi:focus-visible::before { width: 14px; height: 14px; }
.poi.lit::before { box-shadow: 0 0 0 1.5px rgba(2, 4, 3, 0.7), 0 0 14px rgba(47, 182, 255, 0.95); }
.poi.open::before { border-color: #ffd060; }
#poi-counter .ring { border-color: #2fb6ff !important; }
@keyframes poiPulse { 0% { transform: scale(1); opacity: 0.9; } 80%, 100% { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .poi .pulse { animation: none; } }

#poi-tip { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; padding: 5px 9px; background: rgba(6, 12, 9, 0.95); border: 1px solid rgba(255, 208, 96, 0.4);
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; color: var(--paper); white-space: nowrap; }
#poi-tip[hidden] { display: none; }

/* the card sits in the left rail, under the layer list, aligned with it */
#poi-card { position: relative; flex: none;
  padding: 14px 16px 12px; background: rgba(6, 12, 9, 0.95); border: 1px solid rgba(255, 208, 96, 0.45); backdrop-filter: blur(10px);
  animation: poiIn 0.35s ease both; }
#poi-card[hidden] { display: none; }
@keyframes poiIn { from { opacity: 0; } to { opacity: 1; } }
#poi-card .pc-x { position: absolute; top: 8px; right: 10px; font-family: var(--mono); font-size: 18px; color: var(--mint-dim); }
#poi-card .pc-x:hover { color: var(--paper); }
#poi-card h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; margin: 0 22px 8px 0; }
#poi-card .pc-n { display: flex; gap: 10px; align-items: baseline; margin-bottom: 8px; }
#poi-card .pc-n b { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.1; letter-spacing: -0.015em; color: #ffd060; white-space: nowrap; font-variant-numeric: tabular-nums; }
#poi-card .pc-n span { font-size: 10.5px; line-height: 1.45; color: var(--paper-dim); }
#poi-card .pc-t { font-family: var(--text); font-size: 12.5px; line-height: 1.55; color: var(--paper-dim); margin-bottom: 10px; }
#poi-card .pc-layers { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-bottom: 10px; }
#poi-card .pl { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--paper); }
#poi-card .pl i { width: 7px; height: 7px; border-radius: 50%; }
#poi-card .pc-show { width: 100%; display: flex; justify-content: space-between; padding: 8px 11px; margin-bottom: 10px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: var(--gold); }
#poi-card .pc-show:hover { box-shadow: 0 0 20px rgba(225, 254, 144, 0.45); }
#poi-card .pc-src { font-size: 9.5px; line-height: 1.55; color: var(--mint-dim); }
#poi-card .pc-src a { color: var(--mint-dim); }
#poi-card .pc-src a:hover { color: var(--paper); }
#poi-card .pc-tag { display: inline-block; margin-right: 8px; padding: 1px 5px; border: 1px solid rgba(170, 225, 196, 0.35); font-family: var(--mono); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mint); }
#poi-card .pc-tag.reported, #poi-card .pc-tag.estimated { color: #ffd98a; border-color: rgba(255, 217, 138, 0.45); }

#poi-counter { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 9px;
  padding: 6px 12px; background: rgba(4, 9, 7, 0.8); border: 1px solid var(--line);
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mint-dim); opacity: 0; transition: opacity 0.5s; pointer-events: none; }
#poi-counter.on { opacity: 1; }
#poi-counter b { font-weight: 400; color: var(--gold); }
#poi-counter .ring { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #ffd060; }
body.intro-in #poi-layer, body.intro-in #poi-counter.on { animation: uiIn 1.4s ease 2.2s both; }

/* small screens: a narrower, denser left panel, so the map keeps its room */
@media (max-width: 1280px) {
  #panel { width: 310px; padding: 22px 22px 20px; }
  body.panel-open #compass { right: 360px; }
  #rail { width: 320px; padding: 16px 22px 96px 18px !important; gap: 22px; }
  .layer .focus { padding: 10px 0; }
  .layer .name { font-size: 10.5px; }
  #rail-legend { padding: 12px 14px 14px; }
  #rail-legend .legend div { font-size: 9.5px; }
  #poi-card { padding: 12px 14px 10px; }
  #poi-card h3 { font-size: 16px; }
  #poi-card .pc-t { font-size: 12px; }
}
@media (max-width: 1024px) {
  #panel { width: 280px; }
  body.panel-open #compass { right: 330px; }
  #rail { width: 272px; padding: 14px 18px 96px !important; gap: 18px; }
  .layer .focus { padding: 8px 0; }
  #poi-card .pc-n b { font-size: 21px; }
}

/* ---------- the opening story (once, arriving from the intro) ---------- */
#story { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); width: min(920px, 100% - 64px); height: 7.5em; pointer-events: none; z-index: 30;
  font-family: var(--serif); font-weight: 500; font-size: clamp(17px, 1.7vw, 25px); line-height: 1.3; letter-spacing: -0.01em; text-align: center; color: var(--paper); }
#story p { position: absolute; left: 0; right: 0; bottom: 0; opacity: 0; transform: translateY(14px); text-wrap: balance;
  transition: opacity 1.1s ease, transform 1.1s ease; text-shadow: 0 0 18px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.9); }
#story p.on { opacity: 1; transform: none; }
/* the side panels, counter and points wait for the story; the points arrive with the last line */
body.story #rail, body.story #labels, body.story #compass, body.story #poi-counter, body.story #layer-cta, body.story #panel {
  animation: none !important; opacity: 0 !important; pointer-events: none !important; }
body.story:not(.story-points) #poi-layer { animation: none !important; opacity: 0 !important; }
body.story #poi-layer .poi { pointer-events: none; }
body.story.story-points #poi-layer { animation: none !important; opacity: 1; }
body.story.story-points .poi .pulse { animation: poiBeckon 1.6s ease-out 3; }
@keyframes poiBeckon { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(4.2); opacity: 0; } }
body.story-done #rail, body.story-done #labels, body.story-done #compass, body.story-done #poi-counter.on { animation: uiIn 1.2s ease both; }

/* ---------- light mode (shared/theme.js) ----------
   The 3D model washes its terrain toward paper and swaps its colours (model.js,
   setTheme); the data colours in the panels swap through theme-colors.js. */
:root[data-theme="light"] {
  --ink: #ffffff; --panel: rgba(255, 255, 255, 0.9); --line: rgba(22, 70, 45, 0.18);
  --mint: #1f7a4f; --mint-dim: rgba(26, 92, 60, 0.72); --paper: #16211b; --paper-dim: rgba(22, 33, 27, 0.72);
  --gold: #1f7a4f; --red: #d62a20;
}
:root[data-theme="light"] #grain { display: none; }
:root[data-theme="light"] #rail { background: linear-gradient(90deg, rgba(255, 255, 255, 0.94) 0%, rgba(255, 255, 255, 0.62) 75%, rgba(255, 255, 255, 0) 100%); }
:root[data-theme="light"] .p-bar, :root[data-theme="light"] #poi-tip, :root[data-theme="light"] #poi-card { background: rgba(255, 255, 255, 0.96); }
:root[data-theme="light"] #poi-card { border-color: rgba(138, 93, 0, 0.4); }
:root[data-theme="light"] #layer-cta .cta { box-shadow: 0 0 22px rgba(138, 93, 0, 0.22); }
:root[data-theme="light"] .tag, :root[data-theme="light"] #story p { text-shadow: 0 0 14px rgba(255, 255, 255, 0.95), 0 0 4px rgba(255, 255, 255, 0.9); }
/* the points of interest: a deeper blue with a dark edge on paper */
:root[data-theme="light"] .poi::before { background: #1479c4; border-color: #ffffff; box-shadow: 0 0 0 1.5px rgba(22, 33, 27, 0.55), 0 0 8px rgba(20, 121, 196, 0.45); }
:root[data-theme="light"] .poi.done::before { background: rgba(255, 255, 255, 0.7); border-color: #1479c4; }
:root[data-theme="light"] .poi.lit::before { box-shadow: 0 0 0 1.5px rgba(22, 33, 27, 0.55), 0 0 12px rgba(20, 121, 196, 0.7); }
:root[data-theme="light"] #poi-counter .ring { border-color: #1479c4 !important; }
:root[data-theme="light"] .tag::before { background: rgba(22, 33, 27, 0.35); }
:root[data-theme="light"] #poi-counter { background: rgba(255, 255, 255, 0.92); }
:root[data-theme="light"] .p-badge.modelled, :root[data-theme="light"] .p-badge.illustrative, :root[data-theme="light"] .p-badge.mixed { color: #8a5d00; border-color: rgba(138, 93, 0, 0.45); }

/* ---------- armed groups: diamonds on the draped map and their card (groups.js) ---------- */
#gz-layer { position: fixed; inset: 0; pointer-events: none; z-index: 8; opacity: 0; transition: opacity 0.5s; }
#gz-layer.on { opacity: 1; }
#gz-layer:not(.on) .gz { pointer-events: none; }
.gz { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; }
.gz::before { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; transform: translate(-50%, -50%) rotate(45deg);
  background: var(--ink); border: 2px solid var(--c, #3987e5); box-shadow: 0 0 0 1.5px rgba(2, 4, 3, 0.6); transition: width 0.2s, height 0.2s, background 0.2s; }
.gz:hover::before, .gz:focus-visible::before, .gz.open::before { width: 13px; height: 13px; background: var(--c, #3987e5); }
.gz:focus-visible { outline: none; }
#zone-card { position: relative; flex: none; padding: 14px 16px 12px; background: var(--panel); border: 1px solid rgba(57, 135, 229, 0.5); backdrop-filter: blur(10px);
  max-height: calc(100vh - 360px); overflow-y: auto; scrollbar-width: thin; }
#zone-card[hidden] { display: none; }
#zone-card .pc-x { position: absolute; top: 8px; right: 10px; font-family: var(--mono); font-size: 18px; color: var(--mint-dim); }
#zone-card .pc-x:hover { color: var(--paper); }
#zone-card .zc-k { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint-dim); margin-bottom: 4px; }
#zone-card h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; line-height: 1.15; letter-spacing: -0.01em; margin: 0 22px 10px 0; }
#zone-card .zc-entry { padding-top: 10px; border-top: 1px solid var(--line); margin-top: 10px; }
#zone-card .zc-entry:first-of-type { margin-top: 0; }
#zone-card .zc-group { display: flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper); }
#zone-card .zc-group i { width: 8px; height: 8px; transform: rotate(45deg); flex: none; }
#zone-card .zc-hatch { color: var(--mint-dim); letter-spacing: 0; }
#zone-card .zc-fac { font-size: 10.5px; color: var(--paper-dim); margin: 3px 0 0 15px; }
#zone-card .zc-rel { font-family: var(--mono); font-size: 9px; letter-spacing: 0.06em; color: var(--mint-dim); margin: 6px 0; }
#zone-card .zc-rel b { font-weight: 400; color: var(--gold); text-transform: uppercase; letter-spacing: 0.12em; }
#zone-card .zc-t { font-family: var(--text); font-size: 12.5px; line-height: 1.55; color: var(--paper-dim); margin-bottom: 6px; }
#zone-card .zc-src { font-size: 9.5px; line-height: 1.55; color: var(--mint-dim); }
#zone-card .zc-src a { color: var(--mint-dim); }
#zone-card .zc-src a:hover { color: var(--paper); }
#zone-card .zc-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 9.5px; line-height: 1.55; color: var(--mint-dim); }
.p-badge.reported { color: #ffd98a; border-color: rgba(255, 217, 138, 0.45); }
:root[data-theme="light"] .p-badge.reported { color: #8a5d00; border-color: rgba(138, 93, 0, 0.45); }
:root[data-theme="light"] .gz::before { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.8); }
:root[data-theme="light"] #zone-card { background: rgba(255, 255, 255, 0.96); border-color: rgba(42, 120, 214, 0.45); }
#panel .table.zones tr { cursor: pointer; }
#panel .p-note { font-size: 11px; line-height: 1.5; color: var(--paper-dim); margin: 0 0 8px; }
#panel .table.zones .kind-h { font-family: var(--mono); font-size: 9px; color: var(--mint-dim); margin-left: 4px; }
#panel .table.zones tr:hover td { color: var(--paper); }
#panel .table.zones i.zd { display: inline-block; width: 8px; height: 8px; margin-left: 5px; transform: rotate(45deg); }
#panel .table.zones td:last-child { text-align: right; white-space: nowrap; }
#panel .table.zones td:first-child { width: 100%; }
#zone-card details.zc-src summary { cursor: pointer; font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.12em; text-transform: uppercase; list-style: none; }
#zone-card details.zc-src summary::before { content: "+ "; }
#zone-card details.zc-src[open] summary::before { content: "– "; }
#zone-card details.zc-src a { display: block; margin-top: 5px; }
/* SOSOrinoco's places and mercury sites (#135): the model draws the marks, these are their hit targets */
.gz::before { background: transparent !important; border-color: transparent !important; box-shadow: none !important; }
.gz:hover::before, .gz:focus-visible::before, .gz.open::before { background: transparent !important; border: 1.5px solid var(--paper) !important; }
.gz.hg { width: var(--d, 22px); height: var(--d, 22px); left: calc(var(--d, 22px) / -2); top: calc(var(--d, 22px) / -2); cursor: default; }
.gz.hg::before { transform: translate(-50%, -50%); border-radius: 50%; width: 100% !important; height: 100% !important; }
.gz.hg:focus-visible { outline: none; }
.gz[hidden] { display: none; }
#zone-card { max-height: min(62vh, 640px); overflow-y: auto; scrollbar-width: thin; }
#zone-card .zc-group i { margin-right: -3px; }
#zone-card .zc-group span { margin-left: 4px; text-transform: none; letter-spacing: 0.04em; }
#zone-card .zc-also { margin: -6px 0 8px 0; }
#zone-card .zc-rel.zc-first { margin: 0 0 5px; }   /* the event type first, then the group (#141) */
#zone-card .zc-rel.zc-first + .zc-group { margin-bottom: 6px; }
#zone-card .zc-src a { text-decoration: none; }
#zone-card .zc-more { font: inherit; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; white-space: nowrap; }
#zone-card .zc-more:hover, #zone-card .zc-more:focus-visible { color: var(--paper); outline: none; text-decoration: underline; }
#zone-card .hg-counts { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 2px 0 10px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em; color: var(--paper-dim); }
#zone-card .hg-c i, #zone-card .hg-table td i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 0; border: 1px solid var(--silver, #dfe6ee); }
#zone-card .hg-x100 i, #zone-card .hg-x10 i, #zone-card .hg-above i { background: var(--silver, #dfe6ee); }
#zone-card .hg-flag i { border-style: dashed; opacity: 0.6; }
#zone-card .hg-list { list-style: none; margin: 0; padding: 0; }
#zone-card .hg-list li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.45; color: var(--paper-dim); }
#zone-card .hg-list li p:first-child { color: var(--paper); }
#zone-card .hg-list li b { font-weight: 500; }
#zone-card .hg-list li span, #zone-card .hg-list .hg-st { color: var(--mint-dim); font-size: 10px; }
#zone-card .hg-list li i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; border: 1px solid var(--silver, #dfe6ee); }
#zone-card .hg-list li.hg-x100 i, #zone-card .hg-list li.hg-x10 i, #zone-card .hg-list li.hg-above i { background: var(--silver, #dfe6ee); }
#zone-card .hg-list li.hg-flag i { border-style: dashed; opacity: 0.6; }
:root[data-theme="light"] #zone-card .hg-list li i { border-color: #2980db; }
:root[data-theme="light"] #zone-card .hg-list li.hg-x100 i, :root[data-theme="light"] #zone-card .hg-list li.hg-x10 i, :root[data-theme="light"] #zone-card .hg-list li.hg-above i { background: #2980db; }
#zone-card .hg-table { width: 100%; border-collapse: collapse; font-size: 10.5px; line-height: 1.4; color: var(--paper-dim); }
#zone-card .hg-table th { text-align: left; font-family: var(--mono); font-weight: 400; font-size: 8px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mint-dim); padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
#zone-card .hg-table td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
#zone-card .hg-table td b { font-weight: 500; color: var(--paper); }
#zone-card .hg-table td span { color: var(--mint-dim); }
#zone-card .hg-table td:nth-child(2) { white-space: nowrap; color: var(--paper); }
#zone-card .hg-below td:nth-child(2) i, #zone-card .hg-flag td:nth-child(2) i { background: none; }
:root[data-theme="light"] #zone-card .hg-c i, :root[data-theme="light"] #zone-card .hg-table td i { border-color: #2980db; }
:root[data-theme="light"] #zone-card .hg-x100 i, :root[data-theme="light"] #zone-card .hg-x10 i, :root[data-theme="light"] #zone-card .hg-above i { background: #2980db; }
/* the side panels sit above the map's markers (points of interest, armed-group diamonds:
   z-index 8) and below the onward buttons (20) and tooltips (30) */
#rail, #panel { z-index: 12; }
/* light mode: the onward buttons and the point card's button in the header's green, with white text */
:root[data-theme="light"] #layer-cta .cta, :root[data-theme="light"] #poi-card .pc-show { background: #1f7a4f; color: #ffffff; }
/* a point's on-the-ground photo, under its title */
#poi-card .pc-photo { margin: 2px 0 10px; }
#poi-card .pc-photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border: 1px solid var(--line); background: rgba(225, 254, 144, 0.06); }
#poi-card .pc-photo figcaption { margin-top: 5px; font-size: 9.5px; line-height: 1.5; color: var(--paper-dim); }
#poi-card .pc-photo figcaption span, #poi-card .pc-photo figcaption a { color: var(--mint-dim); }
/* light mode: a hovered layer name goes dark green, not white (white vanished on the white page) */
:root[data-theme="light"] .layer .focus:hover .name { color: #1f7a4f; }

/* =====================================================================================
   PHONES (760px and under). The header folds into a menu (shared/nav.css); here the
   layer list becomes a dock of chips along the bottom, and the layer info, point and
   armed-group cards become bottom sheets (mobile.js moves the legend and the onward
   buttons into the layer sheet, and handles the dragging).
   ===================================================================================== */
.sheet-grip { display: none; }
@media (max-width: 760px) {
  /* ---- the dock: view switch, then the layers as chips ---- */
  #rail { top: auto !important; left: 0; right: 0; bottom: 0; width: auto !important; z-index: 14;
    padding: 26px 0 12px !important; gap: 10px; overflow: visible !important;
    background: linear-gradient(0deg, rgba(2, 4, 3, 0.96) 0%, rgba(2, 4, 3, 0.88) 62%, rgba(2, 4, 3, 0) 100%); }
  #rail .layers { display: flex; flex-direction: column; gap: 10px; }
  .layers-head { padding: 0 12px; border: 0; }
  #view { width: 230px; }
  #view button { padding: 7px 8px; font-size: 9px; }
  #layer-list { display: flex; gap: 8px; overflow-x: auto; padding: 2px 12px; scroll-snap-type: x proximity; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  #layer-list::-webkit-scrollbar { display: none; }
  .layer { flex: none; border: 1px solid rgba(225, 254, 144, 0.3); border-radius: 18px; background: var(--panel); scroll-snap-align: start; }
  .layer:last-child { margin-right: 40px; }
  .layer .focus { display: flex; align-items: center; gap: 8px; padding: 8px 13px; }
  .layer .meta { order: -1; }
  .layer .name { font-size: 9.5px; letter-spacing: 0.12em; white-space: nowrap; }
  .layer .eye { display: none; } /* on phones a chip selects; showing and hiding stays a desktop control */
  .layer.active { border-color: var(--gold); background: rgba(225, 254, 144, 0.14); }

  /* ---- the layer sheet ---- */
  #panel { top: auto; left: 0; right: 0; bottom: var(--dock-h, 100px); width: auto; z-index: 13;
    height: 46vh; height: 46dvh; padding: 0 18px; display: flex; flex-direction: column; overflow: hidden;
    border: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    transform: translateY(var(--drag, 0px)); transition: height 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.35s, opacity 0.3s; }
  #panel.dragging { transition: none; }
  #panel[hidden] { display: flex; transform: translateY(110%); }
  body.sheet-full #panel { height: calc(100vh - 64px - var(--dock-h, 100px)); height: calc(100dvh - 64px - var(--dock-h, 100px)); }
  body.sheet-mini #panel { height: 70px; }
  .sheet-grip { display: block; flex: none; width: 100%; height: 26px; position: relative; cursor: grab; touch-action: none; }
  .sheet-grip::before { content: ""; position: absolute; left: 50%; top: 10px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(243, 234, 214, 0.35); }
  #panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; }
  .p-bar { top: 0; margin: 0 -18px 14px; padding: 8px 18px; }
  .p-name { font-size: 20px; }
  .p-summary { font-size: 14.5px; margin-bottom: 16px; }
  .p-stat b { font-size: 21px; }
  #panel #rail-legend { margin-bottom: 18px; padding: 12px 14px 14px; }
  /* the onward buttons: the sheet's footer */
  #panel #layer-cta { position: static; transform: none; animation: none; flex: none; display: grid; justify-content: stretch; gap: 8px; padding: 10px 0 14px; border-top: 1px solid var(--line); }
  #panel #layer-cta[hidden], body.sheet-mini #panel #layer-cta { display: none; }
  #panel #layer-cta .cta { justify-content: space-between; padding: 12px 16px; }

  /* ---- the point and armed-group cards: sheets over the dock ---- */
  #poi-card, #zone-card { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 66vh; max-height: 66dvh; overflow-y: auto;
    padding: 30px 18px 18px; border-radius: 14px 14px 0 0; border-width: 1px 0 0; overscroll-behavior: contain;
    transform: translateY(var(--drag, 0px)); transition: transform 0.3s; animation: sheetUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  #poi-card.dragging, #zone-card.dragging { transition: none; }
  #poi-card::before, #zone-card::before { content: ""; position: absolute; left: 50%; top: 11px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: rgba(243, 234, 214, 0.35); }
  #poi-card .pc-x, #zone-card .pc-x { top: 14px; right: 14px; width: 32px; height: 32px; font-size: 22px; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }

  /* ---- things on the map ---- */
  #poi-counter { bottom: calc(var(--dock-h, 100px) + 10px); white-space: nowrap; width: max-content; }
  #labels { display: none; } /* the stack's floating names: no room beside it; the chips name each layer */
  body.panel-open #poi-counter { opacity: 0 !important; pointer-events: none; }
  #compass, body.panel-open #compass { top: 74px; bottom: auto; right: 14px; width: 34px; height: 34px; }
  #compass svg { width: 34px; height: 34px; }
  .poi { width: 34px; height: 34px; left: -17px; top: -17px; } /* a finger-sized target; the dot stays small */
  .gz { width: 32px; height: 32px; left: -16px; top: -16px; }
  .tag { font-size: 9px; letter-spacing: 0.12em; }
  .tag::before { width: 22px; }
  .tag em { font-size: 12.5px; }
  #story { bottom: 86px; width: calc(100% - 32px); height: 9em; font-size: 16px; }

  /* ---- light mode ---- */
  :root[data-theme="light"] #rail { background: linear-gradient(0deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 255, 255, 0.9) 62%, rgba(255, 255, 255, 0) 100%); }
  :root[data-theme="light"] .layer { border-color: rgba(31, 122, 79, 0.35); }
  :root[data-theme="light"] .layer.active { border-color: #1f7a4f; background: rgba(31, 122, 79, 0.14); }
  :root[data-theme="light"] .sheet-grip::before, :root[data-theme="light"] #poi-card::before, :root[data-theme="light"] #zone-card::before { background: rgba(22, 33, 27, 0.25); }
}
/* armed groups panel: the five kinds of group */
#panel .kinds { display: grid; gap: 12px; }
#panel .kind-n { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--paper); }
#panel .kind-n i.zd { display: inline-block; width: 8px; height: 8px; transform: rotate(45deg); flex: none; }
#panel .kind-h { color: var(--mint-dim); letter-spacing: 0; }
#panel .kind-t { margin: 4px 0 0 16px; font-family: var(--text); font-size: 12.5px; line-height: 1.55; color: var(--paper-dim); }
.p-head { justify-content: flex-end; } /* the status badges are gone: the close button keeps the right */
/* a point's figure: the label beside it starts at the top of the number, not its baseline */
#poi-card .pc-n { align-items: flex-start; }
#poi-card .pc-n span { padding-top: 4px; }
/* sources past two fold under "+ Sources (n)", as on the armed-group cards */
details.src-drop summary { cursor: pointer; list-style: none; font-family: var(--mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mint-dim); }
details.src-drop summary::-webkit-details-marker { display: none; }
details.src-drop summary::before { content: "+ "; }
details.src-drop[open] summary::before { content: "– "; }
details.src-drop summary:hover { color: var(--paper); }
details.src-drop .sources { margin-top: 10px; }
#poi-card details.pc-drop { margin-top: 6px; }
#poi-card details.pc-drop summary { font-size: 8.5px; letter-spacing: 0.12em; }
#poi-card details.pc-drop a { display: block; margin-top: 5px; font-size: 9.5px; line-height: 1.5; color: var(--mint-dim); }
#poi-card details.pc-drop a:hover { color: var(--paper); }
/* the layer labels and point markers are created at the top-left corner and only placed
   by the first frame, after the points and armed-group data have loaded: hidden until then
   (no inline transform yet), so nothing flashes above the header on load */
.tag:not([style*="transform"]), .poi:not([style*="transform"]), .gz:not([style*="transform"]) { visibility: hidden; }
