@import url("/assets/archive/v1p0/styles.css");

:root {
    --refined-deep: #183f39;
    --refined-mid: rgb(54, 119, 107);
    --refined-soft: rgb(179, 219, 212);
    --refined-pale: rgb(226, 242, 239);
    --refined-ink: #16302c;
    --refined-water: #b9dce8;
    --refined-shadow: 0 18px 42px rgba(19, 48, 44, 0.18);
}

body {
    background:
        radial-gradient(circle at top left, rgba(226, 242, 239, 0.9), rgba(223, 232, 227, 0) 38%),
        linear-gradient(180deg, #eef5f3 0%, #dfe8e3 100%);
    font-family: "Montserrat", "Segoe UI", sans-serif;
    overflow: hidden;
}

.page-shell {
    grid-template-columns: minmax(292px, 316px) minmax(0, 1fr);
    height: 100vh;
    overflow: hidden;
}

.intro-panel {
    position: relative;
    height: 100%;
    padding: 18px 16px 22px;
    gap: 12px;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at top left, rgba(179, 219, 212, 0.16), transparent 32%),
        linear-gradient(180deg, rgba(12, 40, 35, 0.98), rgba(23, 63, 57, 0.95) 45%, rgba(54, 119, 107, 0.9) 100%);
    box-shadow: inset -1px 0 0 rgba(226, 242, 239, 0.12);
    overflow-y: auto;
}

.intro-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(226, 242, 239, 0.06), transparent 45%),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 14px);
    pointer-events: none;
}

.intro-panel > * {
    position: relative;
    z-index: 1;
}

/* Scroll affordance: a zero-height sticky rail pinned to the bottom of the
   panel, painting a fade over whatever content sits underneath it. Height is 0
   and the flex gap is cancelled so the rail adds nothing to the scroll height.
   .has-scroll-affordance is set from JS only while there is more to scroll. */
.intro-panel > .intro-panel-fade {
    position: sticky;
    bottom: 0;
    z-index: 2;
    height: 0;
    margin-top: -12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
}

.intro-panel.has-scroll-affordance > .intro-panel-fade {
    opacity: 1;
}

/* -22px reaches past the panel's bottom padding, which content still scrolls
   through, so the fade covers the full visible band. */
.intro-panel-fade::after {
    content: "";
    position: absolute;
    left: -16px;
    right: -16px;
    bottom: -22px;
    height: 68px;
    background: linear-gradient(180deg, rgba(71, 130, 119, 0), rgba(71, 130, 119, 0.92) 62%, rgba(71, 130, 119, 0.98));
}

@media (prefers-reduced-motion: reduce) {
    .intro-panel > .intro-panel-fade {
        transition: none;
    }
}

.logo-card-primary {
    min-height: 56px;
    padding: 10px 14px;
    border-radius: 18px;
    box-shadow: 0 16px 28px rgba(5, 20, 18, 0.18);
}

/* The logo card is an anchor back to "/" where the page provides one; these
   rules only bite on that element, so a plain .logo-card div is unaffected. */
a.logo-card {
    text-decoration: none;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

a.logo-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(5, 20, 18, 0.24);
}

a.logo-card:focus-visible {
    outline: 2px solid rgba(226, 242, 239, 0.9);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    a.logo-card {
        transition: none;
    }
}

.panel-login-button {
    min-height: 46px;
    border-color: rgba(226, 242, 239, 0.2);
    background: linear-gradient(180deg, rgba(226, 242, 239, 0.12), rgba(226, 242, 239, 0.05));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.panel-login-button:hover {
    background: linear-gradient(180deg, rgba(226, 242, 239, 0.18), rgba(226, 242, 239, 0.08));
    border-color: rgba(226, 242, 239, 0.32);
    transform: translateY(-1px);
}

.intro-panel-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(226, 242, 239, 0.16);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.legal-links a {
    color: rgba(237, 245, 241, 0.76);
    font-size: 0.72rem;
    font-weight: 600;
    text-underline-offset: 3px;
}

.legal-links a:hover {
    color: #ffffff;
}

h1 {
    font-family: "Montserrat", "Segoe UI", sans-serif;
    font-size: 1.78rem;
    letter-spacing: 0;
    line-height: 1.06;
    font-weight: 800;
}

.intro-copy {
    color: rgba(237, 245, 241, 0.86);
    max-width: 24ch;
    font-size: 0.82rem;
    line-height: 1.4;
}

.panel-card,
.map-legend {
    border-radius: 20px;
    border: 1px solid rgba(179, 219, 212, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03)),
        rgba(19, 66, 56, 0.74);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        0 16px 30px rgba(9, 28, 24, 0.16);
}

.panel-title {
    font-size: 1.01rem;
    letter-spacing: 0.01em;
}

.selected-survey-panel {
    padding: 12px 13px 11px;
}

.selected-survey-title {
    margin-bottom: 7px;
    font-size: 0.86rem;
}

.selected-survey-card {
    font-size: 0.78rem;
    line-height: 1.4;
}

.map-tools-card .panel-heading {
    margin-bottom: 8px;
}

.map-tools-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 3px;
    border: 1px solid rgba(179, 219, 212, 0.18);
    border-radius: 999px;
    background: rgba(7, 35, 30, 0.34);
}

.map-tools-tab {
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(237, 245, 241, 0.68);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.map-tools-tab:hover {
    color: #ffffff;
}

.map-tools-tab[aria-selected="true"] {
    color: #f7fbf8;
    background: linear-gradient(180deg, rgba(179, 219, 212, 0.28), rgba(179, 219, 212, 0.14));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), 0 5px 12px rgba(6, 25, 22, 0.14);
}

.map-tools-tab:focus-visible {
    outline: 2px solid rgba(226, 242, 239, 0.9);
    outline-offset: 2px;
}

.map-tools-panel {
    margin-top: 11px;
}

.map-tools-panel[hidden] {
    display: none;
}

.map-tools-panel .filter-section:not([hidden]) ~ .filter-section:not([hidden]) {
    margin-top: 11px;
    padding-top: 10px;
}

.map-filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: rgba(237, 245, 241, 0.68);
    font-size: 0.72rem;
    font-weight: 600;
}

.map-filter-primary {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: 0 !important;
}

.panel-reset {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(226, 242, 239, 0.16);
    color: rgba(237, 245, 241, 0.82);
}

.panel-heading-inline {
    margin-bottom: 8px;
}

.search-wrap input,
.select-wrap select {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid rgba(179, 219, 212, 0.18);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(237, 245, 241, 0.95);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
}

.search-wrap input::placeholder {
    color: rgba(237, 245, 241, 0.52);
    font-size: 0.75rem;
    font-weight: 500;
}

.search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.coordinate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.search-button {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.search-button-full {
    width: 100%;
    margin-top: 8px;
}

.search-feedback {
    margin: 10px 2px 0;
    min-height: 1em;
    color: rgba(237, 245, 241, 0.72);
    font-size: 0.72rem;
    line-height: 1.35;
}

.checklist-group {
    display: grid;
    gap: 8px;
}

.checklist-group-scroll {
    max-height: 212px;
    overflow-y: auto;
    padding-right: 4px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 34px;
    padding: 6px 9px;
    border-radius: 14px;
    border: 1px solid rgba(179, 219, 212, 0.16);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(237, 245, 241, 0.92);
    transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.filter-option:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.09);
}

.filter-option:has(input:checked) {
    background: linear-gradient(180deg, rgba(179, 219, 212, 0.28), rgba(179, 219, 212, 0.14));
    border-color: rgba(226, 242, 239, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.filter-option input {
    width: 14px;
    height: 14px;
    accent-color: #ccebe4;
    margin: 0;
}

.filter-option span {
    line-height: 1.25;
    font-size: 0.75rem;
    font-weight: 600;
}

/* `~` rather than `+` so the divider tracks *visible* order: the first visible
   section never gets a top border, and a hidden section in the middle does not
   strand the section after it. */
.filter-section:not([hidden]) ~ .filter-section:not([hidden]) {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(179, 219, 212, 0.12);
}

.filter-subtitle {
    margin: 0 0 8px;
    color: rgba(237, 245, 241, 0.86);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.selected-survey-card h3 {
    font-family: "Montserrat", "Segoe UI", sans-serif;
    font-size: 0.96rem;
    line-height: 1.08;
    font-weight: 700;
    margin: 0;
}

.selected-survey-meta {
    margin: 0 0 8px;
    color: rgba(237, 245, 241, 0.72);
    font-size: 0.76rem;
    font-weight: 600;
}

/* The same area label as the popup, but this card sits on the dark sidebar,
   so it needs the light end of the palette rather than the popup's ink. */
.selected-survey-card .popup-area {
    color: #eaf5f1;
    font-size: 0.85rem;
    gap: 0.4rem;
}

.selected-survey-card .popup-area-position {
    border-color: rgba(237, 245, 241, 0.28);
    background: rgba(237, 245, 241, 0.12);
    color: rgba(237, 245, 241, 0.86);
    font-size: 0.7rem;
}

.selected-survey-grid {
    margin-top: 9px;
    display: grid;
    gap: 7px;
}

.selected-survey-grid > div {
    display: grid;
    gap: 3px;
    padding: 7px 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(179, 219, 212, 0.12);
    color: rgba(237, 245, 241, 0.94);
    font-size: 0.75rem;
    line-height: 1.28;
}

.selected-survey-grid > div strong {
    color: rgba(237, 245, 241, 0.62);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.selected-survey-action {
    margin-top: 12px;
}

.download-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.map-panel {
    position: relative;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(226, 242, 239, 0.42), transparent 28%),
        linear-gradient(180deg, #cbe1e7 0%, var(--refined-water) 100%);
}

.map-status-pill {
    top: 18px;
    left: 18px;
    padding: 8px 12px;
    width: fit-content;
    min-width: 0;
    max-width: min(52rem, calc(100% - 36px));
    border: 1px solid rgba(226, 242, 239, 0.18);
    background: rgba(24, 63, 57, 0.68);
    box-shadow: var(--refined-shadow);
    backdrop-filter: blur(14px);
}

.map-status-pill.refined-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
}

.status-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--refined-soft), #83c3b8);
    box-shadow: 0 0 0 3px rgba(179, 219, 212, 0.14);
}

.status-copy {
    display: grid;
    gap: 1px;
    min-width: 0;
}

.status-primary {
    font-weight: 700;
    color: #f4fbf8;
    font-size: 0.92rem;
    line-height: 1.1;
    white-space: normal;
}

.status-secondary {
    color: rgba(237, 245, 241, 0.78);
    font-size: 0.74rem;
    line-height: 1.1;
    white-space: normal;
}

.map-legend {
    left: 18px;
    bottom: 18px;
    min-width: 0;
    width: min(260px, calc(100% - 36px));
    padding: 9px 10px;
    background:
        linear-gradient(180deg, rgba(19, 66, 56, 0.88), rgba(19, 66, 56, 0.78));
}

.map-legend h2 {
    font-size: 0.92rem;
    margin-bottom: 6px;
}

.legend-list li {
    color: rgba(237, 245, 241, 0.92);
    font-size: 0.82rem;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 0;
    background: linear-gradient(180deg, #cde3ea 0%, #aed4df 100%);
}

.survey-pin-wrapper {
    background: transparent;
    border: 0;
}

.survey-pin {
    position: relative;
    display: block;
    width: 22px;
    height: 22px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 2px solid rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 18px rgba(17, 40, 35, 0.22);
    transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.survey-pin::after {
    content: "";
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.82);
}

.survey-pin-marine {
    background: var(--marine);
}

.survey-pin-land {
    background: var(--land);
}

.survey-pin-airborne {
    background: var(--airborne);
}

.survey-pin-unknown {
    background: #d27f5f;
}

.swatch.unknown {
    background: #d27f5f;
}

.survey-pin-hover {
    filter: brightness(1.05);
    box-shadow: 0 14px 24px rgba(17, 40, 35, 0.28);
    transform: rotate(-45deg) scale(1.08);
}

.survey-pin-linked {
    border-color: rgba(24, 63, 57, 0.96);
    filter: brightness(1.08) saturate(1.08);
    box-shadow:
        0 0 0 4px rgba(255, 202, 122, 0.46),
        0 16px 28px rgba(17, 40, 35, 0.3);
    transform: rotate(-45deg) scale(1.18);
}

.survey-pin-selected {
    filter: brightness(1.02);
    box-shadow: 0 16px 28px rgba(17, 40, 35, 0.34);
    transform: rotate(-45deg) scale(1.14);
}

@keyframes spiderfyPinWobble {
    0% {
        transform: rotate(-45deg) scale(1);
    }
    15% {
        transform: rotate(-62deg) scale(1.16);
    }
    32% {
        transform: rotate(-28deg) scale(1.07);
    }
    48% {
        transform: rotate(-56deg) scale(1.12);
    }
    66% {
        transform: rotate(-32deg) scale(1.05);
    }
    84% {
        transform: rotate(-49deg) scale(1.03);
    }
    100% {
        transform: rotate(-45deg) scale(1);
    }
}

.survey-pin-spiderfy-wobble {
    animation: spiderfyPinWobble 520ms cubic-bezier(0.22, 0.8, 0.28, 1);
}

.spiderfy-connector {
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 2px 4px rgba(17, 40, 35, 0.32));
}

.leaflet-popup-content-wrapper {
    border-radius: 18px;
    border: 1px solid rgba(179, 219, 212, 0.18);
    box-shadow: 0 20px 34px rgba(17, 40, 35, 0.16);
}

.leaflet-popup-tip {
    box-shadow: none;
}

/* Leaflet's default is 13px 24px 13px 20px. The right inset stays generous so
   the title clears the absolutely positioned close button. */
.leaflet-popup-content {
    margin: 11px 22px 12px 18px;
}

.popup-card,
.overlap-chooser {
    min-width: 246px;
}

.popup-card {
    display: grid;
    gap: 8px;
}

.popup-card h3,
.overlap-chooser h3 {
    font-family: "Montserrat", "Segoe UI", sans-serif;
    letter-spacing: -0.015em;
    font-weight: 700;
}

.popup-card h3 {
    font-size: 1.26rem;
    line-height: 1.02;
    margin: 0;
}

.popup-meta {
    margin: 0;
    color: #5f746f;
    font-size: 0.92rem;
    font-weight: 600;
}

.popup-summary {
    color: #294842;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* Names the sub-area a popup belongs to, for surveys drawn as several
   polygons. Absent entirely on single-polygon surveys. */
.popup-area {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.45rem;
    color: #1f5a4f;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.popup-area-position {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    border: 1px solid rgba(179, 219, 212, 0.5);
    background: rgba(226, 242, 239, 0.7);
    color: #446a63;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
}

.popup-unavailable {
    margin: 4px 0 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid rgba(179, 219, 212, 0.34);
    background: linear-gradient(180deg, rgba(226, 242, 239, 0.92), rgba(214, 235, 230, 0.82));
    color: #32524c;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 10px 18px rgba(31, 90, 79, 0.08);
    backdrop-filter: blur(10px);
}

.popup-grid {
    margin-top: 2px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}

.popup-grid > div {
    display: grid;
    gap: 1px;
    align-content: start;
    padding: 6px 9px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(246, 251, 249, 0.98), rgba(237, 246, 243, 0.94));
    border: 1px solid rgba(179, 219, 212, 0.22);
    color: #294842;
    line-height: 1.25;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

/* 0.04em keeps two-word labels such as "Detail Area" on one line at the
   popup's ~300px content width; 0.08em wrapped them and cost a whole row. */
.popup-grid > div strong {
    color: #718883;
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.overlap-chooser p {
    margin-bottom: 12px;
}

.overlap-choice-button {
    border-radius: 14px;
    background: linear-gradient(180deg, #fcfefd, #f2f9f6);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.overlap-choice-title {
    font-size: 0.98rem;
}

.hover-tooltip-card {
    display: grid;
    gap: 2px;
    border-radius: 14px;
    padding: 9px 12px;
    background: rgba(24, 63, 57, 0.95);
    box-shadow: 0 12px 26px rgba(17, 40, 35, 0.22);
}

.hover-tooltip-card em {
    margin-top: 2px;
    font-style: normal;
    color: rgba(226, 242, 239, 0.74);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.factsheet-button,
.download-data-button,
.primary-action,
.inline-action {
    background: linear-gradient(135deg, var(--refined-mid), #255f55);
    box-shadow: 0 12px 24px rgba(31, 90, 79, 0.18);
    transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}

.factsheet-button:hover,
.download-data-button:hover,
.primary-action:hover,
.inline-action:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
    box-shadow: 0 16px 28px rgba(31, 90, 79, 0.22);
}

.dialog-card {
    border-radius: 24px;
    border: 1px solid rgba(179, 219, 212, 0.22);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 249, 0.96));
}

.dialog-copy {
    color: #4d6762;
}

.dialog-close {
    background: rgba(54, 119, 107, 0.08);
}

.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, #2d6a5f 0%, rgb(54, 119, 107) 55%, #2a675c 100%);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.footer-links a:hover {
    color: #ffffff;
    text-decoration: underline;
}

.checkbox-row a {
    color: var(--refined-deep);
    font-weight: 700;
}

body.refined-ui-ready .intro-panel,
body.refined-ui-ready .map-status-pill,
body.refined-ui-ready .map-legend {
    animation: refinedRise 420ms ease;
}

@media (min-width: 1440px) {
    .page-shell {
        grid-template-columns: minmax(308px, 344px) minmax(0, 1fr);
    }
}

@media (max-width: 1200px) {
    h1 {
        font-size: 1.68rem;
    }

    .page-shell {
        grid-template-columns: minmax(276px, 300px) minmax(0, 1fr);
    }

    .map-status-pill {
        max-width: calc(100% - 28px);
        padding: 7px 10px;
    }
}

@keyframes refinedRise {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 960px) {
    body {
        overflow: auto;
    }

    .page-shell {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    .intro-panel {
        height: auto;
        padding: 16px 14px 18px;
        overflow: visible;
    }

    .intro-copy {
        max-width: none;
    }

    .map-panel {
        height: auto;
        overflow: hidden;
        display: block;
        padding: 0;
    }

    .map-status-pill {
        position: absolute;
        top: 12px;
        left: 12px;
        width: fit-content;
        max-width: min(30rem, calc(100% - 24px));
    }

    .map-legend {
        position: absolute;
        left: 12px;
        bottom: 12px;
        width: fit-content;
        max-width: min(230px, calc(100% - 24px));
        padding: 8px 9px;
    }

    #map {
        height: min(65dvh, 560px);
        min-height: 420px;
        border-radius: 0;
    }
}

@media (max-width: 640px) {
    h1 {
        font-size: 1.58rem;
    }

    .coordinate-grid {
        grid-template-columns: 1fr;
    }

    .map-panel {
        padding: 0;
    }

    .map-status-pill {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        padding: 7px 9px;
    }

    .map-legend {
        left: 10px;
        bottom: 10px;
        max-width: min(200px, calc(100% - 20px));
        padding: 7px 8px;
    }

    .map-legend h2 {
        font-size: 0.84rem;
    }

    .legend-list li {
        font-size: 0.75rem;
    }

    #map {
        height: min(58dvh, 460px);
        min-height: 340px;
    }

    .popup-grid {
        grid-template-columns: 1fr;
    }
}

.segmented-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.segmented-option {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(179, 219, 212, 0.14);
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.segmented-option:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.09);
}

.segmented-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-option span {
    color: rgba(237, 245, 241, 0.82);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: center;
}

.segmented-option:has(input:checked) {
    background: linear-gradient(180deg, rgba(179, 219, 212, 0.28), rgba(179, 219, 212, 0.14));
    border-color: rgba(226, 242, 239, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.segmented-option:has(input:checked) span {
    color: #f7fbf8;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.polygon-upload-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
}

.polygon-upload-actions .search-button {
    margin-top: 0;
}

.polygon-clear-button {
    min-width: max-content;
}

.polygon-upload-help {
    margin: 7px 0 0;
    color: rgba(237, 245, 241, 0.62);
    font-size: 0.62rem;
    line-height: 1.45;
}

/* Optional lead capture under the polygon search. Hidden until a search has
   run, so it never competes with the tool itself. */
.search-enquiry {
    margin: 10px 0 0;
    padding: 10px;
    border: 1px solid rgba(237, 245, 241, 0.16);
    border-radius: 6px;
    background: rgba(8, 40, 33, 0.35);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.search-enquiry-title {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgba(237, 245, 241, 0.92);
}

.search-enquiry-help {
    margin: 0 0 2px;
    color: rgba(237, 245, 241, 0.62);
    font-size: 0.62rem;
    line-height: 1.45;
}

.search-enquiry-label {
    font-size: 0.62rem;
    color: rgba(237, 245, 241, 0.72);
}

.search-enquiry-input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 7px;
    border: 1px solid rgba(237, 245, 241, 0.2);
    border-radius: 4px;
    background: rgba(4, 26, 22, 0.55);
    color: #edf5f1;
    font: inherit;
    font-size: 0.68rem;
}

.search-enquiry-input:focus {
    outline: 2px solid rgba(120, 200, 170, 0.75);
    outline-offset: 1px;
}

.search-enquiry-consent {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin: 3px 0;
    color: rgba(237, 245, 241, 0.62);
    font-size: 0.6rem;
    line-height: 1.4;
}

.search-enquiry-consent input {
    margin: 1px 0 0;
    flex: none;
}

.search-enquiry-feedback {
    margin: 2px 0 0;
    font-size: 0.62rem;
    line-height: 1.4;
    color: rgba(237, 245, 241, 0.72);
}

.search-enquiry-feedback[data-tone="success"] { color: #d8f2e6; }
.search-enquiry-feedback[data-tone="error"] { color: #ffc9c9; }

.search-feedback[data-tone="success"] {
    color: #d8f2e6;
}

.search-feedback[data-tone="error"] {
    color: #ffd3c8;
}

.survey-pin-match {
    box-shadow: 0 0 0 3px #f7d276, 0 4px 12px rgba(19, 43, 39, 0.42);
}

@media (max-width: 640px) {
    .polygon-upload-actions {
        grid-template-columns: 1fr;
    }
}
