/* 3D explorer: camera controls stay quiet until a point is selected. */
.v3-explore {
    position: fixed; z-index: 25; left: 50%; bottom: calc(104px + env(safe-area-inset-bottom));
    display: flex; align-items: center; gap: 8px; width: max-content; max-width: calc(100% - 24px);
    padding: 6px; border: 1px solid var(--glass-line); border-radius: 20px;
    background: var(--glass); box-shadow: var(--inset), 0 12px 30px -16px var(--shadow-c);
    -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
    transform: translateX(-50%);
}
.ex-views { display: flex; align-items: center; gap: 2px; }
.v3-explore button {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px;
    padding: 0 12px; border: 0; border-radius: 14px; background: transparent; color: var(--muted);
    font: inherit; font-size: .9rem; line-height: 1.2; white-space: nowrap; cursor: pointer;
    transition: color .2s var(--ease), background-color .2s var(--ease), transform .2s var(--ease);
}
.ex-views button[aria-pressed="true"] { background: var(--accent-soft); color: var(--strong); }
.ex-views button[aria-pressed="true"] i { color: var(--accent); }
.v3-explore .ex-discover { padding-inline: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.ex-discover > i:last-child { margin-left: 4px; font-size: .75rem; }
.v3-explore button:active, .ex-actions button:active, .ex-actions a:active, .ex-close:active { transform: scale(.97); }
body.inspecting .v3-explore, body.touring .v3-explore, body.legend-open .v3-explore { display: none; }
body.inspecting .v3-legend, body.inspecting .v3-near { display: none; }
body.inspecting .mz:not(.is-inspected):not(.gone):not(.bye) { opacity: .18; }
body.inspecting .lb-h { visibility: hidden; }

/* One focused data instrument, with the map still visible above it. */
.v3-inspect {
    --inspect-color: var(--accent);
    left: 50%; bottom: calc(104px + env(safe-area-inset-bottom)); z-index: 30;
    display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; column-gap: 17px;
    width: min(610px, calc(100% - 32px)); max-height: calc(100dvh - 290px); padding: 20px 22px 15px 17px;
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
    background: color-mix(in srgb, var(--core) 80%, var(--glass));
    border-color: color-mix(in srgb, var(--inspect-color) 25%, var(--glass-line));
    transform: translateX(-50%); animation: exInspectIn .48s var(--ease-out) both;
}
.ex-close {
    position: absolute; z-index: 1; top: 5px; right: 5px; display: grid; place-items: center;
    width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent;
    color: var(--muted); font: inherit; cursor: pointer; transition: background-color .2s, color .2s, transform .2s;
}
.ex-art { min-width: 0; width: 100%; align-self: center; }
.ex-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.ex-copy { min-width: 0; }
.v3-inspect .ex-kicker { display: flex; align-items: center; gap: 7px; margin: 0 26px 4px 0; color: var(--muted); font-size: .78rem; line-height: 1.4; }
.ex-kicker::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--inspect-color); }
.v3-inspect h2 { padding-right: 12px; font-size: 1.32rem; line-height: 1.4; font-weight: 600; text-wrap: pretty; }
.v3-inspect .ex-sub { margin-top: 3px; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.v3-inspect .ex-reading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; margin-top: 8px; line-height: 1.1; }
.ex-reading b { color: var(--strong); font-size: 2.7rem; font-weight: 700; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.ex-reading > span { color: var(--muted); font-size: .87rem; }
.ex-reading em {
    align-self: center; padding: 5px 8px; border-radius: 7px; background: color-mix(in srgb, var(--inspect-color) 11%, transparent);
    color: var(--inspect-color); font-size: .8rem; font-style: normal; font-weight: 600; line-height: 1.2;
}
.v3-inspect .ex-gap { margin-top: 8px; color: var(--text); font-size: .88rem; line-height: 1.4; }
.v3-inspect .ex-time { margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.45; }
.ex-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.ex-actions a, .ex-actions button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 2px;
    border: 0; border-radius: 6px; background: transparent; color: var(--accent); font: inherit; font-size: .85rem;
    font-weight: 600; text-decoration: none; cursor: pointer; transition: color .2s, background-color .2s, transform .2s;
}
.ex-actions button { color: var(--muted); }
.ex-actions i { font-size: .7rem; }
.v3-explore button:disabled, .ex-actions button:disabled { opacity: .45; cursor: default; }
.v3-explore :focus-visible, .v3-inspect :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Water inside the diagram moves; scale, boundaries and labels remain steady. */
.ex-gauge-wave { animation: exGaugeWave 4.8s ease-in-out infinite alternate; }
.ex-gauge-caption, .ex-gauge-marker-label, .ex-gauge-tick-label { font-family: var(--font); }
@keyframes exGaugeWave { from { transform: translateX(-3px); } to { transform: translateX(3px); } }
@keyframes exInspectIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
body.v3-paused .ex-gauge-wave, body.v3-paused .mz *, body.v3-paused .mzi *, body.v3-paused .tc-bar i { animation-play-state: paused; }
@media (hover: hover) {
    .ex-views button:hover { background: var(--shell); color: var(--strong); }
    .ex-views button[aria-pressed="true"]:hover { background: var(--accent-soft); }
    .v3-explore .ex-discover:hover { background: color-mix(in srgb, var(--accent) 88%, var(--strong)); }
    .ex-close:hover { background: var(--shell); color: var(--strong); }
    .ex-actions a:hover, .ex-actions button:hover { color: var(--strong); }
}

@media (max-width: 1000px) and (min-width: 761px) {
    /* Leave the compact legend its own lane on smaller laptops. */
    .v3-explore { left: auto; right: 65px; transform: none; }
}
@media (max-width: 760px) {
    .v3-explore { bottom: calc(112px + env(safe-area-inset-bottom)); gap: 5px; padding: 5px; border-radius: 18px; }
    .v3-explore button { gap: 6px; padding-inline: 10px; font-size: .83rem; border-radius: 12px; }
    .v3-explore .ex-discover { padding-inline: 12px; }
    .ex-discover > i:last-child { display: none; }
    .v3-inspect {
        bottom: calc(112px + env(safe-area-inset-bottom)); width: min(480px, calc(100% - 24px));
        grid-template-columns: 104px minmax(0, 1fr); column-gap: 10px; row-gap: 0;
        max-height: calc(100dvh - 285px); padding: 15px 16px 7px 12px; border-radius: 22px;
    }
    .ex-copy { display: contents; }
    .ex-copy > * { grid-column: 2; }
    .ex-art { grid-column: 1; grid-row: 1 / 5; overflow: hidden; }
    /* On phones keep the chamber large; full readings remain in the adjacent text. */
    .ex-art svg { width: 180%; max-width: none; }
    .ex-art .ex-gauge-tick-label { visibility: hidden; }
    .v3-inspect .ex-kicker { margin-right: 18px; margin-bottom: 4px; font-size: .72rem; }
    .v3-inspect h2 { padding-right: 14px; font-size: 1.1rem; }
    .v3-inspect .ex-sub { font-size: .75rem; margin-top: 3px; }
    .v3-inspect .ex-reading { gap: 3px 6px; margin-top: 6px; }
    .ex-reading b { font-size: 2.2rem; }
    .ex-reading > span { font-size: .78rem; }
    .ex-reading em { padding: 4px 6px; font-size: .72rem; }
    .v3-inspect .ex-gap, .v3-inspect .ex-time, .ex-copy > .ex-actions { grid-column: 1 / -1; }
    .v3-inspect .ex-gap { margin: 9px 3px 0; font-size: .84rem; }
    .v3-inspect .ex-time { margin: 3px 3px 0; font-size: .72rem; }
    .ex-copy > .ex-actions { margin: 8px 3px 0; }
    .ex-actions a, .ex-actions button { font-size: .83rem; }
    .ex-close { top: 2px; right: 2px; }
    body.inspecting .v3-stats { display: none; }
    body.inspecting .maplibregl-ctrl-bottom-right { bottom: calc(124px + var(--inspect-height, 275px)); }
    body.inspecting .v3-note { bottom: auto; top: 260px; }
}
@media (max-width: 360px) {
    .v3-explore { gap: 2px; }
    .v3-explore button { padding-inline: 8px; }
    .ex-views button > i { display: none; }
    .v3-explore .ex-discover { padding-inline: 9px; }
    .v3-inspect { grid-template-columns: 86px minmax(0, 1fr); column-gap: 8px; padding-left: 10px; padding-right: 12px; }
}
@media (max-height: 600px) and (min-width: 761px) {
    .v3-inspect { max-height: calc(100dvh - 195px); padding-top: 14px; padding-bottom: 9px; }
    .ex-reading b { font-size: 2.1rem; }
}
@media (max-height: 600px) and (max-width: 760px) and (orientation: landscape) {
    .v3-inspect { width: min(490px, calc(100% - 110px)); max-height: calc(100dvh - 145px); bottom: calc(106px + env(safe-area-inset-bottom)); }
    body.inspecting .v3-top { pointer-events: none; }
    body.inspecting .v3-head, body.inspecting .v3-right { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .v3-inspect, .ex-gauge-wave { animation: none; }
    .v3-explore button, .ex-actions a, .ex-actions button, .ex-close { transition: none; }
}
