/*
 * Topo-guide. The bulletin set like a ski-touring guidebook page: a running
 * head, a plate (the live relief) with numbered pins keyed to a route card,
 * then the text in a calm column with headings in the margin.
 * Colour: ink on white paper, one route blue for links and selection; the EAWS
 * danger colours are reserved for danger and appear nowhere else.
 */

@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/public-sans-latin-217759bd.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/assets/public-sans-latin-ext-f7775153.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/assets/literata-latin-4c1eb525.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/assets/literata-latin-ext-e41b83c2.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("/assets/literata-italic-latin-21e221ed.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #ffffff;
  --ink: #1c2228;
  --ink-2: #4d5863;
  --ink-3: #636e78;
  --rule: #d5dbe0;
  --rule-soft: #e9edf0;
  --wash: #f3f5f7;
  --route: #1d4f91;
  --route-soft: #dbe6f4;
  --bar: #4d5863;
  --bar-soft: #e9edf0;

  --sans: "Public Sans", system-ui, sans-serif;
  --serif: "Literata", Georgia, serif;

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --radius: 6px;
  --radius-sm: 3px;

  color-scheme: light;
  accent-color: var(--route);
  scrollbar-color: #b9c1c8 transparent;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
@media (max-width: 760px) { html { scroll-padding-top: 8rem; } }
@media (pointer: coarse) {
  .terrain__button { width: 44px; height: 44px; }
  .layer-toggle { min-height: 40px; }
  .landmark-card__close { width: 44px; height: 44px; }
}
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--sans); caret-color: var(--route); }
::selection { background: var(--route-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; border-radius: 2px; }
a { color: var(--route); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
p, li, figcaption { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
button { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--ink-2); }
.wrap { width: min(100% - 2.5rem, 1240px); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--s4); top: -3rem; z-index: 20; padding: var(--s2) var(--s3); background: var(--ink); color: var(--paper); border-radius: var(--radius-sm); }
.skip-link:focus { top: var(--s2); }

/* Running head ------------------------------------------------------------ */

.runhead { position: sticky; top: 0; z-index: 10; background: rgb(255 255 255 / 0.96); border-bottom: 1px solid var(--ink); backdrop-filter: saturate(1.2) blur(6px); }
.runhead__inner { display: flex; align-items: center; gap: var(--s5); min-height: 60px; }
.runhead__mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); background: var(--ink); }
.runhead__mark svg { width: 22px; height: 22px; fill: var(--paper); }
.runhead__place { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.runhead__title { font: 800 1.45rem/1 var(--sans); letter-spacing: -0.02em; white-space: nowrap; }
.runhead__level { margin-left: auto; display: inline-flex; align-items: center; gap: var(--s2); font-weight: 600; white-space: nowrap; }
.runhead__until { font-weight: 400; color: var(--ink-2); }

.massif-picker select {
  appearance: none; max-width: 100%; min-height: 34px;
  padding: 0 1.8rem 0 0.6rem; border: 1px solid var(--rule); border-radius: var(--radius-sm);
  font: 500 0.9rem var(--sans); color: var(--ink-2); cursor: pointer;
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%234d5863' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 0.55rem center / 10px;
}
.runhead__place .massif-picker select { color: transparent; width: 2.2rem; padding: 0; background-position: center; }
.runhead__place .massif-picker select option, .runhead__place .massif-picker select optgroup { color: var(--ink); }
.massif-picker select:hover { border-color: var(--ink-3); }

.day-nav { display: flex; align-items: center; gap: var(--s1); }
.day-nav__step { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.day-nav__step:hover { background: var(--wash); }
.day-nav__step.is-disabled { color: var(--rule); }
.day-nav__current {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: 34px; padding: 0 var(--s2) 0 var(--s3);
  border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper); cursor: pointer;
  font: 600 0.95rem var(--sans); white-space: nowrap;
}
.day-nav__current:hover { border-color: var(--ink-3); }
.day-nav__chevron { width: 16px; height: 16px; color: var(--ink-2); }
.day-nav__short { display: none; }

/* Notices ------------------------------------------------------------------ */

.notice { margin: var(--s3) 0 0; padding: var(--s1) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); font-size: 0.9rem; max-width: 90ch; }
.notice.is-warning { font-weight: 500; }
.notice a { font-weight: 600; }

/* Danger chip -------------------------------------------------------------- */

.danger-chip {
  display: inline-grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: var(--radius-sm);
  background: var(--danger); color: var(--danger-ink); font: 800 1.05rem/1 var(--sans);
  box-shadow: inset 0 0 0 1px rgb(28 34 40 / 0.28);
}
.danger-chip--sm { width: 1.45rem; height: 1.45rem; font-size: 0.85rem; }
/* Level 5: the EAWS black/red chequer can't carry a readable numeral, so chips are black with a red inset ring. */
.danger-chip.is-5, .season__cell.is-5 { background: #16232f; color: #fff; box-shadow: inset 0 0 0 3px #ff0000; }

/* Topo block: fiche, plate, key ---------------------------------------- */

.topo {
  display: grid; gap: var(--s5) var(--s6); margin-top: var(--s4);
  grid-template-columns: minmax(0, 1fr) 21rem;
  grid-template-areas: "plate fiche" "plate key" "summits key";
  grid-template-rows: auto 1fr auto;
}
.fiche { grid-area: fiche; border: 1px solid var(--ink); border-radius: var(--radius); overflow: hidden; align-self: start; }
.fiche__level { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) var(--s4); background: var(--danger); color: var(--danger-ink); border-bottom: 1px solid var(--ink); }
.fiche__num { font: 800 4.5rem/0.85 var(--sans); letter-spacing: -0.04em; }
.fiche__name { display: grid; font: 800 1.9rem/1 var(--sans); letter-spacing: -0.02em; }
.fiche__name small { font: 500 0.85rem/1.3 var(--sans); letter-spacing: 0; margin-top: var(--s1); }
.fiche__rows { padding: 0 var(--s4); }
.fiche__rows > div { padding: var(--s3) 0; border-bottom: 1px solid var(--rule-soft); }
.fiche__rows dt { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); margin-bottom: var(--s1); }
.fiche__rows dd { display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.fiche__aspects dd { gap: var(--s3); align-items: center; }
.fiche__focus { cursor: pointer; margin: 0 calc(-1 * var(--s4)); padding-inline: var(--s4) !important; }
.fiche__focus:hover { background: var(--wash); }
.fiche__focus.is-focused { background: var(--route-soft); }
.fiche__focus.is-focused dt::after { content: " (isolé sur le relief)"; font-weight: 500; }
.fiche__aspects small { font-weight: 400; color: var(--ink-2); }
.fiche__problems { flex-wrap: wrap; gap: var(--s1) var(--s4) !important; }
.fiche__problems > span { display: inline-flex; align-items: center; gap: var(--s2); }
.fiche__problems .problem-icon { width: 1.6rem; height: 1.6rem; padding: 0.28rem; }
.fiche__foot { padding: var(--s3) var(--s4); font-size: 0.9rem; font-weight: 600; }
.fiche__avis { margin: 0 var(--s4) var(--s4); padding: var(--s2) var(--s3); background: var(--danger); color: var(--danger-ink); font-weight: 700; border-radius: var(--radius-sm); }

.rose-wedge { fill: var(--rule-soft); stroke: var(--paper); stroke-width: 2.5; }
.rose-wedge.is-on { fill: var(--ink); }
.rose-letter { font: 600 11px var(--sans); fill: var(--ink-3); text-anchor: middle; }
.rose-letter.is-on { fill: var(--ink); font-weight: 800; }
.rose-letter--north { font-size: 26px; font-weight: 800; fill: var(--ink); }

.plate { grid-area: plate; display: grid; gap: var(--s2) var(--s3); align-content: start; grid-template-areas: "days" "stage" "caption" "notes"; }
.plate > .mountain, .plate > .terrain { grid-area: stage; }
.plate > .landmark-card { grid-area: stage; align-self: end; justify-self: start; margin: var(--s3); }
.plate__caption { grid-area: caption; }
.plate__notes { grid-area: notes; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: var(--s4) var(--s5); padding-top: var(--s4); margin-top: var(--s2); border-top: 1px solid var(--ink); }
.plate__notes h2 { font: 800 0.92rem var(--sans); margin-bottom: var(--s1); }
.plate__notes p { font: 400 0.98rem/1.55 var(--serif); }
.mountain { display: block; width: 100%; height: auto; aspect-ratio: 16 / 11; border: 1px solid var(--ink); }
.mountain-outline { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.mountain-split { stroke: var(--paper); stroke-width: 2.5; }
.mountain-level { font: 800 30px var(--sans); }
.mountain-alt { font: 600 12px var(--sans); fill: var(--ink); }

/* States: 2D schematic by default; while the relief loads, its empty stage (same
   size) with a status line; then the relief. Captions follow the state. */
.terrain, .plate__hint, .terrain__layers, .terrain__rose, .terrain__controls, .plate__caption-3d, .plate__legend-slopes { display: none; }
.is-loading .mountain, .is-3d .mountain { display: none; }
.is-loading .terrain, .is-3d .terrain { display: block; }
.is-3d .plate__hint, .is-3d .terrain__rose, .is-3d .terrain__controls { display: block; }
.is-3d .terrain__controls, .has-landmarks .terrain__layers, .is-3d .terrain__layers { display: flex; }
.is-loading .plate__caption-3d, .is-3d .plate__caption-3d { display: block; }
.is-loading .plate__caption-2d, .is-3d .plate__caption-2d { display: none; }
.shows-slopes .plate__legend li.plate__legend-slopes { display: flex; }
.topo:not(.has-landmarks) .layer-toggle:not([data-kind="slopes"]) { display: none; }
.topo:not(.is-3d):not(.is-loading) .plate__legend .swatch:not(.is-line) { display: none; }

.terrain {
  position: relative; aspect-ratio: 16 / 11; overflow: hidden;
  background: var(--paper); border: 1px solid var(--ink);
  cursor: grab; touch-action: pan-y;
}
.terrain.is-dragging { cursor: grabbing; }
.terrain canvas { display: block; width: 100%; height: 100%; }
.terrain__controls { position: absolute; z-index: 3; right: var(--s3); bottom: var(--s3); display: flex; gap: var(--s1); padding: var(--s1); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.terrain__button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; cursor: pointer; }
.terrain__button:hover { background: var(--wash); }
.terrain__statusbar { position: absolute; z-index: 3; left: var(--s3); bottom: var(--s3); display: flex; align-items: center; gap: var(--s3); max-width: calc(100% - 17rem); padding: var(--s1) var(--s1) var(--s1) var(--s3); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.terrain__statusbar[hidden], .terrain__retry[hidden] { display: none; }
.is-loading .terrain__statusbar { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); max-width: none; padding-right: var(--s3); }
.terrain__status { margin: 0; font-size: 0.85rem; color: var(--ink-2); }
.terrain__retry { flex: none; min-height: 30px; padding: 0 var(--s3); border: 1px solid var(--ink); border-radius: var(--radius-sm); background: var(--paper); font-weight: 700; font-size: 0.85rem; cursor: pointer; }
.terrain__retry:hover { background: var(--wash); }

/* The threshold written on its own contour, as on a topo plate. */
.terrain__contour-label { position: absolute; z-index: 2; left: 0; top: 0; padding: 0 0.3rem; border-radius: 2px; background: var(--paper); color: var(--ink); font: 800 0.72rem/1.4 var(--sans); font-variant-numeric: tabular-nums; box-shadow: inset 0 0 0 1px var(--ink); pointer-events: none; white-space: nowrap; }
.terrain__contour-label[hidden] { display: none; }

/* The rose of dangerous aspects turns with the relief and resets the view. */
.terrain__rose { position: absolute; z-index: 3; right: var(--s3); top: var(--s3); width: 76px; height: 76px; padding: 4px; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); cursor: pointer; }
.terrain__rose:hover { border-color: var(--ink-3); }
.terrain__rose-dial { display: block; width: 100%; height: 100%; }
.terrain__rose-dial .rose { width: 100%; height: 100%; }

.terrain__readout { position: absolute; z-index: 4; left: 0; top: 0; margin: 0; padding: 0.2rem 0.5rem; background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: 0 1px 3px rgb(28 34 40 / 0.22); font-variant-numeric: tabular-nums; }
.terrain__readout[hidden] { display: none; }

/* Day selector above the plate */
.plate__days { grid-area: days; display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.day-chip { display: grid; grid-template-columns: auto auto; grid-template-areas: "day level" "date level"; align-items: center; gap: 0 var(--s2); min-width: 4.4rem; padding: var(--s1) var(--s2); border: 1px solid var(--rule); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; background: var(--paper); }
a.day-chip:hover { border-color: var(--ink-3); background: var(--wash); }
.day-chip__day { grid-area: day; font-size: 0.72rem; color: var(--ink-2); }
.day-chip__date { grid-area: date; font-weight: 800; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.day-chip__level { grid-area: level; display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border-radius: var(--radius-sm); background: var(--danger, var(--rule-soft)); color: var(--danger-ink, var(--ink-3)); font-weight: 800; font-size: 0.85rem; box-shadow: inset 0 0 0 1px rgb(28 34 40 / 0.25); }
.day-chip.is-current { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.day-chip.is-forecast { border-style: solid; color: var(--ink-2); }
.day-chip.is-forecast .day-chip__level { background: repeating-linear-gradient(45deg, var(--danger) 0 3px, var(--paper) 3px 6px); }
.day-chip.is-forecast .day-chip__day::after { content: ", tendance"; }
.day-chip.is-5 .day-chip__level { background: #16232f; color: #fff; box-shadow: inset 0 0 0 2px #ff0000; }

.plate__caption { font-size: 0.85rem; color: var(--ink-2); display: grid; gap: var(--s1); }
.plate__caption p { max-width: 62ch; }
.plate__caption strong { color: var(--ink); }
.plate__legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); }
.plate__legend li { display: flex; align-items: center; gap: 0.35rem; }
.plate__legend li .swatch + .swatch { margin-left: -2px; }
.plate__legend li.plate__legend-slopes { display: none; }
.swatch { display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 2px; background: var(--danger); box-shadow: inset 0 0 0 1px rgb(28 34 40 / 0.3); }
.swatch.is-pale { background: repeating-linear-gradient(135deg, rgb(28 34 40 / 0.18) 0 1px, transparent 1px 4px), color-mix(in srgb, var(--danger) 50%, #f3f5f7); }
.swatch.is-line { height: 4px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--ink-3); }
.swatch.is-outside { background: #cbd4dc; }
.swatch.is-steep { background: radial-gradient(circle, var(--ink) 0 1.1px, transparent 1.4px) 0 0 / 4px 4px, var(--paper); }

.terrain__layers { position: absolute; z-index: 3; left: var(--s3); top: var(--s3); gap: var(--s1); padding: var(--s1); background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.layer-toggle { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 28px; padding: 0 var(--s2); border: 0; border-radius: var(--radius-sm); background: none; font: 600 0.8rem var(--sans); color: var(--ink-3); cursor: pointer; }
.layer-toggle:hover { background: var(--wash); }
.layer-toggle__box { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.layer-toggle__box path { opacity: 0; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.layer-toggle[aria-pressed="true"] { color: var(--ink); }
.layer-toggle[aria-pressed="true"] .layer-toggle__box rect { fill: var(--ink); stroke: var(--ink); }
.layer-toggle[aria-pressed="true"] .layer-toggle__box path { opacity: 1; stroke: var(--paper); }

/* Labels and pins on the relief */
.terrain__labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.landmark {
  position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.12rem 0.45rem 0.12rem 0.3rem; border: 0; border-radius: 999px;
  font: 600 0.76rem/1.2 var(--sans); white-space: nowrap; color: var(--ink);
  background: rgb(255 255 255 / 0.94); box-shadow: 0 1px 3px rgb(28 34 40 / 0.22);
  pointer-events: auto; cursor: pointer; transition: opacity 0.2s;
}
.landmark[hidden] { display: none; }
.landmark::after { content: ""; position: absolute; left: 50%; top: 100%; width: 1.5px; height: 12px; margin-left: -0.75px; background: var(--ink); opacity: 0.6; }
.landmark svg { width: 10px; height: 10px; flex: none; fill: var(--ink-2); stroke: none; }
.pin-num { display: inline-grid; place-items: center; min-width: 1.25rem; height: 1.25rem; padding: 0 0.2rem; border-radius: 999px; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 0.72rem; }
.landmark.is-stations { padding-left: 0.15rem; }
.landmark.is-stations::after { opacity: 1; }
.landmark.is-summits { background: none; box-shadow: none; padding: 0; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; }
.landmark.is-summits svg { fill: var(--ink); }
.landmark.is-summits::after { height: 6px; top: calc(100% + 2px); }
.landmark.is-around { color: var(--ink-2); font-weight: 500; }
.landmark.is-occluded { opacity: 0.35; }
.landmark.is-selected, .landmark.is-highlighted { background: var(--route); color: var(--paper); opacity: 1; z-index: 2; }
.landmark.is-selected .pin-num, .landmark.is-highlighted .pin-num { background: var(--paper); color: var(--route); }
.landmark.is-selected::after, .landmark.is-highlighted::after { background: var(--route); }

.landmark-card {
  position: relative; z-index: 4; max-width: min(17rem, calc(100% - 15rem));
  padding: var(--s3) 2.2rem var(--s3) var(--s3); background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgb(28 34 40 / 0.16); cursor: auto;
}
.landmark-card[hidden] { display: none; }
.landmark-card__title { font: 800 1rem var(--sans); }
.landmark-card__meta { font-size: 0.85rem; color: var(--ink-2); }
.landmark-card__danger { list-style: none; margin: var(--s2) 0 0; padding: 0; display: grid; gap: var(--s1); font-size: 0.88rem; }
.landmark-card__danger li { display: flex; align-items: center; gap: var(--s2); }
.landmark-card__close { position: absolute; right: var(--s1); top: var(--s1); display: grid; place-items: center; width: 30px; height: 30px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-2); }
.landmark-card__close:hover { background: var(--wash); }

/* Key: numbered places */
.key { grid-area: key; align-self: start; }
.key h2 { font: 800 0.95rem var(--sans); padding-bottom: var(--s2); border-bottom: 1px solid var(--ink); }
.key ol, .key ul { list-style: none; margin: 0; padding: 0; }
.summits-key { grid-area: summits; align-self: start; }
.summits-key:has(> .key__summits-wrap[hidden]) { display: none; }
.key__summits-wrap { margin-top: 0; }
.key__summits-wrap[hidden] { display: none; }
.key__summits-title { cursor: pointer; list-style: none; display: flex; align-items: center; gap: var(--s2); border-bottom: 1px solid var(--ink); padding-bottom: var(--s2); }
.key__summits-title::-webkit-details-marker { display: none; }
.key__summits-title::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg); transition: transform 0.15s; }
.key__summits-wrap[open] > .key__summits-title::before { transform: rotate(45deg); }
.key__summits-title h2 { font: 800 0.95rem var(--sans); border: 0; padding: 0; }
.summit-group .station__levels { grid-column: auto; grid-row: auto; }
.summit-group { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s3); align-items: start; padding: var(--s2) 0; border-bottom: 1px solid var(--rule-soft); }
.summit-group__names { display: flex; flex-wrap: wrap; gap: 0.15rem 0.6rem; font-size: 0.88rem; }
.summit-link { border: 0; padding: 0; background: none; font: inherit; color: var(--ink); text-align: left; white-space: nowrap; }
button.summit-link { cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 0.2em; }
button.summit-link:hover, .summit-link.is-highlighted { text-decoration-color: var(--route); color: var(--route); }
.summit-link.is-selected { color: var(--paper); background: var(--route); text-decoration: none; padding: 0 0.25rem; border-radius: 2px; }
.summit-mark { display: grid; place-items: center; grid-row: span 2; width: 1.25rem; }
.summit-mark svg, svg.summit-mark { width: 12px; height: 12px; fill: var(--ink); }
.station.is-summit.is-selected .summit-mark svg { fill: var(--paper); }
.station {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0 var(--s3); align-items: center; width: 100%;
  padding: var(--s2) var(--s1); border: 0; border-bottom: 1px solid var(--rule-soft); background: none; text-align: left; cursor: pointer;
}
button.station { cursor: pointer; }
button.station:hover, .station.is-highlighted { background: var(--route-soft); }
.station.is-selected { background: var(--route); color: var(--paper); }
.station.is-selected .station__range { color: var(--route-soft); }
.station.is-selected .pin-num { background: var(--paper); color: var(--route); }
.station .pin-num { grid-row: span 2; }
.station__name { font-weight: 700; font-size: 0.92rem; }
.station__range { grid-column: 2; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.station__levels { grid-column: 3; grid-row: 1 / span 2; display: inline-flex; gap: 3px; }
.key__credit { margin-top: var(--s2); font-size: 0.75rem; color: var(--ink-3); }
.key__credit a { color: inherit; }

.problem-icon { width: 2.2rem; height: 2.2rem; padding: 0.4rem; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); stroke-width: 1.8; }

/* Chapters: headings in the margin, calm reading column ------------------- */

.chapter { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: var(--s6); padding-top: var(--s7); }
.chapter + .chapter { border-top: 1px solid var(--rule); margin-top: var(--s7); }
.chapter__head { font: 800 1.15rem/1.25 var(--sans); letter-spacing: -0.01em; position: sticky; top: 5rem; align-self: start; }
.chapter__body { min-width: 0; display: grid; gap: var(--s5); align-content: start; }

.prose { max-width: 58ch; font: 400 1.0625rem/1.65 var(--serif); }
.prose > * + * { margin-top: var(--s3); }
.prose__lede { font: 600 1.3rem/1.35 var(--serif); max-width: 40ch; }
.prose-heading { font: 700 1rem var(--sans); margin-top: var(--s5) !important; }
.prose-list { margin: var(--s2) 0 0; padding-left: 1.2rem; }
.prose-list > li + li { margin-top: var(--s3); }
.prose-list li::marker { color: var(--ink-3); }
.prose-list ul { margin: var(--s2) 0 0; padding-left: 1.2rem; }
.prose-note { display: block; margin-top: var(--s1); color: var(--ink-2); font-size: 0.97rem; }
.lead { font-weight: 600; }
b.alt, b.aspect { font: 600 0.92em var(--sans); white-space: nowrap; padding: 0.05em 0.3em; border-radius: 3px; background: var(--rule-soft); }

/* Figures */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--s6); }
.figure { display: grid; gap: var(--s3); align-content: start; }
.figure figcaption { font-size: 0.88rem; color: var(--ink-2); max-width: 48ch; }
.figure figcaption strong { display: block; font-size: 0.95rem; color: var(--ink); }
.chart { display: block; width: 100%; height: auto; max-width: 460px; overflow: visible; }
.chart text { font-family: var(--sans); }
.chart-label { font-size: 12px; fill: var(--ink-2); }
.chart-label.is-small { font-size: 10px; }
.chart-label.is-muted { fill: var(--ink-3); }
.chart-value { font-size: 12px; font-weight: 700; fill: var(--ink); font-variant-numeric: tabular-nums; }
.is-center { text-anchor: middle; }
.is-end { text-anchor: end; }
.chart-axis { stroke: var(--rule); stroke-width: 1; }
.bar { fill: var(--bar); }
.bar:hover { fill: var(--ink); }
.bar.is-forecast { fill: url(#hatch); }
.bar-zero { fill: var(--rule); }
.hatch-bg { fill: var(--bar-soft); }
.hatch-line { stroke: var(--bar); stroke-width: 2.5; }
.snowpack-keys { display: grid; grid-template-columns: 1fr 1fr; max-width: 460px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.snowpack-keys span:first-child { text-align: right; padding-right: 30%; }
.snowpack-keys span:last-child { padding-left: 30%; }

/* Weather */
.forecast { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); border-top: 1px solid var(--ink); }
.forecast__slot { padding: var(--s3) var(--s4) var(--s4) 0; }
.forecast__slot + .forecast__slot { padding-left: var(--s4); border-left: 1px solid var(--rule); }
.forecast__when { font-size: 0.85rem; color: var(--ink-2); }
.forecast__when strong { display: block; font-size: 1rem; color: var(--ink); }
.forecast__sky { margin: var(--s1) 0 var(--s2); font-weight: 600; }
.forecast__facts { display: grid; gap: var(--s1); font-size: 0.88rem; }
.forecast__facts div { display: flex; justify-content: space-between; gap: var(--s3); padding-top: var(--s1); border-top: 1px solid var(--rule-soft); }
.forecast__facts dt { color: var(--ink-2); }
.forecast__facts dd { display: inline-flex; align-items: center; gap: var(--s1); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sky-icon { stroke-width: 1.5; color: var(--ink); }
.i-sun { stroke: #b07800; }
.i-sun:is(circle) { fill: #ffd34d; }
.i-cloud { fill: #e6ebef; stroke: var(--ink-2); }
.i-fog { stroke: var(--ink-3); }
.i-rain, .i-snow { stroke: var(--ink-2); }
.i-bolt { stroke: #b07800; stroke-width: 2; }
.wind-arrow { stroke: var(--ink); stroke-width: 2; }

/* Past week */
.table-scroller { overflow-x: auto; }
.past { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.past th, .past td { padding: var(--s2) var(--s2); text-align: center; border-bottom: 1px solid var(--rule-soft); }
.past thead th { font-weight: 700; border-bottom: 1px solid var(--ink); }
.past tbody th, .past thead th:first-child { text-align: left; font-weight: 700; white-space: nowrap; position: sticky; left: 0; z-index: 1; background: var(--paper); }
.past tbody th small { display: block; font-weight: 400; color: var(--ink-3); }
.past .is-strong { font-weight: 800; }
.past td .danger-chip { margin-inline: auto; }
.past__sky { display: inline-flex; gap: 1px; }

/* Season */
.season__scroller { overflow-x: auto; padding-bottom: var(--s1); }
.season__grid { display: grid; grid-template-columns: 2.4rem repeat(var(--weeks), 1.6rem); grid-template-rows: 1.2rem repeat(7, 1.6rem); gap: 3px; width: max-content; }
.season__month { font-size: 0.78rem; color: var(--ink-2); white-space: nowrap; }
.season__weekday { font-size: 0.72rem; color: var(--ink-3); align-self: center; }
.season__cell { display: grid; place-items: center; border-radius: 3px; background: var(--danger, var(--rule-soft)); color: var(--danger-ink, var(--ink)); font: 700 0.75rem var(--sans); text-decoration: none; }
.season__cell.is-unknown { background: var(--rule-soft); }
.season__cell.is-out { background: transparent; }
.season__cell.is-forecast { background: repeating-linear-gradient(45deg, var(--danger) 0 3px, var(--paper) 3px 6px); box-shadow: inset 0 0 0 1px rgb(28 34 40 / 0.25); }
.season__cell.is-current { outline: 2px solid var(--ink); outline-offset: 1px; }
.season__cell:hover { outline: 2px solid var(--route); outline-offset: 1px; }
.season__legend { list-style: none; display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: 0; padding: 0; font-size: 0.85rem; color: var(--ink-2); }
.season__legend li { display: inline-flex; align-items: center; gap: 0.35rem; }

.sources { margin: 0; padding-left: 1.1rem; display: grid; gap: var(--s1); }

/* Calendar (popover) ------------------------------------------------------ */

.calendar { position: fixed; inset: auto; margin: 0; width: min(23rem, calc(100vw - 1.5rem)); padding: var(--s4); border: 1px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 12px 30px rgb(28 34 40 / 0.18); }
.calendar::backdrop { background: transparent; }
.calendar__head { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; margin-bottom: var(--s3); }
.calendar__title { text-align: center; font: 800 1.15rem var(--sans); }
.calendar__nav { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--rule); background: var(--paper); cursor: pointer; }
.calendar__nav:disabled { opacity: 0.35; cursor: default; }
.calendar__month[hidden] { display: none; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.calendar__weekday { text-align: center; font-size: 0.72rem; font-weight: 700; color: var(--ink-3); padding-bottom: var(--s1); }
.calendar__day { display: grid; grid-template-rows: 1fr auto; justify-items: center; min-height: 3rem; padding: 0.3rem 0; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: var(--wash); font-variant-numeric: tabular-nums; }
.calendar__num { font-weight: 700; font-size: 0.92rem; align-self: center; }
.calendar__level { min-width: 1.3rem; height: 1.05rem; padding: 0 0.2rem; border-radius: 2px; display: grid; place-items: center; font: 800 0.72rem/1 var(--sans); background: var(--danger, transparent); color: var(--danger-ink, var(--ink)); }
.calendar__day.is-known .calendar__level { box-shadow: inset 0 0 0 1px rgb(28 34 40 / 0.25); }
.calendar__day.is-unknown .calendar__level { background: none; }
.calendar__day.is-unknown .calendar__level::before { content: ""; width: 0.9rem; height: 3px; border-radius: 2px; background: var(--rule); }
.calendar__day.is-forecast .calendar__level { background: repeating-linear-gradient(45deg, var(--danger) 0 3px, var(--paper) 3px 6px); }
.calendar__day.is-5 .calendar__level { background: #16232f; color: #fff; box-shadow: inset 0 0 0 2px #ff0000; }
.calendar__day:hover { background: var(--route-soft); }
.calendar__day.is-today .calendar__num { text-decoration: underline 2px; text-underline-offset: 3px; }
.calendar__day.is-selected { background: var(--paper); outline: 2px solid var(--ink); outline-offset: -2px; }
.calendar__day.is-future { color: var(--ink-3); background: none; }
.calendar__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--rule-soft); }
.calendar__today { display: inline-grid; padding: var(--s2) var(--s4); border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 700; line-height: 1.2; }
.calendar__today span { font-weight: 400; font-size: 0.8rem; opacity: 0.85; }
.calendar__close { border: 0; background: none; font-weight: 600; color: var(--route); cursor: pointer; padding: var(--s2); }

/* Colophon, empty state --------------------------------------------------- */

.colophon { margin-top: var(--s8); padding: var(--s5) 0 var(--s7); border-top: 1px solid var(--ink); color: var(--ink-2); font-size: 0.85rem; display: grid; gap: var(--s2); }
.colophon p { max-width: 64ch; }
.empty { margin: var(--s8) auto; max-width: 52ch; display: grid; gap: var(--s4); }
.empty h1 { font: 800 2.4rem/1 var(--sans); letter-spacing: -0.02em; }
.button { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s4); border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 700; }
.empty .day-nav__link { color: var(--route); }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1020px) {
  .topo { grid-template-columns: minmax(0, 1fr) 18rem; }
  .chapter { grid-template-columns: 1fr; gap: var(--s4); }
  .chapter__head { position: static; }
}

@media (max-width: 760px) {
  .wrap { width: min(100% - 1.5rem, 1240px); }
  .runhead__inner { gap: var(--s3); flex-wrap: wrap; padding: var(--s2) 0; }
  .runhead__until { display: none; }
  .runhead .day-nav { order: 3; width: 100%; justify-content: space-between; }
  .day-nav__current { flex: 1; justify-content: center; }
  .day-nav__long { display: none; }
  .day-nav__short { display: inline; }
  .topo { grid-template-columns: 1fr; grid-template-areas: "fiche" "plate" "key" "summits"; grid-template-rows: none; gap: var(--s5); }
  .plate { grid-template-areas: "days" "stage" "card" "caption" "notes"; }
  .plate > .landmark-card { grid-area: card; margin: 0; max-width: none; justify-self: stretch; }
  .calendar { inset: auto 0 0 0; width: 100%; border-radius: var(--radius) var(--radius) 0 0; border-width: 1px 0 0; }
  .calendar::backdrop { background: rgb(28 34 40 / 0.2); }
  .table-scroller { direction: rtl; }
  .table-scroller > table { direction: ltr; }
  .fiche__num { font-size: 3.2rem; }
  .fiche__name { font-size: 1.6rem; }
  .fiche__level { padding: var(--s2) var(--s3); }
  .fiche__rows { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s4); padding: 0 var(--s3); }
  .fiche__rows > div { padding: var(--s2) 0; }
  .fiche__aspects { grid-column: 1 / -1; }
  .fiche__aspects .rose { width: 60px; height: 60px; }
  .terrain, .mountain { aspect-ratio: 1; }
  .terrain__rose { width: 60px; height: 60px; }
  /* Phones: the rose moves to the lower left so the layer tray gets the full width on one row. */
  .terrain__rose { top: auto; right: auto; left: var(--s3); bottom: var(--s3); }
  .terrain__layers { flex-wrap: nowrap; right: var(--s3); max-width: none; justify-content: space-between; }
  .terrain__statusbar { top: 3.6rem; bottom: auto; max-width: calc(100% - 1.5rem); }
  .layer-toggle { font-size: 0.74rem; padding: 0 0.2rem; gap: 0.25rem; }
  .forecast__slot, .forecast__slot + .forecast__slot { padding: var(--s3) 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  .chapter { padding-top: var(--s6); }
  .chapter + .chapter { margin-top: var(--s5); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

@media print {
  .runhead, .terrain__controls, .terrain__layers, .season__scroller { display: none; }
}
