/* =============================================
   luminary.dev - Glassmorphic Workshop Aesthetic
   ============================================= */

/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
}

body {
    background: #0A1628;
    color: #E8EDF4;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === Background Grid (Z=2) === */
#bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        linear-gradient(to right, rgba(26, 42, 66, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26, 42, 66, 0.08) 1px, transparent 1px),
        linear-gradient(to right, rgba(42, 58, 82, 0.12) 2px, transparent 2px),
        linear-gradient(to bottom, rgba(42, 58, 82, 0.12) 2px, transparent 2px);
    background-size:
        60px 60px,
        60px 60px,
        300px 300px,
        300px 300px;
    animation: gridDrift 120s linear infinite;
    transition: opacity 1s ease;
}

@keyframes gridDrift {
    0% { background-position: 0 0, 0 0, 0 0, 0 0; }
    100% { background-position: 60px 60px, 60px 60px, 300px 300px, 300px 300px; }
}

/* Grid opacity modulation per room */
body.room-blueprint #bg-grid {
    background:
        linear-gradient(to right, rgba(26, 42, 66, 0.20) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26, 42, 66, 0.20) 1px, transparent 1px),
        linear-gradient(to right, rgba(42, 58, 82, 0.25) 2px, transparent 2px),
        linear-gradient(to bottom, rgba(42, 58, 82, 0.25) 2px, transparent 2px);
    background-size: 60px 60px, 60px 60px, 300px 300px, 300px 300px;
}

body.room-signal #bg-grid {
    background:
        linear-gradient(to right, rgba(26, 42, 66, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26, 42, 66, 0.02) 1px, transparent 1px),
        linear-gradient(to right, rgba(42, 58, 82, 0.03) 2px, transparent 2px),
        linear-gradient(to bottom, rgba(42, 58, 82, 0.03) 2px, transparent 2px);
    background-size: 60px 60px, 60px 60px, 300px 300px, 300px 300px;
}

/* === Ambient Light === */
#ambient-light {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 140%;
    background: radial-gradient(ellipse at center, rgba(255, 179, 71, 0.04) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    transition: opacity 1.5s ease;
}

/* === Scatter Icons (decorative) === */
#scatter-icons {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.06;
}

/* === Horizontal Scroll Container === */
#scroll-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    perspective: 1200px;
    position: relative;
    z-index: 2;
}

#scroll-container::-webkit-scrollbar {
    display: none;
}

/* === Room Base === */
.room {
    min-width: 100vw;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    flex-shrink: 0;
}

.room-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transform-style: preserve-3d;
}

/* === Glassmorphic Panel Base === */
.glass-panel {
    background: rgba(22, 42, 68, 0.55);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    backdrop-filter: blur(24px) saturate(120%);
    border: 1px solid rgba(148, 178, 215, 0.12);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

/* Panel edge highlight (top edge light catch) */
.panel-edge-highlight {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15) 30%, rgba(255, 255, 255, 0.15) 70%, transparent);
    z-index: 10;
}

.panel-edge-highlight-circle {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    z-index: 10;
}

/* Micro-scratch texture */
.panel-scratches {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        15deg,
        transparent,
        transparent 8px,
        rgba(255, 255, 255, 0.005) 8px,
        rgba(255, 255, 255, 0.005) 9px
    );
    pointer-events: none;
    z-index: 5;
}

/* Condensation droplets */
.condensation {
    position: absolute;
    pointer-events: none;
    z-index: 6;
}

.condensation-bl {
    bottom: 12px;
    left: 16px;
    width: 30px;
    height: 30px;
    background:
        radial-gradient(circle at 4px 22px, rgba(255,255,255,0.08) 0%, transparent 3px),
        radial-gradient(circle at 18px 12px, rgba(255,255,255,0.06) 0%, transparent 2px),
        radial-gradient(circle at 8px 8px, rgba(255,255,255,0.07) 0%, transparent 2.5px),
        radial-gradient(circle at 24px 24px, rgba(255,255,255,0.05) 0%, transparent 2px),
        radial-gradient(circle at 14px 26px, rgba(255,255,255,0.06) 0%, transparent 1.5px);
}

.condensation-tr {
    top: 14px;
    right: 18px;
    width: 28px;
    height: 28px;
    background:
        radial-gradient(circle at 6px 6px, rgba(255,255,255,0.07) 0%, transparent 2.5px),
        radial-gradient(circle at 20px 18px, rgba(255,255,255,0.06) 0%, transparent 2px),
        radial-gradient(circle at 12px 22px, rgba(255,255,255,0.08) 0%, transparent 3px),
        radial-gradient(circle at 24px 8px, rgba(255,255,255,0.05) 0%, transparent 2px);
}

/* === Panel Entry Animation === */
.glass-panel {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, -webkit-backdrop-filter 0.6s ease-out, backdrop-filter 0.6s ease-out;
}

.glass-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for panel groups */
.panel-fan-left.visible {
    transition-delay: 0ms;
}
.panel-fan-center.visible {
    transition-delay: 150ms;
}
.panel-fan-right.visible {
    transition-delay: 300ms;
}

/* === ROOM 1: The Lighthouse === */
#room-lighthouse .room-inner {
    justify-content: center;
}

.panel-hero {
    width: min(70vw, 700px);
    height: min(75vh, 600px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    transform: translateY(30px) perspective(1200px) rotateY(2deg);
}

.panel-hero.visible {
    transform: perspective(1200px) rotateY(2deg);
}

/* Lighthouse Container */
.lighthouse-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.lighthouse-svg {
    position: relative;
    z-index: 2;
}

.lighthouse-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle at center, rgba(255, 179, 71, 0.25) 0%, rgba(255, 179, 71, 0.08) 40%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* Lighthouse beam rotation */
.lighthouse-beams {
    transform-origin: 60px 30px;
    animation: beamRotate 8s steps(8, end) infinite;
}

@keyframes beamRotate {
    0% { transform: rotate(0deg); opacity: 0.7; }
    12.5% { transform: rotate(45deg); opacity: 0.5; }
    25% { transform: rotate(90deg); opacity: 0.7; }
    37.5% { transform: rotate(135deg); opacity: 0.5; }
    50% { transform: rotate(180deg); opacity: 0.7; }
    62.5% { transform: rotate(225deg); opacity: 0.5; }
    75% { transform: rotate(270deg); opacity: 0.7; }
    87.5% { transform: rotate(315deg); opacity: 0.5; }
    100% { transform: rotate(360deg); opacity: 0.7; }
}

.hero-title {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.8rem, 5vw, 3.6rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.2;
    color: #E8EDF4;
    text-align: center;
    transform: translateZ(20px);
}

.hero-tagline {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: #6B7D95;
    text-align: center;
    letter-spacing: 0.03em;
    transform: translateZ(20px);
}

/* === ROOM 2: The Workshop === */
#room-workshop .room-inner {
    gap: 0;
    padding: 0 5vw;
}

.panel-fan {
    width: min(30vw, 340px);
    min-height: min(60vh, 480px);
    padding: 2.5rem 2rem;
    position: absolute;
    display: flex;
    flex-direction: column;
}

.panel-fan-left {
    left: 10%;
    z-index: 1;
    transform: translateY(30px) perspective(1200px) rotateY(3deg);
}
.panel-fan-left.visible {
    transform: perspective(1200px) rotateY(3deg);
}

.panel-fan-center {
    left: 50%;
    transform: translateY(30px) translateX(-50%);
    z-index: 3;
}
.panel-fan-center.visible {
    transform: translateX(-50%);
}

.panel-fan-right {
    right: 10%;
    z-index: 1;
    transform: translateY(30px) perspective(1200px) rotateY(-3deg);
}
.panel-fan-right.visible {
    transform: perspective(1200px) rotateY(-3deg);
}

.panel-content {
    position: relative;
    z-index: 8;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transform: translateZ(20px);
}

.section-icon {
    flex-shrink: 0;
}

.panel-heading {
    font-family: 'Share Tech Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.2;
    color: #E8EDF4;
}

.panel-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.88rem, 1.5vw, 1rem);
    line-height: 1.75;
    color: #6B7D95;
    letter-spacing: 0.01em;
}

/* === ROOM 3: The Blueprint === */
#room-blueprint .room-inner {
    justify-content: center;
}

.panel-blueprint {
    width: min(60vw, 560px);
    min-height: min(65vh, 520px);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.panel-blueprint.visible {
    transform: none;
}

.constellation {
    margin-top: 1.5rem;
    position: relative;
}

.constellation-svg {
    max-width: 100%;
    height: auto;
}

.node-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    fill: #6B7D95;
}

.constellation-node {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.constellation-node circle:first-child {
    transition: r 0.3s ease, stroke 0.3s ease, filter 0.3s ease;
}

.constellation-node:hover circle:first-child {
    filter: drop-shadow(0 0 8px rgba(0, 198, 255, 0.5));
}

.constellation-line {
    transition: opacity 0.4s ease, stroke-width 0.4s ease;
}

.constellation-node.node-active circle:first-child {
    filter: drop-shadow(0 0 12px rgba(0, 198, 255, 0.7));
}

/* === ROOM 4: The Signal === */
#room-signal {
    position: relative;
}

#room-signal .room-inner {
    justify-content: center;
    align-items: center;
}

.panel-circle {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(30px);
}

.panel-circle.visible {
    transform: none;
}

.signal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transform: translateZ(20px);
    text-align: center;
    padding: 1.5rem;
}

.signal-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6B7D95;
}

.signal-link {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: #FFB347;
    text-decoration: none;
    letter-spacing: 0.02em;
    position: relative;
    transition: color 0.3s ease;
}

.signal-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 1px;
    background: #FFB347;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.signal-link:hover::after {
    opacity: 1;
}

.signal-link-secondary {
    color: #00C6FF;
}

.signal-link-secondary::after {
    background: #00C6FF;
}

.signal-divider {
    width: 40px;
    height: 1px;
    background: rgba(148, 178, 215, 0.12);
    margin: 0.6rem 0;
}

.signal-lighthouse-glow {
    position: absolute;
    top: 0;
    left: -10%;
    width: 40%;
    height: 100%;
    background: radial-gradient(ellipse at 20% 50%, rgba(255, 179, 71, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 1;
}

/* === Navigation Pill === */
#nav-pill {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    height: 40px;
    padding: 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(22, 42, 68, 0.55);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    z-index: 100;
}

.nav-btn {
    width: 36px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #6B7D95;
    cursor: pointer;
    border-radius: 8px;
    transition: color 0.3s ease, background 0.3s ease;
}

.nav-btn:hover {
    color: #E8EDF4;
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: #00C6FF;
}

.nav-btn svg {
    width: 20px;
    height: 20px;
}

/* === Room Indicator === */
#room-indicator {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(107, 125, 149, 0.4);
    transition: background 0.3s ease, transform 0.3s ease;
}

.indicator-dot.active {
    background: #00C6FF;
    transform: scale(1.3);
}

/* === Focused Panel Glow (Luminary Blue #0088CC) === */
.glass-panel.focused {
    border-color: #0088CC;
    box-shadow: 0 0 30px rgba(0, 136, 204, 0.15), inset 0 0 30px rgba(0, 136, 204, 0.05);
}

/* === Engineering Grid Colors (Blueprint Trace #1A2A42, #2A3A52) === */
.grid-line-thin {
    stroke: #1A2A42;
}
.grid-line-thick {
    stroke: #2A3A52;
}

/* === Loading Orbiter === */
.loading-orbiter {
    width: 24px;
    height: 24px;
    position: relative;
}

.loading-orbiter::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    margin: -2px 0 0 -2px;
    background: #00C6FF;
    border-radius: 50%;
    animation: orbit 2s linear infinite;
}

@keyframes orbit {
    0% { transform: rotate(0deg) translateX(8px) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(8px) rotate(-360deg); }
}

/* === Responsive === */
@media (max-width: 768px) {
    .panel-hero {
        width: 90vw;
        height: auto;
        min-height: 70vh;
        padding: 2rem;
    }

    .panel-fan {
        position: relative;
        width: 80vw;
        min-height: auto;
        left: auto;
        right: auto;
    }

    #room-workshop .room-inner {
        flex-direction: column;
        gap: 1.5rem;
        padding: 2rem;
        overflow-y: auto;
        align-items: center;
    }

    .panel-fan-left,
    .panel-fan-center,
    .panel-fan-right {
        position: relative;
    }

    .panel-fan-left.visible {
        transform: none;
    }
    .panel-fan-center.visible {
        transform: none;
    }
    .panel-fan-right.visible {
        transform: none;
    }

    .panel-blueprint {
        width: 90vw;
    }

    .constellation-svg {
        width: 100%;
        max-width: 320px;
    }

    .panel-circle {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.6rem;
    }

    .panel-heading {
        font-size: 1.1rem;
    }
}
