:root {
    color-scheme: light dark;
    --page-bg: #eef9fb;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --panel-solid: #ffffff;
    --surface-muted: #f2fafc;
    --text: #16272d;
    --text-soft: #536a70;
    --line: rgba(35, 143, 169, 0.14);
    --line-strong: rgba(35, 143, 169, 0.28);
    --accent: #238fa9;
    --accent-2: #74c7dc;
    --accent-soft: rgba(35, 143, 169, 0.1);
    --shadow: 0 24px 70px rgba(25, 95, 112, 0.15), 0 3px 12px rgba(25, 95, 112, 0.07);
    --small-shadow: 0 8px 24px rgba(25, 95, 112, 0.11);
    --map-card-bg: #dceff4;
    --map-toolbar-border: rgba(35, 143, 169, 0.2);
    --map-toolbar-text: #173039;
    --map-toolbar-bg: rgba(249, 253, 254, 0.84);
    --map-toolbar-shadow: 0 12px 32px rgba(25, 95, 112, 0.14);
    --map-control-border: rgba(35, 143, 169, 0.17);
    --map-control-bg: rgba(35, 143, 169, 0.08);
    --map-control-hover: rgba(35, 143, 169, 0.15);
    --map-control-text: #176f85;
    --map-loading-text: #35545d;
    --map-loading-bg: linear-gradient(145deg, #edf9fc, #dceff4);
    --map-popup-border: rgba(35, 143, 169, 0.16);
    --map-popup-bg: rgba(249, 253, 254, 0.96);
    --map-popup-text: #16272d;
    --map-popup-muted: #536a70;
    --map-popup-close: rgba(22, 39, 45, 0.68);
    --map-popup-shadow: 0 16px 44px rgba(25, 95, 112, 0.2);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--page-bg);
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 12% 0%, rgba(35, 143, 169, 0.22), transparent 32rem),
        radial-gradient(circle at 90% 8%, rgba(116, 199, 220, 0.34), transparent 34rem),
        linear-gradient(135deg, #f4fbfd 0%, var(--page-bg) 52%, #f8fcfd 100%);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
}

.globe-breadcrumb {
    display: flex;
    width: min(1760px, 100%);
    min-height: 0;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    padding: 8px clamp(18px, 2.5vw, 40px) 0;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.breadcrumb-home {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    gap: 5px;
    padding: 3px 7px 3px 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--accent);
    background: transparent;
    box-shadow: none;
    font-weight: 680;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.breadcrumb-home:hover {
    border-color: var(--line);
    background: var(--accent-soft);
}

.breadcrumb-home:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
    outline-offset: 2px;
}

.breadcrumb-home svg,
.breadcrumb-separator {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.breadcrumb-separator {
    width: 12px;
    height: 12px;
    opacity: 0.52;
}

.breadcrumb-current {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 7px;
    overflow: hidden;
    white-space: nowrap;
}

.breadcrumb-current span,
.breadcrumb-current i {
    overflow: hidden;
    text-overflow: ellipsis;
}

.breadcrumb-current span {
    font-weight: 650;
}

.breadcrumb-current i {
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
}

.climate-explorer {
    display: grid;
    grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
    gap: clamp(18px, 2vw, 32px);
    width: min(1760px, 100%);
    min-height: 0;
    margin: 0 auto;
    padding: 8px clamp(18px, 2.5vw, 40px) clamp(16px, 2vw, 30px);
}

.info-panel,
.map-card {
    border: 1px solid var(--line);
    border-radius: 26px;
    background: var(--panel-bg);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.info-panel {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-self: stretch;
    padding: clamp(24px, 3vw, 38px);
    overflow: hidden;
}

.info-heading {
    padding-block-end: 26px;
    border-block-end: 1px solid var(--line);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    line-height: 1.2;
    text-transform: uppercase;
}

.eyebrow svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.info-heading h1 {
    margin: 16px 0 12px;
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 3.3vw, 2.75rem);
    font-weight: 500;
    letter-spacing: -0.045em;
    line-height: 1.03;
    text-wrap: balance;
}

.info-heading h1 i {
    font-weight: inherit;
}

.intro-copy {
    margin: 0;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.55;
}

.climate-list {
    display: grid;
    gap: 10px;
    margin-block: 26px;
}

.climate-card {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    width: 100%;
    min-height: 86px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--text);
    background: var(--panel-solid);
    box-shadow: 0 1px 2px rgba(25, 95, 112, 0.04);
    text-align: start;
    cursor: pointer;
    transition: border-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease, transform 180ms ease;
    -webkit-tap-highlight-color: transparent;
}

.climate-card:hover,
.climate-card.is-highlighted {
    border-color: var(--line-strong);
    box-shadow: var(--small-shadow);
    transform: translateY(-2px);
}

.climate-card:focus-visible,
.map-button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 32%, transparent);
    outline-offset: 2px;
}

.climate-card[aria-pressed="false"] {
    opacity: 0.48;
    box-shadow: none;
}

.climate-card[aria-pressed="false"] .climate-code {
    filter: saturate(0.2);
}

.climate-code {
    display: grid;
    width: 56px;
    height: 44px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--zone-color) 66%, #19343d);
    border-radius: 13px;
    color: #111b1e;
    background: var(--zone-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.025em;
}

.climate-copy {
    display: block;
    min-width: 0;
}

.climate-copy strong,
.climate-copy > span {
    display: block;
}

.climate-copy strong {
    margin-block-end: 2px;
    font-size: 0.94rem;
    font-weight: 720;
    line-height: 1.35;
}

.climate-copy > span {
    color: var(--text-soft);
    font-size: 0.8rem;
    line-height: 1.4;
}

.visibility-dot {
    display: grid;
    width: 25px;
    height: 25px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--accent);
    transition: background-color 180ms ease, transform 180ms ease;
}

.visibility-dot svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.climate-card[aria-pressed="false"] .visibility-dot {
    border: 1px solid var(--line-strong);
    background: transparent;
    transform: scale(0.82);
}

.climate-card[aria-pressed="false"] .visibility-dot svg {
    opacity: 0;
}

.classification-note {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    margin-block-start: auto;
    padding: 16px;
    border-radius: 16px;
    color: var(--text-soft);
    background: var(--surface-muted);
}

.classification-note svg {
    width: 18px;
    height: 18px;
    margin-block-start: 1px;
    fill: none;
    stroke: var(--accent);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.classification-note p {
    margin: 0;
    font-size: 0.77rem;
    line-height: 1.55;
}

.map-card {
    position: relative;
    min-width: 0;
    min-height: 600px;
    overflow: hidden;
    background: var(--map-card-bg);
    isolation: isolate;
}

.map-toolbar {
    position: absolute;
    z-index: 5;
    inset-block-start: 16px;
    inset-inline: 16px;
    display: flex;
    min-height: 54px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 9px 8px 16px;
    border: 1px solid var(--map-toolbar-border);
    border-radius: 17px;
    color: var(--map-toolbar-text);
    background: var(--map-toolbar-bg);
    box-shadow: var(--map-toolbar-shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.25);
    backdrop-filter: blur(18px) saturate(1.25);
}

.map-title-group,
.map-actions {
    display: flex;
    align-items: center;
}

.map-title-group {
    min-width: 0;
    gap: 10px;
}

.map-title-group h2 {
    margin: 0;
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 680;
    letter-spacing: 0.01em;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-pulse {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border: 2px solid rgba(116, 199, 220, 0.3);
    border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 0 5px rgba(116, 199, 220, 0.13);
}

.map-actions {
    flex: 0 0 auto;
    gap: 7px;
}

.zone-count {
    display: inline-flex;
    min-width: 48px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding-inline: 10px;
    border: 1px solid var(--map-control-border);
    border-radius: 11px;
    color: var(--map-control-text);
    background: var(--map-control-bg);
    font-size: 0.76rem;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

.map-button {
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--map-control-border);
    border-radius: 11px;
    color: var(--map-control-text);
    background: var(--map-control-bg);
    cursor: pointer;
    transition: background-color 160ms ease, transform 160ms ease;
}

.map-button:hover {
    background: var(--map-control-hover);
    transform: translateY(-1px);
}

.map-button svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

#map {
    width: 100%;
    height: 100%;
    min-height: inherit;
}

.map-loading {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--map-loading-text);
    background: var(--map-loading-bg);
    font-size: 0.86rem;
    font-weight: 600;
    transition: opacity 360ms ease, visibility 360ms ease;
}

.map-loading.is-hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--map-control-border);
    border-block-start-color: var(--accent-2);
    border-radius: 50%;
    animation: loading-spin 720ms linear infinite;
}

@keyframes loading-spin {
    to { transform: rotate(360deg); }
}

.mapboxgl-canvas:focus-visible {
    outline: 3px solid var(--accent-2);
    outline-offset: -3px;
}

.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right {
    opacity: 0.74;
}

.mapboxgl-popup {
    max-width: min(310px, calc(100vw - 44px)) !important;
}

.mapboxgl-popup-content {
    padding: 16px 18px !important;
    border: 1px solid var(--map-popup-border);
    border-radius: 16px !important;
    color: var(--map-popup-text);
    background: var(--map-popup-bg) !important;
    box-shadow: var(--map-popup-shadow) !important;
    font-family: inherit;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.mapboxgl-popup-tip {
    border-top-color: var(--map-popup-bg) !important;
    border-bottom-color: var(--map-popup-bg) !important;
}

.mapboxgl-popup-close-button {
    inset-block-start: 4px;
    inset-inline-end: 6px;
    color: var(--map-popup-close);
    font-size: 20px;
}

.climate-popup strong,
.climate-popup span {
    display: block;
}

.climate-popup strong {
    padding-inline-end: 16px;
    font-size: 0.92rem;
}

.climate-popup span {
    margin-block-start: 5px;
    color: var(--map-popup-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

#map-container:fullscreen {
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: 0;
    border-radius: 0;
}

#footer-container {
    width: min(1760px, calc(100% - 36px));
    margin: 0 auto;
    padding: 6px 0 26px;
}

#footer-container footer p {
    margin-block-end: 0;
}

@media (min-width: 1021px) {
    .climate-explorer {
        height: calc(100svh - 36px);
        min-height: 600px;
    }

    .info-panel {
        overflow-y: auto;
        scrollbar-color: var(--line-strong) transparent;
        scrollbar-width: thin;
    }

    .map-card {
        min-height: 0;
    }
}

@media (min-width: 1021px) and (max-height: 900px) {
    .info-panel {
        padding: 20px 24px;
    }

    .info-heading {
        padding-block-end: 16px;
    }

    .info-heading h1 {
        margin: 12px 0 8px;
        font-size: clamp(1.8rem, 2.8vw, 2.3rem);
    }

    .intro-copy {
        font-size: 0.9rem;
    }

    .climate-list {
        gap: 8px;
        margin-block: 16px;
    }

    .climate-card {
        min-height: 72px;
        padding: 10px 12px;
        border-radius: 15px;
    }

    .classification-note {
        padding: 12px;
    }
}

@media (max-width: 1020px) {
    .climate-explorer {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .info-panel {
        padding: clamp(22px, 5vw, 34px);
    }

    .climate-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .classification-note {
        margin-block-start: 0;
    }

    .map-card {
        height: min(72vh, 760px);
        min-height: 520px;
    }
}

@media (max-width: 660px) {
    .globe-breadcrumb {
        gap: 5px;
        padding: 7px 12px 0;
        font-size: 0.75rem;
    }

    .breadcrumb-home {
        min-height: 28px;
        padding: 3px 6px 3px 3px;
    }

    .breadcrumb-current {
        display: block;
    }

    .breadcrumb-current i {
        display: none;
    }

    .climate-explorer {
        gap: 14px;
        padding: 7px 12px 12px;
    }

    .info-panel,
    .map-card {
        border-radius: 21px;
    }

    .info-heading {
        padding-block-end: 20px;
    }

    .info-heading h1 {
        margin-block-start: 12px;
        font-size: clamp(1.9rem, 10vw, 2.7rem);
    }

    .climate-list {
        grid-template-columns: 1fr;
        margin-block: 20px;
    }

    .climate-card {
        min-height: 80px;
    }

    .classification-note {
        padding: 14px;
    }

    .map-card {
        height: min(72vh, 620px);
        min-height: 470px;
    }

    .map-toolbar {
        inset-block-start: 10px;
        inset-inline: 10px;
        min-height: 50px;
        padding-inline-start: 13px;
    }

    .map-title-group h2 {
        max-width: 35vw;
    }

    .map-button {
        width: 34px;
        height: 34px;
    }

    #footer-container {
        width: calc(100% - 24px);
    }
}

@media (prefers-color-scheme: dark) {
    :root {
        --page-bg: #0e171b;
        --panel-bg: rgba(18, 38, 42, 0.84);
        --panel-solid: #142a31;
        --surface-muted: #183139;
        --text: #eef9fb;
        --text-soft: #b7d2d8;
        --line: rgba(110, 209, 230, 0.14);
        --line-strong: rgba(110, 209, 230, 0.3);
        --accent: #6ed1e6;
        --accent-2: #74c7dc;
        --accent-soft: rgba(110, 209, 230, 0.11);
        --shadow: 0 24px 70px rgba(0, 0, 0, 0.24), 0 3px 12px rgba(0, 0, 0, 0.18);
        --small-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
        --map-card-bg: #0c1119;
        --map-toolbar-border: rgba(255, 255, 255, 0.17);
        --map-toolbar-text: #f7faf8;
        --map-toolbar-bg: rgba(15, 23, 30, 0.73);
        --map-toolbar-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
        --map-control-border: rgba(255, 255, 255, 0.12);
        --map-control-bg: rgba(255, 255, 255, 0.08);
        --map-control-hover: rgba(255, 255, 255, 0.17);
        --map-control-text: rgba(255, 255, 255, 0.82);
        --map-loading-text: rgba(255, 255, 255, 0.9);
        --map-loading-bg: linear-gradient(145deg, #101821, #080b12);
        --map-popup-border: rgba(255, 255, 255, 0.16);
        --map-popup-bg: rgba(17, 26, 33, 0.92);
        --map-popup-text: #f6faf7;
        --map-popup-muted: rgba(255, 255, 255, 0.72);
        --map-popup-close: rgba(255, 255, 255, 0.75);
        --map-popup-shadow: 0 16px 44px rgba(0, 0, 0, 0.28);
    }

    body {
        background:
            radial-gradient(circle at 12% 0%, rgba(31, 143, 173, 0.3), transparent 31rem),
            radial-gradient(circle at 88% 12%, rgba(116, 199, 220, 0.17), transparent 30rem),
            linear-gradient(135deg, #0e171b 0%, #13252c 55%, #0f161a 100%);
    }

    .climate-code {
        color: #111b1e;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
