/* =========================================================================
   TRAIL PAGE STYLES — Austurstræti
   --------------------------------------------------------------------
   Loaded only on /leidin (and /en/trail) via the conditional enqueue
   in functions.php. Inherits design tokens from /assets/css/tokens.css
   loaded earlier in the cascade.
   ========================================================================= */

/* =========================================================================
   PART A — SCROLLY FLY-THROUGH (top half of the page)
   ========================================================================= */
/* ==========================================================================
   DESIGN TOKENS — Bergmál palette (see spec section D)
   ========================================================================== */
/* :root tokens moved to tokens.css */

/* ==========================================================================
   RESET + BASE
   ========================================================================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  font-family: var(--font-body);
  color: var(--basalt-ink);
  background: var(--parchment);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   PAPER GRAIN — applied to image containers for subtle texture
   ========================================================================== */
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0 0.1 0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: var(--grain-opacity);
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* ==========================================================================
   TOP BAR — language toggle + return-to-site link
   ========================================================================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  background: rgba(244, 237, 225, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(46, 74, 92, 0.08);
}
.wordmark {
  font-family: var(--font-sc);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--lon-blue);
  text-decoration: none;
  font-weight: 700;
}
.wordmark::before {
  content: "❖ ";
  color: var(--oxide-rust);
  font-size: 11px;
}
.lang-toggle {
  display: flex;
  gap: 2px;
  font-family: var(--font-sc);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.lang-toggle button {
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 10px;
  cursor: pointer;
  color: var(--stone);
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  transition: color 180ms;
}
.lang-toggle button[aria-pressed="true"] {
  color: var(--lon-blue);
  border-color: var(--lon-blue);
  font-weight: 700;
}
.lang-toggle button:hover { color: var(--oxide-rust); }

/* ==========================================================================
   INTRO — fades out as you scroll into the map
   ========================================================================== */
.intro {
  height: 90vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 32px;
  position: relative;
}
.intro-eyebrow {
  font-family: var(--font-sc);
  letter-spacing: 0.22em;
  font-size: 12px;
  color: var(--oxide-rust);
  margin-bottom: 24px;
}
.intro-eyebrow::before,
.intro-eyebrow::after {
  content: "—";
  color: var(--stone);
  margin: 0 14px;
  opacity: 0.6;
}
.intro h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1.05;
  color: var(--lon-blue);
  max-width: 16ch;
  margin-bottom: 20px;
}
.intro h1 em {
  font-style: italic;
  color: var(--rhyolite-blue);
}
.intro .subhead {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 19px;
  color: var(--basalt-ink);
  max-width: 50ch;
  margin-bottom: 48px;
  opacity: 0.85;
}
.intro .scroll-cue {
  font-family: var(--font-sc);
  letter-spacing: 0.2em;
  font-size: 11px;
  color: var(--stone);
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  animation: scroll-cue-bob 2.2s ease-in-out infinite;
}
@keyframes scroll-cue-bob {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.5; }
  50% { transform: translate(-50%, 8px); opacity: 1; }
}
.intro .coords {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--brass);
  margin-top: 32px;
}

/* ==========================================================================
   SCROLLY CONTAINER — sticky map + scrolling chapter panel
   ========================================================================== */
.scrolly {
  position: relative;
  max-width: 100%;
}

/* The map container is sticky — stays pinned while chapters scroll past */
.map-container {
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  z-index: 1;
}
#map {
  position: absolute;
  inset: 0;
  background: var(--lon-blue);
}

/* Chapter overlay — semi-transparent gradient on the left side of the map */
.map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to right,
    rgba(28, 30, 34, 0.45) 0%,
    rgba(28, 30, 34, 0.15) 35%,
    transparent 55%
  );
  z-index: 2;
}

/* Scroll gutter — invisible column on the left side of the sticky map
   that captures wheel/trackpad events so they trigger page scroll
   instead of map zoom. The right portion of the map remains free for
   pan, zoom, rotate. The gutter is `pointer-events: auto` but has no
   custom wheel handler, so the browser's default page-scroll behaviour
   takes over for events in this column.
   The chapter cards sit on a higher z-index above this gutter, so their
   clicks/scroll still work normally inside the cards. */
.scroll-gutter {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(60%, calc(5vw + 480px));
  pointer-events: auto;
  z-index: 2;
  background: transparent;
}

/* Chapter text overlay floats above the map on the left.
   --------------------------------------------------------------------
   PASS 7 NOTE: !important on these rules because Kadence parent theme
   adds margin/padding to .entry-content > section blocks that would
   otherwise create a visible gap between chapters. The scrolly effect
   only works if chapters tile end-to-end with no gaps.
   ========================================================================== */
.chapters {
  position: relative !important;
  z-index: 3;
  /* Pull chapters up to sit on top of the sticky map */
  margin-top: -100vh !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  pointer-events: none;  /* map below can be scrolled/panned; chapter cards enable pointer */
}
.chapter {
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 120px 0 120px 5vw !important;
  display: flex;
  align-items: center;
  /* Defeat any Kadence ::before/::after that might inject spacing */
  border: 0;
}
.chapter::before, .chapter::after { content: none; display: none; }
.chapter-inner {
  pointer-events: auto;
  width: min(440px, 42vw);
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  background: var(--parchment);
  padding: 36px 36px 32px 36px;
  position: relative;
  box-shadow: 0 20px 60px -20px rgba(28, 30, 34, 0.35),
              0 4px 12px -4px rgba(28, 30, 34, 0.2);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms ease, transform 600ms ease;
  /* Hide scrollbar on modern browsers if it appears */
  scrollbar-width: thin;
  scrollbar-color: rgba(46, 74, 92, 0.2) transparent;
}
.chapter-inner::-webkit-scrollbar { width: 4px; }
.chapter-inner::-webkit-scrollbar-thumb { background: rgba(46, 74, 92, 0.2); }
.chapter.active .chapter-inner { opacity: 1; transform: translateY(0); }

/* Stamp-border perforation (from spec section D) */
.chapter-inner {
  --radius: 7px;
  --paper: var(--parchment);
  background-image:
    radial-gradient(circle var(--radius) at 50% 50%, transparent 98%, var(--paper)),
    linear-gradient(var(--paper) 0 0);
  background-repeat: round, no-repeat;
  background-position:
    calc(var(--radius) * -1.5) calc(var(--radius) * -1.5),
    50%;
  background-size:
    calc(var(--radius) * 3) calc(var(--radius) * 3),
    calc(100% - var(--radius) * 3) calc(100% - var(--radius) * 3);
}

.chapter-inner::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(46, 74, 92, 0.14);
  pointer-events: none;
}

/* Chapter header */
.chapter-num {
  font-family: var(--font-sc);
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--oxide-rust);
  margin-bottom: 4px;
}
.chapter-eyebrow {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--stone);
  margin-bottom: 16px;
}
.chapter h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.15;
  color: var(--lon-blue);
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
.chapter h2 em { font-style: italic; color: var(--rhyolite-blue); }

.chapter p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--basalt-ink);
  margin-bottom: 14px;
}
.chapter p + p { margin-top: -2px; }
.chapter p:last-of-type { margin-bottom: 0; }

/* Stat block */
.stats {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(46, 74, 92, 0.16);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 20px;
}
.stat-label {
  font-family: var(--font-sc);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--stone);
  display: block;
  margin-bottom: 2px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--lon-blue);
  font-weight: 500;
}

/* Ornament between chapter header and body */
.chapter-ornament {
  display: block;
  width: 36px;
  height: 12px;
  margin-bottom: 14px;
  color: var(--oxide-rust);
}

/* ==========================================================================
   CHAPTER PROGRESS INDICATOR — small vertical nav on the right
   ========================================================================== */
.progress {
  position: fixed;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transition: opacity 400ms;
  pointer-events: none;
}
.progress.visible { opacity: 1; pointer-events: auto; }
.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(244, 237, 225, 0.45);
  border: 1px solid rgba(244, 237, 225, 0.7);
  cursor: pointer;
  transition: all 260ms;
  padding: 0;
}
.progress-dot.active {
  background: var(--brass);
  border-color: var(--brass);
  transform: scale(1.35);
}
.progress-dot:hover { background: var(--parchment); }

/* ==========================================================================
   OUTRO — signs off the scrolly, transitions to the rest of the page
   ========================================================================== */
.outro {
  min-height: 60vh;
  padding: 120px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--parchment);
  position: relative;
  z-index: 3;
}
.outro-ornament {
  font-family: var(--font-sc);
  color: var(--oxide-rust);
  letter-spacing: 0.3em;
  font-size: 11px;
  margin-bottom: 24px;
}
.outro h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--lon-blue);
  max-width: 22ch;
  margin-bottom: 28px;
  line-height: 1.3;
}
.outro .cta {
  display: inline-block;
  font-family: var(--font-sc);
  font-size: 13px;
  letter-spacing: 0.18em;
  padding: 14px 32px;
  background: var(--oxide-rust);
  color: var(--parchment);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 200ms;
}
.outro .cta:hover { background: #9B3823; }

/* ==========================================================================
   MAP CUSTOMISATION — popup, controls, waypoint markers
   ========================================================================== */
.mapboxgl-ctrl-group,
.mapboxgl-ctrl-attrib {
  font-family: var(--font-body) !important;
  font-size: 10px !important;
}
.mapboxgl-ctrl-attrib {
  background: rgba(244, 237, 225, 0.85) !important;
}
.mapboxgl-popup-content {
  font-family: var(--font-body);
  background: var(--parchment);
  padding: 14px 18px;
  border: 1px solid rgba(46, 74, 92, 0.15);
  box-shadow: 0 8px 24px -8px rgba(28, 30, 34, 0.3);
}
.mapboxgl-popup-tip {
  border-top-color: var(--parchment) !important;
  border-bottom-color: var(--parchment) !important;
}
.popup-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--lon-blue);
  margin-bottom: 4px;
}
.popup-meta {
  font-family: var(--font-sc);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--stone);
}

/* Waypoint markers */
.waypoint-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--parchment);
  border: 2px solid var(--oxide-rust);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(28, 30, 34, 0.4);
  transition: transform 200ms;
}
.waypoint-marker:hover { transform: scale(1.25); }
.waypoint-marker.start,
.waypoint-marker.end {
  background: var(--oxide-rust);
  border-color: var(--parchment);
}

/* Chapter marker label on the map (shows current chapter location) */
.chapter-label {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--parchment);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  background: rgba(46, 74, 92, 0.75);
  padding: 4px 10px;
  border: 1px solid rgba(244, 237, 225, 0.35);
  white-space: nowrap;
  pointer-events: none;
}

/* ==========================================================================
   LANGUAGE VISIBILITY — swap IS/EN blocks via html[lang]
   ========================================================================== */



/* ==========================================================================
   MOBILE (below 768px) — simplified fallback
   - Stacked chapter cards with small inline maps (still interactive but
     with pitch=0, terrain off for performance — see spec Step 8.5)
   - Progress indicator hidden
   - Lighter hero
   ========================================================================== */
/* ==========================================================================
   MOBILE FALLBACK (≤768px)
   ----------------------------------------------------------------------
   Below 768px we don't load Mapbox GL JS at all. Instead a single static
   PNG of the trail (from the Mapbox Static Images API) acts as the hero,
   anchored as a sticky element so it parallax-drifts behind the chapter
   cards as the user scrolls.
   
   This saves ~750 KB of JavaScript download and avoids WebGL render
   cost — meaningful on mid-range phones over cellular.
   ========================================================================== */
@media (max-width: 768px) {
  .topbar { padding: 10px 18px; }
  .topbar .wordmark { font-size: 11px; }

  .intro { padding: 80px 20px 60px 20px; min-height: auto; height: auto; }
  .intro h1 { font-size: 2.1rem; }
  .intro .subhead { font-size: 15px; margin-bottom: 28px; }
  .intro .scroll-cue { bottom: 24px; }

  /* Hide the live map and the scroll-gutter; static image takes over */
  #map { display: none; }
  .scroll-gutter { display: none; }
  .map-vignette { display: none; }
  .map-loading { display: none; }
  .progress { display: none; }

  /* Static hero map — sticky so the chapter cards scroll over it */
  .map-container {
    position: sticky;
    top: 0;
    height: 70vh;
    overflow: hidden;
  }
  .mobile-static-hero {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 120%;        /* taller than container so parallax has room to drift up */
    object-fit: cover;
    object-position: center;
    background: var(--lon-blue);
    transform: translateY(var(--parallax-y, 0px));
    will-change: transform;
  }
  .mobile-static-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    /* Bottom vignette so chapter text stays readable when they overlap */
    background: linear-gradient(
      to bottom,
      transparent 0%,
      transparent 55%,
      rgba(28, 30, 34, 0.35) 100%
    );
    pointer-events: none;
  }

  /* Chapters: stacked normally, no longer overlay-pulled */
  .chapters {
    margin-top: 0;   /* don't pull up over a non-existent live map */
    background: var(--parchment);
  }
  .chapter {
    min-height: auto;
    padding: 56px 20px 56px 20px;
    display: block;
  }
  .chapter-inner {
    width: 100%;
    max-height: none;     /* allow natural height on mobile */
    overflow: visible;
    padding: 24px 22px 22px 22px;
  }
  .chapter.active .chapter-inner { opacity: 1; transform: none; }
  .chapter h2 { font-size: 24px; }
  .chapter-num { font-size: 9px; }
  .chapter-eyebrow { font-size: 10px; }

  /* The first chapter (overview) sits AT the bottom of the static image,
     creating a clean transition from the hero to the chapter narrative. */
  #ch-1 { padding-top: 24px; margin-top: -8vh; }
  #ch-1 .chapter-inner {
    box-shadow: 0 -16px 32px -8px rgba(28, 30, 34, 0.25),
                0 8px 24px -6px rgba(28, 30, 34, 0.18);
  }
}

/* Default (desktop): hide the static fallback */
.mobile-static-hero { display: none; }

/* ==========================================================================
   LOADING STATE
   ========================================================================== */
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lon-blue);
  color: var(--parchment);
  font-family: var(--font-sc);
  font-size: 12px;
  letter-spacing: 0.22em;
  z-index: 10;
  transition: opacity 400ms;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }
.map-loading span { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* =========================================================================
   PART B — EXPLORE MAP + ELEVATION CHART + SEO SECTION (bottom half)
   --------------------------------------------------------------------
   The explore map uses a different DOM id (#explore-map) than the
   scrolly map (#map) so both maps coexist on the same page. The CSS
   below mostly applies via class selectors, so no conflicts.
   ========================================================================= */

/* :root tokens moved to tokens.css */
* { box-sizing: border-box; margin: 0; padding: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  font-family: var(--font-body);
  color: var(--basalt-ink);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ==========================================================================
   TOP BAR — same as scrolly for visual continuity
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  background: rgba(244, 237, 225, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(46, 74, 92, 0.08);
}
.wordmark {
  font-family: var(--font-sc);
  font-size: 14px;
  letter-spacing: 0.14em;
  color: var(--lon-blue);
  text-decoration: none;
  font-weight: 700;
}
.wordmark::before { content: "❖ "; color: var(--oxide-rust); font-size: 11px; }
.lang-toggle { display: flex; gap: 2px; }
.lang-toggle button {
  background: transparent; border: 1px solid transparent;
  padding: 4px 10px; cursor: pointer; color: var(--stone);
  font-family: var(--font-sc); font-size: 12px; letter-spacing: 0.12em;
  text-transform: uppercase; transition: color 180ms;
}
.lang-toggle button[aria-pressed="true"] {
  color: var(--lon-blue); border-color: var(--lon-blue); font-weight: 700;
}
.lang-toggle button:hover { color: var(--oxide-rust); }

/* ==========================================================================
   SECTION HEADER — introduces the explore section
   ========================================================================== */
.section-header {
  text-align: center;
  padding: 80px 32px 50px 32px;
  max-width: 700px;
  margin: 0 auto;
}
.section-header .eyebrow {
  font-family: var(--font-sc);
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--oxide-rust);
  margin-bottom: 18px;
}
.section-header .eyebrow::before, .section-header .eyebrow::after {
  content: "—"; color: var(--stone); margin: 0 14px; opacity: 0.6;
}
.section-header h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.1;
  color: var(--lon-blue);
  margin-bottom: 16px;
}
.section-header h1 em { font-style: italic; color: var(--rhyolite-blue); }
.section-header p {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 17px;
  color: var(--basalt-ink);
  opacity: 0.85;
  line-height: 1.55;
}

/* ==========================================================================
   MAP — 70vh sticky-ish, but here just normal flow
   ========================================================================== */
.map-section {
  position: relative;
  width: 100%;
  height: 70vh;
  min-height: 520px;
  background: var(--lon-blue);
  overflow: hidden;
}
#map { position: absolute; inset: 0; }

/* Top-left legend card */
.legend {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 5;
  background: var(--parchment);
  padding: 18px 22px;
  width: 240px;
  font-size: 13px;
  /* Stamp-border perforation */
  --radius: 6px;
  --paper: var(--parchment);
  background-image:
    radial-gradient(circle var(--radius) at 50% 50%, transparent 98%, var(--paper)),
    linear-gradient(var(--paper) 0 0);
  background-repeat: round, no-repeat;
  background-position:
    calc(var(--radius) * -1.5) calc(var(--radius) * -1.5), 50%;
  background-size:
    calc(var(--radius) * 3) calc(var(--radius) * 3),
    calc(100% - var(--radius) * 3) calc(100% - var(--radius) * 3);
  box-shadow: 0 12px 32px -12px rgba(28,30,34,0.3);
}
.legend::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(46, 74, 92, 0.16);
  pointer-events: none;
}
.legend h3 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--lon-blue);
  margin-bottom: 4px;
  font-weight: 500;
}
.legend .legend-meta {
  font-family: var(--font-sc);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--oxide-rust);
  margin-bottom: 14px;
}
.legend dl {
  display: grid;
  grid-template-columns: 1fr auto;
  row-gap: 4px;
  font-family: var(--font-body);
}
.legend dt {
  font-family: var(--font-sc);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--stone);
  align-self: center;
}
.legend dd {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--lon-blue);
  font-weight: 500;
  text-align: right;
}

/* Custom 2D/3D toggle on top-right */
.view-toggle {
  position: absolute;
  top: 24px;
  right: 64px;  /* leave room for Mapbox's compact attribution + native controls */
  z-index: 5;
  display: flex;
  background: var(--parchment);
  border: 1px solid var(--lon-blue);
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.18em;
  overflow: hidden;
}
.view-toggle button {
  background: transparent;
  border: none;
  color: var(--lon-blue);
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  letter-spacing: inherit;
  transition: all 200ms;
}
.view-toggle button[aria-pressed="true"] {
  background: var(--lon-blue);
  color: var(--parchment);
}
.view-toggle button:not([aria-pressed="true"]):hover {
  background: var(--parchment-tint);
}

/* ==========================================================================
   MAPBOX UI — popup, controls, markers
   ========================================================================== */
.mapboxgl-ctrl-attrib {
  background: rgba(244, 237, 225, 0.85) !important;
  font-family: var(--font-body) !important;
  font-size: 10px !important;
}
.mapboxgl-ctrl-group {
  background: var(--parchment) !important;
  border: 1px solid rgba(46,74,92,0.2) !important;
}
.mapboxgl-ctrl-group button {
  background-color: var(--parchment) !important;
}
.mapboxgl-ctrl-group button:hover {
  background-color: var(--parchment-tint) !important;
}
.mapboxgl-ctrl-zoom-in span, .mapboxgl-ctrl-zoom-out span,
.mapboxgl-ctrl-compass span, .mapboxgl-ctrl-fullscreen span {
  filter: brightness(0.5) !important;
}

/* Waypoint markers — custom hut/start/end SVG */
.waypoint-marker {
  width: 32px;
  height: 32px;
  cursor: pointer;
  transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.waypoint-marker:hover { transform: scale(1.18); }
.waypoint-marker svg { width: 100%; height: 100%; }

/* Hover marker that follows the mouse on the elevation chart */
.hover-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brass);
  border: 3px solid var(--parchment);
  box-shadow: 0 0 0 2px var(--lon-blue), 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* Popup styling */
.mapboxgl-popup {
  max-width: 340px !important;
}
.mapboxgl-popup-content {
  font-family: var(--font-body);
  background: var(--parchment);
  padding: 0;
  border: 1px solid rgba(46, 74, 92, 0.2);
  box-shadow: 0 14px 36px -12px rgba(28, 30, 34, 0.4);
  overflow: hidden;
  width: 320px;
}
.mapboxgl-popup-tip {
  border-top-color: var(--parchment) !important;
  border-bottom-color: var(--parchment) !important;
}
.mapboxgl-popup-close-button {
  font-size: 22px !important;
  padding: 4px 10px !important;
  color: var(--stone) !important;
}
.popup-photo {
  position: relative;
  height: 160px;
  background: var(--parchment-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(46, 74, 92, 0.16);
  overflow: hidden;
}
.popup-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.28 0 0 0 0 0.22 0 0 0 0.4 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  opacity: 0.18;
  mix-blend-mode: multiply;
  pointer-events: none;
}
.popup-photo svg.placeholder-icon {
  width: 56px;
  height: 56px;
  color: var(--stone);
  opacity: 0.5;
}
.popup-photo .photo-label {
  position: absolute;
  bottom: 10px;
  left: 14px;
  font-family: var(--font-sc);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--stone);
  background: rgba(244, 237, 225, 0.85);
  padding: 4px 8px;
}
.popup-body { padding: 16px 18px 18px 18px; }
.popup-day {
  font-family: var(--font-sc);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--oxide-rust);
  margin-bottom: 4px;
}
.popup-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--lon-blue);
  font-weight: 500;
  margin-bottom: 2px;
  line-height: 1.15;
}
.popup-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 13px;
  color: var(--rhyolite-blue);
  margin-bottom: 10px;
}
.popup-stats {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  margin: 10px 0;
  border-top: 1px solid rgba(46, 74, 92, 0.12);
  border-bottom: 1px solid rgba(46, 74, 92, 0.12);
}
.popup-stat {
  flex: 1;
}
.popup-stat-label {
  font-family: var(--font-sc);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--stone);
  display: block;
  margin-bottom: 2px;
}
.popup-stat-value {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--lon-blue);
  font-weight: 500;
}
.popup-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--basalt-ink);
}

/* ==========================================================================
   ELEVATION PROFILE
   ========================================================================== */
.elevation-section {
  background: var(--parchment-tint);
  padding: 50px 32px 60px 32px;
  position: relative;
}
.elevation-header {
  max-width: 1100px;
  margin: 0 auto 24px auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.elevation-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--lon-blue);
  font-weight: 500;
}
.elevation-title em { font-style: italic; color: var(--rhyolite-blue); }
.elevation-meta {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--stone);
}
.elevation-meta strong {
  color: var(--lon-blue);
  font-weight: 600;
}
.chart-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  background: var(--parchment);
  padding: 24px 28px 20px 28px;
  border: 1px solid rgba(46, 74, 92, 0.12);
  position: relative;
  height: 320px;
}
#elevation-chart {
  cursor: crosshair;
}

/* Day-boundary labels float above the chart, positioned with JS */
.day-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  margin: 24px 28px;  /* match chart padding */
}
.day-label {
  position: absolute;
  top: 0;
  font-family: var(--font-sc);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--stone);
  background: var(--parchment);
  padding: 3px 10px;
  transform: translateX(-50%);
  white-space: nowrap;
  border-bottom: 1px solid rgba(176, 138, 74, 0.5);
}

/* ==========================================================================
   SEO CONTENT BELOW THE FOLD
   --------------------------------------------------------------------
   Step 5 of the build spec. Server-rendered, crawlable content for
   search engines. Mapbox tiles aren't indexable, so the trail's text
   identity lives here. Doubles as readable content for users who want
   detail beyond the popups.
   ========================================================================== */
.seo-section {
  background: var(--parchment);
  padding: 80px 32px 100px 32px;
  border-top: 1px solid rgba(46, 74, 92, 0.10);
}
.seo-inner {
  max-width: 880px;
  margin: 0 auto;
}
.seo-section h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.15;
  color: var(--lon-blue);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.seo-section h2 em { font-style: italic; color: var(--rhyolite-blue); }
.seo-section h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--lon-blue);
  margin-bottom: 6px;
}
.seo-eyebrow {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--oxide-rust);
  margin-bottom: 14px;
}
.seo-intro {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  line-height: 1.6;
  color: var(--basalt-ink);
  margin-bottom: 40px;
  max-width: 60ch;
}
.seo-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--basalt-ink);
  margin-bottom: 14px;
}
.seo-divider {
  border: none;
  height: 1px;
  background: rgba(46, 74, 92, 0.12);
  margin: 48px 0;
  position: relative;
}
.seo-divider::after {
  content: "❦";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--parchment);
  padding: 0 16px;
  color: var(--oxide-rust);
  font-size: 14px;
}

/* Waypoint list */
.seo-waypoints {
  list-style: none;
  padding: 0;
  margin: 32px 0;
  display: grid;
  gap: 28px;
}
.seo-waypoint {
  padding: 24px 28px;
  background: var(--parchment-tint);
  border-left: 3px solid var(--brass);
  position: relative;
}
.seo-waypoint-day {
  font-family: var(--font-sc);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--oxide-rust);
  margin-bottom: 4px;
}
.seo-waypoint-stats {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--stone);
  margin: 8px 0 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.seo-waypoint-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.seo-waypoint-stats strong {
  font-family: var(--font-display);
  color: var(--lon-blue);
  font-size: 15px;
  font-weight: 500;
}

/* Practical info */
.seo-practical {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 28px 32px;
  margin: 32px 0;
}
.seo-practical-item h4 {
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--oxide-rust);
  margin-bottom: 8px;
}
.seo-practical-item p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--basalt-ink);
  margin: 0;
}

/* GPX download block */
.seo-gpx {
  margin: 48px 0 0 0;
  padding: 28px 32px;
  background: var(--lon-blue);
  color: var(--parchment);
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.seo-gpx-icon {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border: 1px solid var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sc);
  font-size: 11px;
  letter-spacing: 0.06em;
}
.seo-gpx-text {
  flex: 1;
  min-width: 240px;
}
.seo-gpx-text h4 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--parchment);
  margin-bottom: 4px;
  font-weight: 500;
}
.seo-gpx-text p {
  font-size: 13px;
  color: rgba(244, 237, 225, 0.75);
  margin: 0;
  line-height: 1.5;
}
.seo-gpx a {
  font-family: var(--font-sc);
  font-size: 12px;
  letter-spacing: 0.18em;
  padding: 12px 22px;
  background: var(--brass);
  color: var(--basalt-ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background 200ms;
}
.seo-gpx a:hover { background: var(--parchment); }

/* ==========================================================================
   MOBILE
   ========================================================================== */
@media (max-width: 768px) {
  .topbar { padding: 10px 18px; }
  .section-header { padding: 60px 20px 40px 20px; }
  .map-section { height: 55vh; min-height: 380px; }
  .legend { width: 200px; padding: 14px 16px; top: 16px; left: 16px; }
  .legend h3 { font-size: 15px; }
  .view-toggle { display: none; }   /* mobile: flat 2D only, no toggle */
  .elevation-section { padding: 36px 16px 50px 16px; }
  .elevation-header { flex-direction: column; gap: 6px; }
  .chart-wrapper { padding: 14px 16px 14px 16px; height: 220px; }
  .day-labels { margin: 14px 16px; }
  .day-label { font-size: 8px; padding: 1px 5px; }

  .seo-section { padding: 50px 18px 60px 18px; }
  .seo-intro { font-size: 16px; }
  .seo-waypoint { padding: 20px 22px; }
  .seo-gpx { flex-direction: column; align-items: flex-start; padding: 22px; gap: 18px; }
  .seo-gpx a { width: 100%; text-align: center; }
}

/* ==========================================================================
   LANGUAGE VISIBILITY
   ========================================================================== */



/* ==========================================================================
   LOADING
   ========================================================================== */
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lon-blue);
  color: var(--parchment);
  font-family: var(--font-sc);
  font-size: 12px;
  letter-spacing: 0.22em;
  z-index: 20;
  transition: opacity 400ms;
}
.map-loading.hidden { opacity: 0; pointer-events: none; }
.map-loading span { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* =========================================================================
   PAGE-LEVEL OVERRIDE: explore-map uses its own ID
   --------------------------------------------------------------------
   The scrolly's #map and the explore's #map shared the same selector
   in the standalone prototypes. On the merged page we rename the
   explore one to #explore-map (see page-trail.php) so each map gets
   its own positioning context.
   ========================================================================= */
#explore-map {
  position: absolute;
  inset: 0;
  background: var(--lon-blue);
}

/* ==========================================================================
   PASS 7: TRAIL-INFO SECTION — Quick Facts + collapsible details
   --------------------------------------------------------------------
   Replaces the old .seo-section block which was a long prose dump that
   broke the page's quiet aesthetic. This version is:
     - 4-chip Quick Facts strip (always visible, scannable in 2 seconds)
     - 3 collapsible <details> blocks (Google still indexes details body
       content, so SEO is preserved)
     - GPX download as a single CTA card (kept always visible since it's
       an action, not info)

   Old .seo-* rules above (line ~1075-1265) are kept in the file as
   harmless orphans — they reference selectors no longer in the DOM,
   so they cost nothing and are easy to delete later for cleanup.
   ========================================================================== */

.trail-info {
  background: var(--parchment);
  padding: 100px 32px 120px;
  border-top: 1px solid rgba(46, 74, 92, 0.10);
}
.trail-info-inner {
  max-width: 880px;
  margin: 0 auto;
}

/* Visually hidden helper — heading is in DOM for SEO/accessibility but
   visually hidden because the Quick Facts chips serve as the visual head. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----- QUICK FACTS STRIP ----- */
.trail-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin-bottom: 60px;
  border-top: 1px solid rgba(46, 74, 92, 0.15);
  border-bottom: 1px solid rgba(46, 74, 92, 0.15);
  padding: 28px 0;
}
.trail-fact {
  text-align: center;
  padding: 0 16px;
  border-right: 1px solid rgba(46, 74, 92, 0.12);
}
.trail-fact:last-child { border-right: 0; }
.trail-fact-num {
  font-family: var(--f-display);
  font-weight: 600;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1;
  color: var(--lon-blue);
  letter-spacing: -.015em;
  margin-bottom: 8px;
}
.trail-fact-label {
  font-family: var(--f-stamp);
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--stone);
}

/* ----- COLLAPSIBLE DETAILS ----- */
.trail-details {
  border-bottom: 1px solid rgba(46, 74, 92, 0.12);
}
.trail-details:first-of-type { border-top: 1px solid rgba(46, 74, 92, 0.12); }

.trail-details > summary {
  list-style: none;       /* hide default disclosure marker */
  cursor: pointer;
  padding: 28px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 28px;
  align-items: center;
  position: relative;
  user-select: none;
}
.trail-details > summary::-webkit-details-marker { display: none; }

.trail-details-eyebrow {
  font-family: var(--f-stamp);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--oxide-rust);
  grid-column: 1;
  grid-row: 1;
}
.trail-details-title {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: clamp(18px, 1.8vw, 22px);
  line-height: 1.3;
  color: var(--lon-blue);
  letter-spacing: -.005em;
  grid-column: 1;
  grid-row: 2;
}

/* +/− toggle marker, swaps state via [open] selector */
.trail-details-mark {
  font-family: var(--f-display);
  font-size: 28px;
  font-weight: 300;
  color: var(--brass);
  line-height: 1;
  grid-column: 2;
  grid-row: 1 / span 2;
  transition: transform 200ms ease;
  display: inline-block;
  width: 22px;
  text-align: center;
}
.trail-details[open] .trail-details-mark {
  transform: rotate(45deg);  /* + becomes × */
}
.trail-details > summary:hover .trail-details-mark { color: var(--oxide-rust); }
.trail-details > summary:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}

/* Body content of collapsible */
.trail-details-body {
  padding: 4px 0 36px;
  max-width: 68ch;
}
.trail-details-body p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--basalt-ink);
  margin-bottom: 14px;
}
.trail-details-body p:last-child { margin-bottom: 0; }

/* ----- WAYPOINTS LIST (inside the second details block) ----- */
.trail-waypoints {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: waypoint;
}
.trail-waypoint {
  padding: 24px 0 24px 56px;
  border-bottom: 1px dashed rgba(46, 74, 92, 0.15);
  position: relative;
  counter-increment: waypoint;
}
.trail-waypoint:last-child { border-bottom: 0; }
.trail-waypoint::before {
  content: counter(waypoint);
  position: absolute;
  left: 0; top: 24px;
  width: 36px; height: 36px;
  border: 1px solid var(--oxide-rust);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-stamp);
  font-size: 12px;
  letter-spacing: .1em;
  color: var(--oxide-rust);
  background: var(--parchment);
}
.trail-waypoint-day {
  font-family: var(--f-stamp);
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--oxide-rust);
  margin-bottom: 4px;
}
.trail-waypoint h3 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 19px;
  color: var(--lon-blue);
  margin: 0 0 8px;
  letter-spacing: -.005em;
}
.trail-waypoint-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 8px;
  font-family: var(--f-stamp);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--stone);
}
.trail-waypoint-stats strong {
  color: var(--lon-blue);
  font-weight: 600;
  margin-left: 4px;
}
.trail-waypoint p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--basalt-ink);
  margin: 0;
}

/* ----- PRACTICAL 2x2 grid ----- */
.trail-practical {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px 40px;
}
.trail-practical-item h4 {
  font-family: var(--f-stamp);
  font-size: 11px;
  letter-spacing: .22em;
  color: var(--oxide-rust);
  margin: 0 0 8px;
  font-weight: 600;
}
.trail-practical-item p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--basalt-ink);
  margin: 0;
}

/* ----- GPX DOWNLOAD CARD ----- */
.trail-gpx {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  margin-top: 48px;
  padding: 24px 28px;
  background: var(--parchment-tint);
  border: 1px solid rgba(46, 74, 92, 0.12);
  text-decoration: none;
  color: inherit;
  transition: background 200ms ease, border-color 200ms ease;
}
.trail-gpx:hover {
  background: rgba(212, 165, 76, 0.08);  /* warm brass tint */
  border-color: var(--brass);
}
.trail-gpx-icon {
  font-family: var(--f-stamp);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15em;
  color: var(--parchment);
  background: var(--lon-blue);
  padding: 12px 14px;
  border-radius: 2px;
}
.trail-gpx-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  color: var(--stone);
  line-height: 1.5;
}
.trail-gpx-text strong {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 16px;
  color: var(--lon-blue);
}
.trail-gpx-arrow {
  font-size: 24px;
  color: var(--brass);
  font-weight: 300;
}

/* ----- MOBILE ----- */
@media (max-width: 960px) {
  .trail-info { padding: 60px 20px 80px; }
  .trail-facts {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 0;
    padding: 20px 0;
  }
  .trail-fact:nth-child(2) { border-right: 0; }
  .trail-fact-num { font-size: 26px; }
  .trail-details > summary { padding: 22px 0; }
  .trail-details-title { font-size: 17px; }
  .trail-practical { grid-template-columns: 1fr; gap: 24px; }
  .trail-gpx {
    grid-template-columns: auto 1fr;
    gap: 16px;
    padding: 18px 20px;
  }
  .trail-gpx-arrow { display: none; }
}
