/* Geography enhancements load only on the interactive geography page. */
.geography-page { --map-header-space: 122px; }
.geography-page.has-map-experience .geography-main { padding-top: var(--map-header-space); }
.geography-page.has-map-experience :is(.geography-stage, .geography-shell, .geography-map-shell, .geography-map) { min-height: 0; }
.has-map-experience .geography-shell { display: block; }
.has-map-experience .geography-map-shell { position: relative; height: calc(100svh - var(--map-header-space)); min-height: 240px; display: block; overflow: hidden; }
.has-map-experience .geography-map { position: absolute; inset: 0; height: 100%; width: 100%; }
.geography-page .geography-map-toolbar { top: 16px; left: 20px; right: auto; flex-direction: column; align-items: stretch; gap: 8px; max-width: calc(100% - 40px); }
.map-route-pickers { display: grid; grid-template-columns: minmax(180px, .85fr) minmax(0, 1.15fr); gap: 8px; }
.map-route-pickers .map-station-picker { min-width: 0; }
.map-itinerary { padding: 8px 12px; border: 1px solid #c9d4c7; border-radius: 12px; background: #fffdf6f5; color: #17392c; max-width: 420px; }
.map-itinerary p { margin: 0 0 5px; font-size: .72rem; }
.map-itinerary ol { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 0 3px; overflow-x: auto; list-style-position: inside; font-size: .68rem; max-width: 100%; }
.map-itinerary li { flex: 0 0 auto; }
.map-itinerary li[aria-current] { font-weight: 800; }
.map-itinerary .is-pending { color: #715226; }
.map-itinerary[hidden] { display: none; }
.map-station-picker { display: grid; gap: 2px; padding: 8px 12px; border: 1px solid #c9d4c7; border-radius: 16px; background: #fffdf6f5; box-shadow: 0 5px 20px #17392c14; color: var(--forest); }
.map-station-picker > span { font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.map-station-picker select { width: 100%; min-width: 0; min-height: 28px; padding: 0 22px 0 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: .9rem; font-weight: 800; cursor: pointer; }
.map-route-pickers select { padding-right: 0; }
.map-toolbar-actions { display: flex; gap: 6px; }
.geography-page .geo-toolbar-link { justify-content: center; border: 1px solid #c9d4c7; min-height: 38px; padding: 6px 12px; background: #fffdf6ed; font-size: .74rem; cursor: pointer; }
.map-bottom-controls { position: absolute; z-index: 510; left: 20px; bottom: 43px; display: grid; justify-items: start; gap: 6px; max-width: min(350px, calc(100% - 40px)); pointer-events: none; }
.map-bottom-controls > * { pointer-events: auto; }
.map-journey-status { margin: 0; padding: 6px 10px; border-radius: 10px; background: #fffdf6ed; color: #17392c; font-size: .72rem; font-weight: 700; }
.geography-page .geography-disclaimer { left: 20px; right: auto; bottom: 22px; padding: 2px 6px; background: #fffdf6db; font-size: .6rem; border-radius: 4px; pointer-events: none; }
.map-overlay-connectors { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 410; pointer-events: none; overflow: hidden; }
.map-overlay-connectors line { stroke: #17392c; stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .55; }
.map-overlay-connectors [hidden] { display: none; }
.map-station-preview, .map-route-badge { position: absolute; z-index: 520; box-shadow: 0 8px 28px #17392c26; }
.map-station-preview { display: flex; gap: 9px; align-items: center; width: 196px; min-height: 72px; padding: 7px; border: 1px solid #bdcdbd; border-radius: 17px; background: #fffdf8; color: var(--forest); text-align: left; cursor: pointer; }
.map-preview-media { position: relative; display: grid; align-items: center; flex: 0 0 70px; width: 70px; height: 56px; overflow: hidden; border-radius: 10px; background: #e6ecdf; }
.map-preview-media img { display: block; width: 100%; height: 100%; object-fit: cover; }
.map-preview-media [data-map-preview-fallback] { padding: 5px; font-size: .61rem; line-height: 1.25; }
.map-preview-copy { display: grid; gap: 4px; min-width: 0; }
.map-preview-copy strong { font-size: .76rem; line-height: 1.2; }
.map-preview-copy > span { color: #52705b; font-size: .66rem; font-weight: 700; }
.map-route-badge { width: 270px; max-width: calc(100% - 24px); border: 1px solid #c3d2bf; border-radius: 16px; padding: 10px 12px 12px; background: #fffdf8f5; color: var(--forest); }
.map-badge-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-bottom: 8px; }
.map-badge-heading > span { font-size: .65rem; font-weight: 800; }
.map-badge-heading button { min-height: 30px; border: 0; padding: 0; background: transparent; color: #416c50; font: inherit; font-size: .65rem; font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.map-badge-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.map-badge-stats > div { display: grid; gap: 4px; }
.map-badge-stats span { font-size: .6rem; line-height: 1.25; color: #5c6c5b; }
.map-badge-stats strong { font-size: 1rem; line-height: 1.1; white-space: nowrap; }
.map-badge-stats strong.is-unavailable, .geography-route-panel .map-route-stat strong.is-unavailable { font-size: .7rem; white-space: normal; overflow-wrap: anywhere; }
.map-station-marker { background: transparent; border: 0; }
.map-station-button { position: relative; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #17392c; font-family: "Manrope", sans-serif; cursor: pointer; }
.map-station-dot { position: relative; width: 16px; height: 16px; border: 2px solid #fffdf6; border-radius: 50%; background: var(--station-color, #8c6239); box-shadow: 0 1px 5px #17392c33; }
.map-station-dot::before, .map-station-dot::after { content: ""; position: absolute; inset: -2px; border: 1.5px solid var(--station-color, #8c6239); border-radius: 50%; pointer-events: none; animation: map-point-pulse 2.8s ease-out infinite; }
.map-station-dot::after { display: none; }
.map-station-button.is-selected { --station-color: #1f6b52 !important; }
.map-station-button.is-selected .map-station-dot { width: 20px; height: 20px; border-width: 3px; }
.map-station-button.is-selected .map-station-dot::before { animation-duration: 2s; }
.map-station-button.is-selected .map-station-dot::after { display: block; animation: map-point-pulse 2s ease-out 1s infinite; }
.map-station-button.is-origin:not(.is-selected) .map-station-dot { outline: 2px solid #d5b57a; outline-offset: 2px; }
.map-station-button.is-visited:not(.is-selected) .map-station-dot { box-shadow: 0 0 0 3px #627b694d; }
.map-station-label { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: max-content; max-width: 138px; padding: 3px 6px; border-radius: 7px; background: #fffdf6db; color: #17392c; font-size: .71rem; line-height: 1.2; font-weight: 800; text-align: center; text-shadow: 0 1px #fff; }
.map-station-button[data-station="pamo"] .map-station-label { top: 40px; bottom: auto; }
.map-station-button[data-station="station-1"] .map-station-label { bottom: 18px; left: 44px; transform: none; }
.map-station-button.is-selected .map-station-label { top: 44px; bottom: auto; background: #17392c; color: #fffdf6; text-shadow: none; }
.map-station-button.is-selected .map-station-label::after { content: " · Selected"; font-size: .55rem; }
.map-station-button:focus-visible { outline: 3px solid #b36e21; outline-offset: 2px; border-radius: 50%; }
.geo-hiker-marker { background: transparent; border: 0; pointer-events: none !important; }
.map-hiker { display: block; width: 100%; height: 100%; --ranger-stride: 1.4s; --ranger-wave-duration: 2.6s; filter: drop-shadow(0 1px 1px #17392c26); }
.map-hiker svg { display: block; width: 100%; height: 100%; overflow: visible; }
.map-hiker[data-ranger-facing="left"] > svg { transform: scaleX(-1); transform-origin: 50% 95%; }
/* Joint wrappers supply local coordinates; Leaflet's root transform stays untouched. */
.map-hiker [data-ranger-motion] { transform-box: view-box; transform-origin: 0 0; }
.map-hiker .ranger-torso { transform-origin: 26px 26px; }
.map-hiker .ranger-hand-open { opacity: 0; }
.map-hiker[data-ranger-state="walking"] .ranger-thigh { animation: ranger-thigh-stride var(--ranger-stride) linear infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-shin { animation: ranger-knee-stride var(--ranger-stride) linear infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-boot { animation: ranger-boot-stride var(--ranger-stride) linear infinite; }
.map-hiker[data-ranger-state="walking"] :is(.ranger-thigh-back, .ranger-shin-back, .ranger-boot-back) { animation-delay: calc(var(--ranger-stride) / -2); }
.map-hiker[data-ranger-state="walking"] .ranger-upper-arm { animation: ranger-arm-stride var(--ranger-stride) ease-in-out infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-upper-arm-front { animation-delay: calc(var(--ranger-stride) / -2); }
.map-hiker[data-ranger-state="walking"] .ranger-forearm { animation: ranger-elbow-stride var(--ranger-stride) ease-in-out infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-forearm-front { animation-delay: calc(var(--ranger-stride) / -2); }
.map-hiker[data-ranger-state="walking"] .ranger-upper-body { animation: ranger-body-stride var(--ranger-stride) ease-in-out infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-head { animation: ranger-head-steady var(--ranger-stride) ease-in-out infinite; }
.map-hiker[data-ranger-state="walking"] .ranger-backpack { animation: ranger-pack-stride var(--ranger-stride) ease-in-out infinite; }
.map-hiker[data-ranger-state="waving"] .ranger-upper-arm-front { animation: ranger-greeting-shoulder var(--ranger-wave-duration) ease-in-out both; }
.map-hiker[data-ranger-state="waving"] .ranger-forearm-front { animation: ranger-greeting-elbow var(--ranger-wave-duration) ease-in-out both; }
.map-hiker[data-ranger-state="waving"] .ranger-hand-front { animation: ranger-greeting-wrist var(--ranger-wave-duration) ease-in-out both; }
.map-hiker[data-ranger-state="waving"] .ranger-hand-open { animation: ranger-open-palm var(--ranger-wave-duration) linear both; }
.map-hiker[data-ranger-state="waving"] .ranger-hand-relaxed { animation: ranger-relaxed-palm var(--ranger-wave-duration) linear both; }
.map-hiker[data-ranger-state="idle"] .ranger-torso { animation: ranger-breathe 4s ease-in-out infinite; }
.map-station-dialog { position: fixed; padding: 0; border: 1px solid #557054; border-radius: 24px; width: min(520px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); overflow: auto; background: #fbf8ef; color: #17392c; box-shadow: 0 24px 80px #07190d66; }
.map-station-dialog::backdrop { background: #071c17a6; backdrop-filter: blur(5px); }
.map-dialog-close { position: absolute; right: 10px; top: 10px; z-index: 2; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #becbbe; border-radius: 50%; background: #fffdf6f5; color: #17392c; font-size: 1.75rem; cursor: pointer; }
.map-dialog-media { margin: 0; min-height: 120px; background: #dfe7d9; }
.map-dialog-media img { width: 100%; max-height: 300px; aspect-ratio: 16/10; object-fit: cover; }
.map-dialog-media > span { display: block; padding: 60px 20px; text-align: center; }
.map-dialog-copy { padding: 22px 24px 26px; }
.map-dialog-copy h2 { margin: 8px 0; font-family: "Playfair Display", serif; font-size: 1.8rem; line-height: 1.15; }
.map-dialog-copy p { font-size: .9rem; line-height: 1.65; }
.map-dialog-copy .section-tag { margin: 0; color: #55704c; font-size: .68rem; }
.map-dialog-location { font-weight: 800; }
.map-dialog-route { margin-top: 22px; padding-top: 20px; border-top: 1px solid #c6d3c0; }
.map-dialog-route h3 { margin: 8px 0 16px; font-family: "Playfair Display", serif; font-size: 1.35rem; }
.map-dialog-route .map-badge-stats { padding: 12px; background: #e7edde; border-radius: 12px; }
.map-dialog-copy .map-route-warning { color: #384f37; background: #e9edde; font-size: .8rem; }
.map-dialog-copy .map-route-caption { color: #596d55; font-size: .75rem; }
.map-tile-notice { max-width: 420px; margin: 0; padding: 6px 10px; border-radius: 12px; background: #fff1d7; color: #62451d; font-size: .65rem; line-height: 1.4; }
.map-image-transition { position: absolute; z-index: 3; margin: 0; border-radius: 12px; object-fit: cover; pointer-events: none; }
.map-desktop-photo { display: block; width: 100%; padding: 0; border: 0; cursor: pointer; }
.geography-page :is(.map-station-preview, .map-route-badge, .map-dialog-route, .map-tile-notice, .map-preview-media img, .map-preview-media span, .map-dialog-media img, .map-dialog-media span)[hidden] { display: none; }
.geography-page [data-map-route-clear][hidden] { display: none; }
.geography-page :is(button, select, [tabindex]):focus-visible { outline: 3px solid #b87b26; outline-offset: 3px; }
@keyframes map-point-pulse { 0% { transform: scale(1); opacity: .65; } 85%, 100% { transform: scale(2.25); opacity: 0; } }
@keyframes ranger-thigh-stride { 0%, 100% { transform: rotate(-16deg); } 25% { transform: rotate(0); } 50% { transform: rotate(18deg); } 75% { transform: rotate(3deg); } }
@keyframes ranger-knee-stride { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(2deg); } 50% { transform: rotate(34deg); } 70% { transform: rotate(48deg); } 85% { transform: rotate(18deg); } }
@keyframes ranger-boot-stride { 0%, 100% { transform: rotate(16deg); } 25% { transform: rotate(0); } 50% { transform: rotate(-55deg); } 70% { transform: rotate(-45deg); } }
@keyframes ranger-arm-stride { 0%, 100% { transform: rotate(14deg); } 50% { transform: rotate(-16deg); } }
@keyframes ranger-elbow-stride { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(-14deg); } }
@keyframes ranger-body-stride { 0%, 50%, 100% { transform: translateY(0); } 25%, 75% { transform: translateY(-.45px); } }
@keyframes ranger-head-steady { 0%, 50%, 100% { transform: translateY(0); } 25%, 75% { transform: translateY(.25px); } }
@keyframes ranger-pack-stride { 0%, 100% { transform: rotate(-1deg); } 50% { transform: rotate(1deg) translateY(.2px); } }
@keyframes ranger-greeting-shoulder { 0%, 100% { transform: rotate(0); } 18%, 80% { transform: rotate(-110deg); } }
@keyframes ranger-greeting-elbow { 0%, 100% { transform: rotate(0); } 18%, 78% { transform: rotate(-58deg); } 28%, 48%, 68% { transform: rotate(-38deg); } 38%, 58% { transform: rotate(-62deg); } }
@keyframes ranger-greeting-wrist { 0%, 18%, 78%, 100% { transform: rotate(0); } 28%, 48%, 68% { transform: rotate(-12deg); } 38%, 58% { transform: rotate(12deg); } }
@keyframes ranger-open-palm { 0%, 8%, 94%, 100% { opacity: 0; } 18%, 80% { opacity: 1; } }
@keyframes ranger-relaxed-palm { 0%, 8%, 94%, 100% { opacity: 1; } 18%, 80% { opacity: 0; } }
@keyframes ranger-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.006); } }
@media (min-width: 961px) {
    .map-station-preview, .map-route-badge, .map-overlay-connectors { display: none !important; }
    .geography-page .geography-point-rail { top: var(--map-rail-top, 148px); max-height: calc(100% - var(--map-rail-top, 148px) - 24px); overflow: auto; }
    .geography-page .geography-panel { max-height: calc(100% - 40px); overflow: auto; }
    .map-bottom-controls .map-journey-status { position: absolute; width: 1px; height: 1px; padding: 0; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
    .map-bottom-controls [data-map-route-clear] { display: none; }
    .geography-route-panel .map-route-stat strong { font-size: 1rem; white-space: nowrap; }
}
@media (max-width: 960px) {
    .geography-page { --map-header-space: 100px; }
    .has-map-experience :is(.geography-point-rail, .geography-panel) { display: none; }
    .geography-page .geography-map-toolbar { top: 10px; left: 12px; right: 12px; max-width: none; width: auto; }
    .map-station-picker { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 10px; border-radius: 13px; }
    .map-station-picker > span { max-width: 65px; font-size: .58rem; line-height: 1.3; }
    .map-station-picker select { font-size: .74rem; min-height: 32px; }
    .map-route-pickers { grid-template-columns: minmax(132px, .85fr) minmax(0, 1.15fr); gap: 6px; }
    .map-route-pickers .map-station-picker { grid-template-columns: minmax(0, 1fr); gap: 2px; padding: 5px 8px; }
    .map-route-pickers .map-station-picker > span { max-width: none; }
    .map-itinerary { max-width: none; padding: 6px 10px; }
    .map-tile-notice { max-width: none; }
    .map-toolbar-actions { justify-content: space-between; }
    .geography-page .geo-toolbar-link { min-height: 36px; padding: 5px 11px; font-size: .68rem; }
    .map-bottom-controls { left: 12px; bottom: 42px; max-width: calc(100% - 24px); }
    .geography-page .geography-disclaimer { left: 12px; bottom: 22px; font-size: .55rem; }
    .map-station-label { font-size: .63rem; max-width: 116px; }
    .map-journey-status { font-size: .66rem; }
}
@media (max-height: 500px) and (max-width: 960px) {
    .has-map-experience .geography-map-shell { min-height: 180px; }
    .geography-page .geography-map-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 8px; }
    .map-route-pickers { grid-column: 1; grid-row: 1; }
    .map-route-pickers .map-station-picker { padding: 2px 8px; }
    .map-route-pickers .map-station-picker select { min-height: 26px; }
    .map-toolbar-actions { grid-column: 2; grid-row: 1; align-items: center; }
    .map-itinerary { grid-column: 1 / -1; }
    .map-itinerary { display: flex; align-items: center; gap: 10px; }
    .map-itinerary p { flex: 0 0 auto; margin: 0; }
    .map-itinerary ol { flex: 1 1 auto; min-width: 0; }
    .map-tile-notice { grid-column: 1 / -1; padding: 3px 8px; font-size: .55rem; }
    .map-route-badge, .map-overlay-connectors { display: none !important; }
    .map-station-preview { width: 164px; min-height: 58px; }
    .map-preview-media { flex-basis: 46px; width: 46px; height: 42px; }
    .map-route-badge { padding: 5px 9px 8px; }
    .map-badge-heading { padding-bottom: 3px; }
    .map-bottom-controls { bottom: 28px; gap: 6px; display: flex; align-items: center; }
    .map-bottom-controls .map-journey-status { padding: 3px 6px; }
    .geography-page .geography-disclaimer { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .geography-page *, .geography-page *::before, .geography-page *::after { animation: none !important; scroll-behavior: auto !important; }
}
