.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100; /* Higher than banner */
    background-color: var(--color-nav-gray);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: var(--header-height);
    border-bottom-left-radius: 300% 150px;
    border-bottom-right-radius: 300% 150px;
    clip-path: inset(0 0 -150px 0); /* Ensures shadow is visible below curved edge */
    transition: transform 0.3s ease-in-out;
}

.site-header.header-hidden {
    transform: translateY(-100%);
}

/* Navigation Styles */
.primary-navigation {
    display: flex;
    align-items: flex-end;
    height: var(--header-height);
    max-width: 1490px;
    margin: 0 auto 30px;
    padding: 0 60px 20px;
    position: relative; /* Ensure it creates a stacking context */
    z-index: 100; /* Stacks within its parent (.site-header), which is z-index: 100 */
    border-bottom: 1px solid transparent;
}

.primary-navigation-subnav-border {
    border-bottom: 1px solid var(--color-white);
}

.wp-block-site-logo {
    width: var(--site-logo-width);
    margin-bottom: 25px;
}

.primary-menu {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0 0 15px 0;
    padding: 0 0 0 4%;
    justify-content: space-between;
    max-width: 1100px;
    width: 100%;
}

.primary-menu li {
    margin: 0;
    padding: 0;
    position: relative;
    max-width: 120px;
}

/* Add safe hover area between menu item and subnav */
.primary-menu li.has-subnav::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -20px; /* Extends below the menu item */
    height: 20px; /* Height of safe area */
    background: transparent;
    pointer-events: auto; /* Ensures hover works */
}

.primary-menu li:last-child {
    max-width: 279px;
    max-height: 80px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0px 6px 12px rgba(0, 0, 0, 0.5));
}

.primary-menu li:last-child a{
    font-size: var(--font-size-nav-button);
    line-height: var(--font-lh-nav-button);
    font-weight: 600;
    color: var(--color-red);
    background-color: var(--color-yellow);
    clip-path: var(--clip-path-mobile-headline);
    padding: 15px 30px 15px;
    border-radius: 0;
    display: inline-block;
    position: relative;
    opacity: 1;
    transition: all 0.3s ease-in-out;
}

.primary-menu li:last-child a:hover{
    color: var(--color-yellow);
    background-color: var(--color-red);
}

.primary-menu a {
    display: inline-block;
    font-size: var(--font-size-nav);
    line-height: var(--font-lh-nav);
    color: white;
    text-transform: uppercase;
    text-decoration: none;
    position: relative;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.15s ease-in-out;
}

.primary-menu .current_page_ancestor a {
    font-weight: 700 !important;
}

.primary-menu .has-subnav > a::after {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    background-image: url('/wp-content/uploads/static/caret-down.svg');
    background-size: contain;
    background-repeat: no-repeat;
    position: absolute;
    right: -20px;
    top: 70%;
    transform: translateY(-50%);
    opacity: 1;
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.primary-menu a:hover {
    opacity: .75;
}

.primary-menu .has-subnav > a:hover::after {
    opacity: .75;
    transform: translateY(-40%);
}

.primary-menu li.current-menu-item a {
    font-weight: 600;
}

/* Sub-navigation Panel Styles */
.subnav-panels-container {
    position: absolute; /* Or relative, depending on where it's placed in HTML and desired flow */
}

.safe-hover-area {
    background: transparent;
    pointer-events: auto;
}

.subnav-panel {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--color-nav-gray);
    padding: 0;
    
    -webkit-mask-image: url(#subnav-shape-mask);
    mask-image: url(#subnav-shape-mask);
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;

    /* Initial animation state (visually hidden by position and z-index) */
    transform: translateY(-100%); /* Start with its top edge at top:0 then move up by its own height */
    z-index: 99; /* Below main header (which is z-index 100) */
    pointer-events: none; /* Not interactive when hidden */
    
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1); /* Only transform, adjusted timing function */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

/* Add safe hover area above subnav panel */
.subnav-panel::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -20px; /* Extends above the panel */
    height: 20px; /* Height of safe area */
    background: transparent;
    pointer-events: auto; /* Ensures hover works */
}

/* Remove the problematic ::after shadow */
.subnav-panel::after {
    display: none; /* Disable the problematic shadow */
}

/* Add separate shadow element that's not affected by mask */
.subnav-panel-shadow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: rgba(0, 0, 0, 0.8); /* Very visible for testing */
    border-radius: 50% 50% 0 0 / 200% 200% 0 0; /* Curved top to match panel bottom */
    filter: blur(10px);
    z-index: 98; /* Behind the panel but above other content */
    pointer-events: none;
    transform: translateY(-100%); /* Start hidden - same as panel */
    transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1); /* Same timing as panel */
    opacity: 0;
    visibility: hidden;
    /* Debug styling */
    border: 2px solid red; /* Temporary border to see the element */
}

.subnav-panel-shadow.is-visible {
    transform: translateY(calc(var(--header-height) - 25px + 12px)); /* Position below panel */
    opacity: 1;
    visibility: visible;
}

/* Ensure no other drop-shadows are applied to subnav panels */
.subnav-panel,
.subnav-panels-container,
.subnav-panel * {
    filter: none !important;
    -webkit-filter: none !important;
}

.subnav-panel.is-visible {
    transform: translateY(calc(var(--header-height) - 25px));
    z-index: 99; /* CRITICAL: Keep z-index the same or lower than main header parts it should be behind */
    pointer-events: auto;
    opacity: 1;
    visibility: visible;
}

.subnav-panel ul {
    list-style: none;
    margin: 0 auto; /* Centers the list within the full-width panel */
    padding: 40px 2.5%; /* Vertical padding + Horizontal padding to align with .primary-navigation content */
    max-width: 800px; /* Matches .primary-navigation max-width */
    opacity: 0;
    display: flex;
    gap: 10%;
    transform: translateY(-10px);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.subnav-panel.is-visible ul {
    opacity: 1;
    transform: translateY(0);
    /* Define transition specifically for fade-in */
    transition-property: opacity;
    transition-duration: 0.2s;
    transition-timing-function: ease-in;
    transition-delay: 0.25s; /* Delay for items to appear after panel slides in */
}

.subnav-panel ul li {
    margin: 0;
    padding: 0;
}

.subnav-panel ul li a {
    display: block;
    color: var(--color-white);
    font-size: var(--font-size-subnav);
    line-height: var(--font-lh-subnav);
    text-decoration: none;
    white-space: nowrap;
    padding: 10px 0;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.15s ease-in-out;
}

.subnav-panel ul li a:hover {
    opacity: .75;
}

/* Static Link Styles */
.site-switcher {
    font-size: var(--font-size-nav);
    color: var(--color-white);
    font-weight: 400;
    text-decoration: none;
    position: absolute  ;
    right: 85px;
    top: 15px;
}

.site-switcher-label-static {
    font-size: var(--font-size-subnav);
    color: var(--color-yellow);
    font-weight: 500;
    margin-right: 10px;
}

.site-switcher a {
    font-size: var(--font-size-subnav);
    color: var(--color-white);
    font-weight: 500;
    text-decoration: none;
    opacity: 1;
    transition: opacity 0.15s ease-in-out;
    margin-left: 10px;
}

.site-switcher a:hover {
    opacity: .75;
}

.site-switcher a::after {
    content: url('/wp-content/uploads/static/caret-right.svg');
    position: absolute;
    top: 1px;
    right: -20px;
    transition: transform 0.3s ease;
    width: 15px;
    height: 15px;
    display: inline-block;
    object-fit: contain;
}

.site-switcher a:hover::after {
    transform: translateX(2px);
}

@media (max-width: 1365px) {
    .primary-menu a {
        font-size: 1.0rem;
        line-height: 1.4rem;
    }
}

/* Hide desktop header on mobile - mobile header will take over */
@media (max-width: 1024px) {
    .site-header {
        display: none !important;
    }
}

/* Mobile Menu Styles */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--color-white);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.mobile-menu-content {
    height: 100vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 80px 20px 20px;
    position: relative;
}

/* Lock scrolling using html element */
html.mobile-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Ensure the page wrapper maintains scroll position */
html.mobile-menu-open #page {
    position: fixed;
    top: var(--scroll-position, 0);
    left: 0;
    width: 100%;
}

@media (max-width: 1365px) {
    .subnav-panel ul {
        gap: 5%;
    }
}