/* ============================================
   GLOBAL HEADER - REDESIGNED
   SEO-Optimized, Systematically Aligned, Responsive
   ============================================ */

:root {
    --header-height: 70px;
    --header-bg: rgba(5, 5, 5, 0.95);
    --header-bg-solid: #050505;
    --header-text: #ffffff;
    --header-text-muted: rgba(255, 255, 255, 0.7);
    --header-border: rgba(255, 255, 255, 0.1);
    --header-spacing: 2rem;
    --header-spacing-mobile: 1rem;
    --transition-smooth: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ============================================
   BASE HEADER STRUCTURE
   ============================================ */
#global-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 9999;
    transition: transform 0.3s var(--transition-smooth),
        background-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* State: At Top (Transparent) */
#global-header.at-top {
    background-color: transparent;
    box-shadow: none;
}

/* State: Scrolled Up (Visible with Background) */
#global-header.scrolled-up {
    background-color: var(--header-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
    transform: translateY(0);
}

/* State: Scrolled Down (Hidden) */
#global-header.scrolled-down {
    transform: translateY(-100%);
}

/* ============================================
   GRID LAYOUT - SYSTEMATIC ALIGNMENT
   ============================================ */
.header-container {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--header-spacing);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

/* Left: Branding */
.header-branding {
    justify-self: start;
}

.header-logo {
    text-decoration: none;
    color: var(--header-text);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: opacity 0.3s ease;
}

.header-logo:hover {
    opacity: 0.8;
}

/* Center: Navigation */
.header-nav-desktop {
    justify-self: center;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-list>li {
    position: relative;
}

.nav-link {
    text-decoration: none;
    color: var(--header-text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
    display: inline-block;
}

.nav-link:hover {
    color: var(--header-text);
    transform: translateY(-1px);
}

.nav-link i {
    font-size: 0.8em;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.3s ease;
}

/* Dropdown Styles */
.nav-item-dropdown {
    position: relative;
}

.nav-item-dropdown:hover .nav-link i {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--header-bg);
    border: 1px solid var(--header-border);
    border-radius: 12px;
    padding: 8px 0;
    min-width: 320px;
    max-width: 350px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--transition-smooth);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    list-style: none;
    margin: 0;
}

.nav-item-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item {
    color: var(--header-text-muted);
    text-decoration: none;
    padding: 12px 20px;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: all 0.2s ease;
    display: block;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    white-space: normal;
    word-wrap: break-word;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--header-text);
    padding-left: 25px;
}

/* Right: Actions */
.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-cta {
    padding: 8px 24px;
    background: var(--header-text);
    color: var(--header-bg-solid);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10002;
    position: relative;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background-color: var(--header-text);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translateY(8px);
}

.menu-toggle.active .hamburger-line:nth-child(2) {
    transform: rotate(-45deg) translateY(-8px);
}

/* Hide hamburger when menu is open */
.menu-toggle.active {
    opacity: 0;
    pointer-events: none;
}

/* ============================================
   MOBILE MENU - PREMIUM PANEL DESIGN
   ============================================ */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--transition-smooth),
        visibility 0.4s var(--transition-smooth);
    z-index: 10000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Premium Contained Panel */
.mobile-menu-panel {
    width: 90%;
    max-width: 420px;
    height: 100vh;
    background: var(--header-bg-solid);
    border-left: 1px solid var(--header-border);
    transform: translateX(100%);
    transition: transform 0.4s var(--transition-smooth);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 5rem 2rem 3rem;
    position: relative;
}

.mobile-menu-overlay.active .mobile-menu-panel {
    transform: translateX(0);
}

/* Close Button - Fixed Top Right */
.mobile-close-btn {
    position: fixed;
    top: 1.5rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--header-border);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    transition: all 0.3s ease;
}

.mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--header-text);
}

.close-icon {
    font-size: 2rem;
    color: var(--header-text);
    line-height: 1;
    font-weight: 300;
}

/* Mobile Navigation Container */
.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Primary Navigation Section */
.mobile-nav-primary {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Primary Links */
.mobile-link.primary {
    text-decoration: none;
    color: var(--header-text);
    font-size: 1.35rem;
    font-weight: 600;
    padding: 0.85rem 0;
    line-height: 1.5;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-overlay.active .mobile-link.primary {
    opacity: 1;
    transform: translateX(0);
}

.mobile-link.primary:hover {
    color: rgba(255, 255, 255, 0.7);
    padding-left: 0.5rem;
}

/* Stagger Animation for Primary Links */
.mobile-menu-overlay.active .mobile-nav-primary .mobile-link:nth-child(1) {
    transition-delay: 0.1s;
}

.mobile-menu-overlay.active .mobile-nav-primary .mobile-link:nth-child(2) {
    transition-delay: 0.15s;
}

.mobile-menu-overlay.active .mobile-nav-primary .mobile-link:nth-child(3) {
    transition-delay: 0.2s;
}

.mobile-menu-overlay.active .mobile-nav-primary .mobile-link:nth-child(4) {
    transition-delay: 0.25s;
}

.mobile-menu-overlay.active .mobile-nav-primary .mobile-link:nth-child(5) {
    transition-delay: 0.3s;
}

/* Secondary Sections (Tools, Locations) */
.mobile-nav-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-nav-section:last-of-type {
    border-bottom: none;
}

/* Section Labels */
.mobile-section-label {
    display: block;
    font-size: 0.75rem;
    color: var(--header-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
    font-weight: 600;
    opacity: 0.6;
}

/* Secondary Links */
.mobile-link.secondary {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.65rem 0;
    padding-left: 0.75rem;
    line-height: 1.5;
    min-height: 44px;
    display: block;
    transition: all 0.3s ease;
    border-left: 2px solid transparent;
}

.mobile-link.secondary:hover {
    color: var(--header-text);
    padding-left: 1rem;
    border-left-color: rgba(255, 255, 255, 0.3);
}

/* CTA Section */
.mobile-nav-cta {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-cta-button {
    display: block;
    width: 100%;
    padding: 1rem 2rem;
    background: var(--header-text);
    color: var(--header-bg-solid);
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    min-height: 48px;
    transition: all 0.3s ease;
}

.mobile-cta-button:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

/* ============================================
   BODY OFFSET FOR FIXED HEADER
   ============================================ */
body {
    padding-top: var(--header-height);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
@media (max-width: 1024px) {
    .nav-list {
        gap: 1.5rem;
    }

    .nav-link {
        font-size: 0.85rem;
    }
}

@media (max-width: 900px) {
    .header-nav-desktop {
        display: none;
    }

    .header-cta {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .header-container {
        grid-template-columns: 1fr auto;
        padding: 0 var(--header-spacing-mobile);
    }

    .header-actions {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .header-logo {
        font-size: 1rem;
    }

    .mobile-menu-panel {
        width: 92%;
        padding: 4.5rem 1.5rem 2.5rem;
    }

    .mobile-close-btn {
        right: 1.5rem;
        top: 1.25rem;
    }

    .mobile-link.primary {
        font-size: 1.25rem;
        padding: 0.75rem 0;
    }

    .mobile-link.secondary {
        font-size: 0.95rem;
    }
}