/* Ensure active underline in submenu is always white, 2px, and at correct position */
.ai-header__sub-menu-link.active::after {
    background: #fff !important;
    height: 2px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
    opacity: 0.9 !important;
    z-index: 3 !important;
}

/* Header background and layout */
.ai-header {
    background: #000;
    color: #fff;
    width: 100%;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1000;
    box-sizing: border-box;
    max-width: 120rem;
    margin: 0 auto;
}

/* Flex row for logo and nav */
.ai-header>div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 128px;
    transition: min-height 0.3s cubic-bezier(.4, 2, .6, 1);
}

/* Logo sizing */
.ai-header__logo {
    display: flex;
    align-items: center;
    height: 128px;
    transition: height 0.3s cubic-bezier(.4, 2, .6, 1);
}

.ai-header__logo img {
    height: 48px;
    max-width: 180px;
    width: auto;
    display: block;
    margin: 0;
    padding: 0;
    transition: height 0.3s cubic-bezier(.4, 2, .6, 1);
}

/* Navigation base styles */
.ai-header__nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 128px;
    transition: height 0.3s cubic-bezier(.4, 2, .6, 1);
}

/* Shrink header on scroll */

.ai-header--scrolled {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
}

.ai-header--scrolled>div {
    min-height: 64px;
}

.ai-header--scrolled .ai-header__logo {
    height: 64px;
}

.ai-header--scrolled .ai-header__logo img {
    height: 32px;
}

.ai-header--scrolled .ai-header__nav {
    height: 64px;
}

.ai-header--scrolled .ai-header__nav-list {
    height: 64px;
}

/* in scrolled reduce font size of a tags */
.ai-header--scrolled .ai-header__nav-link {
    font-size: 0.9rem;
}

.ai-header__nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.5rem;
    height: 128px
}

.ai-header__nav-item {
    position: relative;
}

.ai-header__nav-link {
    text-transform: uppercase;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 1.18rem;
    padding: 0.75rem 1rem;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    height: 100%;
    border: none;
    background: none;
    cursor: pointer;
}

/* Specific styles for dropdown button */
.ai-header__nav-link--dropdown {
    font-family: inherit;
}

.ai-header__nav-link:hover {
    background: #a50065;
    color: #fff;
}

/* Focus styles for keyboard navigation */
.ai-header__nav-link:focus {
    outline: 2px solid #a50065;
    outline-offset: 2px;
    background: #a50065;
    color: #fff;
}

/* Remove focus outline for mouse clicks, keep for keyboard navigation */
.ai-header__nav-link:focus:not(:focus-visible) {
    outline: none;
}

.ai-header__nav-link:focus-visible {
    outline: 2px solid #a50065;
    outline-offset: 2px;
}

.ai-header__nav-link.active {
    background: none;
    color: #a50065;
    position: relative;
}

.ai-header__nav-link.active::after {
    content: '';
    display: block;
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 32px;
    height: 3px;
    background: #a50065;
    border-radius: 2px;
}

.ai-header--scrolled .ai-header__nav-link.active::after {
    content: '';
    display: block;
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 10px;
    height: 3px;
    background: #a50065;
    border-radius: 2px;
}

/* Submenu structure */
.ai-header__sub-menu {
    display: none;
    position: absolute;
    left: auto;
    right: 0;
    background: #a50065;
    min-width: 340px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    /* border-radius removed for clean edge */
    z-index: 1100;
}

/* Show submenu when focused via keyboard or when parent has focus-within */
.ai-header__nav-item--has-submenu:focus-within .ai-header__sub-menu,
.ai-header__nav-item--has-submenu .ai-header__nav-link:focus+.ai-header__sub-menu {
    display: block;
}

/* Ensure submenu stays visible when navigating with keyboard */
.ai-header__sub-menu:focus-within {
    display: block;
}

/* Ensure submenu starts below nav bar when header is fixed/scrolled */
.ai-header--scrolled .ai-header__sub-menu,
.ai-header--fixed .ai-header__sub-menu {
    top: 64px;
}

.ai-header__sub-menu-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: flex-end;
    padding: 0;
    margin: 0;
    list-style: none;
}

.ai-header__sub-menu-item {
    width: 100%;
    display: flex;
    justify-content: flex-end;
}

.ai-header__sub-menu-link {
    font-size: 0.98rem;
    color: #fff;
    background: none;
    border-radius: 0;
    width: 100%;
    text-align: right;
    position: relative;
    text-transform: none;
    transition: color 0.2s, background 0.2s;
    will-change: auto;
    padding: 0.75rem 1rem;
    min-height: 44px;
    /* display: flex;
    align-items: center; */
}

.ai-header__sub-menu-link-text {
    display: inline-block;
    transition: transform 0.2s cubic-bezier(.4, 2, .6, 1);
    will-change: transform;
}

.ai-header__sub-menu-link:hover,
.ai-header__sub-menu-link.active {
    color: #fff;
    background: none;
}

.ai-header__sub-menu-link:hover::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.18);
    pointer-events: none;
    border-radius: 0;
    z-index: 1;
}

.ai-header__sub-menu-link:hover .ai-header__sub-menu-link-text {
    transform: translateX(-12px);
}

/* Focus and active styles for submenu links */
.ai-header__sub-menu-link:focus {
    outline: 2px solid #fff;
    outline-offset: -2px;
    color: #fff;
    background: none;
}

/* Remove focus outline for mouse clicks, keep for keyboard navigation */
.ai-header__sub-menu-link:focus:not(:focus-visible) {
    outline: none;
}

.ai-header__sub-menu-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.ai-header__sub-menu-link.active,
.ai-header__sub-menu-link:focus,
.ai-header__sub-menu-link:active {
    color: #fff;
    background: none;
}

.ai-header__sub-menu-link.active::before,
.ai-header__sub-menu-link:focus::before,
.ai-header__sub-menu-link:active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.12);
    pointer-events: none;
    border-radius: 0;
    z-index: 1;
}

/* Fix underline so it does not move with hover */
.ai-header__sub-menu-link::after {
    content: '';
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: #fff;
    opacity: 0.9;
    border-radius: 0;
    z-index: 3;
    pointer-events: none;
    transition: none;
    transform: none !important;
}

/* ========================================
   HAMBURGER MENU STYLES
   ======================================== */

/* Hamburger button - hidden on desktop, visible on mobile */
.ai-header__hamburger {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 1001;
}

.ai-header__hamburger:focus {
    outline: 2px solid #a50065;
    outline-offset: 2px;
}

/* Remove focus outline for mouse clicks, keep for keyboard navigation */
.ai-header__hamburger:focus:not(:focus-visible) {
    outline: none;
}

.ai-header__hamburger:focus-visible {
    outline: 2px solid #a50065;
    outline-offset: 2px;
}

.ai-header__hamburger__box {
    display: block;
    position: relative;
    width: 24px;
    height: 18px;
    margin: 0 auto;
}

.ai-header__hamburger__box__inner {
    display: block;
    position: absolute;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ai-header__hamburger__box__inner::before,
.ai-header__hamburger__box__inner::after {
    content: '';
    display: block;
    position: absolute;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 1px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.ai-header__hamburger__box__inner::before {
    top: -8px;
}

.ai-header__hamburger__box__inner::after {
    top: 8px;
}

/* Hamburger animation when active */
.ai-header__hamburger--active .ai-header__hamburger__box__inner {
    background: transparent;
}

.ai-header__hamburger--active .ai-header__hamburger__box__inner::before {
    top: 0;
    transform: rotate(45deg);
}

.ai-header__hamburger--active .ai-header__hamburger__box__inner::after {
    top: 0;
    transform: rotate(-45deg);
}

/* ========================================
   MOBILE NAVIGATION STYLES
   ======================================== */

/* Mobile breakpoint */
@media (max-width: 1299px) {

        .ai-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        margin: 0;
        z-index: 1000;
    }

    /* Show hamburger on mobile */
    .ai-header__hamburger {
        display: block;
    }

    /* Hide desktop navigation on mobile */
    .ai-header__nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: #000;
        z-index: 1000;
        display: flex;
        align-items: flex-start;
        /* Change from center to flex-start */
        justify-content: center;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        opacity: 0;
        visibility: hidden;
        overflow-y: auto;
        /* Make the overlay scrollable */
        padding-top: 2rem;
        /* Add top padding for spacing */
    }

    .ai-header--scrolled .ai-header__nav {
        height: 100vh;
        bottom: 0;
        position: fixed;
    }

    /* Show mobile navigation when active */
    .ai-header__nav--active {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }

    /* Mobile navigation layout */
    .ai-header__nav>div {
        width: 100%;
        max-width: 400px;
        padding: 2rem;
    }

    .ai-header__nav-list {
        flex-direction: column;
        height: auto;
        gap: 0;
        text-align: center;
        display: block;
    }

    .ai-header__nav-item {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

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

    .ai-header__nav-link {
        width: 100%;
        padding: 1.5rem 1rem;
        font-size: 1.2rem;
        justify-content: center;
        border-radius: 0;
    }

    .ai-header__nav-link.active::after {
        display: none;
    }

    .ai-header__nav-link.active {
        background: #a50065;
        color: #fff;
    }

    /* Mobile submenu styles */
    .ai-header__sub-menu {
        position: static;
        display: block !important;
        /* Always show submenu on mobile */
        background: transparent;
        /* Remove pink background */
        min-width: auto;
        width: 100%;
        box-shadow: none;
        margin-top: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .ai-header__sub-menu-list {
        align-items: center;
        /* Center align for better appearance */
    }

    .ai-header__sub-menu-item {
        justify-content: center;
        /* Center align items */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .ai-header__sub-menu-item:last-child {
        border-bottom: none;
    }

    .ai-header__sub-menu-link {
        text-align: center;
        /* Center align for better readability */
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        width: 100%;
        justify-content: center;
    }

    /* Remove white underline on mobile submenu links */
    .ai-header__sub-menu-link::after {
        display: none !important;
    }

    .ai-header__sub-menu-link:hover .ai-header__sub-menu-link-text {
        transform: none;
    }

    /* Adjust header layout for mobile */
    .ai-header>div {
        padding: 0 1rem;
        min-height: 64px;
    }

    .ai-header__logo {
        height: 64px;
    }

    .ai-header__logo img {
        height: 32px;
    }
}

/* ========================================
   BODY SCROLL LOCK WHEN MENU IS OPEN
   ======================================== */

.body--nav-active {
    overflow: hidden;
    position: sticky;
    width: 100%;
    height: 100%;
}

@media (prefers-reduced-motion: reduce) {

    .ai-header__sub-menu-link-text,
    .ai-header__hamburger__box__inner,
    .ai-header__hamburger__box__inner::before,
    .ai-header__hamburger__box__inner::after,
    .ai-header__nav {
        transition: none !important;
    }
}