/* relativity.quest - Sci-Fi meets Generative */

:root {
    --void: #0a0a0e;
    --dark-matter: #222233;
    --cherenkov: #4488cc;
    --doppler-red: #cc4422;
    --approach-blue: #2244cc;
    --event-horizon: #6622aa;
    --photon-white: #e8e4f0;
    --distant-light: #888898;
    --gravity: 0;
}

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

body {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    color: var(--photon-white);
    background-color: var(--void);
    overflow-x: hidden;
    line-height: 1.8;
    font-size: clamp(0.9rem, 1vw, 1.1rem);
    letter-spacing: 0.01em;
}

h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
}

/* HUD Overlay */
.hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-item {
    position: absolute;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    color: var(--distant-light);
    opacity: 0;
    animation: hudFadeIn 0.5s ease forwards;
}

.hud-tl { top: 1.5rem; left: 1.5rem; animation-delay: 0.3s; }
.hud-tr { top: 1.5rem; right: 1.5rem; animation-delay: 0.45s; }
.hud-bl { bottom: 1.5rem; left: 1.5rem; animation-delay: 0.6s; }

@keyframes hudFadeIn {
    from { opacity: 0; }
    to { opacity: 0.4; }
}

/* Section 1: Light Cone */
#light-cone {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--void);
}

.light-cone-svg {
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    opacity: 0;
    transform: scale(0);
    animation: coneExpand 1s ease-out 0.6s forwards;
}

@keyframes coneExpand {
    from { opacity: 0; transform: scale(0); }
    to { opacity: 1; transform: scale(1); }
}

.cone-text {
    position: absolute;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: var(--photon-white);
    opacity: 0;
    letter-spacing: 0.1em;
}

.future-text {
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    animation: textTypeIn 0.8s ease 1.6s forwards;
}

.past-text {
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    animation: textTypeIn 0.8s ease 1.9s forwards;
}

@keyframes textTypeIn {
    from { opacity: 0; letter-spacing: 0.3em; }
    to { opacity: 0.85; letter-spacing: 0.1em; }
}

/* Section 2: Warped Grid */
#warped-grid {
    min-height: 180vh;
    position: relative;
    background-color: var(--void);
}

#grid-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8vh 6vw;
    padding: 15vh 10vw;
    max-width: 1100px;
    margin: 0 auto;
}

.grid-text-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease, color 0.4s ease;
    color: var(--cherenkov);
}

.grid-text-block.visible {
    opacity: 1;
    transform: translateY(0);
    color: var(--photon-white);
}

.grid-text-block h2 {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    margin-bottom: 0.75rem;
    color: var(--cherenkov);
}

.grid-text-block p {
    line-height: 1.8;
}

/* Section 3: Time Dilation */
#time-dilation {
    min-height: 40vh;
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, var(--doppler-red) 0%, var(--void) 50%, var(--approach-blue) 100%);
    position: relative;
    overflow: hidden;
}

.dilation-band {
    width: 100%;
    height: 30vh;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.dilation-text-track {
    display: flex;
    gap: 2rem;
    white-space: nowrap;
    animation: dilationScroll 15s linear infinite;
}

.dilation-word {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--photon-white);
    opacity: 0.7;
}

@keyframes dilationScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* Section 4: Singularity */
#singularity {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--void);
    position: relative;
    padding: 10vh 5vw;
}

.singularity-content {
    text-align: center;
    max-width: 50ch;
    transition: transform 1s ease, opacity 1s ease;
}

.singularity-heading {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--event-horizon);
    margin-bottom: 1.5rem;
}

.singularity-text {
    color: var(--distant-light);
    line-height: 1.9;
}

.singularity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--photon-white);
    margin-top: 6vh;
    opacity: 0;
    transition: opacity 1s ease;
}

.singularity-dot.visible {
    opacity: 1;
    animation: dotPulse 3s ease-in-out 1;
}

@keyframes dotPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-width: 768px) {
    .grid-content {
        grid-template-columns: 1fr;
        padding: 10vh 6vw;
    }

    .hud-item {
        font-size: 0.6rem;
    }
}

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

    .light-cone-svg,
    .cone-text,
    .hud-item,
    .grid-text-block,
    .singularity-dot {
        opacity: 1 !important;
        transform: none !important;
    }

    .light-cone-svg {
        transform: scale(1) !important;
    }

    .dilation-text-track {
        animation: none;
    }
}
