/* --- Global Safety & Reset --- */
body {
    overflow-x: hidden;
    /* Prevent horizontal scroll gaps on mobile */
    margin: 0;
    padding: 0 !important;
    /* Force no padding on body */
}

html {
    margin-top: 0 !important;
}

.admin-bar html {
    margin-top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar html {
        margin-top: 46px !important;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 9999;
    padding: 15px 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--header-bg-top, transparent);
}

.home .site-header:not(.is-scrolled) {
    background: var(--bg-color) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid rgba(var(--heading-color-rgb), 0.1);
}

/* WP Admin Bar Sync */
.admin-bar .site-header {
    top: 32px !important;
}

@media screen and (max-width: 782px) {
    .admin-bar .site-header {
        top: 46px !important;
    }
}

@media screen and (max-width: 600px) {
    .admin-bar .site-header {
        top: 46px !important;
    }
}

/*
   Mobile Fix: On screens < 600px, the admin bar is NOT fixed.
   We must force the header to top:0 so it doesn't leave a hole when the bar scrolls away.
*/
@media screen and (max-width: 600px) {
    .admin-bar .site-header {
        top: 46px;
    }
}

/* Scrolled State */
.site-header.is-scrolled {
    background: var(--header-bg-color, rgba(10, 15, 29, 0.9));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 10px 0;
    border-bottom: 1px solid rgba(var(--heading-color-rgb), 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* When scrolled, we always want to be at top 0 on mobile */
@media screen and (max-width: 600px) {
    .site-header.is-scrolled {
        top: 0 !important;
    }
}


.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    /* Center container at 90% width */
    max-width: 1400px;
    margin: 0 auto;
}

/* 1. Branding (Left) */
.site-branding {
    display: flex;
    align-items: center;
}

.custom-logo-link img {
    height: 45px;
    /* Fixed height for consistency */
    width: auto;
    transition: all 0.3s ease;
}

.is-scrolled .custom-logo-link img {
    height: 35px;
    /* Smaller on scroll */
}

.site-branding .site-title {
    margin: 0;
    line-height: 1;
}

.site-branding .site-title a {
    font-size: 20px;
    /* Reduced from 24px */
    font-weight: 800;
    color: var(--header-text-color, #ffffff);
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* 2. Navigation (Center) */
.main-navigation {
    display: flex;
    justify-content: center;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 40px;
}

.main-navigation a {
    color: var(--header-text-color, var(--menu-color));
    font-size: var(--menu-size);
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
}

.is-scrolled .main-navigation a {
    color: var(--header-scrolled-text-color, var(--menu-color));
}

.main-navigation a:hover {
    color: var(--menu-hover-color);
}

/* 3. Actions (Right) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 25px;
    justify-content: flex-end;
}

.btn-header-cta {
    background: var(--cta-bg-color, var(--primary-color));
    color: var(--cta-text-color, #ffffff) !important;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: var(--button-size);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-header-cta:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Minimalist Toggle */
.menu-toggle {
    display: none;
    /* Hidden on Desktop */
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    padding: 5px;
}

.hamburger-line {
    display: block;
    width: 28px;
    height: 2px;
    background: var(--header-text-color, #ffffff);
    transition: all 0.3s ease;
}

.is-scrolled .hamburger-line {
    background: var(--header-scrolled-text-color, #ffffff);
}

/* --- Mobile & Responsive Refinements --- */
@media (max-width: 920px) {
    .main-navigation {
        display: none;
    }

    .menu-toggle {
        display: flex;
        z-index: 10001;
        /* Stay above overlay */
    }

    .btn-header-cta {
        display: none;
        /* Hide header CTA on mobile/tablet to save space */
    }

    .header-container {
        width: 92%;
    }
}

/* Hamburger Animation for 3 lines */
.menu-toggle.is-active .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.menu-toggle.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* --- Mobile Overlay Styles --- */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--mobile-menu-bg, #0a0f1d);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.mobile-close {
    position: absolute;
    top: 25px;
    right: 20px;
    background: rgba(var(--heading-color-rgb), 0.08);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
}

.admin-bar .mobile-close {
    top: 75px;
    /* Offset to clear the WP admin bar on mobile */
}

.mobile-close:hover {
    background: rgba(var(--heading-color-rgb), 0.15);
}

.close-line {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--heading-color);
    position: absolute;
}

.close-line:nth-child(1) {
    transform: rotate(45deg);
}

.close-line:nth-child(2) {
    transform: rotate(-45deg);
}

.mobile-overlay-inner {
    width: 100%;
    text-align: center;
    padding: 40px;
}

.mobile-overlay ul {
    list-style: none;
    padding: 0;
    margin: 0 0 50px 0;
}

.mobile-overlay li {
    margin: 25px 0;
}

.mobile-overlay a {
    font-size: 32px;
    font-weight: 800;
    color: var(--heading-color);
    text-decoration: none;
    letter-spacing: -1px;
    transition: color 0.3s ease;
}

.mobile-overlay a:hover {
    color: var(--primary-color);
}

/* Mobile Action Button inside Overlay */
.mobile-cta-wrapper {
    margin-top: 40px;
}

.btn-mobile-cta {
    background: var(--primary-color);
    color: var(--cta-text-color) !important;
    padding: 16px 40px;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@media (max-width: 480px) {
    .site-branding .site-title a {
        font-size: 18px;
    }

    .mobile-overlay a {
        font-size: 28px;
    }

    .custom-logo-link img {
        height: 38px;
    }
}