/**
 * LCARS HEADER CSS
 * Banner, navigation, and site header components
 * Based on TNG LCARS (1987-1994) and SNW LCARS (2022+)
 *
 * @version 1.0
 * @date 2025-12-29
 */

/* ============================================
   SITE HEADER
   ============================================ */

.site-header {
    position: absolute; /* Changed from fixed to allow relative stacking of children */
    top: 0;
    left: 0;
    width: 100%;
    z-index: auto; /* Let children determine their own z-index relative to body */
    background: transparent;
    pointer-events: none;
}

.site-header > * {
    pointer-events: auto;
}

/* ============================================
   HEADER BANNER
   ============================================ */

.header-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    margin-bottom: 0;
    height: 600px; /* All banners are now 600px for consistency */
    background: #000000;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1; /* Match .stf-banner for layering */
}

/* STF Banner - Viewscreen Mode */
/* Solution 1: Fixed banner for LCARS consistency across all pages */
/* All banners are now 600px for consistency */
.stf-banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 600px;
    overflow: hidden;
    background: #000;
    margin: 0;
    margin-bottom: 0;
    border-bottom: 5px solid #000;
    z-index: 1; /* Lowest layer - the "Environment" backdrop */
}

.stf-banner .tactical-overlay {
    z-index: 5; /* Above banner image (z-index 1) */
}

.stf-banner::before {
    display: none;
}

.stf-banner-image {
    position: fixed;
    width: 100%;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

/* Force the banner image to maintain proper display */
.stf-banner-image img,
.stf-banner-image picture {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Maintains aspect ratio */
    object-position: 65% 10% !important; /* Shifts ship's focal point much higher in frame */
    display: block;
}

/* LCARS Overlay */
.stf-banner .lcars-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 12px 1fr;
    pointer-events: none;
    font-family: var(--lcars-font);
    text-transform: uppercase;
    z-index: 10; /* Above banner image (z-index 1) */
}

/* Left LCARS Vertical Bar */
.stf-banner-image .lcars-left-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background: rgba(255, 153, 0, 0.85);
    border-radius: 0 0 0 18px;
}

/* Top LCARS Rule */
.stf-banner .lcars-overlay .lcars-top-rule {
    position: absolute;
    top: 0;
    left: 12px;
    width: 35%;
    height: 5px;
    background: rgba(255, 153, 0, 0.75);
}

/* Section Title */
.stf-banner .lcars-overlay .lcars-title {
    position: absolute;
    bottom: 42px;
    left: 26px;
    font-family: var(--lcars-font);
    font-size: 22px;
    letter-spacing: 0.15em;
    color: #ffd24d;
    background: none;
    padding: 0;
    border-radius: 0;
    text-shadow: 0 0 6px rgba(255, 210, 77, 0.35);
}

/* Blips (optional decorative elements) */
.stf-banner .lcars-blips {
    position: absolute;
    right: 40px;
    bottom: 40px;
    display: flex;
    gap: 8px;
}

.stf-banner .lcars-blips::before,
.stf-banner .lcars-blips::after {
    content: "";
    width: 12px;
    height: 12px;
    background: var(--lcars-orange);
    border-radius: 50%;
    opacity: 0.6;
}

/* Right Bracket (optional) */
.stf-banner .lcars-right-bracket {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 60px;
    border: 3px solid var(--lcars-orange);
    border-left: none;
    border-radius: 0 15px 15px 0;
    opacity: 0.6;
}

/* Join Banner Video */
.banner-video {
    position: relative;
    width: 100%;
    height: 600px;
    overflow: hidden;
    background: #000000;
}

.banner-video-el {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-video .lcars-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
}

.banner-video .lcars-text {
    font-family: var(--lcars-font);
    color: var(--lcars-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
}

.banner-video .lcars-text h1 {
    margin: 0;
    font-size: 2rem;
}

.banner-video .lcars-text p {
    margin: 6px 0 0;
    font-size: 1rem;
    color: var(--lcars-blue);
    text-transform: none;
    letter-spacing: 1px;
}

/* ============================================
   DESKTOP NAVIGATION - STICKY BLUR MENU
   ============================================ */

/* Global Sticky Blur Navigation - Solution 1 */
.lcars-nav {
    position: relative; /* Changed from fixed top: 600px to avoid breaking other pages */
    width: 100%;
    z-index: 9998;
    
    /* Glassmorphism Blur Effect */
    background: var(--lcars-glass-bg);
    backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
    -webkit-backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
    border-bottom: 2px solid var(--lcars-orange);
    
    /* Layout */
    display: flex;
    margin-top: 0;
    padding: 15px 20px;
    padding-left: 0;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Homepage-specific override to hide old nav */
body.page-home .lcars-nav {
    display: none !important;
}

/* Hide mobile nav on desktop to prevent duplicate navigation */
@media (min-width: 1025px) {
    .mobile-nav-container {
        display: none !important;
    }
}

.nav-group {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Stadium-Shaped Navigation Buttons */
.nav-item {
    display: inline-block;
    padding: 6px 20px;
    margin: 2px;
    font-family: var(--lcars-font);
    font-size: var(--font-size-button);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-decoration: none;
    color: var(--lcars-text-on-orange);
    background: var(--lcars-orange);
    border-radius: 20px;
    transition: filter var(--transition-base) var(--easing);
    white-space: nowrap;
}

.nav-item:hover {
    filter: brightness(0.85);
    transition-delay: var(--transition-fast);
}

.nav-item:active {
    filter: brightness(0.7);
}

.nav-item.active {
    background: var(--lcars-gold);
    font-weight: bold;
}

/* Color Variants */
.nav-group.command .nav-item {
    background: var(--lcars-orange);
    color: var(--lcars-text-on-orange);
}

.nav-group.science .nav-item {
    background: var(--lcars-blue);
    color: var(--lcars-text-on-blue);
}

.nav-group.operations .nav-item {
    background: var(--lcars-gold);
    color: var(--lcars-text-on-orange);
}

.nav-item.highlight {
    background: var(--lcars-pink);
    font-weight: bold;
}

.nav-item.external::after {
    content: " ↗";
    font-size: 0.9em;
}

/* Nav Brackets - Hidden (decorative elements causing visual issues) */
.nav-bracket-top,
.nav-bracket-bottom {
    display: none;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

.mobile-nav-container {
    display: none;
}

/* Removed .nav-toggle - now using button with class-based state */

/* Global Sticky Blur Navigation - Mobile */
@media (max-width: 1024px) {
    /* Show Mobile Menu, Hide Desktop Nav */
    .mobile-nav-container {
        display: block;
        position: relative; /* Changed from fixed top: 600px */
        width: 100%;
        z-index: 9998;
        
        /* Glassmorphism Blur Effect */
        background: var(--lcars-glass-bg);
        backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
        -webkit-backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
        border-bottom: 2px solid var(--lcars-orange);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    .lcars-nav {
        display: none !important;
    }

    /* Mobile Hamburger Button */
    .nav-button {
        background: var(--lcars-orange);
        color: #000;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 20px;
        cursor: pointer;
        font-family: var(--lcars-font);
        font-weight: bold;
        text-transform: uppercase;
        border: none;
        border-bottom: 3px solid var(--lcars-orange);
        -webkit-user-select: none;
    user-select: none;
        width: 100%;
        text-align: left;
    }
    
    .nav-button:hover,
    .nav-button:focus {
        background: var(--lcars-gold);
        outline: 2px solid var(--lcars-blue);
        outline-offset: -2px;
    }
    
    .nav-button:active {
        background: var(--lcars-orange);
    }

    .nav-icon {
        width: 30px;
        height: 3px;
        background: #000;
        position: relative;
        transition: all 0.3s ease;
    }

    .nav-icon::before,
    .nav-icon::after {
        content: "";
        position: absolute;
        width: 30px;
        height: 3px;
        background: #000;
        transition: all 0.3s ease;
    }

    .nav-icon::before {
        top: -10px;
    }

    .nav-icon::after {
        bottom: -10px;
    }

    /* Hamburger to X animation - triggered by .is-open class on container */
    .mobile-nav-container:has(.nav-button[aria-expanded="true"]) .nav-icon,
    .nav-button[aria-expanded="true"] ~ .mobile-menu-overlay.is-open ~ .nav-icon {
        background: transparent;
    }

    .mobile-nav-container:has(.nav-button[aria-expanded="true"]) .nav-icon::before,
    .nav-button[aria-expanded="true"] ~ .mobile-menu-overlay.is-open ~ .nav-icon::before {
        transform: rotate(45deg);
        top: 0;
    }

    .mobile-nav-container:has(.nav-button[aria-expanded="true"]) .nav-icon::after,
    .nav-button[aria-expanded="true"] ~ .mobile-menu-overlay.is-open ~ .nav-icon::after {
        transform: rotate(-45deg);
        bottom: 0;
    }
    
    /* Alternative: Use class-based approach (more compatible) */
    .nav-button[aria-expanded="true"] .nav-icon {
        background: transparent;
    }

    .nav-button[aria-expanded="true"] .nav-icon::before {
        transform: rotate(45deg);
        top: 0;
    }

    .nav-button[aria-expanded="true"] .nav-icon::after {
        transform: rotate(-45deg);
        bottom: 0;
    }

    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        display: none;
        background: #000;
        border-top: 3px solid var(--lcars-orange);
        border-left: 15px solid var(--lcars-gold);
        border-radius: 0 20px 20px 0;
        padding: 20px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .mobile-menu-overlay.is-open {
        display: block;
        max-height: 1000px;
    }

    .menu-header {
        background-color: var(--lcars-gold);
        color: #000;
        font-family: var(--lcars-font);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 2px;
        text-align: right;
        padding: 8px 15px;
        margin: -20px -20px 15px -20px;
        border-radius: 0 20px 0 0;
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid var(--lcars-blue);
    }

    .nav-group-mobile {
        display: flex;
        flex-direction: column;
        gap: 5px;
        margin-bottom: 15px;
    }

    .nav-group-mobile .nav-item {
        display: block;
        padding: 10px 20px;
        margin: 5px 0;
        color: #000;
        text-decoration: none;
        font-family: var(--lcars-font);
        font-weight: bold;
        text-transform: uppercase;
        border-radius: 20px;
        transition: filter 0.2s ease;
    }

    .nav-group-mobile.command .nav-item {
        background: var(--lcars-orange);
    }

    .nav-group-mobile.science .nav-item {
        background: var(--lcars-blue);
        color: var(--lcars-text-white);
    }

    .nav-group-mobile.operations .nav-item {
        background: var(--lcars-gold);
    }

    .nav-group-mobile .nav-item.highlight {
        background: var(--lcars-pink) !important;
        border: 2px solid #fff;
    }

    .nav-group-mobile .nav-item:hover,
    .nav-group-mobile .nav-item:focus {
        filter: brightness(1.2);
    }
}

/* ============================================
   BANNER RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .stf-banner,
    .header-banner {
        height: 600px;
    }

    .stf-banner-image .lcars-left-bar {
        width: 40px;
    }

    .stf-banner .lcars-title {
        font-size: 20px;
        left: 56px;
        bottom: 24px;
    }

    .stf-banner .lcars-overlay .lcars-top-rule {
        left: 56px;
    }
}

@media (max-width: 600px) {
    .stf-banner,
    .header-banner {
        height: 600px;
    }

    .stf-banner-image .lcars-left-bar,
    .stf-banner .lcars-overlay .lcars-top-rule {
        display: none;
    }

    .stf-banner .lcars-overlay .lcars-title {
        left: 18px;
        bottom: 24px;
        font-size: 18px;
    }
}

/* ============================================
   SKIP TO MAIN LINK (ACCESSIBILITY)
   ============================================ */

.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    padding: 10px 20px;
    background: var(--lcars-gold);
    color: #000;
    text-decoration: none;
    font-weight: bold;
    border-radius: 5px;
}

.skip-to-main:focus {
    left: 10px;
    top: 10px;
}

/* ============================================
   UNIFIED LCARS FRAME - Fixed as one unit
   ============================================ */
.lcars-frame-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 4000; /* As per your investigation */
    pointer-events: none; /* Allows interaction with ships behind it */
}

/* Connect the Top Bar to the Vertical Spine */
.lcars-frame-elbow {
    position: absolute;
    top: 0;
    left: 0;
    width: 80px; /* Spine width + gap */
    height: 100px;
    background: var(--lcars-orange);
    border-radius: 30px 0 0 0; /* Authentic LCARS curve */
    pointer-events: auto;
}

/* The Navigation Bar MUST be fixed to the top */
.lcars-frame-horizontal {
    position: absolute;
    top: 0;
    left: 80px; /* Starts after the elbow */
    right: 0;
    height: 40px;
    background: var(--lcars-glass-bg);
    backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
    -webkit-backdrop-filter: blur(var(--lcars-glass-blur)) saturate(var(--lcars-glass-saturate));
    border-bottom: 3px solid var(--lcars-orange);
    pointer-events: auto;
}

/* Ensure the vertical bar sits flush under the elbow */
.lcars-frame-vertical {
    position: absolute;
    top: 100px; 
    left: 0;
    width: 80px; 
    background: linear-gradient(180deg, var(--lcars-orange) 0%, var(--lcars-gold) 100%);
}

