/* Outdoor Promise brand — see brand/brand-guidelines.md */
:root {
  --op-green: #336633;
  --op-green-dark: #244D24;
  --op-green-light: #5C8A5C;
  --op-lime: #DFFE02;
  --op-brown: #634133;
  --op-sage: #BAD1CD;
  --op-sand: #D2BA9D;
  --op-ink: #1A1A1A;
  --op-paper: #FFFFFF;
  --hudson-blue: #2C6E8F;
  --alert-rust: #8A3324;
  --font-display: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --header-h: 58px;
  --strip-h: 54px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; font-family: var(--font-body); color: var(--op-ink); background: var(--op-sage); }

/* ---------- Header ---------- */
.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: var(--header-h);
  background: var(--op-green);
  color: var(--op-paper);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px 0 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-title { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; justify-content: center; }
.header-logo { height: 26px; width: auto; max-width: 150px; object-fit: contain; display: block; flex: 0 0 auto; }
.app-header h1 {
  font-family: var(--font-display); font-size: 12px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
@media (max-width: 430px) {
  .header-logo { height: 22px; }
  .app-header h1 { font-size: 10.5px; }
}
.header-actions { display: flex; gap: 8px; flex-shrink: 0; margin-left: 10px; }
.lang-toggle, .about-btn {
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  border: 1.5px solid rgba(255,255,255,.65); background: transparent; color: var(--op-paper);
  border-radius: 999px; cursor: pointer; transition: background .15s, color .15s;
}
.lang-toggle { padding: 6px 14px; }
.about-btn { width: 32px; height: 32px; font-style: italic; font-family: Georgia, serif; }
.getinvolved-btn {
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  background: var(--op-lime); color: var(--op-ink); border: 1.5px solid var(--op-lime);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
  transition: filter .15s;
}
.getinvolved-btn:hover, .getinvolved-btn:focus-visible { filter: brightness(0.92); }
.lang-toggle:hover, .lang-toggle:focus-visible { background: var(--op-lime); color: var(--op-ink); border-color: var(--op-lime); }
.about-btn:hover, .about-btn:focus-visible { background: rgba(255,255,255,.15); }

/* ---------- Map ---------- */
#map { position: fixed; inset: var(--header-h) 0 0 0; }

/* Numbered stop markers.
 * NEVER set `position` or `transition: transform` here. Mapbox owns
 * .mapboxgl-marker's `position: absolute` and rewrites `transform` inline every
 * frame; overriding either un-anchors the pin from its coordinates (same
 * specificity, and this file loads after mapbox-gl.css, so we'd win and break it).
 * Hover/active affordances must therefore avoid `transform` — an inline transform
 * always beats an author stylesheet, so `scale()` here would silently do nothing. */
.stop-marker {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 14px; color: #fff;
  border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: pointer; transition: box-shadow .12s, filter .12s;
}
.stop-marker:hover, .stop-marker:focus-visible {
  box-shadow: 0 0 0 4px rgba(255,255,255,.55), 0 2px 8px rgba(0,0,0,.4);
  filter: brightness(1.08);
}
.stop-marker.active {
  outline: 3px solid var(--op-lime); outline-offset: 1px;
  box-shadow: 0 0 0 5px rgba(223,254,2,.35), 0 2px 8px rgba(0,0,0,.4);
  z-index: 3;
}
/* Visited: a small ✓ badge, top-right of the marker */
.stop-marker.visited::after {
  content: '✓'; position: absolute; top: -4px; right: -4px;
  width: 15px; height: 15px; border-radius: 50%;
  background: var(--op-lime); color: var(--op-ink);
  font-size: 10px; font-weight: 700; line-height: 15px; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

/* Library meeting-point marker (not a numbered stop) */
.meet-marker {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--op-paper); color: var(--op-green); font-size: 15px; line-height: 1;
  border: 2px solid var(--op-green); box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer;
}

/* Drive-by "along the way" markers (creek crossings, overdevelopment) */
.enroute-marker {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--hudson-blue); color: #fff; font-size: 13px; font-weight: 700; line-height: 1;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: pointer; opacity: .92;
}
/* No transform here either — see the .stop-marker note above. */
.enroute-marker:hover { opacity: 1; filter: brightness(1.1); }

/* Audio-tour toggle button (floating, above the stop strip) */
.tour-toggle {
  position: fixed; z-index: 26;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--strip-h) + 14px + env(safe-area-inset-bottom));
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  background: var(--op-green); color: #fff; border: 2px solid #fff;
  border-radius: 999px; padding: 11px 20px; cursor: pointer;
  box-shadow: 0 3px 12px rgba(0,0,0,.35); white-space: nowrap;
}
.tour-toggle:hover { background: var(--op-green-dark); }
.tour-toggle.on { background: var(--alert-rust); }
/* When the bottom Now-Playing bar is up (50px), lift the floating button + toast above it */
body.np-open .tour-toggle { bottom: calc(var(--strip-h) + 64px + env(safe-area-inset-bottom)); }

/* Toast (transient status message) */
.toast {
  position: fixed; z-index: 45;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--strip-h) + 62px + env(safe-area-inset-bottom));
  max-width: min(92vw, 460px);
  /* np-open shift added below */
  background: rgba(26,26,26,.92); color: #fff;
  font-family: var(--font-display); font-size: 13px; line-height: 1.4;
  padding: 10px 14px; border-radius: 10px; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
body.np-open .toast { bottom: calc(var(--strip-h) + 112px + env(safe-area-inset-bottom)); }

/* Now-Playing bar — Spotify-style mini-player, docked full-width above the stop strip.
 * z-index ABOVE the stop panel (40): the driver must never lose pause/replay while a
 * stop sheet is open, but below modals (50). */
.nowplaying {
  position: fixed; z-index: 42;
  left: 0; right: 0; bottom: var(--strip-h);
  height: 50px;
  display: flex; align-items: center; gap: 10px;
  background: var(--op-green-dark); color: #fff;
  padding: 0 14px; border-radius: 14px 14px 0 0;
  box-shadow: 0 -3px 14px rgba(0,0,0,.3);
}
.np-btn {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: none; background: var(--op-lime); color: var(--op-ink);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.np-btn:last-child { background: rgba(255,255,255,.16); color: #fff; }
.np-btn:hover { filter: brightness(0.92); }
.np-title {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-display); font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Progress count — "N/8 heard", top-left (freed by moving the player to the bottom) */
.progress-count {
  position: fixed; z-index: 26;
  left: 10px; top: calc(var(--header-h) + 8px);
  font-family: var(--font-display); font-size: 11.5px; font-weight: 600;
  background: rgba(26,26,26,.72); color: #fff;
  padding: 5px 11px; border-radius: 999px; box-shadow: 0 1px 5px rgba(0,0,0,.35);
}

/* ---------- Stop strip (horizontal scroller above bottom edge) ---------- */
.stop-strip {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  height: var(--strip-h);
  display: flex; gap: 8px; align-items: center;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(26,26,26,.55), transparent);
  scrollbar-width: none;
}
.stop-strip::-webkit-scrollbar { display: none; }
.stop-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 7px;
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  background: var(--op-paper); color: var(--op-ink);
  border: none; border-radius: 999px; padding: 7px 12px 7px 7px;
  cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.stop-chip .chip-num {
  width: 22px; height: 22px; border-radius: 50%; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.stop-chip.active { background: var(--op-lime); }
.stop-chip.visited:not(.active) { opacity: .62; }
.stop-chip.visited .chip-label::before { content: '✓ '; color: var(--op-green); font-weight: 700; }

/* ---------- Stop detail panel ---------- */
.panel {
  position: fixed; z-index: 40;
  background: var(--op-paper);
  box-shadow: 0 -6px 24px rgba(0,0,0,.28);
  display: flex; flex-direction: column;
  /* mobile: bottom sheet */
  left: 0; right: 0; bottom: 0; top: auto;
  max-height: 62vh; border-radius: 16px 16px 0 0;
}
.panel-scroll { overflow-y: auto; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); }
/* With the Now-Playing bar overlaying the sheet's lower edge, keep panel text scrollable past it */
body.np-open .panel-scroll { padding-bottom: calc(116px + env(safe-area-inset-bottom)); }
.panel-close {
  position: absolute; top: 8px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--op-sage); color: var(--op-ink);
  font-size: 20px; line-height: 1; cursor: pointer; font-family: var(--font-display);
}
.panel-kicker {
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: var(--op-green);
  margin-bottom: 4px;
}
.panel h2 {
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
  line-height: 1.25; margin-bottom: 12px; padding-right: 30px;
}
.panel-images { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.panel-images figure { flex: 0 0 auto; width: min(78vw, 340px); }
.panel-images img {
  width: 100%; height: 190px; object-fit: cover; border-radius: 8px;
  background: var(--op-sage); display: block;
}
.panel-images figcaption {
  font-family: var(--font-display); font-size: 11px; color: #555;
  margin-top: 5px; line-height: 1.4;
}
.img-placeholder {
  width: 100%; height: 190px; border-radius: 8px;
  background: repeating-linear-gradient(45deg, var(--op-sage), var(--op-sage) 12px, #cddcd8 12px, #cddcd8 24px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--op-green-dark);
  padding: 12px;
}
.listen-btn {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  background: var(--op-sage); color: var(--op-green-dark); border: none;
  border-radius: 999px; padding: 7px 14px; cursor: pointer; margin-bottom: 12px;
}
.listen-btn:hover { background: #a9c4bf; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.directions-btn { background: var(--op-green-dark); color: #fff; }
.directions-btn:hover { background: #3d523d; }
.panel-desc { font-size: 16px; line-height: 1.55; }
.panel-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.nav-btn {
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  background: var(--op-green); color: #fff; border: none; border-radius: 8px;
  padding: 10px 16px; cursor: pointer;
}
.nav-btn:disabled { opacity: .35; cursor: default; }
.nav-btn:hover:not(:disabled) { background: var(--op-green-dark); }

/* Print-only reference material shown in the app (sidebar / sidebarTable / panel).
 * Deliberately secondary to the narration: smaller, tinted, labelled "not narrated". */
.panel-extra { margin-top: 18px; }
.extra-label {
  font-family: var(--font-display); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .1em; color: #6b6b6b; margin-bottom: 6px;
}
.extra-box {
  background: #eef3f1; border-left: 3px solid var(--op-sage); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 1.55;
}
.extra-box p { margin: 0 0 9px; }
.extra-box p:last-child { margin-bottom: 0; }
.extra-box strong { font-family: var(--font-display); color: var(--op-green-dark); }
.extra-box h3 { font-family: var(--font-display); font-size: 15px; color: #8A3324; margin-bottom: 6px; }
.extra-box h4 { font-family: var(--font-display); font-size: 12.5px; color: var(--op-green-dark); margin-bottom: 4px; }
.extra-box ul { margin: 0 0 9px 18px; }
.extra-box li { margin-bottom: 2px; }
.extra-panel { border-left-color: #8A3324; background: #f7eeea; }
.extra-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 6px; }
.extra-foot { font-size: 12.5px; color: #555; }
.extra-box a { color: var(--op-green-dark); font-weight: 600; }

/* Photo lightbox — the scroll container lets phones pinch-zoom the full-resolution image. */
.panel-images img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0; z-index: 90; background: rgba(10,14,12,.94);
  display: flex; flex-direction: column;
}
.lightbox-scroll {
  flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pinch-zoom pan-x pan-y;
  display: flex; align-items: flex-start; justify-content: center; padding: 56px 8px 24px;
}
.lightbox-scroll img { width: 100%; max-width: 1100px; height: auto; cursor: zoom-in; }
.lightbox-scroll img.full { width: auto; max-width: none; cursor: zoom-out; }
.lightbox-close { top: calc(10px + env(safe-area-inset-top)); background: #fff; }

/* ---------- About modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(26,26,26,.55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal-card {
  position: relative; background: var(--op-paper); border-radius: 14px;
  max-width: 520px; width: 100%; max-height: 82vh; overflow-y: auto;
  padding: 26px 22px;
}
.modal-card h2 { font-family: var(--font-display); font-size: 19px; margin-bottom: 10px; color: var(--op-green-dark); padding-right: 30px; }
.about-body { font-size: 15px; line-height: 1.55; margin-bottom: 10px; }
.about-route { font-family: var(--font-display); font-size: 13px; color: #444; margin-bottom: 12px; }
.modal-card hr { border: none; border-top: 1px solid var(--op-sage); margin: 12px 0; }
.about-credit { font-family: var(--font-display); font-size: 11.5px; color: #555; line-height: 1.5; margin-bottom: 8px; }
.about-sig { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--op-green); margin-top: 10px; }

/* Get Involved modal */
.gi-subhead {
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--op-green);
  margin: 16px 0 8px;
}
.action-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.action-item {
  border-left: 3px solid var(--op-lime); padding: 2px 0 2px 12px;
}
.action-item strong { font-family: var(--font-display); font-size: 14px; color: var(--op-green-dark); display: block; margin-bottom: 2px; }
.action-item span { font-size: 14px; line-height: 1.45; }
.partner-list { display: flex; flex-direction: column; gap: 10px; }
.partner-item { display: flex; flex-direction: column; gap: 1px; }
.partner-item a { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--hudson-blue); text-decoration: none; }
.partner-item a:hover { text-decoration: underline; }
.partner-item .partner-name { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--op-green-dark); }
.partner-blurb { font-size: 13px; line-height: 1.45; color: #333; }

/* Welcome (on-load) screen */
.welcome {
  position: fixed; inset: 0; z-index: 60;
  background: linear-gradient(160deg, var(--op-green) 0%, var(--op-green-dark) 100%);
  display: flex; align-items: center; justify-content: center; padding: 14px 18px;
  overflow-y: auto;
}
.welcome-card {
  position: relative;
  max-width: 500px; width: 100%; text-align: center; color: var(--op-paper);
  padding: 8px 4px;
}
.welcome-lang {
  position: absolute; top: -4px; right: 0;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  background: transparent; color: var(--op-paper); border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
.welcome-lang:hover { background: rgba(255,255,255,.12); }
.welcome-logo { height: 34px; width: auto; margin: 0 auto 12px; display: block; }
.welcome-card h2 { font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.18; margin-bottom: 6px; }
.welcome-tagline { font-family: var(--font-display); font-size: 12.5px; color: var(--op-lime); margin-bottom: 12px; }
.welcome-intro { font-size: 14px; line-height: 1.5; margin-bottom: 14px; text-align: center; }
.welcome-how {
  display: flex; flex-direction: column; gap: 5px;
  text-align: left; max-width: 320px; margin: 0 auto 10px;
  font-family: var(--font-display); font-size: 12.5px; line-height: 1.3;
  color: var(--op-paper);
}
.welcome-volume {
  font-family: var(--font-display); font-size: 12px; font-weight: 600;
  color: var(--op-lime); margin-bottom: 12px;
}
.welcome-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.welcome-action { display: flex; flex-direction: column; gap: 4px; }
.welcome-sub {
  font-family: var(--font-display); font-size: 12px; line-height: 1.3;
  color: rgba(255,255,255,.72);
}
.welcome-start {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  background: var(--op-lime); color: var(--op-ink); border: none;
  border-radius: 999px; padding: 12px 20px; cursor: pointer;
}
.welcome-start:hover { filter: brightness(0.93); }
.welcome-explore {
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  background: transparent; color: var(--op-paper); border: 1.5px solid rgba(255,255,255,.6);
  border-radius: 999px; padding: 12px 20px; cursor: pointer;
}
.welcome-explore:hover { background: rgba(255,255,255,.12); }
.welcome-credit { font-family: var(--font-display); font-size: 10.5px; color: rgba(255,255,255,.7); line-height: 1.4; }

/* Closing / thank-you card (reuses .modal) */
.closing-card { text-align: center; }
.closing-card h2 { color: var(--op-green-dark); }
.closing-card .welcome-start { margin: 8px auto 4px; display: inline-block; }

.finish-btn {
  display: block; width: 100%; margin-top: 12px;
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  background: var(--op-lime); color: var(--op-ink); border: none;
  border-radius: 8px; padding: 12px; cursor: pointer;
}
.finish-btn:hover { filter: brightness(0.93); }

[hidden] { display: none !important; }

/* ---------- Desktop: side panel ---------- */
@media (min-width: 820px) {
  .app-header h1 { font-size: 16px; }
  .panel {
    top: var(--header-h); right: 0; bottom: 0; left: auto;
    width: 420px; max-height: none; border-radius: 0;
    box-shadow: -6px 0 24px rgba(0,0,0,.2);
  }
  .panel-images figure { width: 100%; }
  .panel-images { flex-direction: column; }
  .panel-images img, .img-placeholder { height: 220px; }
  .stop-strip { right: 0; left: 0; }
}
