/* Explorer: app bar, full-height map with floating controls, and an analysis panel (Ogun-style layout). */
html, body { height: 100%; }
body.explorer { overflow: hidden; background: #fff; }
.explorer .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* app bar */
.appbar { height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--rule); background: #fff; position: relative; z-index: 1100; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--ui); display: grid; place-items: center; flex: none; }
.brand-text { min-width: 0; }
.brand-text h1 { font-family: var(--font); font-size: 17px; font-weight: 700; margin: 0; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text p { margin: 1px 0 0; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.data-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; white-space: nowrap; }
.dot-ok { width: 7px; height: 7px; border-radius: 50%; background: #2e7d32; display: inline-block; }
.btn { font: inherit; font-size: 14px; font-weight: 500; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 13px; cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: border-color .15s ease, background .15s ease; }
.btn:hover { border-color: var(--ink-3); background: #fbfbfa; }
.btn.play { width: 32px; height: 30px; padding: 0; justify-content: center; }

/* shell: map and panel */
.shell { display: grid; grid-template-columns: minmax(0, 1fr) 468px; height: calc(100% - 64px); }
.map-pane { position: relative; min-width: 0; min-height: 0; background: #ececea; }
.map-canvas { position: absolute; inset: 0; }
.map-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 4px 16px rgba(0, 0, 0, .1); margin: 0; max-width: 80%; text-align: center; }

/* floating controls */
.map-float { position: absolute; z-index: 800; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .08); border: 1px solid var(--line); }
.layers { top: 16px; left: 16px; padding: 6px; border-radius: 8px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.08); max-width: calc(100% - 28px); }
.seg-group { display: inline-flex; flex-wrap: wrap; }
.seg-layer { display: inline-flex; flex-wrap: wrap; }
.basemap { top: 16px; right: 72px; padding: 4px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.basemap select { font: inherit; font-size: 14px; font-weight: 500; border-radius: 10px; border: 0; background: transparent; padding: 6px 8px; cursor: pointer; color: var(--ink); }
.legend { left: 16px; bottom: 16px; padding: 14px 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); width: 250px; max-height: 42%; overflow: auto; font-size: 12.5px; }
.legend .lg-t { font-size: 13.5px; }
.legend .lg-c { margin-top: 6px; }
.timeline { bottom: 16px; left: 50%; transform: translateX(-50%); padding: 10px 14px; border-radius: 22px; box-shadow: 0 6px 24px rgba(0,0,0,.10); min-width: 300px; max-width: calc(100% - 300px); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.ctl-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ctl-row[hidden] { display: none; }
.ctl-row input[type="range"] { width: min(360px, 40vw); accent-color: var(--ink); }
.ctl-row output { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3em; text-align: center; }
.ctl-note { margin: 0; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.timeline .seg button { font-size: 13px; }

/* panel */
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--rule); background: #fff; }
.unit { padding: 16px 18px 6px; }
.eyebrow { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 14px; cursor: pointer; color: var(--ink-2); transition: background .18s ease, color .18s ease; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ui); color: #fff; border-color: var(--ui); }
.chip:disabled { opacity: .45; cursor: not-allowed; }
.tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-size: 14.5px; font-weight: 500; background: none; border: 0; padding: 8px 9px; color: var(--ink-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--ui); border-bottom-color: var(--ui); }
.tab-body { overflow-y: auto; padding: 18px 18px 40px; flex: 1; min-height: 0; }
.tp[hidden] { display: none; }
.tp h2 { font-family: var(--font); font-size: 16px; font-weight: 700; margin: 22px 0 8px; }
.tp h2:first-child { margin-top: 0; }
.tp p { font-size: 14px; line-height: 1.55; margin: 0 0 10px; text-align: left; }

/* intro card, tiles, plain text */
.intro { background: var(--ui-soft); border-radius: 8px; padding: 18px 20px; }
.intro h2 { margin-top: 0 !important; }
.intro dl { margin: 0; }
.intro dt { font-weight: 700; font-size: 13.5px; margin-top: 8px; }
.intro dd { margin: 2px 0 0; font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.tile { background: #fff; border: 1px solid #e4e4e0; border-radius: 8px; padding: 14px 15px; }
.tile .k { font-size: 12.5px; color: var(--ink-3); }
.tile .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.tile .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.note-warn { font-size: 13px; color: #7c4a03; background: #fdf6e9; border-radius: 10px; padding: 9px 11px; margin: 12px 0 0; }

/* tables and figures inside the panel */
.panel table { font-size: 13px; }
.panel th, .panel td { padding: 7px 6px; }
.panel .chart-svg { overflow: visible; }
.panel .keylist { font-size: 12.5px; }
.sel-cell { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.mute { color: var(--ink-3); font-size: 13px; }
.sec-note { font-size: 12.5px; color: var(--ink-3); margin: 6px 0 0; }
.seg-inline { margin: 6px 0 10px; }

/* dialogs */
dialog { border: 0; border-radius: 16px; padding: 24px 26px; max-width: min(560px, 92vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .18); font-family: var(--font); color: var(--ink); }
dialog::backdrop { background: rgba(17, 17, 17, .32); }
dialog h2 { font-family: var(--font); font-size: 18px; margin: 0 0 12px; }
dialog p { font-size: 14.5px; line-height: 1.55; margin: 0 0 10px; }
.dlg-close { position: absolute; right: 16px; top: 16px; margin: 0; }
dialog .downloads li { grid-template-columns: auto minmax(0, 1fr); }
dialog .downloads span { text-align: left; }

/* mobile: map above, panel below */
@media (max-width: 900px) {
    body.explorer { overflow: auto; }
    .shell { grid-template-columns: 1fr; height: auto; }
    .map-pane { height: 64vh; min-height: 420px; }
    .panel { border-left: 0; border-top: 1px solid var(--rule); }
    .tab-body { overflow: visible; }
    .legend { width: 200px; max-height: 36%; }
    .timeline { min-width: 0; max-width: calc(100% - 28px); }
    .appbar { height: auto; flex-wrap: wrap; padding: 10px 14px; }
    .appbar-actions { flex-wrap: wrap; }
    .shell { height: auto; }
}
@media (max-width: 560px) {
    .data-chip { display: none; }
    .legend { display: none; }
    .basemap select { font-size: 12.5px; }
    .tiles { grid-template-columns: 1fr; }
}

/* phone: keep the floating controls inside the map and stop horizontal scroll */
@media (max-width: 560px) {
    body.explorer, .shell, .panel, .tab-body { max-width: 100vw; overflow-x: hidden; }
    .map-pane { height: 62vh; min-height: 380px; overflow: hidden; }
    .layers { top: 8px; left: 8px; right: 8px; max-width: none; padding: 6px; }
    .layers .seg { font-size: 12.5px; }
    .layers .seg button { padding: 4px 8px; }
    .basemap { top: auto; bottom: 8px; left: 8px; right: auto; }
    .timeline { left: 8px; right: 8px; transform: none; bottom: 52px; min-width: 0; max-width: none; padding: 8px 10px; }
    .timeline .ctl-note { display: none; }
    .ctl-row input[type="range"] { width: 100%; }
    .ctl-row { flex-wrap: nowrap; }
    .timeline .seg button { font-size: 12px; padding: 4px 7px; }
    .appbar-actions .btn { padding: 5px 9px; font-size: 12.5px; }
    .unit { padding: 12px 14px 4px; }
    .tab-body { padding: 14px 14px 32px; }
}

/* small phones: the action buttons wrap onto their own row instead of running off the screen */
@media (max-width: 560px) { .appbar-actions { flex: 1 1 100%; flex-wrap: wrap; row-gap: 6px; } }

/* ===== match the portfolio and study pages: white, grey hairlines, no shadows, quiet active states ===== */
body.explorer { --ui-soft: #f6f6f4; }
.brand-mark { display: none; }
body.explorer .seg button[aria-pressed="true"], .chip[aria-pressed="true"] { background: #fff; color: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.intro { background: #fff; border: 1px solid var(--rule-2); }
.map-float, .layers, .basemap, .legend, .timeline { box-shadow: none; border-color: var(--rule-2); }
.timeline { border: 1px solid var(--rule-2); border-radius: 10px; }
body.explorer { --line: var(--rule-2); }
/* phones: no empty bar when the floating box holds only a note, the basemap menu sits above the scale bar, and the layer buttons leave room for the north arrow */
@media (max-width: 560px) {
    .timeline:not(:has(.ctl-row:not([hidden]))) { display: none; }
    .basemap { bottom: 30px; }
    .layers { right: 48px; }
}
