/* worldview.css — the Worldview's own layout. Loaded LAST, after base/app-shell/scope/sion, so it
 * may define only what it owns and never reaches into the estate top line.
 *
 * WHY IT LOOKS LIKE configurator.css AND IS NOT IT. The two surfaces are the two halves of
 * DR-SION-037's one shell: the Configurator AUTHORS the model, Worldview MIRRORS it. They share the
 * same three-pane desktop shape on purpose — an operator who has just authored a space should
 * recognise it instantly when they come to look at it — and they share their geometry, their frame
 * and their document through js/configurator/. What they do NOT share is a stylesheet: this one
 * carries no tool bar, no field, no Save and no danger button, because there is nothing here to
 * press. The read-only vocabulary is a shorter one, and a sheet that inherited the editor's would
 * carry rules for controls this page must never grow.
 *
 * CALMER, BY RULING. The viewport is dimmer than the editor's (scene.js MIRROR MODE multiplies
 * every alpha), and the chrome around it follows: quieter lines, no accent fills on the rail, one
 * cyan title per card. The brightness is being held back for the LIVE layer — when perception
 * paints real entities onto this mirror, they have to be the loudest thing on the glass.
 *
 * DESKTOP-CLASS. Same ruling as the editor ("web = desktop-class and may be HEAVIER"), same mobile
 * posture: phones never reach this sheet, js/mobile-gate.js stops them at the door.
 */

:root {
    --wv-rail: 236px;
    --wv-side: 320px;
    --wv-bar: 46px;
    --wv-ground: #06070d;
    --wv-panel: #0b0e18;
    --wv-panel-2: #101524;
    --wv-hair: rgba(120, 134, 160, 0.14);
    --wv-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
    --wv-sans: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    overflow: hidden;                      /* the panes scroll, the page does not */
}

body {
    background: var(--wv-ground);
    color: var(--text);
    font-family: var(--wv-sans);
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
}

/* ── the bar: view controls and the freshness read-out ───────────────────────────────────────
   No tools, by ruling. What lives here is how you LOOK (3D or the derived drop, Fit) and how
   current what you are looking at is. */
.wv-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--wv-bar);
    padding: 0 14px;
    border-bottom: 1px solid var(--wv-hair);
    background: var(--deep);
    flex-shrink: 0;
    overflow-x: auto;
}
.wv-bar-sep { width: 1px; height: 22px; background: var(--wv-hair); flex-shrink: 0; }
.wv-bar-spacer { flex: 1; min-width: 8px; }
.wv-bar-label {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    white-space: nowrap;
}

.wv-btn {
    font-family: var(--wv-sans);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    padding: 6px 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.wv-btn:hover { color: var(--text); border-color: var(--border-focus); }
.wv-btn.on {
    color: var(--cyan);
    border-color: rgba(0, 200, 255, 0.4);
    background: rgba(0, 200, 255, 0.07);
}
.wv-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.wv-fresh {
    font-family: var(--wv-mono);
    font-size: 10.5px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 44ch;
}

/* ── the three panes ──────────────────────────────────────────────────────────────────────── */
.wv-body {
    flex: 1;
    display: grid;
    grid-template-columns: var(--wv-rail) minmax(0, 1fr) var(--wv-side);
    min-height: 0;
}

.wv-rail, .wv-side {
    background: var(--wv-panel);
    overflow-y: auto;
    min-height: 0;
}
.wv-rail { border-right: 1px solid var(--wv-hair); }
.wv-side { border-left: 1px solid var(--wv-hair); }

.wv-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    border-bottom: 1px solid var(--wv-hair);
    position: sticky;
    top: 0;
    background: var(--wv-panel);
    z-index: 2;
}
.wv-panel-body { padding: 8px 10px 14px; }

/* ── the viewport ─────────────────────────────────────────────────────────────────────────── */
.wv-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    background: radial-gradient(120% 90% at 50% -20%, #090f1a 0%, var(--wv-ground) 60%);
}
#wv-canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
    touch-action: none;
}
.wv-overlay {
    position: absolute;
    left: 0; right: 0;
    pointer-events: none;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wv-overlay-top { top: 0; align-items: flex-start; }
.wv-overlay-bottom { bottom: 0; align-items: flex-start; }
.wv-overlay > * { pointer-events: auto; }

.wv-readout {
    font-family: var(--wv-mono);
    font-size: 11px;
    color: var(--text-dim);
    background: rgba(6, 7, 13, 0.8);
    border: 1px solid var(--wv-hair);
    border-radius: 4px;
    padding: 4px 8px;
}

.wv-hubnote {
    font-size: 11.5px;
    line-height: 1.55;
    border-radius: 5px;
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-left: 2px solid var(--warning);
    background: rgba(6, 7, 13, 0.9);
    color: var(--warning);
    max-width: 78ch;
}
.wv-hubnote-error { border-left-color: var(--error); color: var(--error); }

/* The toast: the quiet "updated to v<N>". It is the only thing on this surface that appears
   without being asked for, so it stays small, it stays in one corner, and it goes away. */
.wv-toast {
    font-size: 11.5px;
    line-height: 1.5;
    border-radius: 5px;
    padding: 7px 12px;
    border: 1px solid var(--border-strong);
    background: rgba(6, 7, 13, 0.92);
    color: var(--text-muted);
    max-width: 70ch;
}
.wv-toast-ok { border-left: 2px solid var(--mint); color: var(--mint); }
.wv-toast-error { border-left: 2px solid var(--error); color: var(--error); }

/* The empty state, centred over the stage. Worldview authors nothing, so "nothing to mirror" is a
   real and frequent state and it gets a real card rather than a blank canvas. */
.wv-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px;
    text-align: center;
    pointer-events: none;
}
.wv-empty-title { font-size: 14px; color: var(--text); letter-spacing: 0.04em; }
.wv-empty-body { font-size: 12px; color: var(--text-muted); line-height: 1.7; max-width: 64ch; }

/* ── rail items ───────────────────────────────────────────────────────────────────────────── */
.wv-floor, .wv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-align: left;
    font-family: var(--wv-sans);
    font-size: 12.5px;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    padding: 7px 9px;
    cursor: pointer;
    margin-bottom: 3px;
}
.wv-floor { flex-direction: column; align-items: flex-start; gap: 1px; }
.wv-floor b, .wv-item b { color: var(--text); font-weight: 500; }
.wv-floor small, .wv-item small {
    font-family: var(--wv-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-left: auto;
}
.wv-floor small { margin-left: 0; }
.wv-floor:hover, .wv-item:hover { background: var(--wv-panel-2); color: var(--text); }
.wv-floor.on, .wv-item.on {
    border-color: rgba(0, 200, 255, 0.34);
    background: rgba(0, 200, 255, 0.06);
    color: var(--text);
}
/* A camera the document says is disabled reads disabled here too — the mirror does not tidy the
   document up. */
.wv-item.off { opacity: 0.55; }
.wv-item.off .wv-dot-cam { background: var(--error); box-shadow: none; }

.wv-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }
.wv-dot-room { background: #2f5d8a; }
.wv-dot-cam { background: var(--cyan); box-shadow: 0 0 6px -1px var(--cyan); }
.wv-dot-portal { background: var(--warning); }

.wv-group {
    font-size: 9.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin: 12px 0 5px;
}
.wv-empty-line { font-size: 11.5px; color: var(--text-dim); padding: 4px 2px 8px; line-height: 1.6; }

/* ── the read-only inspector ──────────────────────────────────────────────────────────────── */
.wv-title {
    font-size: 13px;
    color: var(--cyan);
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    word-break: break-word;
}
.wv-line {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    padding: 4px 0;
    border-top: 1px solid rgba(120, 134, 160, 0.07);
}
.wv-line b {
    color: var(--text);
    font-weight: 500;
    font-family: var(--wv-mono);
    font-size: 11px;
    word-break: break-all;
    text-align: right;
}
.wv-note {
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-dim);
    background: var(--wv-panel-2);
    border-radius: 5px;
    padding: 8px 10px;
    margin-top: 10px;
}
.wv-hintline {
    font-size: 10.5px;
    color: var(--text-dim);
    margin-top: 10px;
    letter-spacing: 0.02em;
}

/* ── the live layer, honestly empty ────────────────────────────────────────────────────────
   Visible, quiet, and truthful. This panel exists so the surface can say what it WILL be without
   pretending to be it: no dot, no glow, no sample state. Engine serves intent — ambiance is lit by
   REAL events only, and there are none yet. */
.wv-perception {
    border: 1px dashed var(--wv-hair);
    border-radius: 6px;
    padding: 10px 12px;
    background: rgba(120, 80, 255, 0.03);
}
.wv-perception-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--violet);
    margin-bottom: 8px;
}
.wv-perception-state {
    font-family: var(--wv-mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    border: 1px solid var(--wv-hair);
    border-radius: 999px;
    padding: 1px 8px;
    margin-left: auto;
    text-transform: none;
}
.wv-legend { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; }
.wv-legend-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--text-muted);
}
.wv-legend-row i {
    font-style: normal;
    font-family: var(--wv-mono);
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
}
.wv-perception-body { font-size: 11px; line-height: 1.65; color: var(--text-dim); }
.wv-perception-body b { color: var(--text-muted); font-weight: 500; }

/* A narrow desktop window still has to work; phones never reach this sheet (mobile-gate.js). */
@media (max-width: 1180px) {
    :root { --wv-rail: 190px; --wv-side: 288px; }
}
@media (max-width: 980px) {
    .wv-body { grid-template-columns: minmax(0, 1fr); }
    .wv-rail, .wv-side { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .wv-btn, .wv-floor, .wv-item { transition: none !important; }
}
