/* Southern Soundscapes — a living field guide.
   Shared masthead, footer, and Sabbath palette; map-specific components below.
   Content pages add their reading layouts in content.css. */
html.soundscape-root {
    color-scheme: dark;
    scrollbar-color: #476553 #142e26;
    scrollbar-width: thin;
}
.soundscape-page {
    --ink: #244b3c;
    --muted: #6d7c66;
    --cream: #f0f2df;
    --celery: #c3d5a0;
    --accent: #4b7251;
    --map-paper: #f4f7ea;
    --margin: clamp(28px, 4vw, 76px);
    --landscape-top: 98px;
    --landscape-fade-depth: 160px;
    padding: 0;
    color: var(--cream);
    background-color: #183e34;
    font-size: 14px;
}
.soundscape-page[data-lens="weekday"] {
    --celery: #d5d7a2;
    --accent: #6a7946;
}
.soundscape-page button { font-family: var(--font-body); }
.soundscape-page .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Each lens fades its own landscape, with an independent weekday base color.
   This includes the base color, avoiding a full-page color repaint per frame.
   Static SVG contours crossfade when the lens changes. Animating the inner
   SVG groups forces Firefox to repaint every stroked path on every frame,
   growing renderer memory even while the map is idle. Keep animation on
   the outer layers' opacity and clip their painting to the landscape. */
.landscape { position: absolute; inset: 0; z-index: -1; overflow: hidden; contain: paint; pointer-events: none; }
.landscape-wash { z-index: 1; position: absolute; inset: 0; background: radial-gradient(ellipse at 0 42%, #648f6b20, transparent 60%), linear-gradient(180deg, #142e2600 35%, #102c2770); -webkit-mask-image: linear-gradient(to bottom, transparent var(--landscape-top), #000 calc(var(--landscape-top) + var(--landscape-fade-depth))); mask-image: linear-gradient(to bottom, transparent var(--landscape-top), #000 calc(var(--landscape-top) + var(--landscape-fade-depth))); }
/* Fade the artwork into the solid lens color at the header divider. */
.landscape-layer { position: absolute; inset: var(--landscape-top) 0 auto; width: 100%; height: calc(100% - var(--landscape-top)); min-height: 1050px; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 var(--landscape-fade-depth)); mask-image: linear-gradient(to bottom, transparent, #000 var(--landscape-fade-depth)); transition: opacity .45s ease; }
.landscape-sabbath { opacity: 1; }
[data-lens="weekday"] .landscape-sabbath { opacity: 0; }
/* Keep the full-page theme color independent of the lowered artwork. */
.landscape-weekday-base { position: absolute; inset: 0; background-color: #384b34; transition: opacity .45s ease; }
.landscape-weekday, .landscape-weekday-base { opacity: 0; }
[data-lens="weekday"] :is(.landscape-weekday, .landscape-weekday-base) { opacity: 1; }
/* Interrupted switches settle immediately; the next isolated switch can fade. */
.is-switching-rapidly :is(.landscape-layer, .landscape-weekday-base) { transition: none; }
.contour-lines { fill: none; stroke: #bed1a1; stroke-width: 1; opacity: .22; }
.contour-lines use { vector-effect: non-scaling-stroke; }
.contour-echo { opacity: .16; }
.landscape-weekday .contour-lines { stroke: #d7d5a3; opacity: .25; }
.landscape-weekday .contour-echo { opacity: .15; }
.river { fill: none; stroke-linecap: round; }
.river-outer { stroke: #8cad7d; stroke-width: 150; opacity: .035; }
.river-inner { stroke: #9bb58a; stroke-width: 75; opacity: .04; }
.landscape-weekday .river-outer { stroke: #d3d69e; stroke-width: 190; opacity: .06; }
.landscape-weekday .river-inner { stroke: #d3d69e; stroke-width: 90; opacity: .065; }
.soundscape-page .noise-overlay { opacity: .035; z-index: 1200; }

/* A quiet masthead, with a mark shaped like a small river stone. */
.soundscape-page .site-header { min-height: 98px; margin: 0 var(--margin); padding: 23px 0; flex-direction: row; justify-content: space-between; text-align: left; border-bottom: 1px solid #d1e0bc26; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--cream); font-family: var(--font-heading); font-size: 25px; line-height: .92; letter-spacing: -.6px; }
.brand-second-line { display: block; }
.brand-mark { display: block; flex-shrink: 0; width: 72px; height: 72px; object-fit: contain; }
.soundscape-page .site-nav { gap: 34px; margin: 0; align-items: center; }
.soundscape-page .nav-link { position: relative; padding: 8px 0; font-size: 12px; color: #d1ddc2cc; border: 0; border-radius: 0; }
.soundscape-page .nav-link.active, .soundscape-page .nav-link:hover { color: var(--cream); background: none; border-radius: 0; }
.soundscape-page .nav-link.active::after { content: ""; position: absolute; bottom: 0; left: 30%; right: 30%; height: 2px; background: var(--celery); border-radius: 50%; }
.header-note { font-size: 10px; display: flex; align-items: center; gap: 9px; color: #dae3c4a1; }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--celery); flex-shrink: 0; box-shadow: 0 0 0 4px #c4d8aa0a; }
.soundscape-page .site-main { gap: 0; padding: 0; display: block; }
.map-controls { display: flex; justify-content: center; padding: 24px var(--margin) 20px; }
.soundscape-page .lens-toggle { display: flex; justify-content: center; max-width: none; margin: 0; padding: 0; }
.soundscape-page .lens-nav { display: flex; gap: 3px; padding: 5px; border: 1px solid #d9e2bf38; border-radius: 42px; background: #0e2d2538; box-shadow: 0 4px 20px #08271c0a; }
.soundscape-page .lens-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-width: 130px; font-size: 12px; font-weight: 500; padding: 12px 22px; color: #e1e8d3bf; background: transparent; border: 1px solid transparent; transition: none; }
.soundscape-page .lens-button .icon { width: 17px; height: 17px; }
.lens-icon { background-color: currentColor; -webkit-mask: var(--lens-icon) center / contain no-repeat; mask: var(--lens-icon) center / contain no-repeat; }
.soundscape-page .lens-button:hover { color: #fff; }
.soundscape-page .lens-button.active { background: #e8eed7; border-color: #e8eed7; color: #2d513d; box-shadow: 0 2px 8px #10291e18; }
[data-lens="weekday"] .lens-button.active { background: #eeecd2; border-color: #eeecd2; color: #4b5c33; }

/* The map is the page's centerpiece: a broad, pale clearing in the forest. */
.map-stage { margin: 0 var(--margin); }
.soundscape-page .map-frame { height: clamp(490px, 57vh, 760px); min-height: 490px; background: #dee6d3; border: 6px solid #dce4cb; border-radius: 28px 72px 28px 28px; box-shadow: 0 24px 70px -30px #041e2580, 0 0 0 1px #eef3dc3b; isolation: isolate; container-type: inline-size; }
[data-lens="weekday"] .map-frame { border-color: #dfe2bf; }
.soundscape-page #mapid { background: #e0e7d5; z-index: 0; font-family: var(--font-body); color: var(--ink); }
.soundscape-page .leaflet-tile-pane { filter: saturate(.58) sepia(.13) hue-rotate(12deg); }
.map-compass { position: absolute; z-index: 450; top: 22px; right: 27px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--ink); pointer-events: none; }
/* Leave the popup close target clear of the decorative compass. */
.map-frame:has(.leaflet-popup) .map-compass { visibility: hidden; }
.map-compass span { font-size: 10px; letter-spacing: 1px; }
.map-compass svg { width: 18px; height: 24px; fill: #f8f9ee; stroke: #567044; stroke-width: 1.2; }
.map-recenter { display: flex; align-items: center; gap: 8px; z-index: 450; position: absolute; left: 18px; bottom: 27px; padding: 10px 15px; color: var(--ink); font-size: 11px; background: var(--map-paper); border-radius: 30px; border: 1px solid #657b4a2e; box-shadow: 0 2px 8px #4053350b; cursor: pointer; transition: background-color .3s ease; }
.map-recenter:hover { background: #e5ecd7; }
.map-recenter .icon { width: 15px; height: 15px; }
.soundscape-page .leaflet-right .leaflet-control-zoom { margin-right: 20px; margin-bottom: 27px; border: 1px solid #7c8d6540; box-shadow: 0 2px 10px #3349230b; border-radius: 20px; overflow: hidden; }
.soundscape-page .leaflet-control-zoom a { width: 34px; height: 33px; line-height: 31px; font-weight: 400; color: var(--ink); background: var(--map-paper); border-color: #657b4a26; }
.soundscape-page .leaflet-control-zoom a:hover { background: #e5ecd7; }
.soundscape-page .leaflet-control-attribution { margin: 0 8px 4px 0; padding: 1px 6px; border-radius: 4px; background: #fafbefcc; color: #6b775c; font-size: 9.5px; }
.soundscape-page .leaflet-control-attribution a { color: #597044; }

/* All sound ripples remain regular Leaflet markers, popups, and tooltips. */
.sound-marker { background: transparent; border: none; }
.marker-ripple { position: absolute; inset: 0; border: 1px solid #617b4266; border-radius: 48% 52% 47% 53%; background: #8fa57430; box-shadow: 0 0 0 5px #79905614; transition: transform .4s ease, background-color .4s ease; }
.marker-ripple::before { content: ""; position: absolute; inset: 4px; border: 1px solid #627b4b59; border-radius: 50% 47% 53% 50%; transform: rotate(30deg); }
.marker-core { position: absolute; inset: 8px; display: grid; place-items: center; border-radius: 50%; background-color: var(--accent); color: #f5f8e9; box-shadow: 0 2px 6px #244d2726; border: 2px solid #f5f8e9; }
.marker-core .icon { width: 14px; height: 14px; }
.sound-marker:hover .marker-ripple, .sound-marker.is-selected .marker-ripple { transform: scale(1.2) rotate(15deg); background: #91a87242; }
.sound-marker.is-selected .marker-ripple { animation: listening-ripple 3s ease-in-out infinite; }
@keyframes listening-ripple { 0%, 100% { transform: scale(1.05); } 50% { transform: scale(1.24) rotate(12deg); } }
.soundscape-page .leaflet-tooltip { font-family: var(--font-body); font-size: 10px; color: var(--ink); background: #f8faefed; border: 1px solid #6a80502b; border-radius: 20px; box-shadow: 0 2px 5px #36532d08; padding: 6px 12px; }
.soundscape-page .leaflet-tooltip-right::before { border-right-color: #f8faef; }
.soundscape-page .leaflet-tooltip-left::before { border-left-color: #f8faef; }
.soundscape-page .leaflet-tooltip { width: max-content; max-width: min(18rem, calc(100cqi - 56px)); white-space: normal; overflow-wrap: anywhere; }
.soundscape-page .leaflet-popup-content-wrapper { min-width: 0; max-width: none; background: var(--map-paper); color-scheme: light; color: var(--ink); border: 1px solid #889e6c38; border-radius: 23px; box-shadow: 0 8px 30px #344d3324; }
.soundscape-page .leaflet-popup-content { margin: 24px;
    /* Use the map's content width, leaving room for the wrapper and auto-pan. */
    width: min(270px, calc(100cqi - 76px)) !important; }
.soundscape-page .leaflet-popup-content strong { display: block; font-family: var(--font-heading); font-size: 27px; text-wrap: balance; overflow-wrap: anywhere; font-weight: 400; color: var(--ink); line-height: 1.15; }
.soundscape-page .popup-description { color: #5b6a53; font-size: 12.5px; line-height: 1.65; margin: 10px 0 16px; overflow-wrap: anywhere; }
.popup-audio { display: block; width: 100%; min-width: 0; height: 38px; accent-color: var(--accent); }
.soundscape-page .leaflet-popup-tip { background: var(--map-paper); }
.soundscape-page .leaflet-container a.leaflet-popup-close-button { color: #596c4b; right: 7px; top: 6px; width: 28px; height: 28px; line-height: 28px; border-radius: 50%; }

.soundscape-page .leaflet-container a.leaflet-popup-close-button:hover { background: #244b3c12; color: var(--ink); }

/* A small, data-driven invitation to keep listening. */
.listening-section { padding: 24px var(--margin); }
.listening-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; }
.listening-card { text-align: left; flex: 1; min-width: 0; display: flex; align-items: center; gap: 17px; border: 1px solid #c9d9af38; background: #dae6be0e; border-radius: 20px; padding: 15px; color: var(--cream); cursor: pointer; transition: background-color .3s ease, transform .3s ease, border-color .3s ease; }
.listening-card:hover { background: #dae6be17; border-color: #c9d9af61; transform: translateY(-2px); }
.listening-card.is-selected { background: #dae6be1a; border-color: #c9d9af8c; box-shadow: inset 0 0 0 1px #c3d5a01f; }
.soundscape-page :is(.listening-card, .lens-button, .nav-link, .brand):focus-visible { outline: 2px solid var(--celery); outline-offset: 4px; }
.soundscape-page :is(.map-recenter, .leaflet-popup-close-button):focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.card-art { width: 69px; height: 68px; display: grid; place-items: center; flex-shrink: 0; border-radius: 46% 54% 57% 43% / 54% 42% 58% 46%; background-color: #bbcda3; overflow: hidden; position: relative; color: #496d4d; }
.card-art > svg { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: #496e4c40; stroke-width: 1; }
.card-art .icon { position: relative; width: 24px; height: 24px; stroke: #45664c; stroke-width: 1.2; }
.listening-card:nth-child(even) .card-art { background-color: #cfce9b; border-radius: 57% 43% 45% 55% / 45% 57% 43% 55%; }
[data-lens="weekday"] .card-art { background-color: #cfce9b; }
[data-lens="weekday"] .listening-card:nth-child(even) .card-art { background-color: #b5c49b; }
.card-copy { display: block; flex: 1; min-width: 0; align-self: flex-start; }
.card-title { display: block; font-family: var(--font-heading); font-size: clamp(21px, 1.75vw, 25px); text-wrap: balance; overflow-wrap: anywhere; font-weight: 400; letter-spacing: -.4px; line-height: 1.2; }
.card-description { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #d5e2c4cc; font-size: 11.5px; line-height: 1.5; margin-top: 5px; overflow: hidden; overflow-wrap: anywhere; }
.card-action { display: flex; align-items: center; gap: 8px; align-self: center; margin: 0 8px; color: var(--celery); flex-shrink: 0; font-size: 11px; font-weight: 500; letter-spacing: .02em; white-space: nowrap; }
.card-action .icon { width: 17px; height: 17px; }
.soundscape-page .site-footer { display: flex; justify-content: space-between; align-items: center; margin: 0 var(--margin); padding: 23px 0; border-top: 1px solid #d1e0bc26; text-align: left; }
.soundscape-page .site-footer p { font-size: 10.5px; text-transform: none; letter-spacing: 0; font-weight: 400; color: #b7c8a5b3; }
.soundscape-page .site-footer > span { color: #b7c8a5b3; font-size: 10.5px; }

@media (min-width: 1600px) {
    .card-action { padding-left: 24px; border-left: 1px solid #c9d9af29; }
}

/* Keep the whole composition comfortable on ordinary laptop displays.
   Shorter screens and stacked-card layouts can scroll without shrinking the map further. */
@media (max-height: 960px) and (min-width: 601px) {
    .soundscape-page { --landscape-top: 84px; }
    .soundscape-page .site-header { min-height: 84px; padding: 17px 0; }
    .map-controls { padding: 16px var(--margin) 14px; }
    .soundscape-page .map-frame { height: clamp(400px, 52vh, 620px); min-height: 400px; }
    .listening-section { padding: 18px var(--margin) 24px; }
    .soundscape-page .site-footer { padding: 18px 0; }
}

@media (max-width: 1000px) {
    .listening-card { gap: 13px; padding: 13px; }
    .card-art { width: 58px; height: 58px; }
}

@media (max-width: 600px) {
    .soundscape-page { --landscape-top: 123px; }
    .soundscape-page .site-header { flex-direction: column; align-items: flex-start; gap: 14px; min-height: 0; padding: 18px 0 14px; }
    .soundscape-page .site-nav { width: 100%; justify-content: flex-start; flex-wrap: nowrap; gap: 22px; }
    .soundscape-page .nav-link { font-size: 11px; padding: 6px 0; white-space: nowrap; }
    .soundscape-page .map-frame { height: clamp(380px, 56svh, 520px); min-height: 0; border-width: 5px; border-radius: 22px 56px 22px 22px; }
    .soundscape-page .leaflet-popup-content { margin: 18px; width: min(270px, calc(100cqi - 60px)) !important; }
}

@media (max-width: 480px) {
    .listening-card { gap: 14px; padding: 14px 16px; }
    .card-art { width: 56px; height: 56px; }
    .card-action { width: 30px; height: 30px; margin: 0; padding: 0; border: 1px solid #c9d9af4d; border-radius: 50%; justify-content: center; font-size: 0; gap: 0; }
    .card-action .icon { width: 16px; height: 16px; }
}

@media (max-width: 360px) {
    .soundscape-page .lens-button { min-width: 0; padding: 12px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .soundscape-page *, .soundscape-page *::before, .soundscape-page *::after {
        animation: none !important;
        transition: none !important;
    }
}
