/* ═══════════════════════════════════════════════════════════════════════════
   worlds.css — SCENE 02 · the map of the multiverse

   Three realities are nodes on a route, not three cards in a row. Selecting a
   node reads its dossier; entering grows the node into the screen.
   ═══════════════════════════════════════════════════════════════════════════ */

.map {
    position: relative;
    min-height: calc(100svh - var(--colophon-height));
    display: grid;
    grid-template-rows: var(--bar-height) auto minmax(0, 1fr);
}

.map__head {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: clamp(var(--space-5), 3vh, var(--space-8)) var(--page-gutter) 0;
}
.map__head h1 {
    margin: var(--space-2) 0 var(--space-2);
    font-family: var(--font-display);
    font-weight: var(--weight-medium);
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
    line-height: 1.02;
    letter-spacing: var(--tracking-tight);
    color: var(--scene-ink);
}
.map__lede { max-width: 46ch; font-size: var(--text-base); color: var(--scene-faint); }

/* ── chart + dossier ───────────────────────────────────────────────────── */
.map__body {
    width: 100%;
    max-width: var(--page-max);
    margin: 0 auto;
    padding: var(--space-4) var(--page-gutter) var(--space-6);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: clamp(var(--space-6), 4vw, var(--space-12));
    align-items: stretch;
    min-height: 0;
}

.map__chart {
    position: relative;
    min-height: clamp(320px, 46vh, 470px);
    border: 1px solid var(--scene-rule);
    background:
        radial-gradient(60% 50% at 50% 40%, oklch(100% 0 0 / 0.03), transparent 70%),
        repeating-linear-gradient(0deg, transparent 0 39px, oklch(100% 0 0 / 0.022) 39px 40px),
        repeating-linear-gradient(90deg, transparent 0 39px, oklch(100% 0 0 / 0.022) 39px 40px);
}
.map__chart::before,
.map__chart::after {
    content: ''; position: absolute; width: 9px; height: 9px;
    border: 1px solid var(--scene-accent);
    opacity: 0.8;
}
.map__chart::before { left: 10px; top: 10px; border-right: 0; border-bottom: 0; }
.map__chart::after { right: 10px; bottom: 10px; border-left: 0; border-top: 0; }

.map__route { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.map__route polyline {
    fill: none;
    stroke: var(--scene-accent);
    stroke-width: 1;
    stroke-dasharray: 3 7;
    opacity: 0.42;
    stroke-linecap: round;
}
.map__nodes { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }
.map__node-slot {
    position: absolute;
    left: var(--x); top: var(--y);
    translate: -50% -50%;
}

.node {
    display: grid; justify-items: center; gap: var(--space-3);
    text-decoration: none; color: inherit;
    padding: var(--space-2);
    transition: transform var(--dur-base) var(--ease-out);
}
.node__ring {
    position: relative;
    display: grid; place-items: center;
    width: 116px; aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--scene-rule);
    transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out);
}
.node__scene {
    position: relative;
    width: 92px; aspect-ratio: 1;
    border-radius: 50%;
    overflow: hidden;
    isolation: isolate;
    filter: saturate(0.72) brightness(0.86);
    transition: filter var(--dur-base) var(--ease-out), width var(--dur-base) var(--ease-out);
}
.node__tick {
    position: absolute; width: 7px; height: 1px;
    background: var(--scene-rule);
    top: 50%;
}
.node__tick--a { left: -4px; }
.node__tick--b { right: -4px; }

.node__label { display: grid; justify-items: center; gap: 1px; text-align: center; }
.node__no {
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: var(--tracking-caps); color: var(--scene-faint);
}
.node__title {
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 1.35vw, 1.2rem);
    line-height: 1.1;
    color: var(--scene-dim);
    transition: color var(--dur-base) var(--ease-out);
}
.node__genre {
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--scene-faint); opacity: 0.8;
}

.node:hover, .node:focus-visible { transform: translateY(-3px); }
.node:hover .node__title, .node:focus-visible .node__title { color: var(--scene-ink); }
.node:hover .node__scene, .node:focus-visible .node__scene { filter: none; width: 100px; }

.node[aria-current] .node__ring {
    border-color: var(--scene-accent);
    box-shadow: 0 0 0 1px var(--scene-accent), 0 0 44px -6px var(--scene-accent);
    transform: scale(1.04);
}
.node[aria-current] .node__scene { filter: none; }
.node[aria-current] .node__title { color: var(--scene-ink); }

.map__axis {
    position: absolute; left: 16px; bottom: 14px;
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: var(--tracking-caps); text-transform: uppercase;
    color: var(--scene-dim);
}

/* ── dossier: the instrument panel ─────────────────────────────────────── */
.map__side {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: var(--space-6);
    border-left: 1px solid var(--scene-rule);
    padding-left: clamp(var(--space-4), 2vw, var(--space-6));
    min-height: 0;
}
.dossier { display: grid; align-content: start; gap: var(--space-2); }
.dossier__no {
    font-family: var(--font-mono); font-size: var(--text-2xs);
    letter-spacing: var(--tracking-caps); color: var(--scene-accent);
}
.dossier__title {
    font-family: var(--font-display);
    font-weight: var(--weight-regular);
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    line-height: 1.05;
    letter-spacing: var(--tracking-tight);
    color: var(--scene-ink);
}
.dossier__genre {
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--scene-faint);
}
.dossier__line {
    margin-top: var(--space-2);
    font-family: var(--font-prose);
    font-size: var(--text-lg);
    line-height: 1.4;
    color: var(--scene-dim);
    min-height: 3.6em;
}
.dossier__enter {
    display: inline-flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    margin-top: var(--space-3);
    min-height: var(--control-lg);
    padding: 0 var(--space-4);
    border: 1px solid var(--scene-accent);
    color: var(--scene-ink);
    font-family: var(--font-mono); font-size: var(--text-2xs);
    letter-spacing: var(--tracking-caps); text-transform: uppercase;
    text-decoration: none;
    transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.dossier__enter:hover { background: var(--scene-accent); color: var(--scene-bg); }
.dossier__arrow { display: inline-flex; width: 24px; }
.dossier__arrow svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.4; }
.dossier__keys {
    margin-top: var(--space-2);
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: 0.1em; color: var(--scene-dim);
}

.unmapped { border-top: 1px dashed var(--scene-rule); padding-top: var(--space-4); }
.unmapped__label {
    font-family: var(--font-mono); font-size: var(--text-3xs);
    letter-spacing: var(--tracking-caps); text-transform: uppercase;
    color: var(--scene-faint);
}
.unmapped__body { margin-top: var(--space-1); font-size: var(--text-sm); line-height: 1.5; color: var(--scene-faint); }

/* node glow states re-light the whole chart */
.map[data-selected='teaser'] { --scene-glow: oklch(50% 0.17 22 / 0.4); }
.map[data-selected='shd'] { --scene-glow: oklch(88% 0.05 80 / 0.34); }
.map[data-selected='at'] { --scene-glow: oklch(78% 0.11 340 / 0.36); }

/* ── narrow: the route becomes a column ────────────────────────────────── */
@media (max-width: 980px) {
    .map { min-height: calc(100svh - var(--colophon-height)); grid-template-rows: var(--bar-height) auto auto; }
    .map__body { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
    .map__chart {
        min-height: 0;
        border: 0;
        background: none;
        padding: 0;
    }
    .map__chart::before, .map__chart::after { display: none; }
    .map__route { display: none; }
    .map__nodes { position: static; display: grid; gap: 2px; }
    .map__node-slot {
        position: relative; left: auto; top: auto; translate: none;
    }
    .node {
        grid-template-columns: 72px minmax(0, 1fr);
        justify-items: start;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-2) var(--space-2);
        border-bottom: 1px solid var(--scene-rule);
    }
    .node__ring { width: 72px; }
    .node__scene { width: 58px; }
    .node__tick { display: none; }
    .node__label { justify-items: start; text-align: left; }
    .node:hover .node__scene, .node:focus-visible .node__scene { width: 62px; }
    .map__axis { position: static; display: block; padding-top: var(--space-3); }
    .map__side {
        border-left: 0;
        border-top: 1px solid var(--scene-rule);
        padding-left: 0;
        padding-top: var(--space-4);
    }
    .dossier__line { min-height: 0; }
    .dossier__keys { display: none; }
}
