/* ============================================================
   SITE — first-person walkthrough of the physical location
   ============================================================
   Layout is deliberately minimal: the canvas is the page. Everything
   here is either the gate that precedes it, the HUD that overlays it,
   or the text alternative beneath it.
   ============================================================ */

.site-body {
    background: #05070a;
}

.site {
    padding-top: var(--nav-h, 64px);
}

/* ============ STAGE ============ */

.site-stage {
    position: relative;
    width: 100%;
    height: calc(100vh - var(--nav-h, 64px));
    min-height: 520px;
    overflow: hidden;
    background: #05070a;
}

#siteCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Only while the pointer is actually captured — otherwise the cursor
   should behave normally so the page stays usable. */
.site-stage.is-locked {
    cursor: none;
}

/* ============ GATE ============ */

.site-gate {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: var(--pad-x);
    background:
        radial-gradient(ellipse at 50% 40%, rgba(0, 240, 255, 0.05), transparent 60%),
        rgba(5, 7, 10, 0.82);
    backdrop-filter: blur(3px);
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.site-gate.is-gone {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.site-gate__inner {
    max-width: 62ch;
    text-align: center;
}

.site-gate__kicker {
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    color: var(--accent-muted-text);
    margin-bottom: calc(var(--unit) * 2);
}

.site-gate__title {
    font-size: clamp(2.6rem, 9vw, 6rem);
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 0.92;
    margin-bottom: calc(var(--unit) * 3);
    color: var(--text-0);
}

.site-gate__body {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: calc(var(--unit) * 2);
    font-size: 0.95rem;
}

.site-gate__body--dim {
    color: var(--text-dim);
    font-size: 0.86rem;
}

.site-gate__enter {
    margin-top: calc(var(--unit) * 3);
    padding: calc(var(--unit) * 2) calc(var(--unit) * 5);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--accent-muted);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.site-gate__enter:hover,
.site-gate__enter:focus-visible {
    background: var(--accent);
    border-color: var(--accent);
    color: #05070a;
}

.site-gate__controls {
    margin-top: calc(var(--unit) * 3);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.site-gate__controls span {
    color: var(--accent-muted-text);
}

.site-gate__fallback {
    margin-top: calc(var(--unit) * 3);
    padding: calc(var(--unit) * 2);
    border: 1px solid var(--border-0);
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.6;
}

/* ============ HUD ============ */

.hud {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
    font-family: var(--font-mono);
}

.hud__reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    margin: -1.5px 0 0 -1.5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.hud__corner {
    position: absolute;
    padding: calc(var(--unit) * 2);
    line-height: 1.5;
}

.hud__corner--tl { top: 0; left: 0; }
.hud__corner--tr { top: 0; right: 0; text-align: right; }
.hud__corner--bl { bottom: 0; left: 0; }
.hud__corner--br { bottom: 0; right: 0; text-align: right; }

.hud__label {
    font-size: 0.52rem;
    letter-spacing: 0.18em;
    color: rgba(0, 240, 255, 0.45);
    margin-top: var(--unit);
}

.hud__corner > .hud__label:first-child {
    margin-top: 0;
}

.hud__val {
    font-size: 0.72rem;
    color: rgba(224, 224, 224, 0.85);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.hud__val--big {
    font-size: 1.1rem;
    color: var(--accent);
}

.hud__val.is-err { color: var(--err); }
.hud__val.is-warn { color: var(--amber); }

.hud__hint {
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    color: rgba(136, 136, 136, 0.65);
}

/* Probe card — appears when the reticle is over a rack beacon. */
.hud__probe {
    position: absolute;
    left: 50%;
    top: 52%;
    transform: translateX(-50%);
    width: min(360px, 70vw);
    padding: calc(var(--unit) * 1.5) calc(var(--unit) * 2);
    border: 1px solid var(--accent-muted);
    background: rgba(5, 7, 10, 0.85);
    text-align: left;
}

.hud__probe__name {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.hud__probe__state {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    margin-top: 2px;
    color: var(--text-muted);
}

.hud__probe__state.is-ok { color: var(--ok); }
.hud__probe__state.is-warn { color: var(--amber); }
.hud__probe__state.is-err,
.hud__probe__state.is-down { color: var(--err); }

.hud__probe__note {
    font-family: var(--font-body);
    font-size: 0.72rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin-top: var(--unit);
}

.hud__probe__act {
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    color: var(--accent-muted-text);
    margin-top: var(--unit);
}

/* ============ TEXT ALTERNATIVE ============ */

.site-doc {
    padding: calc(var(--unit) * 8) var(--pad-x);
    border-top: 1px solid var(--border-0);
    background: var(--bg-0);
}

.site-doc__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
    gap: calc(var(--unit) * 5);
    max-width: 1200px;
    margin: 0 auto;
}

.site-doc__h {
    font-size: 0.62rem;
    letter-spacing: 0.18em;
    color: var(--accent-muted-text);
    margin-bottom: calc(var(--unit) * 2);
}

.site-doc p {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.75;
    margin-bottom: var(--unit);
}

.site-doc strong { color: var(--text-0); }

.site-doc code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--accent-muted-text);
}

/* ============ SMALL SCREENS ============ */

@media (max-width: 860px) {
    /* A pointer-lock first-person view is not usable on a phone. Say so
       and send people to the view that is, rather than shipping an
       unusable canvas and a WebGL context nobody can drive. */
    .site-stage {
        height: auto;
        min-height: 0;
    }

    #siteCanvas,
    .hud {
        display: none;
    }

    .site-gate {
        position: static;
        backdrop-filter: none;
        padding: calc(var(--unit) * 8) var(--pad-x);
    }

    .site-gate__enter {
        display: none;
    }

    .site-gate__controls {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-gate {
        transition: none;
    }
}
