/* lrx.sh — Pixel-Art Orbital Relay Station */

:root {
    --kiln-ember: #C4724B;
    --fired-clay: #D4845A;
    --sunbaked-dust: #E8A878;
    --desert-glass: #F5D6B8;
    --reactor-amber: #FFB347;
    --station-hull: #1A110D;
    --bulkhead-shadow: #2A1D15;
    --atmosphere-haze: #3D2B1F;
    --viewport-fog: #0F0A07;
    --relay-active: #7ECFC0;
    --signal-echo: #5BA89A;
    --flare-core: #FFF4E0;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    color: var(--desert-glass);
    background: var(--station-hull);
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
}

/* ---- Scan lines overlay ---- */
.scan-lines {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(196, 114, 75, 0.03) 3px,
        rgba(196, 114, 75, 0.03) 4px
    );
}

/* ============ HUD FRAME ============ */
.hud-frame {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
}

/* Corner brackets */
.hud-corner {
    position: absolute;
    width: 60px;
    height: 60px;
}

.hud-bracket {
    position: absolute;
    display: block;
}

.hud-bracket::before,
.hud-bracket::after {
    content: '';
    position: absolute;
    background: var(--kiln-ember);
    opacity: 0.6;
}

.hud-tl { top: 20px; left: 20px; }
.hud-tl .hud-bracket::before { top: 0; left: 0; width: 40px; height: 2px; }
.hud-tl .hud-bracket::after { top: 0; left: 0; width: 2px; height: 40px; }

.hud-tr { top: 20px; right: 20px; }
.hud-tr .hud-bracket::before { top: 0; right: 0; width: 40px; height: 2px; }
.hud-tr .hud-bracket::after { top: 0; right: 0; width: 2px; height: 40px; }

.hud-bl { bottom: 20px; left: 20px; }
.hud-bl .hud-bracket::before { bottom: 0; left: 0; width: 40px; height: 2px; }
.hud-bl .hud-bracket::after { bottom: 0; left: 0; width: 2px; height: 40px; }

.hud-br { bottom: 20px; right: 20px; }
.hud-br .hud-bracket::before { bottom: 0; right: 0; width: 40px; height: 2px; }
.hud-br .hud-bracket::after { bottom: 0; right: 0; width: 2px; height: 40px; }

/* HUD labels */
.hud-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    opacity: 0.4;
    position: absolute;
}

.hud-tl .hud-label { top: 44px; left: 0; }
.hud-tr .hud-label { top: 44px; right: 0; }
.hud-bl .hud-label { bottom: 44px; left: 0; }
.hud-br .hud-label { bottom: 44px; right: 0; }

/* HUD indicators (blinking) */
.hud-indicator {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--reactor-amber);
    image-rendering: pixelated;
}

.hud-indicator-tl { top: 4px; left: 44px; animation: hudBlink 3s ease-in-out infinite; }
.hud-indicator-tr { top: 4px; right: 44px; animation: hudBlink 3s ease-in-out 0.75s infinite; }
.hud-indicator-br { bottom: 4px; right: 44px; animation: hudBlink 3s ease-in-out 1.5s infinite; }
.hud-indicator-bl { bottom: 4px; left: 44px; animation: hudBlink 3s ease-in-out 2.25s infinite; }

@keyframes hudBlink {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

/* Depth gauge */
.depth-gauge {
    position: absolute;
    top: 50%;
    left: 28px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.depth-mark {
    width: 8px;
    height: 8px;
    border: 1px solid var(--kiln-ember);
    opacity: 0.5;
    image-rendering: pixelated;
    cursor: pointer;
    pointer-events: auto;
}

.depth-mark.depth-active {
    background: var(--reactor-amber);
    border-color: var(--reactor-amber);
    opacity: 1;
    animation: hudBlink 3s ease-in-out infinite;
}

.depth-mark.depth-visited {
    background: var(--fired-clay);
    border-color: var(--fired-clay);
    opacity: 0.8;
}

/* Data ticker */
.data-ticker {
    position: absolute;
    bottom: 28px;
    right: 90px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    opacity: 0.5;
}

/* ============ LENS FLARE ============ */
.lens-flare {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    mix-blend-mode: screen;
}

.flare-core {
    position: absolute;
    top: 15vh;
    right: 20vw;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(255, 244, 224, 0.25) 0%, transparent 8%),
        radial-gradient(circle at center, rgba(232, 168, 120, 0.15) 0%, transparent 25%),
        radial-gradient(circle at center, rgba(196, 114, 75, 0.06) 0%, transparent 50%);
    animation: flareDrift 45s ease-in-out infinite;
}

@keyframes flareDrift {
    0%   { transform: translate(0, 0) scale(1); opacity: 0.9; }
    25%  { transform: translate(-15px, 10px) scale(1.05); opacity: 0.85; }
    50%  { transform: translate(10px, -8px) scale(0.95); opacity: 0.95; }
    75%  { transform: translate(-5px, -15px) scale(1.02); opacity: 0.88; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.9; }
}

.flare-spot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(255, 179, 71, 0.15) 0%, transparent 70%);
    mix-blend-mode: screen;
    animation: flareDrift 45s ease-in-out infinite;
}

.fs-1 { top: 25vh; right: 30vw; width: 80px; height: 80px; animation-delay: -5s; }
.fs-2 { top: 35vh; right: 40vw; width: 50px; height: 50px; animation-delay: -12s; }
.fs-3 { top: 45vh; left: 40vw; width: 120px; height: 120px; animation-delay: -20s; opacity: 0.6; }
.fs-4 { top: 55vh; left: 30vw; width: 40px; height: 40px; animation-delay: -30s; }

/* ============ STATION (Main scroll container) ============ */
.station {
    scroll-snap-type: y proximity;
    height: 100vh;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* ---- Decks ---- */
.deck {
    min-height: 100vh;
    scroll-snap-align: start;
    display: grid;
    place-items: center;
    padding: clamp(4rem, 8vw, 6rem) clamp(2rem, 6vw, 8rem);
    position: relative;
}

/* ---- Deck content (blur-focus) ---- */
.deck-content {
    max-width: 680px;
    text-align: center;
}

[data-deck-reveal] {
    filter: blur(6px);
    opacity: 0.7;
    transition: filter 2s ease-out, opacity 1.5s ease-out;
}

[data-deck-reveal].in-view {
    filter: blur(0);
    opacity: 1;
}

/* ---- Deck elements ---- */
.deck-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    opacity: 0.6;
    display: block;
    margin-bottom: 2rem;
}

.deck-heading {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 4vw, 3rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    margin-bottom: 1.5rem;
}

.deck-body {
    font-size: clamp(1rem, 1.2vw + 0.6rem, 1.25rem);
    line-height: 1.75;
    color: var(--desert-glass);
    margin-bottom: 1.5rem;
}

/* ============ DECK 01: BRIDGE ============ */
.deck-bridge {
    background: radial-gradient(ellipse at 80% 20%, var(--atmosphere-haze) 0%, var(--station-hull) 60%);
}

.bridge-title {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: clamp(3rem, 10vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    margin-bottom: 1.5rem;
}

.bridge-log {
    font-size: clamp(1rem, 1.2vw + 0.6rem, 1.25rem);
    line-height: 1.75;
    color: var(--desert-glass);
    max-width: 500px;
    margin: 0 auto;
}

/* ============ DECK 02: COMMS ============ */
.deck-comms {
    background: var(--station-hull);
}

.signal-rings {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
    position: relative;
    height: 120px;
}

.signal-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--kiln-ember);
    opacity: 0;
    transform: scale(0);
}

.signal-ring.animate {
    animation: ringExpand 2s ease-out forwards;
}

.sr-1 { width: 30px; height: 30px; border-color: var(--reactor-amber); }
.sr-2 { width: 60px; height: 60px; border-color: var(--kiln-ember); }
.sr-3 { width: 90px; height: 90px; border-color: var(--fired-clay); opacity: 0.6; }
.sr-4 { width: 120px; height: 120px; border-color: var(--fired-clay); opacity: 0.4; }

.sr-1.animate { animation-delay: 0s; }
.sr-2.animate { animation-delay: 0.3s; }
.sr-3.animate { animation-delay: 0.6s; }
.sr-4.animate { animation-delay: 0.9s; }

@keyframes ringExpand {
    0%   { transform: scale(0); opacity: 0; }
    60%  { opacity: 0.8; }
    100% { transform: scale(1); opacity: 0.4; }
}

/* ============ DECK 03: LOGS ============ */
.deck-logs {
    background: var(--bulkhead-shadow);
}

.log-entry {
    text-align: left;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 2px solid var(--kiln-ember);
    opacity: 0;
    filter: blur(3px);
    transition: opacity 1s ease-out, filter 1s ease-out;
}

.log-entry.log-visible {
    opacity: 1;
    filter: blur(0);
}

.log-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--relay-active);
    display: block;
    margin-bottom: 0.25rem;
}

.log-text {
    font-size: 0.95rem;
    color: var(--desert-glass);
    line-height: 1.6;
}

/* ============ DECK 04: CORE ============ */
.deck-core {
    background: var(--station-hull);
}

.relay-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 2rem auto;
}

.diagram-pixel {
    image-rendering: pixelated;
}

.dp-antenna {
    width: 8px;
    height: 40px;
    background: var(--kiln-ember);
    box-shadow:
        -16px 8px 0 0 var(--sunbaked-dust),
        16px 8px 0 0 var(--sunbaked-dust),
        -8px 4px 0 0 var(--fired-clay),
        8px 4px 0 0 var(--fired-clay);
}

.dp-body {
    width: 48px;
    height: 32px;
    background: var(--fired-clay);
    box-shadow:
        -8px 0 0 0 var(--kiln-ember),
        8px 0 0 0 var(--kiln-ember),
        0 -8px 0 0 var(--sunbaked-dust);
}

.dp-base {
    width: 64px;
    height: 16px;
    background: var(--kiln-ember);
    box-shadow:
        -8px 8px 0 0 var(--atmosphere-haze),
        8px 8px 0 0 var(--atmosphere-haze);
}

/* ============ DECK 05: ENGINE ============ */
.deck-engine {
    background: var(--viewport-fog);
}

.deck-engine .scan-lines-bright {
    opacity: 0.06;
}

.reactor-core {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 2rem auto;
}

.reactor-pixel {
    position: absolute;
    image-rendering: pixelated;
}

.rp-center {
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    margin: -4px 0 0 -4px;
    animation: reactorPulse 2s ease-in-out infinite;
}

@keyframes reactorPulse {
    0%, 100% { background: var(--reactor-amber); box-shadow: 0 0 8px var(--reactor-amber); }
    50% { background: var(--flare-core); box-shadow: 0 0 16px var(--flare-core); }
}

.rp-ring {
    border-radius: 50%;
    border: 2px solid var(--sunbaked-dust);
    opacity: 0.4;
    animation: reactorRing 2s ease-in-out infinite;
}

.rp-1 { top: 50%; left: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; animation-delay: 0.2s; }
.rp-2 { top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; animation-delay: 0.4s; }
.rp-3 { top: 50%; left: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; animation-delay: 0.6s; }
.rp-4 { top: 50%; left: 50%; width: 72px; height: 72px; margin: -36px 0 0 -36px; animation-delay: 0.8s; }

@keyframes reactorRing {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ============ DECK 06: THE DEEP ============ */
.deck-deep {
    background: var(--viewport-fog);
}

.deep-message {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--desert-glass);
    margin-bottom: 2rem;
}

.end-transmission {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kiln-ember);
    opacity: 0.3;
    animation: endPulse 4s ease-in-out 1;
}

@keyframes endPulse {
    0% { opacity: 0; }
    30% { opacity: 0.8; }
    100% { opacity: 0.3; }
}

/* Scan line transition between decks */
.deck::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--fired-clay), transparent);
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.deck.deck-active::after {
    opacity: 0.6;
}

/* ---- Mobile ---- */
@media (max-width: 767px) {
    .hud-corner {
        width: 40px;
        height: 40px;
    }

    .hud-bracket::before { width: 24px !important; }
    .hud-bracket::after { height: 24px !important; }

    .hud-label { display: none; }

    .depth-gauge { display: none; }

    .data-ticker { display: none; }

    .flare-core { width: 200px; height: 200px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    [data-deck-reveal] {
        filter: blur(0);
        opacity: 1;
    }

    .log-entry {
        opacity: 1;
        filter: blur(0);
    }

    .signal-ring {
        opacity: 0.4;
        transform: scale(1);
    }

    .flare-core {
        animation: none;
    }

    .flare-spot {
        animation: none;
    }

    .hud-indicator {
        animation: none;
        opacity: 0.5;
    }

    .depth-mark.depth-active {
        animation: none;
    }

    .rp-center {
        animation: none;
        background: var(--reactor-amber);
    }

    .rp-ring {
        animation: none;
        opacity: 0.5;
    }

    .end-transmission {
        animation: none;
        opacity: 0.3;
    }
}
