/* Wanderlust Mission
   Swiss red on white, one grotesque family (Archivo) at two widths.
   The white-red-white trail blaze is the only ornament. */

:root {
  --red: #DA291C;
  --red-deep: #A91D13;
  --paper: #FFFFFF;
  --snow: #F2F4F6;
  --ink: #1B242C;
  --granite: #5C6770;
  --scree: #8B949B;
  --line: #DCE1E5;
  --marker: #FFD100;
  --shadow: 0 1px 2px rgba(27, 36, 44, .18), 0 8px 28px rgba(27, 36, 44, .16);
  --rail-w: 300px;
  --panel-w: 468px;
  --story-w: 50vw;
  --slim: 72px;
  --bar-h: 56px;
  --ui: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--snow);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

#map { position: fixed; inset: 0; background: #E6EBEE; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 0 0; z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 14px; height: 100%;
  padding: 0 18px 0 0; color: var(--ink); text-decoration: none;
}
.blaze { display: flex; flex-direction: column; width: 56px; height: 100%; }
.blaze i { flex: 1; background: var(--paper); }
.blaze i:nth-child(2) { background: var(--red); flex: 1.15; }
.blaze { border-right: 1px solid var(--line); background: var(--paper); padding: 14px 12px; }
.blaze i:first-child, .blaze i:last-child { box-shadow: inset 0 0 0 1px var(--line); }
.brand-name {
  font-stretch: 68%; font-weight: 800; font-size: 25px; letter-spacing: .005em; line-height: 1;
}
.nav { display: flex; gap: 2px; }
.nav button {
  background: none; border: 0; padding: 9px 13px; font-weight: 600; font-size: 14px;
  border-radius: 3px; color: var(--granite);
}
.nav button:hover { color: var(--ink); background: var(--snow); }
.nav button[aria-pressed="true"] { color: var(--ink); box-shadow: inset 0 -3px 0 var(--red); border-radius: 0; }

/* ---------- logbook rail ---------- */
.rail {
  position: fixed; top: var(--bar-h); bottom: 0; left: 0; width: var(--rail-w); z-index: 20;
  background: var(--paper); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  transition: transform .28s cubic-bezier(.2, .7, .2, 1);
}
.rail.is-shut { transform: translateX(-100%); }
.rail-head { padding: 18px 18px 12px; border-bottom: 1px solid var(--line); }
.rail-head h2 { font-stretch: 68%; font-weight: 800; font-size: 30px; line-height: 1; }
.rail-head p { color: var(--granite); font-size: 13px; margin-top: 6px; }
.rail-list { overflow-y: auto; flex: 1; padding-bottom: 96px; }
.rail-item {
  display: grid; grid-template-columns: 38px 1fr; gap: 0 10px; width: 100%; text-align: left;
  padding: 11px 18px 11px 14px; background: none; border: 0; border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
}
.rail-item:hover, .rail-item.is-hot { background: var(--snow); }
.rail-item.is-active { border-left-color: var(--red); background: var(--snow); }
.rail-no {
  grid-row: span 2; font-stretch: 62%; font-weight: 800; font-size: 30px; line-height: 1;
  color: var(--red); font-variant-numeric: tabular-nums; text-align: right; padding-top: 1px;
}
.rail-item.is-nonsac .rail-no { color: var(--scree); }
.rail-title { font-weight: 700; font-size: 15px; line-height: 1.25; }
.rail-meta { font-size: 12.5px; color: var(--granite); font-variant-numeric: tabular-nums; }

/* ---------- mission meter ---------- */
.meter {
  position: fixed; left: calc(var(--rail-w) + 16px); bottom: 16px; z-index: 15;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 12px 14px 12px; width: 372px; max-width: calc(100vw - 32px);
  background: var(--paper); border: 0; border-radius: 3px; box-shadow: var(--shadow); text-align: left;
  transition: left .28s cubic-bezier(.2, .7, .2, 1);
}
body.rail-shut .meter { left: 16px; }
.meter-num { display: flex; align-items: baseline; gap: 8px; color: var(--granite); font-size: 14px; font-weight: 600; }
.meter-num b { font-stretch: 62%; font-weight: 800; font-size: 44px; line-height: .85; color: var(--red); font-variant-numeric: tabular-nums; }
.meter-ticks { display: grid; grid-template-columns: repeat(51, 1fr); gap: 2px 2px; width: 100%; }
.meter-ticks i { height: 7px; background: var(--line); }
.meter-ticks i.on { background: var(--red); }

/* ---------- map controls ---------- */
.mapctl { position: fixed; right: 16px; top: calc(var(--bar-h) + 14px); z-index: 15; display: flex; gap: 8px; transition: right .28s cubic-bezier(.2, .7, .2, 1); }
body.panel-open .mapctl { right: calc(var(--panel-w) + 16px); }
.seg { display: flex; background: var(--paper); border-radius: 3px; box-shadow: var(--shadow); padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 11px; font-size: 13px; font-weight: 600; color: var(--granite); border-radius: 2px; }
.seg button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.ctl-btn { border: 0; background: var(--paper); box-shadow: var(--shadow); border-radius: 3px; padding: 0 13px; font-weight: 700; font-size: 13px; }
.ctl-btn[aria-pressed="true"] { background: var(--red); color: var(--paper); }
.maplibregl-ctl-bottom-right { transition: right .28s cubic-bezier(.2, .7, .2, 1); }
body.panel-open .maplibregl-ctl-bottom-right { right: var(--panel-w); }
.maplibregl-ctl-group { border-radius: 3px !important; box-shadow: var(--shadow) !important; }
.maplibregl-ctl-attrib { font-family: var(--ui); font-size: 11px; }

/* ---------- pins ---------- */
.pin {
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  background: var(--red); color: var(--paper); border: 2.5px solid var(--paper);
  font-family: var(--ui); font-stretch: 70%; font-weight: 800; font-size: 15px; line-height: 1;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(27, 36, 44, .5);
  display: grid; place-items: center;
  transition: box-shadow .12s;
}
.pin.is-nonsac { background: var(--paper); color: var(--red); border-color: var(--red); }
.pin:hover, .pin.is-hot { box-shadow: 0 0 0 5px rgba(218, 41, 28, .28), 0 1px 3px rgba(27, 36, 44, .5); z-index: 5; }
.pin.is-active { box-shadow: 0 0 0 5px var(--paper), 0 0 0 8px var(--red); z-index: 6; }
.pin.is-dim { opacity: .55; }
.dot { width: 16px; height: 16px; border-radius: 50%; background: var(--marker); border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--paper); pointer-events: none; }

/* ---------- hover card ---------- */
.card {
  position: fixed; z-index: 40; width: 292px; pointer-events: none;
  background: var(--paper); border-radius: 3px; box-shadow: var(--shadow); overflow: hidden;
}
.card-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--snow); }
.card-body { padding: 12px 14px 14px; border-top: 4px solid var(--red); }
.card-kicker { font-size: 12.5px; color: var(--granite); font-weight: 600; }
.card-title { font-stretch: 70%; font-weight: 800; font-size: 25px; line-height: 1.05; margin: 2px 0 6px; }
.card-sub { font-size: 13.5px; color: var(--ink); }
.card-stats { display: flex; gap: 18px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.card-stats div { font-size: 12px; color: var(--granite); }
.card-stats b { display: block; font-stretch: 70%; font-size: 20px; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.card-hint { font-size: 12px; color: var(--granite); margin-top: 10px; }

/* ---------- detail panel ---------- */
.panel {
  position: fixed; top: var(--bar-h); right: 0; bottom: 0; width: var(--panel-w); max-width: 100vw; z-index: 25;
  background: var(--paper); border-left: 1px solid var(--line);
  animation: slide-in .3s cubic-bezier(.2, .7, .2, 1);
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel-scroll { height: 100%; overflow-y: auto; outline: none; }
.panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: var(--paper); box-shadow: var(--shadow); display: grid; place-items: center;
}
.hero { position: relative; background: var(--ink); }
.hero img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; }
.hero-no {
  position: absolute; left: 0; bottom: 0; background: var(--red); color: var(--paper);
  font-stretch: 62%; font-weight: 800; font-size: 54px; line-height: .9; padding: 10px 14px 8px;
  font-variant-numeric: tabular-nums;
}
.sheet { padding: 22px 26px 40px; }
.sheet h1 { font-stretch: 66%; font-weight: 800; font-size: 44px; line-height: .98; letter-spacing: -.005em; }
.lede { font-size: 17px; line-height: 1.4; margin-top: 10px; max-width: 36ch; }
.facts { color: var(--granite); font-size: 13.5px; margin-top: 12px; }
.facts span + span::before { content: ""; display: inline-block; width: 1px; height: 11px; background: var(--scree); margin: 0 9px; vertical-align: -1px; }
.stats { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px; margin: 22px 0 0; padding: 16px 0; border-top: 3px solid var(--ink); border-bottom: 1px solid var(--line); }
.stats dt { font-size: 12.5px; color: var(--granite); }
.stats dd { font-stretch: 66%; font-weight: 800; font-size: 31px; line-height: 1; font-variant-numeric: tabular-nums; }
.stats dd small { font-size: 15px; font-weight: 700; margin-left: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 3px; padding: 10px 15px;
  font-weight: 700; font-size: 14px; text-decoration: none; background: var(--red); color: var(--paper);
}
.btn:hover { background: var(--red-deep); }
.btn.is-quiet { background: var(--snow); color: var(--ink); }
.btn.is-quiet:hover { background: var(--line); }
.block { margin-top: 30px; }
.block h2 { font-stretch: 70%; font-weight: 800; font-size: 22px; line-height: 1.1; }
.block .note { color: var(--granite); font-size: 13px; margin-top: 4px; max-width: 52ch; }
.chart { position: relative; margin-top: 12px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--ui); font-size: 11px; fill: var(--granite); font-variant-numeric: tabular-nums; }
.chart .hutlabel { fill: var(--ink); font-weight: 700; paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.day { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.day:first-of-type { border-top: 0; padding-top: 0; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.day-head h3 { font-size: 15px; font-weight: 700; }
.day-head p { font-size: 13.5px; color: var(--granite); text-align: right; }
.day-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.day-facts div { font-size: 12px; color: var(--granite); }
.day-facts b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 700; }
.chart-label { font-size: 12px; color: var(--granite); margin-top: 12px; }
.huts li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.huts li b { font-weight: 700; }
.huts li span { color: var(--granite); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 6px; border-radius: 2px; margin-left: 6px; background: var(--red); color: var(--paper); vertical-align: 1px; }
.tag.is-off { background: var(--snow); color: var(--granite); }
.prose p { margin-top: 12px; max-width: 58ch; font-size: 15.5px; line-height: 1.55; }
.prose a { color: var(--red-deep); }

/* mission */
.bars { margin-top: 8px; }
.bars div { margin-top: 16px; }
.bars p { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; color: var(--granite); }
.bars p b { font-stretch: 68%; font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }
.bars i { display: block; height: 10px; background: var(--snow); margin-top: 6px; position: relative; }
.bars i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--v); background: var(--red); border-radius: 0 4px 4px 0; }
.stamps { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; margin-top: 14px; }
.stamps button, .stamps span {
  aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed var(--line); background: none; padding: 0;
  font-stretch: 66%; font-weight: 800; font-size: 15px; color: var(--scree); font-variant-numeric: tabular-nums;
  display: grid; place-items: center;
}
.stamps button { border: 0; background: var(--red); color: var(--paper); }
.stamps button:hover { background: var(--red-deep); }

/* ---------- chart tooltip ---------- */
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: var(--paper);
  font-size: 12.5px; line-height: 1.35; padding: 7px 9px; border-radius: 3px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 700; }
.mapfail { position: fixed; left: calc(var(--rail-w) + 24px); top: calc(var(--bar-h) + 24px); max-width: 40ch; background: var(--paper); padding: 14px 16px; box-shadow: var(--shadow); z-index: 10; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --panel-w: 100vw; }
  .brand-name { font-size: 21px; }
  .blaze { width: 44px; padding: 14px 9px; }
  .nav button { padding: 9px 8px; font-size: 13.5px; }
  .rail { width: min(86vw, 320px); box-shadow: var(--shadow); }
  .meter, body.rail-shut .meter { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .meter-num b { font-size: 34px; }
  .panel { top: auto; height: 68vh; border-left: 0; border-top: 4px solid var(--red); box-shadow: 0 -8px 28px rgba(27, 36, 44, .2); animation-name: rise-in; }
  @keyframes rise-in { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .hero img { aspect-ratio: 16 / 9; }
  .sheet { padding: 18px 18px 32px; }
  .sheet h1 { font-size: 36px; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 14px 8px; }
  body.panel-open .mapctl { right: 12px; }
  body.panel-open .maplibregl-ctl-bottom-right { right: 0; }
  body.panel-open .meter { display: none; }
  .mapctl { right: 12px; }
  .card { display: none; }
}


/* ---------- story view: logbook list | map | story (half the page) ---------- */
.panel.is-story { width: var(--story-w); min-width: 560px; }
body.story-open .mapctl { right: calc(max(var(--story-w), 560px) + 16px); }
body.story-open .maplibregl-ctl-bottom-right { right: max(var(--story-w), 560px); bottom: 150px; }
body.story-open .meter { display: none; }
body.story-open .rail { width: var(--slim); overflow: hidden; transition: width .2s cubic-bezier(.2, .7, .2, 1), transform .28s cubic-bezier(.2, .7, .2, 1); }
body.story-open .rail:hover, body.story-open .rail:focus-within { width: var(--rail-w); box-shadow: var(--shadow); z-index: 28; }
body.story-open .rail-head { padding-left: 12px; padding-right: 8px; white-space: nowrap; }
body.story-open .rail:not(:hover):not(:focus-within) .rail-head h2 { font-size: 15px; font-stretch: 100%; font-weight: 700; padding: 8px 0 7px; }
body.story-open .rail:not(:hover):not(:focus-within) .rail-head p { display: none; }
body.story-open .rail:not(:hover):not(:focus-within) .rail-head { display: none; }
body.story-open .rail:not(:hover):not(:focus-within) .rail-title, body.story-open .rail:not(:hover):not(:focus-within) .rail-meta { visibility: hidden; }
body.story-open .rail:not(:hover):not(:focus-within) .rail-item { padding-left: 8px; }
body.story-open .rail-item { grid-template-columns: 38px 220px; padding-left: 10px; }
body.story-open .rail-list { overflow-x: hidden; padding-bottom: 24px; }

.strip {
  position: fixed; z-index: 15; bottom: 14px; left: calc(var(--slim) + 14px); right: calc(max(var(--story-w), 560px) + 14px);
  background: var(--paper); border-radius: 3px; box-shadow: var(--shadow); padding: 9px 14px 6px;
}
body.rail-shut .strip { left: 14px; }
.strip-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--granite); }
.strip-head b { color: var(--ink); font-weight: 700; }
.strip-tabs { display: flex; gap: 2px; white-space: nowrap; }
.strip-head span#strip-now { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; margin-left: auto; }
.strip-tabs button { border: 0; background: none; padding: 3px 8px; border-radius: 3px; font-size: 13px; font-weight: 600; color: var(--granite); }
.strip-tabs button:first-child { padding-left: 0; }
.strip-tabs button:hover { color: var(--ink); }
.strip-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 700; box-shadow: inset 0 -2px 0 var(--red); border-radius: 0; }
.strip-tabs button:only-child { box-shadow: none; }
.strip-head { gap: 12px; }
.strip-key { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.strip-key i { width: 70px; height: 6px; border-radius: 3px; }
.strip-key[hidden] { display: none; }
#clock-watch { color: var(--ink); font-weight: 600; }
body.is-night #clock-watch { color: #F2F4F6; }
.strip-head span { font-variant-numeric: tabular-nums; }
.strip .chart { margin-top: 2px; cursor: pointer; }

.hiker {
  width: 38px; height: 38px; border-radius: 50%; background: var(--red); border: 3px solid var(--paper);
  box-shadow: 0 0 0 2px var(--red), 0 3px 10px rgba(27, 36, 44, .45); display: grid; place-items: center; pointer-events: none; z-index: 8;
}

.kicker { font-size: 13.5px; font-weight: 700; color: var(--red); margin-bottom: 6px; }
.panel.is-story .sheet { padding: 28px 44px 8px 44px; }
.panel.is-story .sheet.after { padding: 12px 44px 64px 44px; }
.panel.is-story .sheet h1 { font-size: 56px; }
.panel.is-story .lede { font-size: 19px; max-width: 44ch; }
.panel.is-story .hero img { aspect-ratio: 16 / 9; }
.panel.is-story .stats { justify-content: flex-start; gap: 8px 44px; }
.howto { margin-top: 18px; font-size: 13.5px; color: var(--granite); padding-left: 14px; border-left: 3px solid var(--red); }

.story { position: relative; padding: 26px 44px 20px 0; }
.story:not(.is-plain)::before { content: ""; position: absolute; left: 99px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.row { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 0 26px; }
.story.is-plain .row { grid-template-columns: 44px minmax(0, 1fr); gap: 0; }
.tl { position: relative; text-align: right; padding-right: 18px; }
.node { position: absolute; right: -6px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--scree); z-index: 1; }
.node.is-chapter { border-radius: 2px; top: 22px; border-color: var(--ink); background: var(--ink); }
.tl-label { display: block; font-size: 11.5px; line-height: 1.3; color: var(--scree); font-variant-numeric: tabular-nums; padding-top: 5px; }
.tl-label b { display: block; font-weight: 700; color: var(--granite); font-size: 12.5px; }
.row.is-now .node { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(218, 41, 28, .18); }
.row.is-now .tl-label, .row.is-now .tl-label b { color: var(--ink); }
.rc { min-width: 0; }
.rc .prose p, .rc .prose ul, .rc .prose ol { font-size: 17px; line-height: 1.62; margin: 0 0 18px; max-width: 62ch; }
.rc .prose ul, .rc .prose ol { padding-left: 22px; list-style: revert; }
.rc .prose a { color: var(--red-deep); text-underline-offset: 2px; }
.chapter h3 { font-stretch: 68%; font-weight: 800; font-size: 34px; line-height: 1; margin: 14px 0 16px; padding-top: 14px; border-top: 3px solid var(--ink); }
.shot { margin: 6px 0 24px; }
.shot img { display: block; width: 100%; height: auto; background: var(--snow); border-radius: 2px; }
.shot.is-tall { max-width: 74%; }
.shot figcaption { font-size: 13px; color: var(--granite); margin-top: 7px; max-width: 60ch; }
.shot.is-video a { display: block; position: relative; background: var(--ink); border-radius: 2px; overflow: hidden; }
.shot video { display: block; width: 100%; height: auto; background: var(--ink); border-radius: 2px; }
.play { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--paper); }
.play::after { content: ""; position: absolute; left: 26px; top: 20px; border: 12px solid transparent; border-left: 18px solid var(--paper); border-right: 0; }
.panel.is-story .prose p { font-size: 17px; }

@media (max-width: 900px) {
  .panel.is-story { width: 100vw; min-width: 0; height: 52vh; height: 52dvh; }
  body.story-open .rail { width: min(86vw, 320px); }
  body.story-open .mapctl { right: 12px; }
  body.story-open .maplibregl-ctl-bottom-right { right: 0; bottom: 0; }
  .panel.is-story .sheet, .panel.is-story .sheet.after { padding-left: 18px; padding-right: 18px; }
  .panel.is-story .sheet h1 { font-size: 38px; }
  .story { padding-right: 18px; }
  .story:not(.is-plain)::before { left: 61px; }
  .row { grid-template-columns: 62px minmax(0, 1fr); gap: 0 16px; }
  .tl { padding-right: 12px; }
  .shot.is-tall { max-width: 100%; }
  .hiker { width: 32px; height: 32px; }
}

/* ---------- photos page ---------- */
.bar .brand { margin-right: 0; }
.bar-photos {
  margin-right: auto; margin-left: 6px; border: 2px solid var(--ink); background: var(--paper); border-radius: 3px;
  padding: 6px 14px; font-weight: 700; font-size: 14px;
}
.bar-photos:hover, .bar-photos[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.gallery { position: fixed; top: var(--bar-h); left: 0; right: 0; bottom: 0; z-index: 29; background: var(--paper); overflow-y: auto; }
.gallery-in { max-width: 1500px; margin: 0 auto; padding: 34px 32px 80px; outline: none; }
.gallery h1 { font-stretch: 66%; font-weight: 800; font-size: 64px; line-height: .95; }
.gallery .lede { margin-top: 12px; max-width: 60ch; font-size: 17px; }
.g-sec { margin-top: 44px; }
.g-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; border-top: 3px solid var(--ink); padding-top: 12px; }
.g-head h2 { font-stretch: 70%; font-weight: 800; font-size: 28px; line-height: 1.05; }
.g-head span { color: var(--granite); font-size: 13.5px; }
.g-head button { margin-left: auto; border: 0; background: none; padding: 0; font-weight: 700; font-size: 14px; color: var(--red-deep); text-decoration: underline; text-underline-offset: 3px; }
.g-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.g-grid::after { content: ""; flex: 10 1 0; }
.g-item { position: relative; height: 230px; border: 0; padding: 0; background: var(--snow); overflow: hidden; border-radius: 2px; cursor: zoom-in; }
.g-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.g-item:hover img { filter: brightness(1.06); }
.g-item:focus-visible { outline-offset: -3px; outline-color: var(--red); }

.lightbox { position: fixed; inset: 0; z-index: 70; background: #10161B; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.lightbox img { grid-row: 1; width: 100%; height: 100%; object-fit: contain; padding: 18px 76px 6px; min-height: 0; }
.lb-bar { grid-row: 2; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 22px 16px; color: #fff; }
.lb-bar p { font-size: 14px; color: #C9D0D6; }
.lb-bar p b { color: #fff; font-weight: 700; margin-right: 10px; }
.lb-btn { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; z-index: 2; }
.lb-btn:hover { background: var(--red); }
.lb-btn:focus-visible { outline-color: #fff; }
.lb-close { top: 16px; right: 18px; }
.lb-prev { left: 16px; top: 50%; margin-top: -40px; }
.lb-next { right: 16px; top: 50%; margin-top: -40px; }
@media (max-width: 900px) {
  .bar-photos { padding: 5px 9px; font-size: 13px; margin-left: 0; }
  .brand { padding-right: 8px; gap: 9px; }
  .gallery-in { padding: 22px 12px 60px; }
  .gallery h1 { font-size: 44px; }
  .g-item { height: 130px; }
  .lightbox img { padding: 56px 6px 4px; }
  .lb-prev, .lb-next { top: auto; bottom: 74px; }
  .lb-bar { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ---------- phones: the sections fold into a Menu button, so the top bar always fits ---------- */
@media (max-width: 900px) {
  .bar { padding-right: 6px; gap: 6px; }
  .bar .brand { min-width: 0; flex: 0 1 auto; padding-right: 4px; margin-right: auto; }
  .brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bar-photos { flex: none; margin: 0; }
}
@media (max-width: 420px) {
  .blaze { width: 30px; padding: 16px 7px; }
  .bar .brand { gap: 8px; }
  .brand-name { font-size: 19px; }
}
@media (max-width: 350px) {
  .brand-name { font-size: 16px; }
  .bar-photos { padding: 5px 7px; }
  .bar-menu { padding: 9px 6px; }
}

/* =====================================================================
   The day's light and weather, the clock, fly-through, replay, summits
   ===================================================================== */
.wx { position: fixed; top: var(--bar-h); left: 0; right: 0; bottom: 0; z-index: 4; pointer-events: none; }
.wx canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#wx-shade { mix-blend-mode: multiply; filter: blur(10px); -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to bottom, transparent 0, #000 22%); }

.clock {
  position: fixed; z-index: 15; top: calc(var(--bar-h) + 14px); left: calc(var(--slim) + 14px);
  display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 8px;
  background: var(--paper); border-radius: 3px; box-shadow: var(--shadow);
}
body.rail-shut .clock { left: 14px; }
@media (min-width: 901px) { body.story-open:not(.fly-open) .clock { top: calc(var(--bar-h) + 60px); } }
@media (max-width: 1500px) { .strip-key { display: none; } }
.clock p { display: flex; flex-direction: column; line-height: 1.25; }
.clock b { font-stretch: 78%; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.clock span { font-size: 12.5px; color: var(--granite); font-variant-numeric: tabular-nums; }
.clock-arc { flex: none; }
body.is-night .clock { background: #131C2B; color: #F2F4F6; }
body.is-night .clock span { color: #A9B4C0; }
body.is-night .hiker { box-shadow: 0 0 0 2px var(--red), 0 0 18px 8px rgba(255, 214, 140, .55); }
body.is-night .pin.is-active { box-shadow: 0 0 0 5px var(--paper), 0 0 0 8px var(--red), 0 0 22px 12px rgba(255, 205, 120, .6); }

.mapctl { flex-wrap: wrap; justify-content: flex-end; }
.ctl-btn { min-height: 34px; }
#light[aria-pressed="true"] { background: #E8A317; color: var(--ink); }

.peak { pointer-events: none; display: flex; flex-direction: column; align-items: center; font-size: 12px; line-height: 1.15; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 6px rgba(0, 0, 0, .6); white-space: nowrap; padding-bottom: 16px; transition: opacity .25s; }
.peak::after { content: ""; position: absolute; bottom: 0; left: 50%; width: 1px; height: 13px; background: #fff; box-shadow: 0 0 2px rgba(0, 0, 0, .8); }
.peak b { font-weight: 700; font-size: 12.5px; }
.peak span { font-variant-numeric: tabular-nums; opacity: .92; }
body.peaks-far .peak, body:not(.story-open) .peak { display: none; }

.tip img { display: block; width: 190px; max-height: 150px; object-fit: cover; border-radius: 2px; margin: 1px 0 7px; }

.hud {
  position: fixed; z-index: 26; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: center;
  max-width: min(720px, calc(100vw - 24px)); padding: 10px 12px 10px 18px;
  background: var(--ink); color: var(--paper); border-radius: 4px; box-shadow: 0 10px 30px rgba(10, 16, 22, .4);
}
.hud-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.hud-text b { font-stretch: 74%; font-weight: 800; font-size: 19px; }
.hud-text span { font-size: 13px; color: #C2CAD1; }
.hud-btns { display: flex; gap: 8px; }
.hud .btn.is-quiet { background: rgba(255, 255, 255, .14); color: var(--paper); }
.hud .btn.is-quiet:hover { background: rgba(255, 255, 255, .26); }
.hud :focus-visible { outline-color: #fff; }
.hud-bar { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255, 255, 255, .18); border-radius: 4px 4px 0 0; overflow: hidden; }
.hud-bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .25s linear; }

.flycard { position: fixed; z-index: 16; left: 18px; bottom: 164px; width: min(34vw, 460px); background: var(--paper); padding: 6px 6px 0; border-radius: 3px; box-shadow: 0 12px 34px rgba(10, 16, 22, .45); }
.flycard img { display: block; width: 100%; max-height: 46vh; object-fit: contain; background: var(--ink); border-radius: 2px; }
.flycard figcaption { font-size: 12.5px; font-weight: 600; color: var(--granite); padding: 6px 4px 7px; font-variant-numeric: tabular-nums; }
.flycard.is-in { animation: card-in .45s cubic-bezier(.2, .7, .2, 1); }
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

/* fly-through: the map takes the whole window */
body.fly-open .panel, body.fly-open .rail { display: none; }
body.fly-open .strip { left: 14px; right: 14px; bottom: 84px; }
body.fly-open .clock { left: 14px; }
body.fly-open .mapctl { right: 16px; }
body.fly-open .maplibregl-ctl-bottom-right { right: 0; bottom: 216px; }
body.fly-open .flycard { bottom: 232px; }

/* search */
.search { position: relative; display: flex; align-items: center; gap: 8px; margin-left: 12px; padding: 0 10px; height: 36px; width: min(320px, 26vw); border: 2px solid var(--line); border-radius: 3px; color: var(--granite); background: var(--paper); }
.search:focus-within { border-color: var(--ink); color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font: inherit; font-size: 14px; color: var(--ink); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-out { position: absolute; top: calc(100% + 8px); left: -2px; width: min(460px, 92vw); max-height: min(70vh, 560px); overflow-y: auto; margin: 0; padding: 6px 0; list-style: none; background: var(--paper); border-top: 3px solid var(--red); border-radius: 3px; box-shadow: 0 16px 40px rgba(27, 36, 44, .3); z-index: 60; }
.search-out li[data-n] { display: flex; flex-direction: column; gap: 2px; padding: 8px 16px; cursor: pointer; }
.search-out li[data-n]:hover, .search-out li.is-on { background: var(--snow); box-shadow: inset 3px 0 0 var(--red); }
.search-out b { font-size: 14.5px; font-weight: 700; color: var(--ink); line-height: 1.3; }
.search-out span { font-size: 12.5px; color: var(--granite); }
.search-out mark { background: #FFE27A; color: inherit; padding: 0 1px; }
.search-h { padding: 10px 16px 4px; font-size: 12px; font-weight: 700; color: var(--granite); }
.search-none { padding: 12px 16px; font-size: 14px; color: var(--granite); }
.bar-search { display: none; border: 0; background: none; padding: 8px; border-radius: 3px; color: var(--ink); }
.row.is-found { background: #FFF6CC; box-shadow: 0 0 0 8px #FFF6CC; transition: background 1.2s, box-shadow 1.2s; }
body .peak.is-found { display: flex !important; color: #fff; }
.peak.is-found b { background: var(--red); padding: 2px 7px; border-radius: 3px; text-shadow: none; }

/* hut details card */
.hutcard {
  position: fixed; z-index: 16; top: calc(var(--bar-h) + 14px); left: calc(var(--rail-w) + 16px); width: 340px; max-height: calc(100vh - var(--bar-h) - 150px); overflow-y: auto;
  background: var(--paper); border-top: 4px solid var(--red); border-radius: 3px; box-shadow: 0 12px 34px rgba(27, 36, 44, .3); padding: 14px 16px 16px;
  transition: left .28s cubic-bezier(.2, .7, .2, 1);
}
body.rail-shut .hutcard { left: 16px; }
.hutcard .card-title { padding-right: 34px; }
.hutcard-close { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; box-shadow: none; background: var(--snow); }
.hutcard .huts { margin-top: 12px; }
.hutcard .huts li, .hut-more .huts li { align-items: flex-start; gap: 14px; }
.hutcard .huts li b, .hut-more .huts li b { flex: none; font-size: 13.5px; }
.hutcard .huts li span, .hut-more .huts li span { font-size: 13.5px; }
.hut-links { margin-top: 12px; flex-wrap: wrap; gap: 6px; }
.hut-links .btn { padding: 7px 11px; font-size: 13px; text-decoration: none; }
.hutcard .actions { margin-top: 12px; }
.hut-more { margin-top: 16px; }
.hut-more h3 { font-stretch: 76%; font-weight: 800; font-size: 18px; }
body.story-open .hutcard, body.replaying .hutcard { display: none; }

/* live conditions */
#live[aria-pressed="true"] { background: #1F6FB2; color: #fff; }
.livechip {
  position: fixed; z-index: 15; top: calc(var(--bar-h) + 60px); right: 16px; width: min(360px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 10px; padding: 12px 14px;
  background: var(--paper); border-radius: 3px; border-top: 3px solid #1F6FB2; box-shadow: var(--shadow);
}
body.panel-open .livechip { right: calc(var(--panel-w) + 16px); }
.livechip p { display: flex; flex-direction: column; gap: 3px; }
.livechip b { font-stretch: 76%; font-weight: 800; font-size: 19px; line-height: 1.1; }
.livechip span { font-size: 14px; line-height: 1.35; }
.livechip small { font-size: 12px; line-height: 1.35; color: var(--granite); }
.livechip-btns { display: flex; gap: 8px; }
.livechip .btn { padding: 7px 11px; font-size: 13px; }
.livechip .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
body.replaying .livechip, body.story-open .livechip { display: none; }

/* mission replay */
.replay-btn {
  position: fixed; z-index: 15; left: calc(var(--rail-w) + 16px); bottom: 112px;
  display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 3px; padding: 8px 13px 8px 10px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 13.5px; box-shadow: var(--shadow);
  transition: left .28s cubic-bezier(.2, .7, .2, 1);
}
.replay-btn:hover { background: var(--red); }
body.rail-shut .replay-btn { left: 16px; }
body.panel-open .replay-btn, body.story-open .replay-btn, body.replaying .replay-btn { display: none; }
.pin { transition: box-shadow .12s, scale .5s cubic-bezier(.3, 1.7, .5, 1); }
.pin.is-unborn { scale: 0; }
body.replaying .rail { transform: translateX(-102%); }
body.replaying .meter, body.replaying .replay-btn { left: 16px; }
body.replaying .mapctl { display: none; }

.huts.is-facts li span { white-space: normal; text-align: right; }

/* ---------- menu button (phones) ---------- */
.bar-menu { display: none; border: 0; background: none; padding: 9px 10px; font-weight: 700; font-size: 14px; border-radius: 3px; }
.bar-menu[aria-expanded="true"] { background: var(--ink); color: var(--paper); }

.page { z-index: 29; }

/* ---------- rankings: a grid, huts down the side, scores across ---------- */
.rk-empty { margin-top: 22px; padding: 12px 16px; border-left: 3px solid var(--red); background: var(--snow); max-width: 70ch; font-size: 14.5px; }
.rk-wrap { margin-top: 26px; overflow-x: auto; border: 2px solid var(--ink); border-radius: 3px; -webkit-overflow-scrolling: touch; }
.rk { width: 100%; min-width: 760px; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.rk th, .rk td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.rk tr > :last-child { border-right: 0; }
.rk tbody tr:last-child > * { border-bottom: 0; }
.rk thead th { padding: 0; background: var(--ink); border-color: #38434C; border-bottom: 0; vertical-align: bottom; }
.rk thead button { display: flex; align-items: flex-end; justify-content: center; gap: 6px; width: 100%; min-height: 54px; border: 0; background: none; padding: 10px 10px; color: var(--paper); font-weight: 700; font-size: 13.5px; line-height: 1.2; text-align: center; }
.rk thead .rk-h button { justify-content: flex-start; text-align: left; padding-left: 16px; }
.rk thead button i { font-style: normal; font-size: 10px; opacity: .55; flex: none; padding-bottom: 2px; }
.rk thead button:hover { background: #2A3640; }
.rk thead th[aria-sort="ascending"] button, .rk thead th[aria-sort="descending"] button { background: var(--red); }
.rk thead th[aria-sort="ascending"] button i, .rk thead th[aria-sort="descending"] button i { opacity: 1; }
.rk thead :focus-visible { outline-color: #fff; outline-offset: -4px; }
.rk-h { position: sticky; left: 0; z-index: 1; text-align: left; }
.rk thead .rk-h { z-index: 2; }
.rk tbody .rk-h { background: var(--paper); padding: 10px 14px 10px 54px; min-width: 250px; box-shadow: 1px 0 0 var(--ink); }
.rk tbody .rk-h em { position: absolute; left: 14px; top: 10px; font-style: normal; font-stretch: 66%; font-weight: 800; font-size: 22px; line-height: 1.1; color: var(--red); }
.rk tbody .rk-h button { display: block; border: 0; background: none; padding: 0; font-weight: 800; font-stretch: 78%; font-size: 17.5px; line-height: 1.15; text-align: left; }
.rk tbody .rk-h button:hover { color: var(--red-deep); text-decoration: underline; text-underline-offset: 3px; }
.rk tbody .rk-h span { display: block; font-weight: 400; font-size: 12.5px; color: var(--granite); margin-top: 2px; }
.rk tbody .rk-h small { display: block; font-weight: 400; font-size: 13px; margin-top: 4px; max-width: 40ch; }
.rk-c { text-align: center; vertical-align: middle; padding: 8px 6px; min-width: 96px; background: rgba(218, 41, 28, calc(var(--s, 0) * var(--s, 0) * .34)); }
.rk-c b { font-stretch: 70%; font-weight: 800; font-size: 22px; line-height: 1; }
.rk-c.is-empty span, .rk-c.is-none span { color: var(--scree); font-size: 13px; }
.rk-c.is-sorted { box-shadow: inset 2px 0 0 var(--red), inset -2px 0 0 var(--red); }
.rk-c.rk-o { border-left: 2px solid var(--ink); }
.rk-c.rk-o b { color: var(--red-deep); }
.rk-key { margin-top: 40px; max-width: 900px; }
.rk-key h2 { font-stretch: 70%; font-weight: 800; font-size: 22px; }
.rk-key dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 24px; margin-top: 12px; }
.rk-key dt { font-weight: 700; }
.rk-key dd { color: var(--granite); font-size: 13.5px; }

@media (max-width: 900px) {
  .clock { left: 10px; top: auto; bottom: calc(52vh + 10px); bottom: calc(52dvh + 10px); padding: 5px 10px; gap: 0; }
  body.rail-shut .clock { left: 10px; }
  .clock-arc { display: none; }
  .clock p { flex-direction: row; gap: 8px; align-items: baseline; }
  .clock b { font-size: 14px; }
  .clock span { font-size: 12px; }
  body.fly-open .clock { bottom: auto; top: calc(var(--bar-h) + 56px); }
  .livechip, body.panel-open .livechip { top: auto; bottom: 150px; right: 12px; left: 12px; width: auto; padding: 10px 12px; gap: 8px; }
  .livechip span { font-size: 13px; }
  .livechip small { display: none; }
  .hutcard, body.rail-shut .hutcard { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 62vh; border-radius: 0; z-index: 27; box-shadow: 0 -8px 26px rgba(27, 36, 44, .28); }
  .bar-search { display: block; flex: none; }
  .search { display: none; position: fixed; top: var(--bar-h); left: 0; right: 0; z-index: 45; width: auto; margin: 0; height: 48px; border-width: 0 0 3px; border-color: var(--red); border-radius: 0; box-shadow: 0 10px 22px rgba(27, 36, 44, .2); }
  .search.is-open { display: flex; }
  .search input { font-size: 16px; }
  .search-out { left: 0; right: 0; width: auto; top: 100%; border-top: 0; border-radius: 0; max-height: calc(100vh - var(--bar-h) - 60px); }
  .peak { font-size: 11px; }
  .peak b { font-size: 11.5px; }
  .hud { left: 10px; right: 10px; bottom: 10px; transform: none; max-width: none; justify-content: space-between; padding: 10px 10px 10px 14px; gap: 10px; }
  .hud-text b { font-size: 16px; }
  .hud .btn { padding: 9px 11px; font-size: 13px; }
  .flycard, body.fly-open .flycard { left: 10px; right: 10px; width: auto; bottom: 96px; }
  .flycard img { max-height: 27vh; }
  body.fly-open .maplibregl-ctl-bottom-right { display: none; }
  .replay-btn, body.rail-shut .replay-btn { left: 12px; bottom: 104px; }
  .bar-menu { display: block; flex: none; }
  .nav { display: none; position: fixed; top: var(--bar-h); left: 0; right: 0; z-index: 40; flex-direction: column; gap: 0; background: var(--paper); border-bottom: 3px solid var(--red); box-shadow: 0 14px 28px rgba(27, 36, 44, .22); padding: 6px 0; }
  .nav.is-open { display: flex; }
  .nav button, .nav button[aria-pressed="true"] { padding: 14px 20px; font-size: 16px; text-align: left; border-radius: 0; box-shadow: none; color: var(--ink); }
  .nav button[aria-pressed="true"] { box-shadow: inset 4px 0 0 var(--red); }
  /* rankings stay a grid on a phone: the hut column holds still and the scores slide sideways */
  .rk { min-width: 640px; }
  .rk tbody .rk-h { min-width: 0; width: 150px; max-width: 150px; padding: 9px 8px 9px 30px; }
  .rk tbody .rk-h em { left: 8px; top: 9px; font-size: 17px; }
  .rk tbody .rk-h button { font-size: 13.5px; font-stretch: 72%; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
  .rk tbody .rk-h span { font-size: 11px; }
  .rk thead button { font-size: 12.5px; padding: 8px 6px; min-height: 50px; }
  .rk thead .rk-h button { padding-left: 8px; }
  .rk-c { min-width: 82px; }
  .rk-c b { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .rail, .meter, .mapctl, .panel, .maplibregl-ctl-bottom-right { transition: none; animation: none; }
}
