/* ============================================
   INTERPLANETARY.QUEST — Styles
   Ethereal Blue | Y2K-Futurism | Watercolor
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-space: #080e1a;
    --cosmic-ink: #0f1b2d;
    --stratosphere: #1a3a5c;
    --transmission-cyan: #3d8ec9;
    --nebula-coral: #e8766d;
    --ion-trail: #7ec8e3;
    --frost-white: #e0f0ff;
    --pale-cerulean: #b8d4e8;
    --muted-azure: #6ba3c7;
    --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: var(--deep-space);
    color: var(--pale-cerulean);
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Star Field --- */
.star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    animation: drift 120s linear infinite;
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(-15px, -10px); }
    100% { transform: translate(0, 0); }
}

/* --- Orbital Descent Container --- */
.orbital-descent {
    position: relative;
    perspective: 1200px;
    perspective-origin: 50% 50%;
    z-index: 1;
}

/* --- Layer Base --- */
.layer {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.layer-0 {
    height: 100vh;
    transform: translateZ(0px);
}

.layer-1 {
    height: 100vh;
    transform: translateZ(-100px) scale(1.083);
}

.layer-2 {
    height: 100vh;
    transform: translateZ(-200px) scale(1.167);
}

.layer-3 {
    height: 150vh;
    transform: translateZ(-400px) scale(1.333);
}

.layer-4 {
    height: 100vh;
    transform: translateZ(-600px) scale(1.5);
}

/* --- Nebula Fields (Watercolor CSS Effects) --- */
.nebula-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 3s ease-in;
    z-index: 0;
}

.nebula-field.visible {
    opacity: 1;
}

.nebula-dock {
    background:
        radial-gradient(ellipse at 70% 30%, rgba(61,142,201,0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(126,200,227,0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 50%, rgba(26,58,92,0.3) 0%, transparent 60%);
    filter: blur(50px) saturate(1.3);
}

.nebula-transfer {
    background:
        radial-gradient(ellipse at 23% 34%, rgba(61,142,201,0.3) 0%, transparent 55%),
        radial-gradient(ellipse at 67% 78%, rgba(232,118,109,0.15) 0%, transparent 40%),
        radial-gradient(ellipse at 45% 12%, rgba(126,200,227,0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(26,58,92,0.4) 0%, transparent 45%);
    filter: blur(40px) saturate(1.3);
}

.nebula-gravity {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(232,118,109,0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 20% 60%, rgba(61,142,201,0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 30%, rgba(126,200,227,0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 60% 80%, rgba(26,58,92,0.35) 0%, transparent 55%);
    filter: blur(45px) saturate(1.4);
}

.nebula-deep {
    background:
        radial-gradient(ellipse at 15% 25%, rgba(61,142,201,0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 75%, rgba(126,200,227,0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(15,27,45,0.5) 0%, transparent 70%);
    filter: blur(60px) saturate(1.2);
}

.nebula-frontier {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(26,58,92,0.2) 0%, transparent 30%),
        radial-gradient(ellipse at 30% 40%, rgba(15,27,45,0.6) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 60%, rgba(15,27,45,0.6) 0%, transparent 60%);
    filter: blur(70px) saturate(1.1);
}

/* --- Holographic Sheen Strips --- */
.holographic-sheen {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(232,118,109,0.06) 15%,
        rgba(126,200,227,0.08) 30%,
        rgba(61,142,201,0.06) 45%,
        rgba(232,118,109,0.05) 60%,
        rgba(126,200,227,0.07) 75%,
        rgba(61,142,201,0.04) 90%,
        transparent 100%
    );
    z-index: 10;
    pointer-events: none;
}

/* --- Orbital Rings --- */
.orbital-ring {
    position: absolute;
    border: 1px solid rgba(224,240,255,0.08);
    border-radius: 50%;
    pointer-events: none;
}

.ring-1 {
    width: 600px;
    height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(65deg);
}

.ring-2 {
    width: 450px;
    height: 450px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(65deg) rotateZ(30deg);
    border-color: rgba(61,142,201,0.06);
}

.ring-3 {
    width: 750px;
    height: 750px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(65deg) rotateZ(-15deg);
    border-color: rgba(126,200,227,0.04);
}

/* --- Grid Dots Pattern --- */
.grid-dots {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(61,142,201,0.12) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* ============================================
   LAYER 0 — DOCK
   ============================================ */
.dock-metadata {
    position: absolute;
    top: 10%;
    left: 4%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 5;
    width: 18%;
    min-width: 160px;
}

.meta-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.08em;
    color: var(--muted-azure);
    opacity: 0.7;
    margin-top: 12px;
}

.meta-value {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.72rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--transmission-cyan);
}

.dock-planet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(250px, 40vw, 500px);
    height: clamp(250px, 40vw, 500px);
    z-index: 2;
    opacity: 0;
    animation: planetReveal 3s ease-out 0.5s forwards;
}

@keyframes planetReveal {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    60% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0.15; transform: translate(-50%, -50%) scale(0.95); }
}

.planet-svg {
    width: 100%;
    height: 100%;
}

.dock-designation {
    position: absolute;
    top: 35%;
    right: 8%;
    text-align: right;
    z-index: 5;
}

.designation-prefix {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.72rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--muted-azure);
    margin-bottom: 8px;
}

.designation-name {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: 0.15em;
    line-height: 1.05;
    color: var(--frost-white);
    text-transform: uppercase;
}

.designation-coords {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.72rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--muted-azure);
    margin-top: 12px;
}

/* Mission Patch Badges */
.mission-patch {
    position: absolute;
    opacity: 0;
    z-index: 4;
    pointer-events: none;
}

.patch-layer0 {
    width: 100px;
    height: 100px;
    bottom: 12%;
    left: 8%;
}

.patch-layer1 {
    width: 80px;
    height: 80px;
    top: 8%;
    right: 6%;
}

.patch-layer2 {
    width: 90px;
    height: 90px;
    bottom: 10%;
    right: 10%;
}

.mission-patch.visible {
    animation: patchBounce 0.8s var(--bounce) forwards;
}

@keyframes patchBounce {
    0% {
        opacity: 0;
        transform: scale(0.3) rotate(-360deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ============================================
   LAYER 1 — TRANSFER ORBIT
   ============================================ */
.transfer-panels {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 5% 8%;
    z-index: 5;
    gap: 2%;
}

.transfer-panel {
    position: relative;
    max-width: 340px;
    padding: 32px 28px;
    background: rgba(15,27,45,0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(61,142,201,0.15);
    border-radius: 8px;
    opacity: 0;
    transform: translateY(30px);
}

.panel-1 {
    transform: rotate(2deg) translateY(30px);
    z-index: 3;
}

.panel-2 {
    transform: rotate(-1deg) translateY(30px);
    margin-top: 40px;
    z-index: 4;
}

.panel-3 {
    transform: rotate(0.5deg) translateY(30px);
    z-index: 3;
}

.transfer-panel.bounced {
    opacity: 1;
}

.panel-1.bounced {
    transform: rotate(2deg) translateY(0);
}

.panel-2.bounced {
    transform: rotate(-1deg) translateY(0);
}

.panel-3.bounced {
    transform: rotate(0.5deg) translateY(0);
}

.panel-label {
    display: block;
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    letter-spacing: 0.15em;
    color: var(--transmission-cyan);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.transfer-panel p {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.88rem, 1vw, 1rem);
    line-height: 1.72;
    color: var(--pale-cerulean);
}

/* ============================================
   LAYER 2 — GRAVITY WELL
   ============================================ */
.gravity-planet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(300px, 70vmin, 600px);
    height: clamp(300px, 70vmin, 600px);
    z-index: 1;
}

.target-planet-svg {
    width: 100%;
    height: 100%;
}

.gravity-text-orbit {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    z-index: 5;
    padding: 5%;
}

.orbital-text-block {
    position: absolute;
    max-width: 320px;
    padding: 24px 20px;
    background: rgba(8,14,26,0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(61,142,201,0.1);
    border-radius: 6px;
    opacity: 0;
    transform: translateY(20px);
}

.orbital-text-block.bounced {
    opacity: 1;
    transform: translateY(0);
}

.text-orbit-1 {
    top: 10%;
    left: 5%;
}

.text-orbit-2 {
    bottom: 15%;
    right: 5%;
}

.text-orbit-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px);
}

.text-orbit-3.bounced {
    transform: translate(-50%, -50%) translateY(0);
}

.orbit-label {
    display: block;
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    letter-spacing: 0.15em;
    color: var(--ion-trail);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.orbital-text-block p {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    line-height: 1.72;
    color: var(--pale-cerulean);
}

/* ============================================
   LAYER 3 — DEEP TRANSIT
   ============================================ */
.layer-3 {
    background: var(--deep-space);
}

.data-buoys {
    position: relative;
    width: 100%;
    height: 100%;
}

.data-buoy {
    position: absolute;
    left: var(--bx);
    top: var(--by);
    max-width: 280px;
    padding: 20px 18px;
    background: rgba(15,27,45,0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(61,142,201,0.1);
    border-radius: 4px;
    opacity: 0;
    z-index: 5;
}

.data-buoy.bounced {
    opacity: 1;
}

.buoy-id {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.08em;
    color: var(--transmission-cyan);
    margin-bottom: 10px;
    opacity: 0.8;
}

.data-buoy p {
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: clamp(0.82rem, 0.9vw, 0.9rem);
    line-height: 1.65;
    color: var(--pale-cerulean);
    opacity: 0.85;
}

/* ============================================
   LAYER 4 — FRONTIER
   ============================================ */
.layer-4 {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--deep-space);
}

.frontier-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(61,142,201,0.08) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.frontier-content {
    position: relative;
    z-index: 5;
    text-align: center;
    opacity: 0;
}

.frontier-content.bounced {
    opacity: 1;
}

.frontier-label {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    letter-spacing: 0.15em;
    color: var(--muted-azure);
    opacity: 0.5;
    margin-bottom: 16px;
}

.frontier-domain {
    display: block;
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    letter-spacing: 0.2em;
    color: var(--frost-white);
    text-transform: lowercase;
    opacity: 0.4;
}

.frontier-coords {
    display: block;
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.6rem, 0.7vw, 0.7rem);
    letter-spacing: 0.1em;
    color: var(--muted-azure);
    opacity: 0.3;
    margin-top: 12px;
}

/* --- Bounce Animation Classes --- */
.bounce-target {
    opacity: 0;
}

.bounce-target.bounced {
    animation: bounceEnter 0.7s var(--bounce) forwards;
    animation-delay: var(--delay, 0ms);
}

@keyframes bounceEnter {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    60% {
        opacity: 1;
        transform: translateY(-6px) scale(1.02);
    }
    80% {
        transform: translateY(2px) scale(0.99);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Overrides for panels which have rotation */
.transfer-panel.bounce-target.bounced {
    animation: none;
    transition: opacity 0.7s var(--bounce), transform 0.7s var(--bounce);
    transition-delay: var(--delay, 0ms);
}

.orbital-text-block.bounce-target.bounced {
    animation: none;
    transition: opacity 0.7s var(--bounce), transform 0.7s var(--bounce);
    transition-delay: var(--delay, 0ms);
}

.data-buoy.bounce-target.bounced {
    animation: buoyBounce 0.7s var(--bounce) forwards;
    animation-delay: var(--delay, 0ms);
}

@keyframes buoyBounce {
    0% {
        opacity: 0;
        transform: translate(
            calc(cos(var(--entry-angle, 0deg)) * 50px),
            calc(sin(var(--entry-angle, 0deg)) * 50px)
        ) scale(0.85);
    }
    60% {
        opacity: 1;
        transform: translate(-3px, -3px) scale(1.03);
    }
    100% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

.frontier-content.bounce-target.bounced {
    animation: frontierFade 2s ease-in forwards;
    animation-delay: var(--delay, 0ms);
}

@keyframes frontierFade {
    0% {
        opacity: 0;
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Gravitational Pull Effect --- */
.gravitational {
    transition: transform 0.4s ease-out;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .transfer-panels {
        flex-direction: column;
        padding: 10% 5%;
        gap: 20px;
    }

    .transfer-panel {
        max-width: 100%;
    }

    .panel-1, .panel-2, .panel-3 {
        transform: none;
    }

    .panel-1.bounced, .panel-2.bounced, .panel-3.bounced {
        transform: none;
    }

    .dock-designation {
        right: 5%;
        top: 55%;
    }

    .dock-metadata {
        top: 5%;
        left: 5%;
    }

    .text-orbit-1 {
        position: relative;
        top: auto;
        left: auto;
        margin: 20px 5%;
    }

    .text-orbit-2 {
        position: relative;
        bottom: auto;
        right: auto;
        margin: 20px 5%;
    }

    .text-orbit-3 {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin: 20px 5%;
    }

    .text-orbit-3.bounced {
        transform: none;
    }

    .gravity-text-orbit {
        flex-direction: column;
        padding: 10% 2%;
    }

    .gravity-planet {
        width: clamp(200px, 60vmin, 350px);
        height: clamp(200px, 60vmin, 350px);
        opacity: 0.3;
    }

    .data-buoy {
        position: relative;
        left: auto;
        top: auto;
        max-width: 90%;
        margin: 15px auto;
    }

    .data-buoys {
        display: flex;
        flex-direction: column;
        padding: 10% 5%;
    }

    .orbital-ring {
        display: none;
    }
}
