:root {
  color-scheme: dark;
  font-family: var(--brand-body);
  background: #0b201d;
  color: var(--brand-cream);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid var(--brand-focus-on-dark); outline-offset: 3px; }
.skip-link { position: fixed; left: 12px; top: 10px; z-index: 20; padding: 10px 14px; color: var(--brand-asphalt); background: var(--brand-gold); transform: translateY(-140%); }
.skip-link:focus { transform: none; }
.corridor-header {
  height: 68px; padding: 0 26px 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--brand-evergreen); border-bottom: 1px solid #ffffff24;
}
.corridor-brand { display: flex; align-items: center; gap: 4px; text-decoration: none; font-size: 25px; font-weight: 700; white-space: nowrap; }
.corridor-brand img { display: block; width: 86px; height: auto; }
.corridor-brand b { color: var(--brand-gold); }
.corridor-header nav { display: flex; align-items: center; gap: 24px; }
.corridor-header nav a { min-height: 44px; display: flex; align-items: center; font-weight: 600; white-space: nowrap; text-decoration: none; }
.corridor-header nav a:hover, .corridor-header nav [aria-current] { color: var(--brand-gold); }
.corridor-shell { display: grid; grid-template-columns: minmax(280px, 318px) minmax(0, 1fr); min-height: 550px; height: calc(100dvh - 68px); }
.corridor-panel {
  display: flex; flex-direction: column; gap: 22px; padding: 28px 23px 24px; overflow: auto;
  background: var(--brand-forest-shadow); border-right: 1px solid #ffffff22;
}
.corridor-panel:has(.corridor-terrain-controls[open]) { gap: 16px; }
.corridor-intro { padding-bottom: 18px; border-bottom: 1px solid #f5e8ce2e; }
.corridor-kicker { margin: 0 0 9px; color: var(--brand-gold); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.corridor-intro h1 { font: 400 clamp(31px, 4vw, 43px)/1.04 var(--brand-display); margin: 0; }
.corridor-summary { margin: 11px 0 0; font-size: 16px; line-height: 1.45; color: var(--brand-on-dark-muted); }
.corridor-trail-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 6px; color: var(--brand-gold); font-weight: 700; }
.corridor-panel h2 { margin: 0 0 9px; font-size: 15px; font-weight: 700; }
.corridor-view-buttons, .corridor-layer-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
:is(.corridor-panel, .mobile-map-sheet-body) button {
  min-height: 44px; padding: 5px 8px; color: var(--brand-cream); font-weight: 600; cursor: pointer;
  background: var(--brand-forest-panel); border: 1px solid #cdddc654; border-radius: var(--brand-radius-sm);
}
:is(.corridor-panel, .mobile-map-sheet-body) button:hover { border-color: var(--brand-cream); }
:is(.corridor-panel, .mobile-map-sheet-body) button[aria-pressed="true"] { color: var(--brand-asphalt); background: var(--brand-gold); border-color: var(--brand-gold); }
.short-state { display: none; }
#terrain-toggle { grid-column: 1 / -1; }
.corridor-layer-option {
  display: flex; align-items: center; gap: 7px; min-height: 44px; padding: 4px 8px; cursor: pointer;
  background: var(--brand-forest-panel); border: 1px solid #cdddc654; border-radius: var(--brand-radius-sm);
  font-weight: 600; white-space: nowrap;
}
.corridor-trail-option { grid-column: 1 / -1; }
.corridor-layer-option input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--brand-gold); }
.layer-status { margin: 5px 0 0; color: var(--brand-on-dark-muted); font-size: 14px; }
.corridor-terrain-controls { margin-top: 9px; color: var(--brand-on-dark-muted); font-size: 14px; }
.corridor-terrain-controls summary { display: list-item; width: fit-content; cursor: pointer; padding: 4px 0; color: var(--brand-cream); }
.corridor-terrain-sliders { display: grid; gap: 3px; margin-top: 8px; }
.corridor-terrain-sliders label { display: flex; justify-content: space-between; }
.corridor-terrain-sliders input { width: 100%; margin: 0 0 4px; height: 26px; accent-color: var(--brand-gold); }
.corridor-terrain-sliders output { color: var(--brand-gold); font-variant-numeric: tabular-nums; }
.corridor-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 14px; color: var(--brand-on-dark-muted); }
.corridor-legend span { display: inline-flex; align-items: center; gap: 7px; }
.corridor-legend span[hidden] { display: none; }
.legend-line { display: inline-block; width: 20px; border-top: 3px solid var(--brand-gold); }
.legend-band { border: 1px dashed #9ad9e2; height: 9px; }
.legend-contour { border-top: 2px solid #cce4ba; }
.legend-trail { border-top: 2px solid #f3c294; }
.legend-road { border-top: 2px solid #f2ede4; }
.legend-stop { display: inline-block; width: 10px; height: 10px; border: 1px solid #fffcf5; border-radius: 50%; background: #256a57; margin-inline: 5px; }
.corridor-elsewhere { margin-top: auto; font-size: 14px; color: var(--brand-on-dark-muted); }
.corridor-elsewhere > a { display: inline-flex; align-items: center; min-height: 44px; color: var(--brand-cream); }
.corridor-elsewhere summary { cursor: pointer; margin: 6px 0; }
.corridor-elsewhere details p { font-size: 14px; line-height: 1.4; margin: 12px 0; }
.corridor-map-pane { position: relative; min-width: 0; min-height: 360px; background: #102b27; }
#corridor-map { position: absolute; inset: 0; }
.corridor-map-message {
  position: absolute; z-index: 2; top: 12px; left: 12px; max-width: calc(100% - 72px);
  margin: 0; padding: 8px 12px; color: var(--brand-cream);
  background: #102c28ee; border: 1px solid #f5e8ce4d; border-radius: var(--brand-radius-sm);
}
.corridor-terminus {
  white-space: nowrap; pointer-events: none; padding: 4px 8px; border-radius: 5px; border: 1px solid #f5e8ce73;
  color: var(--brand-cream); background: #17372f; font-size: 13px; font-weight: 700;
}
.corridor-state-label { color: #c6d7c4; text-shadow: 0 1px 3px #081a16; font-size: 13px; font-weight: 700; letter-spacing: .12em; pointer-events: none; }
.corridor-road-popup .maplibregl-popup-content { color: var(--brand-asphalt); background: var(--brand-white); font: 15px var(--brand-body); }
.corridor-road-popup .maplibregl-popup-content small { display: block; margin-top: 4px; color: var(--brand-on-light-muted); }
.corridor-stop-popup .maplibregl-popup-content { color: var(--brand-asphalt); background: var(--brand-white); font: 16px var(--brand-body); padding: 12px; }
.corridor-stop-popup strong { display: block; padding-right: 23px; overflow-wrap: anywhere; color: var(--brand-evergreen); }
.corridor-stop-popup p { margin: 4px 0 7px; }
.corridor-stop-popup a { display: inline-flex; align-items: center; min-height: 41px; color: var(--brand-evergreen); font-weight: 650; }
.corridor-stop-popup button:not(.maplibregl-popup-close-button) { display: block; min-height: 42px; padding: 5px 11px; font-weight: 650; color: var(--brand-cream); background: var(--brand-evergreen); border: 0; border-radius: 5px; cursor: pointer; }
.corridor-stop-popup .maplibregl-popup-close-button { width: 39px; height: 40px; color: var(--brand-evergreen); font-size: 21px; }
@media (min-width: 721px) {
  .corridor-map-pane:has(.stop-map-key:not([hidden])):has(.maplibregl-ctrl-attrib[open]) .maplibregl-ctrl-scale { margin-bottom: 28px; }
}
.stop-map-key { position: absolute; z-index: 2; top: 10px; left: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; max-width: calc(100% - 64px); padding: 0 9px; border-radius: 6px; background: #102c28f2; color: var(--brand-cream); }
.stop-map-key[hidden], .stop-map-key span:empty { display: none; }
.stop-map-key label { display: inline-flex; align-items: center; gap: 4px; min-height: 42px; font-size: 14px; }
.stop-map-key input { accent-color: var(--brand-gold); }
.stop-map-key span { width: 100%; max-width: 27ch; padding-bottom: 5px; font-size: 13px; }
/* The phone uses a dedicated map viewport and on-demand controls. */
.mobile-map-dock, .mobile-map-detail, .mobile-map-sheet:not([open]) { display: none; }
.corridor-elsewhere > a { display: flex; width: fit-content; }
.mobile-map-sheet {
  inset: auto 0 0; margin: 0 auto; box-sizing: border-box; width: min(100%, 40rem);
  max-width: none; max-height: min(84dvh, 38rem); padding: 0; overflow: auto; overscroll-behavior: contain;
  border: 1px solid #f5e8ce35; border-bottom: 0; border-radius: 22px 22px 0 0;
  color: var(--brand-cream); background: var(--brand-forest-shadow); box-shadow: 0 -12px 55px #071b17a6;
}
.mobile-map-sheet::backdrop { background: #081d1661; }
.mobile-map-sheet-head { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--brand-forest-shadow); border-bottom: 1px solid #f5e8ce29; }
.mobile-map-sheet-head h2 { margin: 0; font: 400 1.45rem var(--brand-display); }
.mobile-map-sheet-head button { min-height: 44px; min-width: 58px; border: 1px solid #f5e8ce55; border-radius: 8px; background: var(--brand-forest-panel); color: var(--brand-cream); font-weight: 650; }
.mobile-map-sheet-body { display: grid; gap: 13px; padding: 14px 16px max(18px, env(safe-area-inset-bottom)); }
#mobile-layer-content { display: grid; gap: 12px; }
.mobile-map-info { border-top: 1px solid #f5e8ce29; }
.mobile-map-info > summary { min-height: 44px; padding-block: 11px; color: var(--brand-cream); font-weight: 650; cursor: pointer; }
#mobile-map-info-content { display: grid; gap: 11px; }
.mobile-map-sheet-body :is(.corridor-views, .corridor-settings) > h2 { display: none; }
.mobile-map-sheet-body .corridor-view-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mobile-map-sheet-body .corridor-terrain-controls summary { min-height: 44px; padding-block: 11px; }
.mobile-map-sheet-body .corridor-terrain-sliders input { height: 38px; }
.mobile-map-sheet-body .corridor-elsewhere { margin: 0; padding-top: 10px; border-top: 1px solid #f5e8ce29; }
.mobile-map-sheet-body .corridor-elsewhere summary { min-height: 44px; padding-block: 11px; margin: 0; }
.mobile-map-sheet-body .stop-map-key { position: static; display: flex; max-width: none; padding: 0; background: none; }
.mobile-map-sheet-body .stop-map-key[hidden] { display: none; }
.mobile-map-sheet-body :is(.corridor-layer-option, .stop-map-key label) input { width: 19px; height: 19px; }
.mobile-map-sheet-body .corridor-layer-option { border-radius: 8px; min-height: 48px; }
.mobile-map-sheet-body #terrain-toggle { min-height: 48px; }
:is(.corridor-panel, .mobile-map-sheet-body) .corridor-view-buttons button { min-height: 48px; }
@media (max-width: 720px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  :root { --phone-header: calc(56px + env(safe-area-inset-top, 0px)); }
  .corridor-header { height: var(--phone-header); padding: env(safe-area-inset-top, 0px) max(9px, env(safe-area-inset-right)) 0 max(5px, env(safe-area-inset-left)); gap: 5px; }
  .corridor-brand { font-size: 1.17rem; gap: 0; }
  .corridor-brand img { width: 53px; }
  .corridor-header nav { gap: 1px; font-size: .94rem; }
  .corridor-header nav a { justify-content: center; min-width: 44px; padding-inline: 5px; }
  .corridor-header [aria-current] { box-shadow: inset 0 -2px var(--brand-gold); }
  .corridor-shell { position: relative; display: grid; grid-template: minmax(0, 1fr) auto / minmax(0, 1fr); min-height: 0; height: calc(100vh - var(--phone-header)); height: calc(100dvh - var(--phone-header)); }
  .corridor-panel { display: none; }
  .mobile-map-ready .corridor-panel { position: absolute; display: block; width: 1px; height: 1px; padding: 0; clip-path: inset(50%); overflow: hidden; border: 0; }
  .corridor-map-pane { grid-row: 1; min-height: 0; }
  .corridor-state-label { font-size: 11px; letter-spacing: .07em; }
  .mobile-map-dock:not([hidden]) { grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) max-content max-content; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: var(--brand-evergreen); border-top: 1px solid #f5e8ce30; }
  .mobile-map-dock button { min-width: 0; min-height: 47px; border: 1px solid transparent; border-radius: 9px; text-align: left; font: 650 1rem var(--brand-body); cursor: pointer; }
  .mobile-map-dock .mobile-map-route { display: grid; grid-template-columns: minmax(0, 1fr) auto; place-content: center stretch; align-items: center; column-gap: 8px; padding: 5px 13px; color: var(--brand-cream); border-color: #f5e8ce42; background: #1a483a; }
  .mobile-map-route span { grid-column: 1; color: #d2ddc5; font-size: .75rem; line-height: 1; }
  .mobile-map-route strong { grid-column: 1; line-height: 1.14; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mobile-map-route::after { content: ''; grid-area: 1 / 2 / span 2; width: 8px; height: 8px; margin-right: 2px; transform: translateY(-2px) rotate(45deg); border-right: 2px solid var(--brand-cream); border-bottom: 2px solid var(--brand-cream); }
  .mobile-map-dock .mobile-map-trails { display: grid; place-items: center; min-width: 62px; min-height: 47px; padding: 0 9px; font-weight: 650; text-decoration: none; color: var(--brand-cream); border: 1px solid #f5e8ce42; background: #1a483a; border-radius: 9px; }
  .mobile-map-dock .mobile-map-layers { min-width: 76px; padding: 0 15px; text-align: center; background: var(--brand-gold); color: var(--brand-asphalt); }
  .mobile-map-dock button:disabled { opacity: .64; cursor: default; }
  .mobile-map-detail:not([hidden]) { position: absolute; z-index: 2; bottom: 42px; left: 10px; right: 10px; display: block; width: min(calc(100% - 20px), 26rem); padding: 10px 53px 6px 13px; color: var(--brand-asphalt); background: var(--brand-white); border: 1px solid #0b211c26; border-radius: 13px; box-shadow: 0 5px 18px #0a251e55; }
  .mobile-map-detail strong { display: block; color: var(--brand-evergreen); font-size: 1.0625rem; line-height: 1.25; overflow-wrap: anywhere; }
  .mobile-map-detail :is(p, small) { margin: 2px 0 0; color: var(--brand-on-light-muted); }
  .mobile-map-detail :is(a, .mobile-map-detail-body button) { display: inline-flex; align-items: center; min-height: 44px; margin-right: 13px; padding: 3px 0; border: 0; background: transparent; color: var(--brand-evergreen); font-weight: 700; text-decoration: underline; }
  .mobile-map-dismiss { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--brand-evergreen); font-size: 1.5rem; }
  .mobile-map-detail :focus-visible { outline-color: var(--brand-blue); }
  .corridor-map-pane .maplibregl-ctrl-group button { width: 44px; height: 44px; }
  .corridor-map-pane:has(.maplibregl-ctrl-attrib[open]) .maplibregl-ctrl-scale { margin-bottom: 55px; }
  .corridor-map-pane:has(.mobile-map-detail:not([hidden])) .maplibregl-ctrl-attrib:not([open]) { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
