.climate-dashboard,
.climate-index {
    --climate-line: rgba(127, 127, 127, 0.28);
    --climate-soft: rgba(127, 127, 127, 0.08);
    --climate-soft-strong: rgba(127, 127, 127, 0.15);
    --climate-panel-background: Canvas;
    box-sizing: border-box;
    color: inherit;
    font-family: inherit;
}

.climate-dashboard *,
.climate-dashboard *::before,
.climate-dashboard *::after,
.climate-index *,
.climate-index *::before,
.climate-index *::after {
    box-sizing: inherit;
}

/* ==========================================================
   Application shell
   ========================================================== */

.climate-dashboard {
    position: relative;
    display: grid;
    grid-template-columns: 218px minmax(0, 1fr);
    width: 100%;
    min-height: 720px;
    border: 1px solid var(--climate-line);
    background: transparent;
}

.climate-dashboard-mobile-bar {
    display: none;
}

.climate-dashboard-sidebar {
    min-width: 0;
    padding: 22px 14px 30px;
    border-right: 1px solid var(--climate-line);
}

.climate-dashboard-sidebar-header {
    padding: 0 10px 18px;
    border-bottom: 1px solid var(--climate-line);
    margin-bottom: 14px;
}

.climate-dashboard-sidebar-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.35;
    text-transform: uppercase;
}

.climate-dashboard-sidebar-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 0.76rem;
    line-height: 1.35;
    opacity: 0.58;
}

.climate-dashboard-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.climate-dashboard-nav-group {
    margin-top: 13px;
}

.climate-dashboard-nav-label {
    display: block;
    margin: 0 10px 4px;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.065em;
    line-height: 1.35;
    opacity: 0.52;
    text-transform: uppercase;
}

.climate-dashboard-nav button,
.climate-dashboard-menu-button,
.climate-overview-card,
.climate-compare-submit {
    appearance: none;
    border: 0;
    border-radius: 0;
    color: inherit;
    font: inherit;
}

.climate-dashboard-nav button {
    display: block;
    width: 100%;
    padding: 9px 10px;
    background: transparent;
    cursor: pointer;
    line-height: 1.35;
    text-align: left;
}

.climate-dashboard-nav button:hover,
.climate-dashboard-nav button:focus-visible,
.climate-dashboard-nav button.is-active {
    background: var(--climate-soft);
}

.climate-dashboard-nav button.is-active {
    box-shadow: inset 2px 0 0 currentColor;
    font-weight: 650;
}

.climate-dashboard-main {
    min-width: 0;
    padding: clamp(24px, 4vw, 48px);
}

.climate-dashboard-pane[hidden] {
    display: none !important;
}

.climate-dashboard-backdrop {
    display: none;
}

.climate-dashboard-overview,
.climate-compare {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

.climate-dashboard-overview h1,
.climate-compare h1 {
    max-width: 760px;
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.2rem);
    font-weight: 650;
    letter-spacing: -0.025em;
    line-height: 1.05;
}

.climate-dashboard-intro {
    max-width: 720px;
    margin: 18px 0 34px;
    font-size: 1.03rem;
    line-height: 1.65;
    opacity: 0.7;
}

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

.climate-overview-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 5px 18px;
    min-height: 132px;
    padding: 20px;
    border: 1px solid var(--climate-line);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

.climate-overview-card::after {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
    content: "→";
    font-size: 1.25rem;
    opacity: 0.55;
}

.climate-overview-card:hover,
.climate-overview-card:focus-visible {
    background: var(--climate-soft);
    border-color: currentColor;
}

.climate-overview-card strong {
    font-size: 1.22rem;
    line-height: 1.2;
}

.climate-overview-card > span:last-of-type {
    font-size: 0.9rem;
    line-height: 1.45;
    opacity: 0.66;
}

.climate-overview-family {
    font-size: 0.69rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    opacity: 0.55;
    text-transform: uppercase;
}

.climate-dashboard-note,
.climate-compare-method,
.climate-dashboard-message {
    margin-top: 24px;
    padding: 16px 18px;
    border-left: 2px solid currentColor;
    background: var(--climate-soft);
    font-size: 0.92rem;
    line-height: 1.6;
}

.climate-dashboard-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 180px;
    opacity: 0.68;
}

.climate-dashboard-loader {
    width: 18px;
    height: 18px;
    border: 2px solid var(--climate-line);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: climate-dashboard-spin 0.85s linear infinite;
}

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

/* ==========================================================
   Shared index views
   ========================================================== */

.climate-index {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.climate-dashboard .climate-index {
    max-width: none;
}

.climate-index-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    margin-bottom: 20px;
}

.climate-index-kicker {
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    line-height: 1.4;
    opacity: 0.58;
    text-transform: uppercase;
}

.climate-index-header h2 {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

.climate-index-subtitle {
    margin-top: 7px;
    opacity: 0.62;
}

.climate-index-current {
    min-width: 175px;
    text-align: right;
}

.climate-index-current-value {
    font-size: 2.2rem;
    font-weight: 650;
    line-height: 1;
}

.climate-index-current-period {
    margin-top: 8px;
    font-size: 0.9rem;
    opacity: 0.62;
}

.climate-index-chart {
    width: 100%;
    height: 520px;
}

.climate-index-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--climate-line);
    margin-top: 10px;
    font-size: 0.88rem;
}

.climate-index-update {
    opacity: 0.62;
}

.climate-index-downloads,
.climate-index-method-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}

.climate-index-downloads a,
.climate-index-method-links a {
    color: inherit;
    font-weight: 650;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

.climate-index-methodology {
    padding-top: 18px;
    border-top: 1px solid var(--climate-line);
    margin-top: 25px;
}

.climate-index-methodology summary {
    margin-bottom: 18px;
    cursor: pointer;
    font-weight: 650;
}

.climate-index-metadata-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px 30px;
    margin-top: 18px;
}

.climate-index-metadata-item span {
    display: block;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    opacity: 0.55;
    text-transform: uppercase;
}

.climate-index-note {
    padding: 15px 18px;
    margin-top: 18px;
    background: var(--climate-soft);
    line-height: 1.58;
}

.climate-index-method-links {
    margin-top: 18px;
}

.climate-index-error {
    margin-top: 15px;
}

.climate-index-chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.climate-index-chart-title {
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 650;
    opacity: 0.65;
}

.mjo-phase-chart,
.mjo-amplitude-chart {
    width: 100%;
    height: 500px;
}

/* ==========================================================
   Compare view
   ========================================================== */

.climate-compare-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1.7fr) minmax(155px, 0.8fr) minmax(130px, 0.65fr) auto;
    gap: 14px;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--climate-line);
}

.climate-compare-controls fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    min-width: 0;
    padding: 0;
    border: 0;
    margin: 0;
}

.climate-compare-controls legend,
.climate-compare-field > span {
    display: block;
    width: 100%;
    margin-bottom: 7px;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.05em;
    opacity: 0.58;
    text-transform: uppercase;
}

.climate-compare-controls label {
    font-size: 0.88rem;
    line-height: 1.4;
}

.climate-compare-controls input {
    margin-right: 5px;
}

.climate-compare-field select {
    width: 100%;
    min-height: 39px;
    padding: 7px 28px 7px 9px;
    border: 1px solid var(--climate-line);
    border-radius: 0;
    background: var(--climate-panel-background);
    color: inherit;
    font: inherit;
}

.climate-compare-submit {
    min-height: 39px;
    padding: 8px 14px;
    border: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    font-weight: 650;
    white-space: nowrap;
}

.climate-compare-submit:hover,
.climate-compare-submit:focus-visible {
    background: var(--climate-soft-strong);
}

.climate-compare-submit:disabled {
    cursor: wait;
    opacity: 0.55;
}

.climate-compare-chart {
    width: 100%;
    height: 560px;
    margin-top: 25px;
}

/* ==========================================================
   Responsive layout
   ========================================================== */

@media (max-width: 1080px) {
    .climate-compare-controls {
        grid-template-columns: 1fr 1fr;
    }

    .climate-compare-controls fieldset {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .climate-dashboard {
        display: block;
        min-height: 0;
    }

    .climate-dashboard-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        min-height: 54px;
        padding: 8px 14px;
        border-bottom: 1px solid var(--climate-line);
    }

    .climate-dashboard-menu-button {
        padding: 8px 10px;
        background: transparent;
        cursor: pointer;
        font-weight: 650;
    }

    .climate-dashboard-mobile-title {
        overflow: hidden;
        font-size: 0.82rem;
        opacity: 0.64;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .climate-dashboard-sidebar {
        position: fixed;
        z-index: 10002;
        inset: 0 auto 0 0;
        width: min(300px, 86vw);
        min-height: 0;
        padding-top: 22px;
        border-right: 1px solid var(--climate-line);
        background: var(--climate-panel-background);
        color: CanvasText;
        overflow-y: auto;
        transform: translateX(-102%);
        transition: transform 180ms ease;
    }

    .climate-dashboard.is-menu-open .climate-dashboard-sidebar {
        transform: translateX(0);
    }

    .climate-dashboard-backdrop {
        position: fixed;
        z-index: 10001;
        inset: 0;
        display: block;
        background: rgba(0, 0, 0, 0.38);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .climate-dashboard.is-menu-open .climate-dashboard-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .climate-dashboard-main {
        padding: clamp(22px, 5vw, 34px);
    }

    .climate-index-chart-grid {
        grid-template-columns: 1fr;
    }

    .mjo-phase-chart,
    .mjo-amplitude-chart {
        height: 440px;
    }
}

@media (max-width: 700px) {
    .climate-overview-grid,
    .climate-compare-controls {
        grid-template-columns: 1fr;
    }

    .climate-compare-controls fieldset {
        grid-column: auto;
    }

    .climate-index-header {
        flex-direction: column;
    }

    .climate-index-current {
        min-width: 0;
        text-align: left;
    }

    .climate-index-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .climate-index-metadata-grid {
        grid-template-columns: 1fr;
    }

    .climate-index-chart,
    .mjo-phase-chart,
    .mjo-amplitude-chart,
    .climate-compare-chart {
        height: 430px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .climate-dashboard-sidebar,
    .climate-dashboard-backdrop {
        transition: none;
    }

    .climate-dashboard-loader {
        animation: none;
    }
}
