/* SHARED NAVBAR
All component rules are scoped to .site-header to avoid conflicts
with Bootstrap, CakePHP and individual page styles. */

/* 1. Fixed header: transparent over the hero, solid everywhere else. */
.site-header {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    background: #1c3027;
    color: #fffdf4;
    font: 16px/1.6 Arial, Helvetica, sans-serif;
    letter-spacing: normal;
    text-align: left;
    transition: background .2s;
}
.site-header--overlay {
    background: transparent;
}
.site-header.is-scrolled,
.site-header.menu-open {
    background: #1c3027;
}
.site-header *,
.site-header *::before,
.site-header *::after {
    box-sizing: border-box;
}
.site-header a {
    color: inherit;
    text-decoration: none;
    font-weight: 400;
}
.site-header a:hover {
    text-decoration: underline;
    text-underline-offset: 5px;
}
.site-header a:focus-visible,
.site-header button:focus-visible,
.site-header input:focus-visible {
    outline: 2px solid #fffdf4;
    outline-offset: 4px;
}

/* 2. Desktop: links, centred brand and search share one compact row. */
.site-header .store-navigation {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 44px 190px;
    align-items: center;
    gap: 24px;
    padding: 16px 3%;
}
.site-header .wordmark {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin-inline-start: 12px;
    text-align: left;
    line-height: 1;
}
.site-header .wordmark:hover {
    text-decoration: none;
}
.site-header .wordmark > span {
    display: block;
    font: 40px/1 Georgia, serif;
    letter-spacing: -2px;
}
.site-header .wordmark small {
    display: block;
    margin-top: 6px;
    font-size: 10px;
    letter-spacing: 3.2px;
}
/* Keep the main navigation close to the wordmark while tools stay on the right. */
.site-header .navbar-menu {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    justify-content: flex-start;
    align-items: center;
    gap: 28px;
    margin-left: 0;
}
.site-header .nav-primary,
.site-header .nav-secondary {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 18px;
    min-width: 0;
}
.site-header .nav-primary {
    grid-column: 2;
    grid-row: 1;
}
.site-header .nav-secondary {
    grid-column: 2;
    grid-row: 1;
    gap: 14px;
}
.site-header .nav-primary > a,
.site-header .nav-secondary > a {
    white-space: nowrap;
}
.site-header .nav-link,
.site-header .nav-dropdown > .nav-link {
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    font-size: 18px;
    min-height: 38px;
    padding: 0 12px;
    white-space: nowrap;
}
.site-header .nav-link:hover,
.site-header .nav-link:focus {
    background: #ffffff12;
    text-decoration: none;
}
.site-header .nav-link.is-active,
.site-header .nav-link[aria-current="page"] {
    background: #fffdf4;
    color: #173f35;
    font-weight: 700;
    text-decoration: none;
}
.site-header .nav-dropdown {
    position: relative;
}
.site-header .nav-dropdown::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 10px;
}
.site-header .nav-dropdown__panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    display: grid;
    gap: 4px;
    min-width: 210px;
    padding: 10px;
    border: 1px solid #ffffff2e;
    border-radius: 8px;
    background: #173f35;
    box-shadow: 0 18px 45px #0004;
    opacity: 0;
    transform: translateY(-4px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}
.site-header .nav-dropdown:hover .nav-dropdown__panel,
.site-header .nav-dropdown:focus-within .nav-dropdown__panel {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}
.site-header .nav-dropdown__panel a {
    border-radius: 6px;
    color: #fffdf4;
    font-size: 18px;
    padding: 10px 12px;
    white-space: nowrap;
}
.site-header .nav-dropdown__panel a:hover,
.site-header .nav-dropdown__panel a:focus {
    background: #ffffff14;
    text-decoration: none;
}
/* 3. Search: one form works on every page and becomes a mobile row. */
.site-header .navbar-search {
    grid-column: 4;
    grid-row: 1;
    display: flex;
    align-items: center;
    width: 190px;
    flex-shrink: 0;
    gap: 8px;
    padding: 0 12px;
    margin: 0;
    border: 1px solid #ffffff80;
    border-radius: 999px;
}
/* Focus the complete rounded control instead of drawing a square around the input. */
.site-header .navbar-search:focus-within {
    outline: 2px solid #fffdf4;
    outline-offset: 2px;
}
.site-header .navbar-search input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    color: inherit;
    font: 12px Arial, sans-serif;
}
.site-header .navbar-search input:focus,
.site-header .navbar-search input:focus-visible,
.site-header .navbar-search button:focus,
.site-header .navbar-search button:focus-visible {
    outline: none;
    background: transparent;
}
.site-header .navbar-search input::placeholder {
    color: #fffdf4;
    opacity: .9;
}
.site-header .navbar-search button {
    width: 34px;
    height: 40px;
    padding: 8px;
}
.site-header button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    height: 44px;
    padding: 10px;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}
.site-header button:hover,
.site-header button:focus {
    background: #ffffff12;
    color: #fffdf4;
}
.site-header .search-icon {
    position: relative;
    width: 16px;
    height: 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}
.site-header .search-icon::after {
    content: '';
    position: absolute;
    right: -5px;
    bottom: -3px;
    width: 7px;
    height: 1.5px;
    background: currentColor;
    transform: rotate(45deg);
}

/* 4. Hamburger: hidden on desktop; the three bars become a close icon. */
.site-header .menu-toggle {
    display: none;
    gap: 10px;
}
.site-header .hamburger {
    display: grid;
    gap: 5px;
    width: 22px;
}
.site-header .hamburger span {
    height: 2px;
    background: currentColor;
    transition: transform .2s, opacity .2s;
}
.site-header.menu-open .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.site-header.menu-open .hamburger span:nth-child(2) {
    opacity: 0;
}
.site-header.menu-open .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* 5. Tablet/phone: keep the brand left, tools visible, and expand links below.
Without JS the links stay visible, so navigation is still usable. */
@media (max-width: 1250px) {
    .site-header {
        max-height: 100dvh;
        overflow-y: auto;
    }
    .site-header .store-navigation {
        grid-template-columns: 38px minmax(0, 1fr) 44px 44px 44px;
        gap: 10px;
        padding: 12px 18px 16px;
    }
    .site-header .wordmark {
        grid-column: 2;
        justify-self: start;
        margin-inline-start: 0;
    }
    .site-header .wordmark > span {
        font-size: 30px;
    }
    .site-header[data-enhanced] .menu-toggle {
        display: inline-flex;
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        width: 38px;
        height: 38px;
        padding: 8px;
    }
    .site-header .menu-toggle > span:last-child {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }
    .site-header .navbar-menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        grid-column: 1 / -1;
        grid-row: 3;
        margin-top: 0;
        padding-top: 12px;
        border-top: 1px solid #ffffff33;
        text-align: center;
        width: 100%;
    }
    .site-header[data-enhanced] .navbar-menu {
        display: none;
    }
    .site-header[data-enhanced].menu-open .navbar-menu {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    .site-header .nav-primary,
    .site-header .nav-secondary {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0;
        text-align: center;
        width: 100%;
    }
    .site-header .nav-primary > a,
    .site-header .nav-secondary > a,
    .site-header .nav-dropdown {
        display: block;
        min-height: 44px;
        font-size: 18px;
        text-align: center;
        width: 100%;
        max-width: 220px;
    }
    .site-header .nav-link,
    .site-header .nav-dropdown > .nav-link {
        justify-content: center;
        width: 100%;
        min-height: 44px;
        padding: 10px 4px;
    }
    .site-header .nav-dropdown__panel {
        position: static;
        display: grid;
        min-width: 0;
        width: 100%;
        padding: 0 0 8px;
        border: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        transform: none;
        visibility: visible;
        pointer-events: auto;
    }
    .site-header .nav-dropdown__panel a {
        color: #fffdf4;
        font-size: 18px;
        padding: 8px 4px;
    }
    .site-header .navbar-search {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid #ffffff66;
        border-radius: 50%;
        background: transparent;
        overflow: hidden;
    }
    .site-header .navbar-search input {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .site-header .navbar-search button {
        width: 44px;
        height: 44px;
        padding: 10px;
    }
}

/* Small phones use tighter edges while preserving comfortable touch targets. */
@media (max-width: 520px) {
    .site-header .store-navigation {
        grid-template-columns: 36px minmax(0, 1fr) 40px 40px 40px;
        gap: 8px;
        padding: 10px 12px 14px;
    }

    .site-header .wordmark > span {
        font-size: 24px;
        letter-spacing: -1px;
    }

    .site-header .wordmark small {
        font-size: 7px;
        letter-spacing: 3px;
    }

    .site-header .navbar-search {
        width: 40px;
        height: 40px;
    }
    .site-header .navbar-search button {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .site-header .nav-cart,
    .site-header .nav-profile {
        width: 40px;
        height: 40px;
    }

    .site-header[data-enhanced] .menu-toggle {
        width: 36px;
        height: 36px;
        padding: 7px;
    }
}

/* JS replaces this fallback with the actual closed header height. */
.navbar-spacer {
    --navbar-height: 76px;
    height: var(--navbar-height);
    flex-shrink: 0;
}
@media (max-width: 1250px) { .navbar-spacer {
    --navbar-height: 72px;
} }
.brand-auth--navigation {
    justify-content: flex-start;
}
.brand-auth--navigation .auth-main {
    margin-block: auto;
    padding-block: 32px;
}
@media (prefers-reduced-motion: reduce) {
    .site-header, .site-header * {
        animation: none !important;
        transition: none !important;
    }
}

/* The bag and total quantity stay visible outside the mobile link menu. */
.site-header .store-navigation {
    grid-template-columns: minmax(240px, auto) minmax(0, 1fr) 44px 190px 44px;
}
.site-header .nav-cart {
    grid-column: 3;
    grid-row: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}
/* Keep the bag beside Login, before the search field on desktop. */
@media (min-width: 1251px) {
    .site-header .navbar-search {
        grid-column: 4;
        grid-row: 1;
    }
    .site-header .nav-profile {
        grid-column: 5;
        grid-row: 1;
    }
}
.site-header .cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 50%;
    background: #fffdf4;
    color: #173f35;
    font: 700 12px/22px Arial, sans-serif;
    text-align: center;
}
.site-header .cart-added .cart-count { animation: cart-pop .6s ease; }
.site-header .nav-profile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid #ffffff66;
    border-radius: 50%;
}
.site-header .nav-profile:hover,
.site-header .nav-profile:focus {
    background: #ffffff12;
    text-decoration: none;
}
.site-header .nav-profile.is-active,
.site-header .nav-profile[aria-current="page"] {
    background: #fffdf4;
    border-color: #fffdf4;
    color: #173f35;
}
.site-header .profile-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 50%;
    background: #fffdf4;
    color: #173f35;
    font: 700 12px/22px Arial, sans-serif;
    text-align: center;
}
.site-header .nav-profile.is-active .profile-count,
.site-header .nav-profile[aria-current="page"] .profile-count {
    background: #173f35;
    color: #fffdf4;
}
@keyframes cart-pop {
    0%, 100% { transform: scale(1); }
    45% { transform: scale(1.45); }
}
.site-header .cart-feedback {
    position: fixed;
    top: 180px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 999px;
    background: #173f35;
    color: white;
    box-shadow: 0 4px 20px #0002;
    animation: cart-feedback-out 5s forwards;
    pointer-events: none;
}
@keyframes cart-feedback-out {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}
@media (max-width: 1250px) {
    .site-header .store-navigation { grid-template-columns: 38px minmax(0, 1fr) 44px 44px 44px; }
    .site-header .wordmark {
        grid-column: 2;
        justify-self: start;
    }
    .site-header .nav-cart { grid-column: 3; justify-self: end; }
    .site-header .nav-profile {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
    }
    .site-header .navbar-search {
        grid-column: 5;
        grid-row: 1;
        justify-self: end;
    }
    .site-header .navbar-menu {
        grid-column: 1 / -1;
    }
}
@media (prefers-reduced-motion: reduce) {
    .site-header .cart-added .cart-count { animation: none; }
    .site-header .cart-feedback { animation: cart-feedback-out 5s forwards !important; }
}
