/* ============================================================
   SPACE RACE — style.css
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --bg:          #05050f;
    --text:        #eeeeff;
    --dim:         rgba(220, 220, 255, 0.45);
    --faint:       rgba(220, 220, 255, 0.18);
    --accent:      #7eb8f7;
    --accent-glow: rgba(126, 184, 247, 0.25);
    --cyan:        #64dfdf;
    --gold:        #ffd166;
    --orange:      #ff9843;
    --silver:      #c8c8d8;
    --purple:      #b89fcf;
    --hud-bg:      rgba(4, 4, 18, 0.82);
    --font-hero:   'Marvel', sans-serif;
    --font-ui:     'Varela Round', sans-serif;
    --timeline-x:  22%;          /* where the vertical timeline sits */
}

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

html { scroll-behavior: auto; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    overflow-x: hidden;
    padding-bottom: 80px;    /* room for HUD */
}

/* ============================================================
   STARFIELD CANVAS
   ============================================================ */
#starfield {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    width: 100vw;
    height: 100vh;
}

/* ============================================================
   ATMOSPHERE OVERLAY
   ============================================================ */
.atmosphere-overlay {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(
        ellipse 120% 60% at 50% 0%,
        rgba(10, 40, 120, 0.55) 0%,
        rgba(5, 15, 60, 0.25) 50%,
        transparent 80%
    );
    transition: opacity 0.05s linear;
}

/* ============================================================
   HERO HEADER
   ============================================================ */
.site-header {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem 6rem;
}

.header-inner {
    text-align: center;
    max-width: 680px;
}

.eyebrow {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 2rem;
}

h1 {
    font-family: var(--font-hero);
    font-size: clamp(4rem, 14vw, 10rem);
    font-weight: 700;
    line-height: 0.88;
    text-transform: uppercase;
    color: #fff;
    text-shadow:
        0 0 60px rgba(126, 184, 247, 0.45),
        0 0 120px rgba(126, 184, 247, 0.2);
    margin-bottom: 1.5rem;
}

.tagline {
    font-family: var(--font-hero);
    font-size: clamp(0.9rem, 2.5vw, 1.4rem);
    font-style: italic;
    color: var(--dim);
    letter-spacing: 0.06em;
    margin-bottom: 3.5rem;
}

.scroll-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--faint);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    animation: float 3s ease-in-out infinite;
}

.scroll-arrow {
    width: 24px;
    height: 36px;
    opacity: 0.6;
}

.scroll-dot {
    animation: scroll-dot 2s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { opacity: 0.6; transform: translateY(0); }
    50%       { opacity: 1;   transform: translateY(8px); }
}

@keyframes scroll-dot {
    0%   { cy: 6; opacity: 1; }
    100% { cy: 22; opacity: 0; }
}

/* ============================================================
   JOURNEY SECTION
   ============================================================ */
#journey {
    position: relative;
    z-index: 10;
    /* height set by JS */
}

/* Vertical timeline line */
.timeline-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--timeline-x);
    width: 1px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.07) 5%,
        rgba(255, 255, 255, 0.07) 95%,
        transparent 100%
    );
    pointer-events: none;
}

/* ============================================================
   MILESTONES
   ============================================================ */
.milestone {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    transform: translateY(-50%);
    pointer-events: none;
    /* Fade in when entering viewport — handled via JS class */
    opacity: 0;
    transition: opacity 0.6s ease;
}

.milestone.visible { opacity: 1; }

/* Distance label (left column) */
.ms-dist {
    width: var(--timeline-x);
    text-align: right;
    padding-right: 1.4rem;
    flex-shrink: 0;
}

.ms-dist-value {
    font-family: var(--font-hero);
    font-size: 1.1rem;
    color: var(--accent);
    display: block;
    line-height: 1.2;
}

.ms-dist-unit {
    font-size: 0.58rem;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Dot on the timeline */
.ms-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.4);
    position: relative;
    z-index: 2;
    transition: transform 0.3s;
}

/* Name + description (right column) */
.ms-info {
    flex: 1;
    padding-left: 1.4rem;
    padding-right: 5%;
}

.ms-name {
    font-family: var(--font-hero);
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.ms-desc {
    font-size: 0.83rem;
    color: var(--dim);
    line-height: 1.6;
    max-width: 400px;
}

/* ---- Zone labels (large background watermarks) ---- */
.zone-label {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: var(--font-hero);
    font-size: clamp(3.5rem, 11vw, 8.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.055);
    transform: translateY(-50%);
    pointer-events: none;
    user-select: none;
    z-index: 1;
    white-space: nowrap;
    overflow: hidden;
    animation: zone-breathe 12s ease-in-out infinite;
}

@keyframes zone-breathe {
    0%, 100% { opacity: 0.65; }
    50%       { opacity: 1;    }
}

/* Date label under distance */
.ms-date {
    display: block;
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    color: var(--faint);
    text-transform: uppercase;
    margin-top: 0.2rem;
}

/* ---- Type-specific colours ---- */

/* atmosphere */
.milestone.t-atmosphere .ms-dot  { background: #88b4d8; width: 5px; height: 5px; }
.milestone.t-atmosphere .ms-name { color: #88b4d8; font-size: 0.85rem; }

/* landmark */
.milestone.t-landmark .ms-dot  { background: #8dd4b4; width: 5px; height: 5px; }
.milestone.t-landmark .ms-name { color: #8dd4b4; }

/* human-made */
.milestone.t-human .ms-dot  { background: var(--cyan); box-shadow: 0 0 8px rgba(100, 223, 223, 0.7); }
.milestone.t-human .ms-name { color: var(--cyan); }

/* key milestone (Kármán line, GEO, Kuiper Belt) */
.milestone.t-milestone .ms-dot  { background: #fff; box-shadow: 0 0 14px rgba(255,255,255,0.8); width: 10px; height: 10px; }
.milestone.t-milestone .ms-name { color: #fff; font-size: 1.1rem; }

/* moon */
.milestone.t-moon .ms-dot  { background: var(--silver); width: 10px; height: 10px; box-shadow: 0 0 12px rgba(200,200,220,0.6); }
.milestone.t-moon .ms-name { color: var(--silver); }

/* planet */
.milestone.t-planet .ms-dot  { background: var(--gold); width: 10px; height: 10px; box-shadow: 0 0 12px rgba(255, 209, 102, 0.6); }
.milestone.t-planet .ms-name { color: var(--gold); }

/* star */
.milestone.t-star .ms-dot  { background: var(--orange); width: 14px; height: 14px; box-shadow: 0 0 20px rgba(255,150,67,0.9), 0 0 50px rgba(255,150,67,0.4); }
.milestone.t-star .ms-name { color: var(--orange); font-size: 1.2rem; }

/* dwarf planet */
.milestone.t-dwarf .ms-dot  { background: var(--purple); width: 8px; height: 8px; box-shadow: 0 0 8px rgba(184,159,207,0.6); }
.milestone.t-dwarf .ms-name { color: var(--purple); }

/* zone */
.milestone.t-zone .ms-dot  { background: rgba(255,255,255,0.2); width: 5px; height: 5px; }
.milestone.t-zone .ms-name { color: var(--faint); font-style: italic; font-size: 0.85rem; }

/* event (asteroid near-misses, meteor explosions) */
.milestone.t-event .ms-dot  { background: #ff8c69; width: 6px; height: 6px; box-shadow: 0 0 8px rgba(255,140,105,0.5); }
.milestone.t-event .ms-name { color: #ff8c69; }

/* fact (gravity percentages, physics notes) */
.milestone.t-fact .ms-dot  { background: rgba(200,200,210,0.3); width: 5px; height: 5px; }
.milestone.t-fact .ms-name { color: rgba(200,200,210,0.5); font-size: 0.82rem; font-style: italic; }

/* ============================================================
   END SECTION
   ============================================================ */
.end-section {
    position: relative;
    z-index: 10;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    text-align: center;
    background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(20,40,100,0.2) 0%, transparent 80%);
}

.end-inner { max-width: 600px; }

.end-title {
    font-family: var(--font-hero);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 400;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
}

.end-credit {
    font-size: 0.68rem;
    color: var(--faint);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 3rem;
}

.end-quote {
    font-family: var(--font-hero);
    font-size: clamp(2rem, 6vw, 4rem);
    font-style: italic;
    color: var(--accent);
    text-shadow: 0 0 40px var(--accent-glow);
    margin-bottom: 1.5rem;
    quotes: none;
}

.end-sub {
    font-size: 1rem;
    color: var(--dim);
    line-height: 1.7;
    margin-bottom: 3.5rem;
}

.end-note {
    font-size: 0.68rem;
    color: var(--faint);
    line-height: 1.6;
}

/* ---- Site credit — vertical on desktop, footer on mobile ---- */
.credit-fixed {
    position: fixed;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%) rotate(180deg);
    writing-mode: vertical-rl;
    font-family: var(--font-ui);
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--faint);
    z-index: 50;
    pointer-events: none;
    user-select: none;
}

.credit-footer {
    display: none;
}

/* ============================================================
   HUD (FIXED BOTTOM BAR)
   ============================================================ */
.hud {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: var(--hud-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(126, 184, 247, 0.12);
}

.hud-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
    gap: 0;
}

.hud-cell {
    flex: 1;
    text-align: center;
    padding: 0 1rem;
}

.hud-label {
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
    margin-bottom: 0.3rem;
}

.hud-value {
    font-family: var(--font-hero);
    font-size: 1.25rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.hud-sep {
    width: 1px;
    height: 28px;
    background: rgba(126, 184, 247, 0.12);
    flex-shrink: 0;
}

/* ============================================================
   ROCKET GUIDE
   ============================================================ */
.rocket-wrap {
    position: fixed;
    left: var(--timeline-x);
    top: 50vh;
    z-index: 60;
    width: 32px;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease;
    /* top is driven by JS — use a short transition so it tracks smoothly */
    will-change: top;
}

.rocket-wrap.active { opacity: 1; }

.rocket-svg {
    width: 32px;
    height: auto;
    filter:
        drop-shadow(0 0 5px rgba(126, 184, 247, 0.8))
        drop-shadow(0 0 14px rgba(126, 184, 247, 0.35));
}

.rocket-flame {
    transform-origin: 14px 46px;
    animation: flame-flicker 0.14s ease-in-out infinite alternate;
}

@keyframes flame-flicker {
    from { transform: scaleY(1)    scaleX(1);    opacity: 0.88; }
    to   { transform: scaleY(1.12) scaleX(0.91); opacity: 1;    }
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0%;
    background: linear-gradient(to right, var(--accent), var(--cyan));
    box-shadow: 0 0 8px var(--accent-glow);
    z-index: 300;
    transition: width 0.12s linear;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    :root { --timeline-x: 30%; }

    .ms-dist-value { font-size: 0.88rem; }
    .ms-name       { font-size: 1.15rem; }
    .ms-desc       { font-size: 0.74rem; max-width: 100%; }

    .hud-cell--hide-sm { display: none; }
    .hud-sep:last-of-type { display: none; }
    .hud-value { font-size: 1rem; }

    /* Credit: hide fixed sidebar, show footer instead */
    .credit-fixed  { display: none; }
    .credit-footer {
        display: block;
        text-align: center;
        padding: 2rem 1rem 3rem;
        font-family: var(--font-ui);
        font-size: 0.62rem;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--faint);
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }
}

@media (max-width: 400px) {
    :root { --timeline-x: 36%; }
    .ms-dist-value { font-size: 0.78rem; }
    .ms-name       { font-size: 1rem; }
}
