/**
 * Nascar Amaxa — header navigation styles.
 * Desktop menu and Buy button match the provided design values.
 */

/* Desktop: brand locked to the left edge of the 1100px container;
   navigation remains right-aligned regardless of logo size. */
@media (min-width: 1051px) {
    .site-header .site-header__inner {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .site-header .site-logo {
        display: inline-flex;
        order: 0;
        flex: 0 0 auto;
        margin: 0 auto 0 0;
    }

    .site-header .site-nav {
        order: 1;
        flex: 0 1 auto;
        margin-left: auto;
    }

    .site-header .site-logo img {
        display: block;
        width: auto;
        height: auto;
        max-width: 210px;
        max-height: 67px;
        object-fit: contain;
        object-position: left center;
    }

    .site-header .site-nav > ul {
        gap: 15px;
    }

    .site-header .site-nav > ul > li > a {
        font-family: "Open Sans", sans-serif;
        font-size: 13px;
        font-weight: 600;
        line-height: 20px;
        letter-spacing: 1px;
        text-align: center;
        text-transform: uppercase;
        color: #282222;
    }
}

/* Keep the Buy button styling consistent across desktop and mobile. */
.site-header .site-nav > ul > li:last-child > a {
    padding: 6px 12px;
    border: 1px solid #F1515E;
    border-radius: 20px;
    background: #E44261;
    color: #FFFFFF !important;
    transition: background-color 0.2s linear, color 0.2s linear,
                border-color 0.2s linear;
}

.site-header .site-nav > ul > li:last-child > a:hover,
.site-header .site-nav > ul > li:last-child > a:focus-visible {
    background: #FFFFFF;
    color: #E44261 !important;
}


/* Full-screen navigation on phones and tablets. */
@media (max-width: 1050px) {
    /* Logo is always on the left; burger remains on the right. */
    .site-header .site-header__inner {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        justify-content: space-between;
        width: min(calc(100% - 32px), 1100px);
        margin-inline: auto;
        gap: 12px;
    }

    .site-header .site-logo {
        order: 0;
        display: inline-flex;
        flex: 0 1 auto;
        margin: 0 auto 0 0;
        min-width: 0;
        max-width: calc(100% - 60px);
        justify-content: flex-start;
    }

    .site-header .site-logo img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 56px;
        object-fit: contain;
        object-position: left center;
    }

    .site-header .site-menu-toggle {
        order: 1;
        display: flex;
        flex: 0 0 44px;
        margin: 0 0 0 auto;
    }

    html.nascar-menu-open {
        overflow: hidden;
    }

    .nascar-menu-open .site-header[data-site-header] {
        z-index: 100000;
    }

    .site-header .site-logo {
        position: relative;
        z-index: 103;
    }

    .site-header .site-menu-toggle {
        position: relative;
        z-index: 103;
        cursor: pointer;
    }

    .site-header .site-menu-toggle[aria-expanded="true"] {
        position: fixed;
        top: max(14px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        margin: 0;
    }

    .site-header .site-menu-toggle span {
        transition: transform 300ms ease, opacity 200ms ease, background-color 200ms ease;
    }

    .site-header .site-nav,
    .site-header .site-nav.is-open {
        display: block;
        position: fixed;
        inset: 0;
        width: auto;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: calc(var(--header-height) + 26px) 16px 42px;
        padding-bottom: max(42px, env(safe-area-inset-bottom));
        text-align: left;
        overflow-y: auto;
        overscroll-behavior: contain;
        border: 0;
        border-radius: 0;
        background: #fff;
        box-shadow: none;
        transform: translateY(-100%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
                    visibility 420ms;
        z-index: 102;
    }

    .site-header .site-nav.is-open {
        transform: translateY(0);
        visibility: visible;
        pointer-events: auto;
    }

    .site-header .site-nav > ul {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .site-header .site-nav > ul > li > a {
        font-family: var(--font-nascar, "Open Sans", sans-serif);
        font-size: 15px;
        font-weight: 600;
        line-height: 1.5;
        letter-spacing: 0.6px;
        text-transform: uppercase;
        color: #282222;
    }

    .site-header .site-nav > ul > li:last-child > a {
        display: inline-flex;
        margin-top: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header .site-nav,
    .site-header .site-menu-toggle span {
        transition-duration: 0.01ms !important;
    }
}


/* Sticky glass header: remains in normal document flow. */
.site-header[data-site-header] {
    position: sticky;
    top: 0;
    z-index: 101;
    background-color: #ffffff;
    border-bottom: 1px solid #eee7eb;
    transition: background-color 350ms ease, border-color 350ms ease, box-shadow 350ms ease;
}

.site-header[data-site-header].is-sticky {
    background-color: rgba(255, 255, 255, 0.76);
    -webkit-backdrop-filter: blur(16px) saturate(145%);
    backdrop-filter: blur(16px) saturate(145%);
    border-bottom-color: rgba(228, 66, 97, 0.12);
    box-shadow: 0 8px 28px rgba(40, 34, 34, 0.09);
}

/* Keep sliding mobile navigation opaque while the header is glass. */
@media (max-width: 1050px) {
    .site-header[data-site-header] .site-nav {
        background-color: #ffffff;
    }
}

@supports not (backdrop-filter: blur(1px)) {
    .site-header[data-site-header].is-sticky {
        background-color: rgba(255, 255, 255, 0.96);
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header[data-site-header] {
        transition: none;
    }
}

/* ------------------------------------------------------------
 * Navigation feedback: understated underline and active state.
 * Top-level links only; the final Buy button keeps its own style.
 * ------------------------------------------------------------ */
.site-header .site-nav > ul > li:not(:last-child) > a {
    position: relative;
    color: #282222;
    transition: color 240ms ease;
}

.site-header .site-nav > ul > li:not(:last-child) > a::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 9px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: #e44261;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}

.site-header .site-nav > ul > li:not(:last-child) > a:hover,
.site-header .site-nav > ul > li:not(:last-child) > a:focus-visible,
.site-header .site-nav > ul > li.current-menu-item:not(:last-child) > a,
.site-header .site-nav > ul > li.current_page_item:not(:last-child) > a,
.site-header .site-nav > ul > li.current-menu-ancestor:not(:last-child) > a,
.site-header .site-nav > ul > li.current_page_ancestor:not(:last-child) > a {
    color: #e44261;
}

.site-header .site-nav > ul > li:not(:last-child) > a:hover::after,
.site-header .site-nav > ul > li:not(:last-child) > a:focus-visible::after,
.site-header .site-nav > ul > li.current-menu-item:not(:last-child) > a::after,
.site-header .site-nav > ul > li.current_page_item:not(:last-child) > a::after,
.site-header .site-nav > ul > li.current-menu-ancestor:not(:last-child) > a::after,
.site-header .site-nav > ul > li.current_page_ancestor:not(:last-child) > a::after {
    transform: scaleX(1);
}

/* Keep the Buy CTA pink/white, even when WordPress marks it current. */
.site-header .site-nav > ul > li:last-child > a,
.site-header .site-nav > ul > li:last-child.current-menu-item > a,
.site-header .site-nav > ul > li:last-child.current_page_item > a {
    color: #ffffff !important;
}

.site-header .site-nav > ul > li:last-child > a:hover,
.site-header .site-nav > ul > li:last-child > a:focus-visible {
    color: #e44261 !important;
}

/* Entering sticky mode subtly strengthens the glass and bottom shadow.
 * No geometry changes, so scrolling cannot cause a layout jump. */
.site-header[data-site-header] {
    transition:
        background-color 380ms cubic-bezier(0.22, 1, 0.36, 1),
        border-color 380ms ease,
        box-shadow 380ms ease,
        -webkit-backdrop-filter 380ms ease,
        backdrop-filter 380ms ease;
}

.site-header[data-site-header].is-sticky {
    box-shadow: 0 7px 24px rgba(40, 34, 34, 0.14);
}

@media (max-width: 1050px) {
    .site-header .site-nav > ul > li:not(:last-child) > a::after {
        bottom: 7px;
        right: auto;
        width: 45px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header .site-nav > ul > li:not(:last-child) > a,
    .site-header .site-nav > ul > li:not(:last-child) > a::after {
        transition: none;
    }
}


/* ------------------------------------------------------------
 * v0.6.9: animated logo and compact sticky header.
 * Keep the header full width; only its internal vertical spacing
 * and logo dimensions change after scrolling.
 * ------------------------------------------------------------ */
.site-header[data-site-header] .site-header__inner {
    min-height: 88px;
    transition: min-height 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.site-header[data-site-header].is-sticky .site-header__inner {
    min-height: 68px;
}

.site-header[data-site-header] .site-logo {
    transform-origin: left center;
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Logo hover: a small lift and gentle zoom, never a big jump. */
@media (hover: hover) and (pointer: fine) {
    .site-header[data-site-header] .site-logo:hover {
        transform: translateY(-2px) scale(1.035);
    }
}

.site-header[data-site-header] .site-logo:focus-visible {
    outline: 2px solid #e44261;
    outline-offset: 5px;
    border-radius: 3px;
}

.site-header[data-site-header] .site-logo img {
    transition: max-height 360ms cubic-bezier(0.22, 1, 0.36, 1),
                max-width 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

@media (min-width: 1051px) {
    .site-header[data-site-header].is-sticky .site-logo img {
        max-width: 185px;
        max-height: 52px;
    }
}

@media (max-width: 1050px) {
    .site-header[data-site-header] .site-header__inner {
        min-height: 72px;
    }

    .site-header[data-site-header].is-sticky .site-header__inner {
        min-height: 62px;
    }

    .site-header[data-site-header].is-sticky .site-logo img {
        max-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .site-header[data-site-header] .site-header__inner,
    .site-header[data-site-header] .site-logo,
    .site-header[data-site-header] .site-logo img {
        transition: none;
    }
}

/* Put the glass on a separate layer so it cannot contain the fixed menu. */
@media (max-width: 1050px) {
    .site-header[data-site-header].is-sticky {
        background-color: transparent;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .site-header[data-site-header].is-sticky::before {
        content: "";
        position: absolute;
        inset: 0;
        pointer-events: none;
        background-color: rgba(255, 255, 255, 0.96);
    }

    @supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
        .site-header[data-site-header].is-sticky::before {
            background-color: rgba(255, 255, 255, 0.76);
            -webkit-backdrop-filter: blur(16px) saturate(145%);
            backdrop-filter: blur(16px) saturate(145%);
        }
    }
}
