/* =============================================
   El Gibbor Header - V6 (Definitive Fix)
   ============================================= */

/* --- Global Typography --- */
body {
    font-family: 'Montserrat', sans-serif;
    color: #333;
}

h1,
h2,
h3,
h4,
h5,
h6,
.logo-text {
    font-family: 'Cinzel', serif;
    font-weight: 700;
}

/* --- Base & Variables --- */
:root {
    --gold: #D4AF37;
    --gold-light: #EADCA6;
    /* Lighter gold for hover */
    --dark-gold: #B8860B;
    --black: #1a1a1a;
    --white: #ffffff;
    --light-gray: #f8f9fa;
    --border-radius: 8px;
    --shadow-medium: 0 4px 15px rgba(0, 0, 0, 0.1);
    --transition: 0.3s ease;
    --transition-med: 0.3s ease;
    /* ensure referenced var exists */
    --transition-fast: 0.2s ease;
    /* ensure referenced var exists */
    --header-height: 65px;
}

/* Prevent horizontal overflow globally (header.css is always loaded) */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* --- Header --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1020;
    padding: 0 5%;
    background-color: transparent;
    transition: background-color var(--transition-med), box-shadow var(--transition-med);
}

.header-scrolled {
    background-color: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65px;
    /* Reduced header height */
    max-width: 1400px;
    margin: 0 auto;
}

/* --- Header Sections (Desktop) --- */
.header-left,
.header-right {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
}

.nav {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    /* Aligns nav to the right */
}

/* --- Logo --- */
.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo-img {
    height: 40px;
    /* Adjusted logo size */
    width: auto;
}

.logo-text {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    margin-left: 15px;
    transition: color var(--transition-med);
}

.header-scrolled .logo-text {
    color: var(--black);
}

/* Swap logos: light (white) by default on transparent header, dark on scrolled/overlay */
.logo-img--dark {
    display: none;
}

.header-scrolled .logo-img--dark {
    display: inline-block;
}

.header-scrolled .logo-img--light {
    display: none;
}

body.mobile-menu-open .logo-img--dark {
    display: inline-block;
}

body.mobile-menu-open .logo-img--light {
    display: none;
}

/* --- Desktop Navigation --- */
.nav-list {
    display: flex;
    gap: 30px;
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-list a {
    color: var(--white);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: var(--transition);
    padding: 8px 0;
}

.header-scrolled .nav-list a {
    color: var(--black);
}

.nav-list a.active,
.nav-list a:hover {
    color: var(--gold);
}

.nav-list a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: var(--transition);
}

.nav-list a:hover::after,
.nav-list a.active::after {
    width: 100%;
}

/* --- Desktop Dropdowns --- */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: block;
    position: absolute;
    top: calc(100% + 20px);
    /* Directly below the trigger, aligned to its left */
    left: 0;
    /* Unset left so right alignment works */
    right: auto;
    /* Align menu's right edge with the trigger's right edge */
    min-width: 220px;
    background-color: var(--white);
    border-radius: 0 0 8px 8px;
    padding: 8px 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    z-index: 1001;
    border-top: none;
    /* Remove top border */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    /* Refined shadow */
}

.dropdown.open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    color: #212529;
    padding: 10px 20px;
    display: block;
    white-space: nowrap;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus {
    background-color: var(--gold);
    color: #fff;
}

.dropdown-menu a::after {
    display: none;
}

/* --- Header Right (Contact Button) --- */
.contact-btn {
    background: var(--gold);
    color: var(--black) !important;
    padding: 10px 20px;
    /* Adjusted button padding */
    font-size: 0.8rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    margin-left: 15px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    /* Remove border from previous design */
}

.contact-btn:hover {
    background: var(--gold-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    color: var(--black) !important;
}

/* The scroll effect no longer needs to change the button styles, so these rules are no longer needed. */

/* --- Mobile Navigation Controls --- */
.mobile-toggle,
.mobile-close {
    display: none;
    /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1052;
    /* High z-index */
    position: relative;
}

.mobile-close {
    position: fixed;
    /* Fixed position for overlay */
    top: 25px;
    right: 5%;
    font-size: 35px;
    color: var(--white);
}

/* =============================================
   Mobile Responsive (max-width: 992px)
   ============================================= */
@media (max-width: 992px) {
    .nav {
        display: none !important;
        /* Hide desktop nav */
    }

    .mobile-toggle {
        display: block;
        /* Show hamburger icon */
        font-size: 24px;
        color: var(--black);
        margin-left: 20px;
    }

    /* Ensure toggle is visible on dark hero before scroll */
    .header:not(.header-scrolled) .mobile-toggle {
        color: var(--white);
    }

    body.mobile-menu-open .mobile-toggle {
        display: none;
        /* Hide hamburger when menu is open */
    }

    body.mobile-menu-open .mobile-close {
        display: block;
        /* Show close button when menu is open */
        color: var(--black);
        /* Dark icon on light overlay */
    }

    /* Improve brand visibility on light overlay */
    body.mobile-menu-open .logo-text {
        color: var(--black) !important;
    }

    body.mobile-menu-open .nav.active {
        display: flex !important;
        /* Show mobile nav panel */
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: fixed;
        inset: 0;
        background: rgba(255, 255, 255, 0.92);
        /* Light translucent background */
        backdrop-filter: blur(8px) saturate(120%);
        -webkit-backdrop-filter: blur(8px) saturate(120%);
        color: var(--black);
        z-index: 1050;
        overflow-y: auto;
        overflow-x: hidden;
        /* prevent horizontal scroll */
        padding: 20px;
        box-sizing: border-box;
        /* Visibility is now controlled by the 'display' property */
    }

    /* Slightly increased spacing for mobile menu items */
    .nav-list {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        /* was 10px -> more vertical space */
        padding: 8px 0 0 0;
        /* small top padding so first item has breathing room */
        text-align: center;
        margin: 0;
        list-style: none;
    }

    .nav-list>li {
        width: 100%;
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
        border-bottom: 1px solid rgba(0, 0, 0, 0.06);
        padding: 6px 0;
        /* added vertical padding for extra spacing */
    }

    body.mobile-menu-open .nav-list>li {
        opacity: 1;
        transform: translateY(0);
    }

    /* Staggered animation for list items */
    .nav-list>li:nth-child(1) {
        transition-delay: 0.1s;
    }

    .nav-list>li:nth-child(2) {
        transition-delay: 0.15s;
    }

    .nav-list>li:nth-child(3) {
        transition-delay: 0.2s;
    }

    .nav-list>li:nth-child(4) {
        transition-delay: 0.25s;
    }

    .nav-list>li:nth-child(5) {
        transition-delay: 0.3s;
    }

    .nav-list>li>a {
        color: var(--black);
        padding: 18px;
        /* was 15px -> slightly larger touch target */
        width: 100%;
        border-bottom: none;
        font-size: 1.6rem;
        font-weight: 700;
        display: block;
        box-sizing: border-box;
    }

    .nav-list>li>a.active,
    .nav-list>li>a:hover {
        color: var(--gold);
    }

    .nav-list a::after {
        display: none;
    }

    /* Mobile overlay: dark links on light translucent background */
    .header .nav.active .nav-list a {
        color: var(--black);
        border-radius: 10px;
        transition: background-color var(--transition-fast), color var(--transition-fast);
    }

    /* Preserve gold highlight for hover/active inside the mobile overlay */
    .header .nav.active .nav-list a:hover,
    .header .nav.active .nav-list a.active {
        color: var(--gold) !important;
        background: rgba(0, 0, 0, 0.06);
    }

    .dropdown-menu {
        position: static;
        background: transparent;
        box-shadow: none;
        border: none;
        min-width: 100%;
        padding: 10px 0 0 0;
        text-align: left;
        /* Left align submenu items for readability */
        display: none;
    }

    .dropdown.open>.dropdown-menu {
        display: block;
    }

    .dropdown-menu a {
        padding: 10px 20px !important;
        font-weight: 500;
        font-size: 1rem;
        color: #333 !important;
        background: none !important;
        border-radius: 8px;
    }

    /* Add subtle separators between dropdown items */
    .dropdown-menu li+li a {
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }

    .dropdown-menu a:hover {
        color: var(--gold) !important;
    }

    .dropdown>a .fa-chevron-down {
        transition: transform var(--transition-fast);
        margin-left: 5px;
        font-size: 0.8em;
    }

    .dropdown.open>a .fa-chevron-down {
        transform: rotate(180deg);
    }
}

/* =============================================
   Extra Small Devices (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {
    .header {
        padding: 0 3%;
    }

    /* Reduce header padding */

    .logo-text {
        display: none;
        /* Hide logo text to save space */
    }

    .contact-btn {
        padding: 8px 18px;
        /* Make contact button smaller */
        font-size: 0.8rem;
    }

    .mobile-toggle {
        margin-left: 15px;
        /* Adjust margin */
    }
}