/* ===========================================================================
   H&F Alpencross — visual system
   Dark, cinematic, alpine. Warm ochre for everything on foot, glacier cyan
   for everything airborne. Type: Fraunces (display) / Inter (UI) / Plex Mono.
   =========================================================================== */

:root {
  /* Sampled from the skywalk PACE "midnight sun": petrol, orange, bone, stone. */
  --petrol-deep:  #0c2733;
  --petrol:       #17475b;
  --petrol-light: #7cc0d8;
  --orange:       #e0872b;
  --orange-lift:  #f0a04d;
  --bone:         #f0eee8;
  --stone:        #c6cac5;

  --ink:        #081820;
  --surface:    #0e2029;
  --surface-2:  #143039;
  --surface-3:  #1c414f;
  --line:       rgba(240, 238, 232, 0.11);
  --line-soft:  rgba(240, 238, 232, 0.06);

  --text:       var(--bone);
  --text-dim:   #9fb6c0;
  --muted:      #6d8b97;

  --hike:       var(--orange);
  --hike-soft:  rgba(224, 135, 43, 0.16);
  --flight:     var(--petrol-light);
  --flight-soft:rgba(124, 192, 216, 0.16);
  --glide:      #5aa9dc;
  --warn:       #e0605a;
  --sel:        #ffffff;

  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  --shadow-md: 0 12px 32px -14px rgba(0, 0, 0, 0.8);

  --rail-w: 316px;
  --profile-h: 300px;
  --topbar-h: 58px;

  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.03em; }
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 600; color: var(--text); }

.mark { font-weight: 700; letter-spacing: -0.03em; color: var(--hike); }

.eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
  font-weight: 500;
}

/* Film grain over the whole page — kills banding in the big gradients. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─────────────────────────────── Topbar ─────────────────────────────── */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  z-index: 900;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 0 28px;
  background: rgba(8, 24, 32, 0.74);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  transform: translateY(-100%);
  transition: transform 0.45s var(--ease), border-color 0.45s var(--ease);
}
.topbar.is-visible { transform: none; border-bottom-color: var(--line); }

.topbar__brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar__nav { display: flex; gap: 26px; font-size: 13px; color: var(--text-dim); }
.topbar__nav a { position: relative; padding: 4px 0; transition: color 0.2s; }
.topbar__nav a:hover { color: var(--text); }
.topbar__nav a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: 0;
  height: 1px; background: var(--hike); transition: right 0.3s var(--ease);
}
.topbar__nav a:hover::after { right: 0; }
.topbar__meta {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ──────────────────────────────── Hero ──────────────────────────────── */

.hero {
  position: relative;
  /* Deliberately short: the map underneath should already be half visible when
     the page opens. */
  min-height: 54svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  isolation: isolate;
}

.hero__sky {
  position: absolute; inset: 0; z-index: -3;
  background:
    radial-gradient(120% 80% at 68% 88%, #6b4420 0%, transparent 55%),
    radial-gradient(90% 60% at 18% 95%, #123748 0%, transparent 60%),
    linear-gradient(180deg, #050f15 0%, #07202b 32%, #0d3345 56%, #1c4a5c 74%, #7a5127 93%, #a06a2c 100%);
}

/* Low alpine sun sitting just above the last ridge. */
.hero__sun {
  position: absolute; z-index: -3;
  left: 66%; bottom: 30%;
  width: 46vw; height: 46vw;
  transform: translate(-50%, 50%);
  background: radial-gradient(circle, rgba(240, 200, 140, 0.5) 0%, rgba(224, 135, 43, 0.2) 26%, transparent 62%);
  filter: blur(4px);
}

.hero__ridges { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; }

.hero__vignette {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(8, 24, 32, 0.82) 0%, transparent 24%, transparent 58%, rgba(8, 24, 32, 0.55) 88%, rgba(8, 24, 32, 0.85) 100%),
    radial-gradient(130% 95% at 50% 42%, transparent 44%, rgba(8, 24, 32, 0.58) 100%);
}

.hero__content {
  position: relative;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: clamp(76px, 9vh, 104px) clamp(28px, 5vw, 84px) clamp(22px, 3vh, 34px);
}

.hero__title {
  font-weight: 600;
  font-size: clamp(40px, 6.4vw, 104px);
  line-height: 0.94;
  letter-spacing: -0.05em;
  margin: 0 0 22px;
  text-wrap: balance;
}
.hero__title em { font-style: normal; font-weight: 600; color: var(--orange); }

.hero__lead {
  max-width: 56ch;
  font-size: clamp(15px, 1.15vw, 18px);
  color: var(--text-dim);
  margin: 0 0 40px;
  text-wrap: pretty;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  max-width: 1180px;
  margin: 0 0 20px;
  background: var(--line-soft);
  border-block: 1px solid var(--line);
}
.hero__stats > div {
  background: rgba(8, 24, 32, 0.4);
  backdrop-filter: blur(6px);
  padding: 13px 18px 12px;
}
.hero__stats dt {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.hero__stats dd {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(19px, 1.5vw, 25px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
}
.hero__stats dd small {
  font-size: 0.5em;
  color: var(--text-dim);
  margin-left: 4px;
  letter-spacing: 0;
}
.hero__stats .is-hike dd { color: var(--hike); }
.hero__stats .is-flight dd { color: var(--flight); }

/* ───────────────────────── App: map + profile ───────────────────────── */

.app {
  position: relative;
  height: 100svh;
  min-height: 720px;
  display: grid;
  grid-template-rows: 1fr var(--profile-h);
  border-top: 1px solid var(--line);
}

/* The rail is a column of the layout, not a panel floating over the map: it is
   needed constantly, and an overlay would keep stealing the map's edge. */
.app__map {
  position: relative;
  display: grid;
  grid-template-columns: 1fr var(--rail-w);
  min-height: 0;
  background: #071a22;
  /* No transition here: animating grid-template-columns between a var() and a
     literal leaves the property stuck at its old value in Chromium. */
}
.app__map.is-collapsed { grid-template-columns: 1fr 0; }

.app__stage { position: relative; overflow: hidden; min-width: 0; }
#map { position: absolute; inset: 0; }

/* MapLibre restyling */
.maplibregl-ctrl-group {
  background: rgba(14, 32, 41, 0.86) !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md) !important;
}
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--line-soft) !important; }
.maplibregl-ctrl-group button span { filter: invert(1) brightness(1.6); }
.maplibregl-ctrl-attrib {
  background: rgba(8, 24, 32, 0.7) !important;
  border-radius: 8px 0 0 0 !important;
  font-size: 10px !important;
}
.maplibregl-ctrl-attrib a { color: var(--text-dim) !important; }

/* Cursor readout, mirrors the profile hover */
.readout {
  position: absolute;
  left: 24px; bottom: 24px;
  z-index: 20;
  min-width: 230px;
  padding: 15px 18px 14px;
  background: rgba(10, 30, 39, 0.82);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(18px) saturate(140%);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
.readout__km {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.readout__rows { display: grid; gap: 5px; font-size: 12.5px; }
.readout__rows div { display: flex; justify-content: space-between; gap: 20px; }
.readout__rows span:first-child { color: var(--muted); }
.readout__rows span:last-child { font-family: var(--mono); }

/* ─────────────────────────────── Rail ──────────────────────────────── */

.rail {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(10, 30, 39, 0.94), rgba(10, 30, 39, 0.9));
  backdrop-filter: blur(22px) saturate(150%);
  border-left: 1px solid var(--line);
}

.rail__toggle {
  position: absolute;
  right: var(--rail-w); top: 18px;
  z-index: 40;
  width: 34px; height: 46px;
  display: grid; place-items: center;
  background: rgba(10, 30, 39, 0.9);
  border: 1px solid var(--line);
  border-right: none;
  border-radius: 10px 0 0 10px;
  color: var(--text-dim);
  cursor: pointer;
  backdrop-filter: blur(14px);
  transition: color 0.2s, background 0.2s, right 0.4s var(--ease);
}
.rail__toggle:hover { color: var(--text); background: rgba(28, 65, 79, 0.95); }
.app__map.is-collapsed .rail__toggle { right: 0; }
.app__map.is-collapsed .rail__toggle svg { transform: rotate(180deg); }

.rail__scroll {
  height: 100%;
  overflow-y: auto;
  /* Chain to the page instead of trapping the wheel: once the rail is at its
     end, scrolling on top of it must keep moving the page. */
  overscroll-behavior-y: auto;
  padding: 20px 20px 32px;
}
.rail__scroll::-webkit-scrollbar { width: 8px; }
.rail__scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.panel + .panel { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.panel__title {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-weight: 600;
}
.panel__hint { font-size: 12px; color: var(--muted); margin: -6px 0 14px; line-height: 1.5; }
.panel__note { font-size: 11.5px; color: var(--muted); margin-top: 12px; line-height: 1.5; font-family: var(--mono); }

.chips { display: flex; gap: 6px; margin-bottom: 16px; }
.chip {
  flex: 1;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: 0.18s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.chip.is-active { color: #1c1003; background: var(--hike); border-color: var(--hike); font-weight: 600; }

.ctrl { display: block; margin-bottom: 16px; }
.ctrl__label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--text-dim); margin-bottom: 8px;
}
.ctrl__label b { font-family: var(--mono); font-size: 12.5px; color: var(--text); font-weight: 500; }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(0, 0, 0, 0.6);
  transition: background 0.18s, transform 0.18s;
}
input[type=range]::-webkit-slider-thumb:hover { background: var(--hike); transform: scale(1.15); }
input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--surface); cursor: pointer;
}

.switches { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 4px; }
.sw {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--text-dim); cursor: pointer; user-select: none;
}
.sw input { position: absolute; opacity: 0; pointer-events: none; }
.sw span {
  width: 30px; height: 17px; flex: none;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  position: relative;
  transition: background 0.2s;
}
.sw span::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--muted);
  transition: transform 0.22s var(--ease), background 0.2s;
}
.sw input:checked + span { background: rgba(224, 135, 43, 0.3); border-color: rgba(224, 135, 43, 0.55); }
.sw input:checked + span::after { transform: translateX(13px); background: var(--hike); }
.sw:hover { color: var(--text); }

.btnrow { display: flex; gap: 8px; margin-top: 4px; }
.btn {
  flex: 1;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #235567; border-color: rgba(255, 255, 255, 0.18); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn--primary { background: var(--hike); border-color: var(--hike); color: #1c1003; font-weight: 600; }
.btn--primary:hover:not(:disabled) { background: var(--orange-lift); border-color: var(--orange-lift); }
.btn--ghost { background: transparent; flex: none; }

.progress {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 12px;
}
.progress i { display: block; height: 100%; width: 0; background: var(--flight); transition: width 0.2s linear; }

.drop {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}
.drop small { color: var(--muted); opacity: 0.7; }
.drop:hover, .drop.is-over { border-color: var(--hike); color: var(--text-dim); background: var(--hike-soft); }

.layers { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.layers li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
}
.layers li i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.layers li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layers li button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 2px 4px;
}
.layers li button:hover { color: var(--warn); }
.layers li.is-off { opacity: 0.45; }
.layers__empty { color: var(--muted); font-size: 12px; padding: 4px 2px; }

/* ────────────────────────────── Profile ────────────────────────────── */

.app__profile {
  position: relative;
  background: linear-gradient(180deg, #0b222c, var(--ink));
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.profile__bar {
  display: flex; align-items: center; gap: 26px;
  padding: 11px 24px;
  border-bottom: 1px solid var(--line-soft);
  min-height: 48px;
}
.legend { display: flex; gap: 18px; font-size: 11.5px; color: var(--muted); flex: none; }
.legend__item { display: flex; align-items: center; gap: 7px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; }
.sw-hike { background: var(--hike); }
.sw-flight { background: var(--flight); }
.sw-ground { background: #3d5c68; }

.selection { flex: 1; font-size: 12.5px; min-width: 0; }
.selection__idle { color: var(--muted); }
.selection__data { display: flex; gap: 22px; flex-wrap: wrap; align-items: baseline; }
.selection__data em { font-style: normal; color: var(--muted); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-right: 7px; }
.selection__data b { font-family: var(--mono); font-weight: 500; font-size: 13.5px; }
.profile__actions { display: flex; gap: 8px; flex: none; }

.profile__plot { position: relative; min-height: 0; cursor: crosshair; }
#profile-canvas { display: block; width: 100%; height: 100%; }

.profile__flags { position: absolute; inset: 0; pointer-events: none; }
.profile__flags .flag {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(10, 30, 39, 0.86);
  border: 1px solid var(--line);
  color: var(--text-dim);
}
.profile__flags .flag.is-flight { color: var(--flight); border-color: rgba(124, 192, 216, 0.35); }

.profile__cursor {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.profile__cursor::after {
  content: ''; position: absolute; left: -4px; width: 9px; height: 9px;
  border-radius: 50%; background: var(--text);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5);
  top: var(--dot, 50%); margin-top: -4px;
}
.profile__tip {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -100%);
  padding: 8px 11px;
  background: rgba(10, 30, 39, 0.94);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}
.profile__tip b { color: var(--hike); font-weight: 500; }
.profile__tip.is-flight b { color: var(--flight); }

/* ────────────────────────────── Sections ───────────────────────────── */

.section { padding: clamp(64px, 8vh, 110px) 0 clamp(56px, 7vh, 90px); }
.section--alt { background: linear-gradient(180deg, #0b222c, var(--ink)); border-top: 1px solid var(--line); }
.section__head {
  max-width: 1680px;
  margin: 0 auto clamp(30px, 4vh, 48px);
  padding: 0 clamp(28px, 5vw, 84px);
}
.section__title {
  font-weight: 600;
  font-size: clamp(30px, 3.4vw, 48px);
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin-bottom: 18px;
}
.section__lead { max-width: 68ch; color: var(--text-dim); margin: 0; font-size: 14.5px; text-wrap: pretty; }

/* Segment strip — horizontal timeline of the route */
.strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 6px clamp(28px, 5vw, 84px) 26px;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--surface-3) transparent;
}
.strip::-webkit-scrollbar { height: 9px; }
.strip::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
.strip::-webkit-scrollbar-thumb:hover { background: #2a5f72; }

.card {
  flex: 0 0 272px;
  scroll-snap-align: start;
  position: relative;
  display: flex; flex-direction: column;
  padding: 20px 20px 18px;
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.22s, transform 0.22s var(--ease), box-shadow 0.22s;
}
.card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--accent, var(--hike));
}
.card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 60% at 0% 0%, var(--accent-soft, transparent), transparent 70%);
}
.card:hover, .card.is-active {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: var(--shadow-md);
}
.card--flight { --accent: var(--flight); --accent-soft: var(--flight-soft); }
.card--hike { --accent: var(--hike); --accent-soft: var(--hike-soft); }

.card__kind {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; margin-bottom: 9px;
}
.card__title { font-size: 16.5px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 3px; }
.card__where { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-bottom: 16px; }
.card__figures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 10px; margin-bottom: 14px; }
.card__fig dt { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.card__fig dd { margin: 0; font-family: var(--mono); font-size: 17px; letter-spacing: -0.02em; }
.card__fig dd small { font-size: 0.62em; color: var(--text-dim); margin-left: 3px; }
.card__note {
  margin-top: auto;
  font-size: 11.5px;
  color: var(--muted);
  display: flex; align-items: flex-start; gap: 7px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  line-height: 1.45;
}
.card__note.is-warn { color: var(--warn); }
.card__note.is-good { color: var(--glide); }

/* ─────────────────────────────── Stages ───────────────────────────── */

.stages {
  max-width: 1680px;
  margin: 0 auto;
  padding: 0 clamp(28px, 5vw, 84px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.stage {
  position: relative;
  padding: 20px 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 0.2s;
}
.stage:hover { border-color: rgba(255, 255, 255, 0.2); }
.stage__no {
  font-family: var(--mono); font-size: 11px; color: var(--hike);
  letter-spacing: 0.16em; margin-bottom: 8px;
}
.stage__name {
  font-size: 17px; font-weight: 600; letter-spacing: -0.015em;
  background: none; border: none; color: var(--text); font-family: inherit;
  width: 100%; padding: 0 0 4px; outline: none;
  border-bottom: 1px solid transparent; transition: border-color 0.2s;
}
.stage__name:focus { border-bottom-color: var(--hike); }
.stage__range { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-bottom: 16px; }
.stage__figs { display: flex; flex-wrap: wrap; gap: 18px; }
.stage__figs div { display: flex; flex-direction: column; gap: 3px; }
.stage__figs em { font-style: normal; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.stage__figs b { font-family: var(--mono); font-size: 16px; font-weight: 500; }
.stage__del {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 4px;
}
.stage__del:hover { color: var(--warn); }
.stages__empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 16px;
  font-size: 13px;
}
.stages__foot {
  max-width: 1680px;
  margin: 26px auto 0;
  padding: 0 clamp(28px, 5vw, 84px);
  display: flex; align-items: center; gap: 10px;
}
.stages__foot .btn { flex: none; }
.stages__total { margin-left: auto; font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }

/* ─────────────────────────────── Footer ───────────────────────────── */

.footer {
  display: flex; flex-wrap: wrap; gap: 14px 40px; align-items: baseline;
  max-width: 1680px; margin: 0 auto;
  padding: 40px clamp(28px, 5vw, 84px) 56px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.footer__credits { margin-left: auto; text-align: right; }

/* ──────────────────────── Map pins & popups ────────────────────────── */

/* The pins themselves are point sprites inside the map's own draw call
   (js/pins.js) — only the popup is DOM. */
.pin-popup {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 180px;
  max-width: 280px;
  padding: 13px 16px;
  background: rgba(10, 30, 39, 0.94);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 12.5px;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-lg);
  z-index: 4;
  pointer-events: none;
}
.pin-popup h4 { margin: 0 0 6px; font-size: 13.5px; font-weight: 600; }
.pin-popup dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 3px 16px; font-size: 12px; }
.pin-popup dt { color: var(--muted); }
.pin-popup dd { margin: 0; font-family: var(--mono); text-align: right; }

/* ────────────────────────────── Responsive ─────────────────────────── */

@media (max-width: 1180px) {
  :root { --rail-w: 288px; --profile-h: 250px; }
  .topbar__nav { display: none; }
}
@media (max-width: 860px) {
  .app { height: auto; min-height: 0; grid-template-rows: 62svh var(--profile-h); }
  .app__map, .app__map.is-collapsed { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { border-left: none; border-top: 1px solid var(--line); }
  .rail__scroll { height: auto; max-height: 46svh; }
  .rail__toggle { display: none; }
  .app__stage { min-height: 44svh; }
  .readout { display: none; }
  .profile__bar { flex-wrap: wrap; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
