/* ========================================
   MASTER HEADER - hk3k Unified Header Component
   ======================================== */

/* ========== HEADER BASE ========== */
header {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(13, 27, 42, 0.95);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--cyan-glass-border);
    transition: transform 0.15s linear;
    /* Safe area for notched devices */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

header.scroll-down {
    transform: translateY(-100%);
}

header.scroll-up {
    transform: translateY(0);
}

/* ========== NAV CONTAINER ========== */
nav {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

/* ========== ANIMATED LOGO ========== */
.logo {
    font-size: 1rem;
    font-weight: 800;
    color: var(--vibrant-cyan);
    text-decoration: none;
    letter-spacing: -0.5px;
    text-shadow: var(--shadow-glow-cyan);
    white-space: nowrap;
}

/* Individual letter styling for progressive fill */
.logo .letter {
    display: inline-block;
    color: var(--vibrant-cyan);
    text-shadow: var(--shadow-glow-cyan);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

/* Filled state - alternating purple and white */
.logo .letter.filled-purple {
    color: var(--purple);
    text-shadow: 0 0 15px rgba(167, 139, 250, 0.8);
    animation: letterPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo .letter.filled-white {
    color: var(--white);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    animation: letterPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes letterPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Fully charged logo effect - unified gradient on all letters */
.logo.fully-charged .letter {
    background: linear-gradient(180deg, var(--white) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: letterPulseGradient 2s ease-in-out infinite;
}

@keyframes letterPulseGradient {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 10px rgba(167, 139, 250, 0.5));
    }
    50% {
        filter: brightness(1.5) drop-shadow(0 0 30px rgba(167, 139, 250, 1)) drop-shadow(0 0 40px rgba(255, 255, 255, 0.8));
    }
}

/* Outer glow on fully charged logo */
.logo.fully-charged {
    animation: logoOuterGlow 2s ease-in-out infinite;
}

@keyframes logoOuterGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(167, 139, 250, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(167, 139, 250, 0.8)) drop-shadow(0 0 25px rgba(255, 255, 255, 0.4));
    }
}

/* Logo hover - turn purple in final state */
.logo.fully-charged:hover .letter {
    background: var(--purple);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 10px rgba(167, 139, 250, 0.8));
}

/* ========== CENTERED NAV LINKS ========== */
.nav-links {
    display: flex;
    gap: 1.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.nav-links a {
    color: var(--vibrant-cyan);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.1s linear;
    position: relative;
    padding: 0.25rem 0;
    white-space: nowrap;
}

/* Arcade hover - INSTANT purple glow + underline slide */
.nav-links a:hover {
    color: var(--purple);
    text-shadow: 0 0 10px rgba(167, 139, 250, 0.8);
}

/* Glowing underline - instant slide-in from left */
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--purple);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.8);
    transition: width 0.15s linear;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Active page indicator - always glowing cyan */
.nav-links a.active {
    color: var(--vibrant-cyan);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.nav-links a.active::after {
    width: 100%;
    background: var(--vibrant-cyan);
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.8);
    animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Keyboard focus - WCAG AAA */
.nav-links a:focus {
    outline: 2px dashed #00E5FF;
    outline-offset: 4px;
}

/* ========== CTA BUTTONS ========== */
.cta-buttons {
    display: flex;
    gap: 1rem;
}

header .btn-primary {
    background: rgba(0, 229, 255, 0.05);
    border: 2px solid rgba(0, 229, 255, 0.5);
    color: var(--white);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

header .btn-primary:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--vibrant-cyan);
    color: var(--white);
    box-shadow: 0 0 25px rgba(0, 229, 255, 0.6);
}

/* ========== MOBILE MENU TOGGLE ========== */
.mobile-menu-close {
    display: none;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 2px solid var(--vibrant-cyan);
    color: var(--vibrant-cyan);
    cursor: pointer;
    width: 44px;
    height: 44px;
    padding: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: all 0.15s linear;
}

.mobile-menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--vibrant-cyan);
    transition: all 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ========== BARNABY EASTER EGG MODAL ========== */
#barnaby-modal {
    position: fixed;
    top: -500px;
    left: 20px;
    z-index: 400;
    max-width: 380px;
    width: 380px;
    opacity: 0;
    pointer-events: none;
    transition: top 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55), opacity 0.3s ease-out;
}

#barnaby-modal.unlocked {
    display: block;
}

#barnaby-modal.unlocked.show {
    top: 68px;
    opacity: 1;
    pointer-events: auto;
    animation: arcadeDropGlow 0.6s ease-out;
}

@keyframes arcadeDropGlow {
    0% { filter: brightness(1.5) drop-shadow(0 0 30px rgba(167, 139, 250, 0.8)); }
    50% { filter: brightness(1.3) drop-shadow(0 0 20px rgba(167, 139, 250, 0.6)); }
    100% { filter: brightness(1) drop-shadow(0 0 0 transparent); }
}

.barnaby-modal-content {
    background: rgba(13, 27, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(167, 139, 250, 0.3);
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.barnaby-header {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.barnaby-image-container {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border: 2px solid rgba(167, 139, 250, 0.4);
    overflow: hidden;
    background: rgba(167, 139, 250, 0.05);
}

.barnaby-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.barnaby-quote {
    flex: 1;
    font-size: 0.875rem;
    color: var(--light-grey);
    line-height: 1.5;
    font-style: italic;
}

.unlock-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.unlock-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
    line-height: 1;
}

.unlock-details {
    flex: 1;
}

.unlock-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--purple);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.unlock-description {
    font-size: 0.75rem;
    color: var(--light-grey);
    line-height: 1.4;
}

/* Mode Switch Container */
.mode-switch-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: rgba(167, 139, 250, 0.05);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

.mode-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--light-grey);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mode-label svg {
    width: 20px;
    height: 20px;
    stroke: var(--vibrant-cyan);
    stroke-width: 2;
    fill: none;
}

/* Toggle Switch */
.mode-toggle {
    position: relative;
    width: 60px;
    height: 32px;
    background: rgba(13, 27, 42, 0.8);
    border: 2px solid var(--vibrant-cyan);
    cursor: pointer;
    transition: all 0.15s linear;
    flex-shrink: 0;
}

.mode-toggle:hover {
    border-color: var(--purple);
    box-shadow: 0 0 15px rgba(167, 139, 250, 0.4);
}

.mode-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: var(--vibrant-cyan);
    transition: all 0.15s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.mode-toggle.active .mode-toggle-slider {
    left: calc(100% - 26px);
    background: var(--purple);
    box-shadow: 0 0 10px rgba(167, 139, 250, 0.5);
}

.mode-toggle.active {
    border-color: var(--purple);
}

/* ========== LIGHT SENSITIVITY WARNING MODAL ========== */
#light-sensitivity-warning {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 600;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
}

#light-sensitivity-warning.show {
    display: flex;
}

.warning-modal-content {
    background: rgba(13, 27, 42, 0.98);
    border: 3px solid rgba(239, 68, 68, 0.6);
    max-width: 500px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(239, 68, 68, 0.4);
    animation: warningPulse 2s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% {
        border-color: rgba(239, 68, 68, 0.6);
        box-shadow: 0 20px 60px rgba(239, 68, 68, 0.4);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.9);
        box-shadow: 0 20px 80px rgba(239, 68, 68, 0.6);
    }
}

.warning-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: warningShake 0.5s ease-in-out infinite;
}

@keyframes warningShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.warning-modal-content h2 {
    color: #ef4444;
    font-size: 1.75rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

.warning-modal-content p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.warning-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.warning-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.warning-btn-cancel {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--white);
}

.warning-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

.warning-btn-proceed {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

.warning-btn-proceed:hover {
    background: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
}

/* ========== NITRO MODE ========== */
body.nitro-mode {
    animation: nitroActivate 0.5s ease-out;
}

@keyframes nitroActivate {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5) saturate(1.5); }
    100% { filter: brightness(1.1) saturate(1.3); }
}

/* Ultra-intense button hovers in Nitro Mode */
body.nitro-mode .btn-primary:hover,
body.nitro-mode .btn-secondary:hover {
    transform: translateY(-8px) scale(1.1);
    box-shadow: 0 15px 50px rgba(167, 139, 250, 0.8),
                0 0 60px rgba(6, 182, 212, 0.6),
                inset 0 0 30px rgba(255, 255, 255, 0.3);
    animation: nitroButtonPulse 0.3s ease-in-out infinite alternate;
}

@keyframes nitroButtonPulse {
    0% {
        filter: brightness(1.2) saturate(1.5);
        border-width: 2px;
    }
    100% {
        filter: brightness(1.5) saturate(2);
        border-width: 3px;
    }
}

/* Explosive nav link hovers in Nitro Mode */
body.nitro-mode .nav-links a:hover {
    transform: translateY(-5px) scale(1.15);
    text-shadow: 0 0 30px rgba(6, 182, 212, 1),
                0 0 60px rgba(167, 139, 250, 0.8),
                0 5px 20px rgba(0, 0, 0, 0.5);
    filter: brightness(1.5);
}

/* ========== WAITLIST MODAL ========== */
#waitlist-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
}

#waitlist-modal.active {
    display: flex;
}

.waitlist-modal-content {
    background: linear-gradient(180deg, rgba(13, 27, 42, 0.98) 0%, rgba(13, 27, 42, 0.95) 100%);
    border: 3px solid var(--vibrant-cyan);
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    position: relative;
    box-shadow:
        0 0 40px rgba(0, 229, 255, 0.6),
        0 0 80px rgba(0, 229, 255, 0.4),
        inset 0 0 60px rgba(0, 229, 255, 0.05);
    z-index: 2;
    overflow: hidden;
}

.waitlist-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid var(--vibrant-cyan);
    color: var(--vibrant-cyan);
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s linear;
    z-index: 10;
}

.waitlist-close-btn:hover {
    background: var(--vibrant-cyan);
    color: var(--dark-bg);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.8);
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 768px) {
    /* Prevent horizontal scroll on mobile */
    html, body {
        overflow-x: hidden !important;
        position: relative;
    }

    header, nav, main, section, div {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Mobile menu scroll lock */
    body.mobile-menu-open {
        overflow: hidden;
    }

    .nav-links {
        position: fixed;
        top: 72px;
        left: 0;
        right: 0;
        background: rgba(13, 27, 42, 0.98);
        backdrop-filter: blur(24px);
        border-bottom: 2px solid var(--cyan-glass-border);
        padding: 2rem;
        padding-top: 3.5rem;
        flex-direction: column;
        gap: 1.5rem;
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
        z-index: 1002;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-links li {
        text-align: center;
        border-bottom: 1px solid rgba(0, 229, 255, 0.1);
        padding-bottom: 1rem;
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        font-size: 1.125rem;
        display: block;
        padding: 0.5rem;
        transition: all 0.15s linear;
    }

    .nav-links a:hover {
        color: var(--vibrant-cyan);
        text-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
    }

    /* Close button for mobile menu */
    .mobile-menu-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        background: transparent;
        border: 2px solid var(--vibrant-cyan);
        color: var(--vibrant-cyan);
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        display: none;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        cursor: pointer;
        transition: all 0.15s linear;
        z-index: 1003;
    }

    .mobile-menu-close:hover {
        background: var(--vibrant-cyan);
        color: var(--dark-bg);
        box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
    }

    .nav-links.active .mobile-menu-close {
        display: flex;
    }

    /* Mobile header layout */
    nav {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.75rem;
        padding: 1rem 1.5rem;
    }

    .logo {
        display: flex;
        font-size: 1rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    header .cta-buttons {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
    }

    header .btn-primary {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        white-space: nowrap;
    }

    header .mobile-menu-toggle {
        border: none;
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    /* Mobile waitlist modal */
    #waitlist-modal {
        padding: 0;
    }

    .waitlist-modal-content {
        border: none;
        padding: 2rem 1.5rem;
        max-width: 100%;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .waitlist-modal-content h2 {
        font-size: 1.75rem;
    }

    .waitlist-modal-content p {
        font-size: 0.9rem;
    }

    .waitlist-close-btn {
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }

    /* Mobile Barnaby modal */
    #barnaby-modal {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }

    #barnaby-modal.unlocked.show {
        top: 60px;
    }
}
