/* ==========================================================================
   Global Header Styles
   ========================================================================== */
.site-header {
    /* Background removed for transparency */
    color: var(--wp--preset--color--fair-sand);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.site-header a {
    color: var(--wp--preset--color--fair-sand);
    text-decoration: none;
    transition: color 0.3s ease;
}

.site-header a:hover {
    color: var(--wp--preset--color--game-red, #B02A2A);
}

/* Top Bar */
.site-header__top {
    /* fair-sand with opacity */
    height: 48px;
    display: flex;
    align-items: center;
}

.site-header__top-inner {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    /* Prevent width overflow */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-header__lang {
    display: flex;
    gap: var(--space-sm);
}

.site-header__lang a {
    display: inline-flex;
    align-items: center;
    opacity: 0.5;
}

.site-header__lang a.active,
.site-header__lang a:hover {
    opacity: 1;
}

.site-header__actions {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.site-header__cart {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.site-header__socials {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.site-header__socials a {
    display: flex;
    padding: var(--space-2xs);
}

/* Main Nav */
.site-header__main {
    height: 96px;
    display: flex;
    align-items: center;
}

.site-header__hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000;
    position: relative;
    outline: none;
}

.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    display: block;
    top: 50%;
    margin-top: -2px;
}

.hamburger-inner,
.hamburger-inner::before,
.hamburger-inner::after {
    width: 30px;
    height: 3px;
    background-color: #fff;
    border-radius: 4px;
    position: absolute;
    transition: transform 0.3s ease, background-color 0.3s;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    display: block;
}

.hamburger-inner::before {
    top: -10px;
}

.hamburger-inner::after {
    bottom: -10px;
}

/* Hamburger active state */
.site-header__hamburger.is-active .hamburger-inner {
    background-color: transparent;
}

.site-header__hamburger.is-active .hamburger-inner::before {
    transform: translateY(10px) rotate(45deg);
}

.site-header__hamburger.is-active .hamburger-inner::after {
    transform: translateY(-10px) rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: #B02A2A;
    /* Nines Red */
    z-index: 999;
    visibility: hidden;
    opacity: 1;
    /* Always opaque, controlled by transform now */
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    /* Start completely off-screen to the right */
    will-change: transform;
}

.mobile-menu-overlay__inner {
    padding: 80px 20px 40px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    width: 100%;
    margin: 0 auto;
    position: relative;
}

.mobile-menu-overlay__lang {
    position: absolute;
    top: 25px;
    left: 20px;
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
}

.mobile-menu-overlay__lang a {
    display: flex;
    align-items: center;
    color: #fff;
    opacity: 0.5;
    text-decoration: none;
}

.mobile-menu-overlay__lang a.active {
    opacity: 1;
}

.mobile-menu-overlay__nav {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    text-align: right;
}

.mobile-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
}

.mobile-menu-list li {
    margin-bottom: 20px;
    will-change: transform;
}

.mobile-menu-list a {
    font-size: clamp(22px, 7vw, 32px);
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
    display: inline-block;
    transition: color 0.3s;
    word-break: break-word;
    /* Ensure long words wrap instead of breaking layout */
    white-space: normal;
    line-height: 1.1;
}

.mobile-menu-list a:hover {
    color: #111;
    /* Changed hover color to black for contrast against red */
}

.mobile-menu-overlay__bottom {
    margin-top: auto;
    /* Push to the very bottom instead of fixed margin-top */
    padding-top: 60px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 20px;
}

.mobile-menu-overlay__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 15px;
}

.mobile-menu__contact {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    text-transform: uppercase;
}

.mobile-menu__cart {
    display: inline-flex;
    align-items: center;
    background-color: #111;
    /* Black cart button on red background */
    color: #fff;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.3s;
}

.mobile-menu__cart:hover {
    background-color: #333;
}

.mobile-menu-overlay__socials {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.mobile-menu-overlay__socials a {
    color: #fff;
    opacity: 0.8;
    transition: opacity 0.3s, color 0.3s;
}

.mobile-menu-overlay__socials a:hover {
    opacity: 1;
    color: #111;
    /* Hover black for contrast on red */
}

/* Mobile Menu GSAP Animation targets */
.mobile-menu-overlay__lang,
.mobile-menu-list li,
.mobile-menu-overlay__socials {
    transform: translateX(100vw);
    /* Start off-screen right */
}

.site-header__main-inner {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    /* Prevend width overflow */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-header__nav {
    flex: 1;
    display: flex;
}

/* Align left menu to right (towards center logo) */
.site-header__nav--left {
    justify-content: flex-end;
}

/* Align right menu to left (towards center logo) */
.site-header__nav--right {
    justify-content: flex-start;
}

.header-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    /* Center items vertically */
    gap: var(--space-lg);
    /* fluid 32px instead of fixed 30px */
}

/* Custom fluid typography: 28px at 1920px -> 18px at 991px */
.header-menu li a {
    font-size: clamp(1.125rem, 0.4583rem + 1.0764vw, 1.75rem);
    white-space: nowrap;
    display: flex;
    /* Center items vertically */
    align-items: center;
    /* Prevent text wrapping */

    /* Wipe Animation Base */
    background: linear-gradient(to top, var(--wp--preset--color--game-red, #B02A2A) 50%, var(--wp--preset--color--fair-sand) 50%);
    background-size: 100% 200%;
    background-position: top;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: background-position 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.header-menu li a:hover {
    background-position: bottom;
}

/* Active current page item (Main Menu) */
.header-menu li.current-menu-item>a,
.header-menu li.current_page_item>a {
    background: linear-gradient(to top, var(--wp--preset--color--warm-copper, #D66E3A) 50%, var(--wp--preset--color--warm-copper, #D66E3A) 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Dropdown Menus --- */
.header-menu .menu-item-has-children {
    position: relative;
}

.header-menu .menu-item-has-children>a {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    /* space between text and chevron */
}

.dropdown-chevron {
    display: inline-flex;
    align-items: center;
    transition: transform 0.3s ease;
    /* Removed margin-top adjustment */
}

.dropdown-chevron img {
    flex-shrink: 0;
}

.header-menu .menu-item-has-children:hover>a .dropdown-chevron {
    transform: rotate(180deg);
}

.header-menu .sub-menu {
    position: absolute;
    top: calc(100% + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background-image: url("http://nines.local/wp-content/uploads/background-texture-white.jpg");
    border-radius: 0;
    padding: var(--space-lg) var(--space-md);
    list-style: none;
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 100;
}

/* Invisible bridge */
.header-menu .sub-menu::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
}

/* Submenu Open state */
.header-menu .menu-item-has-children:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Submenu Links Styles */
.header-menu .sub-menu li a {
    color: var(--wp--preset--color--steel-black);
    font-family: var(--wp--preset--font-family--nines);
    font-size: var(--wp--preset--font-size--bold-small);
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    display: block;
    letter-spacing: 0.05em;

    /* Wipe Animation Base */
    background: linear-gradient(to top, var(--wp--preset--color--game-red, #B02A2A) 50%, var(--wp--preset--color--steel-black) 50%);
    background-size: 100% 200%;
    background-position: top;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: background-position 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.header-menu .sub-menu li a:hover {
    background-position: bottom;
}

/* Active current page item (Sub Menu) */
.header-menu .sub-menu li.current-menu-item>a,
.header-menu .sub-menu li.current_page_item>a {
    background: linear-gradient(to top, var(--wp--preset--color--warm-copper, #D66E3A) 50%, var(--wp--preset--color--warm-copper, #D66E3A) 50%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-header__logo-wrapper {
    padding: 0 var(--space-xl);
    /* exact 32px spacing requested around logo */
    flex-shrink: 1;
    width: 100%;
    max-width: 280px;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.site-header__logo-wrapper img.custom-logo {
    width: auto;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    /* Override WP inline height attribute to match the 96px container */
}

.site-header__logo {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: -1px;
}

.site-header__logo span {
    color: var(--wp--preset--color--game-red, #B02A2A);
}

@media (max-width: 991px) {
    .site-header__top {
        display: none;
    }

    .site-header__nav {
        display: none;
    }

    /* Hide cart, contact, and language switchers outside of the mobile menu overlay to prevent duplicates showing at bottom/top */
    .site-header__actions>a,
    .site-header__actions .site-header__cart,
    .site-header__lang {
        display: none !important;
    }

    .site-header__main-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .site-header__hamburger {
        display: block;
    }

    .site-header__logo {
        padding: 0;
        text-align: left;
    }
}