/*
File: explorer.css
Purpose: Explorer catalog landing and indicator desk, in the dashboard visual identity.
*/

@property --topic-accent {
    syntax: '<color>';
    inherits: true;
    initial-value: #0078d7;
}

@property --insight-mask-x {
    syntax: '<percentage>';
    inherits: false;
    initial-value: 100%;
}

:root {
    --banner-gap: 16px;
    --banner-side-gap: 16px;
    --topic-accent: #0078d7;
    --ex-ink: #1b242e;
    --ex-muted: #5c6570;
    --ex-line: rgba(27, 36, 46, 0.12);
    --ex-radius: 14px;
    --ex-pill: 999px;
}

* { box-sizing: border-box; }

html, body.explorer-body {
    height: 100%;
    margin: 0;
}

body.explorer-body {
    font-family: 'PeydaFaNumWeb', Tahoma, sans-serif !important;
    background: #f7f4ed;
    color: var(--ex-ink);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: var(--vvh, 100dvh);
}

.explorer-workspace {
    flex: 1;
    min-height: 0;
    margin-top: calc(75px + var(--banner-gap));
    padding: 8px 20px 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#explorer-page-nav[hidden] {
    display: none !important;
}

.hidden { display: none !important; }

.custom-scrollbar::-webkit-scrollbar { width: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(27, 36, 46, 0.18);
    border-radius: 99px;
}

/* ------------------------------------------------------------------ */
/* Landing                                                             */
/* ------------------------------------------------------------------ */

.ex-landing {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ex-stage {
    position: relative;
    z-index: 2;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ex-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex: 0 0 auto;
    padding: 4px 16px 14px;
}

.ex-title {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: clamp(2rem, 4.6vw, 3.2rem);
    font-weight: 800;
    line-height: 1.2;
    color: #a18447;
    transition: color 0.45s ease;
}

.ex-stage.is-topic-hover .ex-title {
    color: var(--topic-accent, #0078d7);
}

.ex-title::before,
.ex-title::after {
    content: "";
    width: 3px;
    height: 0.78em;
    background: currentColor;
    flex-shrink: 0;
}

.ex-lead {
    margin: 8px 0 0;
    max-width: 36rem;
    font-size: 0.95rem;
    font-weight: 400;
    line-height: 1.7;
    color: var(--ex-muted);
}

.ex-topics {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(var(--ex-cols, 3), minmax(0, 1fr));
    grid-template-rows: repeat(var(--ex-rows, 3), minmax(0, 1fr));
    gap: 12px;
}

.ex-room {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.ex-room-face {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.ex-room-visual {
    width: 100%;
    height: 100%;
    border-radius: 18px;
    background-color: #d7dbe3;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 28px rgba(27, 36, 46, 0.08);
}

.ex-room[data-tone="gold"] { --mosaic-shade: #CCAE72; }
.ex-room[data-tone="olive"] { --mosaic-shade: #C6CC86; }

.ex-room-photo {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(1);
    transform: scale(1.02);
    transition: filter 0.45s ease;
}

.ex-room-visual::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: var(--mosaic-shade, #a18447);
    mix-blend-mode: multiply;
    pointer-events: none;
    transition: opacity 0.45s ease;
}

.ex-room:hover .ex-room-photo,
.ex-room-face:focus-visible .ex-room-photo {
    filter: grayscale(0);
}

.ex-room:hover .ex-room-visual::after,
.ex-room-face:focus-visible .ex-room-visual::after {
    opacity: 0;
}

.ex-room-copy {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14% 16px 16px;
    text-align: center;
    pointer-events: none;
}

.ex-room-copy h2 {
    margin: 0;
    font-size: clamp(1rem, 1.7vw, 1.45rem);
    font-weight: 800;
    line-height: 1.45;
    color: #ffffff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
}

.ex-room-count {
    margin: 6px 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

.ex-stage.is-pending .ex-room {
    opacity: 0;
}

/* ------------------------------------------------------------------ */
/* Indicator desk                                                      */
/* ------------------------------------------------------------------ */

.ex-dash {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f7f4ed;
}

.ex-dash-head {
    flex-shrink: 0;
    width: 100%;
    margin: 0;
    padding: 4px 4px 12px;
}

.ex-dash-nav {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ex-dash-head #btn-nav-subtopics {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px 1px;
    border-radius: var(--ex-pill);
    border: 0;
    background: #515811;
    color: #fff;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.ex-dash-head #btn-nav-subtopics:hover { filter: brightness(0.96); }
.ex-dash-head .ex-back-arrow {
    transform: none;
    flex-shrink: 0;
}

.ex-dd-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.ex-dd {
    position: relative;
    flex: 0 0 auto;
    width: min(var(--ex-dd-width, 280px), 28vw);
    min-width: 0;
}

.ex-dd-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: none;
    min-height: 42px;
    padding: 0 16px 1px;
    border: 0;
    border-radius: var(--ex-pill);
    background: #515811;
    color: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.ex-dd-kicker {
    flex-shrink: 0;
    opacity: 0.85;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.ex-dd-kicker::after {
    content: "";
    width: 1px;
    height: 0.9em;
    background: currentColor;
    opacity: 0.45;
}

.ex-dd-value {
    flex: 1 1 auto;
    min-width: 0;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ex-dd-icon {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin-inline-start: 2px;
}

.ex-dd.is-open .ex-dd-icon {
    transform: rotate(180deg);
}

.ex-dd-menu {
    position: absolute;
    top: calc(100% + 8px);
    inset-inline-start: 0;
    width: 100%;
    min-width: 100%;
    max-width: none;
    max-height: min(52vh, 360px);
    overflow: auto;
    padding: 8px 6px;
    border-radius: 16px;
    background: #515811;
    box-shadow: 0 12px 28px rgba(27, 36, 46, 0.12);
    z-index: 30;
}

.ex-dd-menu[hidden] { display: none; }

.ex-dd-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
}

.ex-dd-menu button.ex-dd-topic-item {
    display: flex;
    align-items: center;
    gap: 9px;
    direction: rtl;
    min-height: 36px;
    padding-block: 6px;
}
.ex-dd-topic-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    object-fit: contain;
    border-radius: 5px;
}
/* Keep the active Atlas artwork; mute only topics that are not selected. */
.ex-dd-topic-item:not(.is-current) .ex-dd-topic-icon {
    filter: grayscale(1) brightness(0.85) drop-shadow(0 1px 1px rgba(128, 128, 128, 0.35));
    opacity: 0.82;
}
.ex-dd-topic-label { min-width: 0; flex: 1; }

.ex-dd-menu button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ex-dd-menu button.is-current {
    color: #fff;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
}

.ex-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ex-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 2px 10px 3px;
    border-radius: var(--ex-pill);
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.16);
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
}

.ex-dash-body {
    flex: 1;
    min-height: 0;
    width: 100%;
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 268px;
    grid-template-areas: "chart side";
    gap: 14px;
}
.ex-chart-room { grid-area: chart; }
.ex-side { grid-area: side; }

.ex-chart-room {
    position: relative;
    min-width: 0;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 0;
    border-radius: 20px;
    box-shadow: 0 10px 28px rgba(27, 36, 46, 0.06);
    padding: 14px 18px 12px;
}

.chart-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    margin-bottom: 10px;
    flex-shrink: 0;
    min-width: 0;
}

.chart-toolbar h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ex-ink);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chart-switcher {
    display: flex;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--ex-pill);
    padding: 3px;
    background: #eef1f8;
}

.chart-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    direction: rtl;
    white-space: nowrap;
    height: 32px;
    padding: 0 14px 1px;
    border: 0;
    border-radius: var(--ex-pill);
    background: transparent;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ex-muted);
    cursor: pointer;
}

.chart-mode-label-short { display: none; }

.chart-mode-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    pointer-events: none;
}

.chart-mode-btn.active {
    background: #515811;
    color: #fff;
}

#canvas-reveal-wrapper {
    position: relative;
    width: 100%;
    flex: 0 1 auto;
    min-height: 240px;
    aspect-ratio: 16 / 9;
    max-height: min(62vh, 560px);
}

.chart-pane {
    position: absolute;
    inset: 0;
    display: none;
}

.chart-pane.is-active { display: block; }
.chart-pane canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

#compare-chart-wrap.is-active { display: flex; flex-direction: column; }
.explorer-compare-canvas { position: relative; flex: 1 1 auto; min-height: 0; }
.explorer-compare-controls { flex: 0 0 auto; padding: 22px 12px 10px; }

#table-chart-wrap { overflow: hidden; }

#map-chart-wrap { overflow: hidden; border: 1px solid #e2e8f0; border-radius: 14px; background: linear-gradient(145deg, #fcfdf9, #f4f6ed); }
#map-chart-wrap.is-active { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
#explorer-leaflet-map { position: relative; width: 100%; height: 100%; min-height: 0; z-index: 0; background: #bcdfe5; }
/* Loading gestures belong to the page, never the map underneath the status. */
#explorer-leaflet-map.is-loading { pointer-events: none; touch-action: pan-y; }
.explorer-map-status { touch-action: pan-y; }
#map-chart-wrap .leaflet-tile-pane { transition: opacity 2.2s ease, filter 2.2s ease; filter: none; opacity: .30; }
#map-chart-wrap .leaflet-control-attribution { background: rgba(255,255,255,.68); font-size: 9px; }
.explorer-province-label { color: #17210c; direction: ltr; font-family: PeydaFaNumWeb, Peyda, sans-serif; font-size: clamp(8px, 1.1vw, 12px); font-weight: 800; line-height: 1.22; text-align: center; pointer-events: none; white-space: normal; }
.explorer-province-label span { position: absolute; top: 0; left: 0; direction: rtl; text-align: center; }
.explorer-map-legend {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(56px, .65fr) minmax(0, 8fr);
    column-gap: 12px;
    width: 100%;
    min-width: 0;
    gap: 4px;
    color: #515811;
    direction: ltr;
    font-family: PeydaFaNumWeb, Peyda, sans-serif;
    font-size: .67rem;
    font-weight: 700;
    pointer-events: auto;
}
/* Physical left-to-right placement keeps no-data left of the ascending score scale. */
.explorer-map-legend-title { grid-column: 1 / -1; text-align: center; direction: rtl; }
.explorer-map-legend-scale { grid-column: 2; grid-row: 2; display: grid; gap: 4px; min-width: 0; }
.explorer-map-legend-no-data { grid-column: 1; grid-row: 2; display: grid; gap: 4px; text-align: center; direction: rtl; color: #586174; font-size: .61rem; }
.explorer-map-legend-no-data-swatch { display: block; height: 10px; border-radius: 2px; background: #e5e7eb; }
.explorer-map-legend-bar { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; height: 10px; direction: ltr; }
.explorer-map-legend-bar > span { border-radius: 2px; }
.explorer-map-legend-bar > span:nth-child(1) { background: rgb(238,240,210); }
.explorer-map-legend-bar > span:nth-child(2) { background: rgb(216,218,182); }
.explorer-map-legend-bar > span:nth-child(3) { background: rgb(193,197,155); }
.explorer-map-legend-bar > span:nth-child(4) { background: rgb(171,175,127); }
.explorer-map-legend-bar > span:nth-child(5) { background: rgb(148,153,100); }
.explorer-map-legend-bar > span:nth-child(6) { background: rgb(126,131,72); }
.explorer-map-legend-bar > span:nth-child(7) { background: rgb(103,110,45); }
.explorer-map-legend-bar > span:nth-child(8) { background: rgb(81,88,17); }
.explorer-map-legend-range { display: flex; direction: ltr; justify-content: space-between; gap: 8px; color: #586174; font-size: .61rem; }
.explorer-map-legend-range b { font-weight: 700; }
.explorer-map-status { position: absolute; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 1rem; text-align: center; color: var(--ex-muted); background: rgba(255,255,255,.82); font-size: .84rem; }
.explorer-map-status[hidden] { display: none; }
.explorer-map-controls {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 10px 12px;
    padding: 22px 16px 12px;
    direction: ltr;
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid #dfe4d1;
}
.explorer-map-timeline {
    grid-column: 2;
    grid-row: 1;
    display: block;
    width: 100%;
    min-width: 0;
    padding: 5px 10px;
    border: 1px solid #dfe4d1;
    border-radius: 999px;
    color: #515811;
    direction: ltr;
}
.explorer-map-timeline-track { position: relative; display: block; width: 100%; height: 24px; }
.explorer-map-timeline input { direction: ltr; position: absolute; inset: 0; width: 100%; height: 24px; margin: 0; accent-color: #515811; cursor: pointer; }
.explorer-map-timeline input:disabled { cursor: default; opacity: .45; }
#explorer-map-timeline-value,
#explorer-compare-timeline-value { position: absolute; top: -17px; z-index: 1; min-width: 34px; padding: 2px 5px 1px; border-radius: 999px; background: #515811; color: #fff; direction: rtl; font-family: PeydaFaNumWeb, Peyda, sans-serif; font-size: .62rem; font-weight: 700; line-height: 1.2; text-align: center; transform: translateX(-50%); pointer-events: none; }
.explorer-map-play {
    grid-column: 1;
    grid-row: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    padding: 5px 12px;
    border: 0;
    border-radius: 999px;
    background: #515811;
    color: #fff;
    direction: rtl;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(39,48,11,.22);
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    cursor: pointer;
}

.explorer-score-tooltip { border: 1px solid #dfe4d1; border-radius: 8px; background: rgba(255,255,255,.96); color: #27300b; font-weight: 700; text-align: center; }
.explorer-map-play:hover { background: #3d430c; }
.explorer-map-play svg { width: 12px; height: 12px; flex-shrink: 0; fill: currentColor; }
.explorer-map-play:focus-visible { outline: 3px solid rgba(81,88,17,.3); outline-offset: 2px; }
.indicator-table-scroll {
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
}

.indicator-score-table {
    width: 100%;
    min-width: max-content;
    border-collapse: separate;
    border-spacing: 0;
    color: var(--ex-ink);
    font-family: PeydaFaNumWeb, Peyda, sans-serif;
    font-size: 0.78rem;
    text-align: center;
    white-space: nowrap;
}

.indicator-score-table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.indicator-score-table th,
.indicator-score-table td {
    min-width: 76px;
    padding: 11px 14px;
    border-inline-start: 1px solid #e8edf4;
    border-bottom: 1px solid #e8edf4;
}

.indicator-score-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f5f7ed;
    color: #515811;
    font-weight: 700;
}

.indicator-score-table tbody tr:last-child th,
.indicator-score-table tbody tr:last-child td { border-bottom: 0; }

.indicator-score-table tbody tr:nth-child(even) { background: #fafbfd; }
.indicator-score-table tbody tr:hover { background: #f2f6e7; }

.indicator-score-table .indicator-table-province {
    position: sticky;
    inset-inline-start: 0;
    z-index: 1;
    min-width: 142px;
    background: #fff;
    color: #1b242e;
    font-weight: 700;
    text-align: start;
}

.indicator-score-table thead .indicator-table-province {
    z-index: 3;
    background: #edf1df;
    color: #515811;
}

.indicator-score-table tbody tr:nth-child(even) .indicator-table-province { background: #fafbfd; }
.indicator-score-table tbody tr:hover .indicator-table-province { background: #f2f6e7; }

.ex-chart-foot {
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding-top: 6px;
    direction: rtl;
}

.ex-insight-open {
    --shine: rgba(255, 237, 174, 0.95);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 7px 22px 8px;
    border: 1px solid #a18447;
    border-radius: 999px;
    background: #515811;
    color: #fffdf3;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.5;
    cursor: pointer;
    box-shadow: 0 3px 12px rgba(81, 88, 17, 0.18);
    transition: transform 220ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 150ms ease;
}

.ex-insight-open:hover {
    transform: scale(1.01);
    box-shadow: 0 5px 16px rgba(81, 88, 17, 0.25);
}

.ex-insight-open:active { transform: scale(0.97); }
.ex-insight-open:focus-visible { outline: 3px solid #a18447; outline-offset: 3px; }
.ex-insight-open:disabled { pointer-events: none; opacity: 0.5; }

.ex-insight-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    -webkit-mask-image: linear-gradient(-75deg, #fff calc(var(--insight-mask-x) + 20%), transparent calc(var(--insight-mask-x) + 30%), #fff calc(var(--insight-mask-x) + 100%));
    mask-image: linear-gradient(-75deg, #fff calc(var(--insight-mask-x) + 20%), transparent calc(var(--insight-mask-x) + 30%), #fff calc(var(--insight-mask-x) + 100%));
    animation: insight-text-shine 2s linear infinite;
}

.ex-insight-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    pointer-events: none;
    background: linear-gradient(-75deg, transparent 30%, var(--shine) 50%, transparent 70%);
    background-size: 200% 100%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: insight-border-shine 2s linear infinite;
}

@keyframes insight-text-shine {
    0% { --insight-mask-x: 100%; }
    50%, 100% { --insight-mask-x: -100%; }
}

@keyframes insight-border-shine {
    0% { background-position: 100% 0; opacity: 0; }
    25% { opacity: 1; }
    50%, 100% { background-position: 0% 0; opacity: 0; }
}

.ex-chart-legend-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: #1b242e;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    direction: rtl;
}

.ex-chart-legend-btn[hidden] { display: none; }

.ex-chart-legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: #1e293b;
    flex-shrink: 0;
}

.ex-chart-legend-btn.is-off {
    opacity: 0.38;
    text-decoration: line-through;
}

.ex-insight-layer {
    position: absolute;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px;
    background: rgba(27, 36, 46, 0.28);
    border-radius: inherit;
}

.ex-insight-layer[hidden] { display: none; }

.ex-insight-card {
    position: relative;
    width: min(100%, 48rem);
    max-height: 90%;
    overflow: auto;
    flex: 0 0 auto;
    padding: 0 0 4px;
    border-radius: 18px;
    background: transparent;
    color: #fff;
}

.ex-side {
    width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

.ex-insight-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 10px;
}

.ex-insight-card h2,
.ex-insight-card #indicator-question {
    margin: 0;
    padding: 10px 14px;
    border-radius: 14px;
    background: #515811;
    color: #fff;
    overflow-wrap: anywhere;
}

.ex-insight-card h2 {
    flex: 1 1 11rem;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.5;
}

.ex-insight-card #indicator-question {
    flex: 2 1 20rem;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.65;
    white-space: pre-line;
}

.ex-insight-card #insight-text {
    margin: 0 0 14px;
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.85;
    color: rgba(255, 255, 255, 0.92);
    text-align: justify;
    padding: 14px 16px;
    border-radius: 18px;
    background: #515811;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.ex-insight-card .ex-meta {
    justify-content: space-between;
    align-items: flex-start;
}

.ex-insight-card .ex-meta span {
    max-width: 100%;
    border: 0;
    background: #fff;
    color: #515811;
    overflow-wrap: anywhere;
}

.ex-prov-rail {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 12px 14px 10px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 10px 28px rgba(27, 36, 46, 0.06);
}

.ex-prov-search input {
    width: 100%;
    height: 38px;
    padding: 0 14px 1px;
    border-radius: var(--ex-radius);
    border: 1px solid var(--ex-line);
    background: #fff;
    font: inherit;
    font-size: 0.85rem;
    outline: none;
}

.ex-prov-search input:focus {
    border-color: var(--topic-accent, #0078d7);
}

.ex-prov-actions {
    display: flex;
    gap: 6px;
    margin: 10px 0 12px;
}

.ex-prov-actions button {
    flex: 1;
    height: 32px;
    border-radius: var(--ex-pill);
    border: 1px solid var(--ex-line);
    background: #fff;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--ex-ink);
    cursor: pointer;
}

.ex-prov-actions button:last-child { color: #b91c1c; }

.ex-prov-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.province-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 4px;
    border-radius: var(--ex-radius);
}

.province-item:hover { background: rgba(27, 36, 46, 0.04); }

.province-item label {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--ex-ink);
    cursor: pointer;
}

.province-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.ex-prov-rail.is-disabled {
    opacity: 0.4;
    pointer-events: none;
}

@media (max-width: 980px) {
    .ex-dash-body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "side"
            "chart";
    }
    .ex-side {
        width: 100%;
        max-height: none;
    }
    .ex-prov-rail { max-height: none; }
    .ex-dd-group { flex-wrap: wrap; justify-content: flex-end; }
    #canvas-reveal-wrapper {
        min-height: 200px;
        max-height: min(52vh, 420px);
    }
}

@media (max-width: 767px) {
    body.explorer-body {
        overflow-x: hidden;
        overflow-y: auto;
        height: 100vh;
    }
    @supports (height: 100svh) {
        body.explorer-body {
            height: 100svh;
        }
    }
    body.explorer-body #explorer-page-nav:not([hidden]) {
        display: flex;
        margin-top: calc(env(safe-area-inset-top, 0px) + var(--banner-gap) + 56px + 8px);
        flex-shrink: 0;
    }
    body.explorer-body #explorer-page-nav .banner-seg {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        direction: rtl;
        width: 100%;
    }
    body.explorer-body #explorer-page-nav .banner-seg-btn[data-nav="atlas"] { grid-column: 1; }
    body.explorer-body #explorer-page-nav .banner-seg-btn[data-nav="explorer"] { grid-column: 2; }
    body.explorer-body #explorer-page-nav .banner-seg-btn[data-nav="index"] { grid-column: 3; }
    body.explorer-body #explorer-page-nav .banner-seg-btn[data-nav="types"] { grid-column: 4; }
    .explorer-workspace {
        margin-top: 0;
        padding: 8px 10px calc(10px + env(safe-area-inset-bottom, 0px));
        gap: 8px;
        overflow: visible;
    }
    .ex-landing {
        min-height: 0;
    }
    .ex-hero {
        padding: 2px 4px 8px;
    }
    .ex-title {
        font-size: clamp(1.35rem, 6.2vw, 1.8rem);
        gap: 8px;
    }
    .ex-title::before,
    .ex-title::after {
        width: 2px;
        height: 0.7em;
    }
    .ex-lead {
        margin-top: 4px;
        font-size: 0.78rem;
        line-height: 1.55;
        max-width: 22rem;
    }
    .ex-topics {
        gap: 8px;
    }
    .ex-room-visual {
        border-radius: 16px;
    }
    .ex-room-copy {
        padding: 12% 10px 12px;
    }
    .ex-room-copy h2 {
        font-size: clamp(0.82rem, 3.6vw, 1.05rem);
    }
    .ex-room-count {
        font-size: 0.72rem;
        margin-top: 4px;
    }
    .ex-dash {
        min-height: calc(100% + 92px);
        overflow: visible;
        gap: 6px;
    }
    .ex-dash-head {
        position: relative;
        z-index: 80;
        padding: 0 0 2px;
        overflow: visible;
    }
    .ex-dash-nav {
        display: grid;
        grid-template-columns: 40px minmax(0, 1fr);
        grid-template-rows: repeat(3, 40px);
        width: 100%;
        min-width: 0;
        align-items: center;
        gap: 6px;
        overflow: visible;
    }
    .ex-dash-nav::-webkit-scrollbar { display: none; }
    .ex-dash-head #btn-nav-subtopics {
        grid-column: 1;
        grid-row: 1;
        width: 40px;
        min-height: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        background: #515811;
        justify-content: center;
        flex-shrink: 0;
    }
    .ex-dash-head .ex-back-label {
        display: none;
    }
    .ex-dd-group {
        display: contents;
    }
    .ex-dd {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .ex-dd[data-dd="topic"] {
        grid-column: 2;
        grid-row: 1;
    }
    .ex-dd[data-dd="subtopic"] {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    .ex-dd[data-dd="indicator"] {
        grid-column: 1 / -1;
        grid-row: 3;
    }
    .ex-dd.is-open {
        z-index: 40;
    }
    .ex-dd-toggle {
        box-sizing: border-box;
        width: 100%;
        max-width: none;
        min-height: 40px;
        height: 40px;
        padding: 0 10px 1px;
        background: #515811;
        font-size: 0.72rem;
        justify-content: flex-start;
    }
    .ex-dd-menu {
        box-sizing: border-box;
        min-width: 0;
        background: #515811;
    }
    .ex-dd-value {
        display: block;
        flex: 1 1 auto;
        min-width: 0;
        text-align: right;
    }
    .ex-dd-menu {
        z-index: 4000;
    }
    .ex-stage.is-pending .ex-room {
        opacity: 1;
    }
    .ex-dash-body {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        gap: 6px;
        overflow: visible;
        min-height: 0;
    }
    .ex-side {
        display: contents;
    }
    .ex-prov-rail {
        order: 1;
        flex: 0 0 36vh;
        height: 36vh;
        max-height: 36vh;
        min-height: 0;
        padding: 8px 12px 6px;
        border-radius: 22px;
    }
    @supports (height: 1svh) {
        .ex-prov-rail {
            flex-basis: 36svh;
            height: 36svh;
            max-height: 36svh;
        }
    }
    .ex-prov-search {
        display: none;
    }
    .ex-prov-actions {
        margin: 0 0 6px;
        gap: 6px;
    }
    .ex-prov-actions button {
        height: 26px;
        border: 0;
        background: #f7f4ed;
        color: #515811;
        font-size: 0.68rem;
        padding: 0 8px;
    }
    .ex-prov-actions #btn-clear-all-provinces {
        color: #515811;
    }
    .ex-insight-card {
        background: transparent;
        border-radius: 22px;
        padding: 0 0 4px;
    }
    .ex-insight-card h2 {
        font-size: 1.15rem;
        margin: 0;
        border: 0;
    }
    .ex-insight-card #indicator-question {
        font-size: 0.95rem;
    }
    .ex-insight-card #insight-text {
        font-size: 0.78rem;
        line-height: 1.85;
    }
    .ex-meta span {
        background: #ffffff;
        color: #515811;
        border: 0;
        min-height: 28px;
        padding: 3px 12px 4px;
    }
    .ex-chart-room {
        order: 2;
        flex: 0 0 auto;
        height: auto;
        padding: 10px 12px 8px;
        border-radius: 22px;
    }
    .chart-toolbar {
        gap: 8px;
        margin-bottom: 8px;
        flex-wrap: nowrap;
    }
    .chart-toolbar h3 {
        font-size: 0.78rem;
        color: #1b242e;
    }
    .chart-switcher {
        background: #eef1e4;
        padding: 3px;
    }
    .chart-mode-btn {
        height: 28px;
        padding: 0 10px 1px;
        font-size: 0.68rem;
        color: #515811;
    }
    .chart-mode-btn.active {
        background: #515811;
        color: #fff;
    }
    #canvas-reveal-wrapper {
        flex: 0 0 auto;
        height: clamp(180px, 52vw, 260px);
        min-height: 0;
        aspect-ratio: auto;
        max-height: none;
    }
    .ex-chart-foot {
        padding-top: 4px;
    }
    .ex-insight-open {
        min-height: 40px;
        font-size: 0.8rem;
    }
    .ex-chart-legend-btn {
        height: 28px;
        font-size: 0.72rem;
        background: transparent;
        color: #1b242e;
    }
    .chart-mode-btn {
        white-space: nowrap;
    }
}



@media (prefers-reduced-motion: reduce) {
    .ex-room-face { animation: none; }
    .ex-insight-label { animation: none; -webkit-mask-image: none; mask-image: none; }
    .ex-insight-shine { animation: none; opacity: 0; }
    .ex-insight-open { transition: none; }
}

/* Province SVG paths use their own borders as the focus indicator. */
#explorer-leaflet-map path.leaflet-interactive:focus {
    outline: none;
}

#explorer-leaflet-map path.leaflet-interactive:focus-visible {
    stroke: #881337;
    stroke-width: 3;
}

/* Mobile charts keep their own height; controls extend the scrollable page. */
@media (max-width: 767px) {
    .ex-dash { flex: 0 0 auto; min-height: 0; }
    .ex-dash-body { flex: 0 0 auto; }
    .ex-chart-room { --ex-mobile-chart-height: clamp(300px, 80vw, 420px); }
    .chart-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .chart-toolbar h3 { white-space: normal; }
    .chart-switcher {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }
    .chart-mode-btn { min-width: 0; height: 36px; gap: 4px; padding-inline: 3px; }
    .chart-mode-icon { width: 14px; height: 14px; }
    .chart-mode-label-full { display: none; }
    .chart-mode-label-short { display: inline; }
    #canvas-reveal-wrapper { height: auto; min-height: 0; max-height: none; }
    .chart-pane { position: relative; inset: auto; }
    #trend-chart-wrap { height: var(--ex-mobile-chart-height); }
    .explorer-compare-canvas { flex: 0 0 auto; height: var(--ex-mobile-chart-height); }
    .explorer-compare-controls { padding-top: 26px; }
    #map-chart-wrap.is-active { grid-template-rows: var(--ex-mobile-chart-height) auto; }
    .explorer-map-controls { min-width: 0; padding: 26px 10px 14px; }
    #table-chart-wrap { height: var(--ex-mobile-chart-height); }
    .ex-chart-foot { flex: 0 0 auto; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
}

.explorer-map-legend-bar>span { cursor:pointer; transition:transform .15s,filter .15s; }
.explorer-map-legend-bar>span:hover,.explorer-map-legend-bar>span.is-highlighted { transform:scaleY(1.3); filter:brightness(1.2); }
.explorer-map-legend-bar>span:focus-visible,.explorer-map-legend-no-data:focus-visible { outline:2px solid #515811; outline-offset:3px; }
.explorer-map-legend-no-data { cursor:pointer; }
@media(prefers-reduced-motion:reduce) { .explorer-map-legend-bar>span { transition:none; } }
