:root {
    --bg-color: #050505;
    --accent-color: #00f2ff;
    --text-color: #ffffff;
}

body, html {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    transition: background-color 0.8s ease; 
    -webkit-overflow-scrolling: touch;
}

#world {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100vh;
    perspective: 1000px;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    will-change: transform, opacity;
    pointer-events: none; /* Lets touch swipe pass through */
}

.section {
    position: absolute; width: 90%; max-width: 800px;
    text-align: center;
    visibility: hidden; 
    will-change: transform, opacity;
    pointer-events: auto; 
    touch-action: pan-y;
    z-index: 10; /* THE FIX: Forces cards in front of the rocket */
    
    /* Optional: Add a dark glass background to the section so it actually hides the rocket */
    background: rgba(5, 5, 5, 0.8);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(0, 242, 255, 0.1);
}

h1 { font-size: clamp(3rem, 10vw, 6rem); font-weight: 900; margin: 0; text-transform: uppercase; }
h2 { font-size: clamp(2rem, 5vw, 4rem); margin-bottom: 10px; }
.sub-text { font-size: 1.2rem; color: var(--accent-color); letter-spacing: 5px; }

/* The Glitch Effect */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
    content: attr(data-text);
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
}
.glitch::before {
    left: 2px; text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}
.glitch::after {
    left: -2px; text-shadow: -2px 0 #00fff9;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(10px, 9999px, 31px, 0); transform: skew(0.5deg); }
    5% { clip: rect(70px, 9999px, 12px, 0); transform: skew(0.1deg); }
    10% { clip: rect(30px, 9999px, 80px, 0); transform: skew(0.8deg); }
    15% { clip: rect(90px, 9999px, 45px, 0); transform: skew(0.2deg); }
    20% { clip: rect(0px, 0px, 0px, 0px); } 
    100% { clip: rect(0px, 0px, 0px, 0px); }
}
@keyframes glitch-anim2 {
    0% { clip: rect(65px, 9999px, 100px, 0); transform: skew(0.2deg); }
    5% { clip: rect(20px, 9999px, 60px, 0); transform: skew(0.6deg); }
    10% { clip: rect(80px, 9999px, 20px, 0); transform: skew(0.1deg); }
    15% { clip: rect(10px, 9999px, 90px, 0); transform: skew(0.9deg); }
    20% { clip: rect(0px, 0px, 0px, 0px); }
    100% { clip: rect(0px, 0px, 0px, 0px); }
}

/* Particles */
#ambient-particles {
    position: fixed; 
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 9999; /* Absolute top layer */
    pointer-events: none; /* Let mouse clicks pass through to the text/links below */
    overflow: hidden;
    mix-blend-mode: screen; /* Forces the cyan glow to pop over dark backgrounds */
}

.ambient-particle {
    position: absolute;
    background: #00f2ff; /* Hardcoded cyan to ensure color rendering */
    border-radius: 50%;
    box-shadow: 0 0 12px 2px rgba(0, 242, 255, 1); /* Maximum glow intensity */
    will-change: transform, opacity;
}

/* Utilities */
.project-img { 
    width: 100%; height: 250px; background: #222; 
    border: 1px solid var(--accent-color); border-radius: 10px; 
    display: flex; align-items: center; justify-content: center; margin-top: 20px; 
}

#progress { 
    position: fixed; top: 0; left: 0; height: 3px; 
    background: var(--accent-color); width: 0%; z-index: 999; 
}

.interactive-project { cursor: pointer; transition: transform 0.2s ease; }
.interactive-project:active { transform: scale(0.95); }

/* Hyperdrive Flash Screen */
#hyperdrive-flash {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background-color: #ffffff; z-index: 9999; opacity: 0;
    pointer-events: none; will-change: opacity;
}

/* ==========================================
   THE ROCKET SHIP
   ========================================== */
#rocket-ship {
    position: fixed;
    bottom: 5%; 
    left: calc(50% - 30px); /* THE FIX: Perfect centering without transforms */
    width: 60px;
    height: 60px;
    z-index: 500; 
    filter: drop-shadow(0 0 15px rgba(0, 242, 255, 0.6));
    will-change: transform;
    transform-origin: center center;
    cursor: grab;
    pointer-events: auto; 
}

#rocket-ship:active {
    cursor: grabbing;
}

#rocket-flame {
    transform-origin: top center;
    /* The idle flicker */
    animation: flicker 0.1s infinite alternate; 
}

@keyframes flicker {
    0% { transform: scaleY(0.8); opacity: 0.8; }
    100% { transform: scaleY(1.2); opacity: 1; }
}

/* ==========================================
   GLOBAL THEME VARIABLES
   ========================================== */
:root {
    --primary-neon: #00f2ff; /* Default Cyan */
    --bg-glow: rgba(0, 242, 255, 0.1);
}

/* NIGHTMARE MODE OVERRIDES */
body.nightmare-mode {
    --primary-neon: #ff0055; /* Aggressive Red */
    --bg-glow: rgba(255, 0, 85, 0.1);
}

body.nightmare-mode .digital-grid {
    background-image: linear-gradient(var(--bg-glow) 1px, transparent 1px), linear-gradient(90deg, var(--bg-glow) 1px, transparent 1px);
}

/* ==========================================
   CUSTOM CROSSHAIR CURSOR
   ========================================== */
/* Hide the default mouse pointer everywhere */
* { cursor: none !important; }

#cursor-dot {
    position: fixed; top: 0; left: 0; width: 6px; height: 6px;
    background: var(--primary-neon); border-radius: 50%;
    pointer-events: none; z-index: 9999;
    transform: translate(-50%, -50%);
    transition: background 0.3s ease;
}

#cursor-ring {
    position: fixed; top: 0; left: 0; width: 30px; height: 30px;
    border: 1px solid var(--primary-neon); border-radius: 50%;
    pointer-events: none; z-index: 9998;
    transform: translate(-50%, -50%);
    transition: border-color 0.3s ease, width 0.2s, height 0.2s;
}



/* ==========================================
   TACTICAL RESUME BUTTON
   ========================================== */
.resume-btn {
    border: 1px solid var(--primary-neon);
    color: var(--primary-neon);
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    text-decoration: none;
    font-family: monospace;
    font-size: 0.9rem;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px); /* Gives it that glass UI feel */
    cursor: none; /* Keeps your custom cursor active */
}

/* The Hover State: Inverts the colors and makes it glow */
.resume-btn:hover {
    background: var(--primary-neon);
    color: #000;
    box-shadow: 0 0 20px var(--primary-neon);
}

/* If Nightmare Mode is active, the button automatically turns Crimson Red! */
body.nightmare-mode .resume-btn {
    border-color: #ff0055;
    color: #ff0055;
}
body.nightmare-mode .resume-btn:hover {
    background: #ff0055;
    color: #fff;
    box-shadow: 0 0 20px #ff0055;
}

/* ==========================================
   SOUND TOGGLE BUTTON
   ========================================== */
.sound-btn {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    color: var(--primary-neon);
    border: 1px solid rgba(0, 242, 255, 0.45);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    backdrop-filter: blur(10px);
    cursor: none;
    transition: background 0.25s ease, box-shadow 0.25s ease, color 0.25s ease, transform 0.15s ease;
}
body.nightmare-mode .sound-btn { border-color: rgba(255, 0, 85, 0.5); }
.sound-btn:hover { box-shadow: 0 0 16px var(--bg-glow); }
.sound-btn:active { transform: scale(0.92); }

.sound-ico {
    width: 22px;
    height: 22px;
    display: block;
}
.sound-ico .spk { fill: currentColor; }
.sound-ico .wave {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}
.sound-ico .mute {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* OFF state: speaker + mute slash, no waves */
.sound-btn .wave { display: none; }
.sound-btn .mute { display: inline; }

/* ON state: filled accent, speaker + waves, no slash */
.sound-btn.sound-on {
    background: var(--primary-neon);
    color: #000;
    border-color: var(--primary-neon);
    box-shadow: 0 0 18px var(--primary-neon);
}
.sound-btn.sound-on .wave { display: inline; }
.sound-btn.sound-on .mute { display: none; }

/* Keep the top nav from overflowing on phones so the toggle stays tappable */
@media (max-width: 600px) {
    .top-nav { padding: 14px 16px !important; }
    .nav-brand { font-size: 0.95rem !important; }
    .nav-actions { gap: 8px !important; }
    .resume-btn { padding: 9px 12px; font-size: 0.72rem; letter-spacing: 0; }
    .sound-btn { width: 42px; height: 42px; }
}

/* ==========================================
   SECTION MINIMAP RAIL (wayfinding)
   ========================================== */
#section-rail {
    position: fixed;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1500;
    display: flex;
    flex-direction: column;
    gap: 9px;
    pointer-events: auto;
}
.rail-dot {
    --dot-accent: #00f2ff;
    position: relative;
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--dot-accent);
    background: transparent;
    cursor: none;
    opacity: 0.45;
    transition: opacity 0.25s, transform 0.25s, box-shadow 0.25s;
}
.rail-dot:hover { opacity: 1; transform: scale(1.3); }
.rail-dot.active {
    opacity: 1;
    background: var(--dot-accent);
    box-shadow: 0 0 10px var(--dot-accent);
    transform: scale(1.25);
}
.rail-tip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translate(6px, -50%);
    margin-right: 10px;
    padding: 4px 8px;
    background: rgba(5, 8, 16, 0.9);
    border: 1px solid var(--dot-accent);
    border-radius: 4px;
    color: var(--dot-accent);
    font-family: monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    white-space: nowrap;
    text-transform: uppercase;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.rail-dot:hover .rail-tip { opacity: 1; transform: translate(0, -50%); }

/* ==========================================
   ROCKET EXHAUST TRAIL
   ========================================== */
.rocket-trail {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 450;
    will-change: transform, opacity;
}

/* ==========================================
   LIVE TERMINAL CARET
   ========================================== */
.term-caret {
    display: inline-block;
    width: 7px;
    height: 0.95em;
    margin-left: 4px;
    vertical-align: text-bottom;
    background: currentColor;
    animation: caretBlink 1.05s steps(1) infinite;
}
@keyframes caretBlink {
    0%, 50% { opacity: 1; }
    50.01%, 100% { opacity: 0; }
}

/* ==========================================
   CONTACT / CTA SECTION
   ========================================== */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}
.contact-links a {
    font-family: monospace;
    font-size: 0.85rem;
    letter-spacing: 1px;
    color: #00f2ff;
    border: 1px solid rgba(0, 242, 255, 0.5);
    border-radius: 4px;
    padding: 10px 18px;
    text-decoration: none;
    background: rgba(0, 242, 255, 0.05);
    cursor: none;
    transition: all 0.25s ease;
}
.contact-links a:hover {
    background: #00f2ff;
    color: #000;
    box-shadow: 0 0 18px rgba(0, 242, 255, 0.5);
}

/* ==========================================
   REDUCED MOTION (accessibility)
   - JS swaps the 3D fly for an opacity crossfade and skips the rocket;
     here we silence the decorative loops and hide motion-only chrome.
   ========================================== */
body.reduced-motion #rocket-ship { display: none; }

@media (prefers-reduced-motion: reduce) {
    .glitch::before,
    .glitch::after,
    #rocket-flame,
    .digital-grid,
    .term-caret,
    .ambient-particle {
        animation: none !important;
    }
    #rocket-ship { display: none; }
    html { scroll-behavior: auto !important; }
}

/* ==========================================
   MINIMAP — hide on small screens to avoid overlapping cards
   ========================================== */
@media (max-width: 700px) {
    #section-rail { display: none; }
}
