/* ======================================================================
   Header — Cohort 1 (Amber Oud)
   Bootstrap-first: layout / spacing / colors / forms / dropdowns / buttons
   come from Bootstrap utilities + components. This file only carries
   premium polish that Bootstrap does NOT ship.
   ====================================================================== */

/* Sticky elevation cue (Bootstrap's .sticky-top has no shadow on scroll) */
.header-1-sticky.is-scrolled {
    box-shadow: 0 4px 8px rgba(17, 24, 39, 0.06), 0 2px 4px rgba(17, 24, 39, 0.04);
    transition: box-shadow 0.25s ease;
}

/* Mid-row layout
   Mobile (< 992px): [burger] [logo] [actions] in one row, search hidden
                      (it slides down as overlay via .header-1-search mobile fixed)
   Desktop (>= 992px): [logo] [search-flex] [actions] */
.header-1-mid-row {
    grid-template-columns: auto 1fr auto;
    column-gap: 12px;
    row-gap: 0;
    align-items: center;
}

.header-1-mid-row .header-1-logo {
    justify-self: start;
}

@media (max-width: 991.98px) {
    /* Mobile: hide the inline search form and let the overlay handle it.
       Logo centered between burger and action icons feels balanced. */
    .header-1-mid-row > .header-1-search {
        display: none;
    }
    body.is-mobile-search-open .header-1-mid-row > .header-1-search {
        display: block;
    }
}

@media (min-width: 992px) {
    .header-1-mid-row {
        grid-template-columns: auto 1fr auto;
        column-gap: 24px;
    }
}

/* Mobile burger — bigger, easier touch target, branded */
@media (max-width: 991.98px) {
    .header-1-burger {
        width: 44px;
        height: 44px;
        background: var(--bs-secondary-bg) !important;
        border-color: var(--bs-border-color) !important;
        color: var(--bs-primary) !important;
    }
    .header-1-burger:hover,
    .header-1-burger:focus {
        background: var(--bs-primary) !important;
        color: var(--bs-body-bg) !important;
        border-color: var(--bs-primary) !important;
    }
    .header-1-logo img {
        max-height: 50px;
        width: auto;
        object-fit: contain;
    }
    .header-1-action {
        width: 38px;
        height: 38px;
    }
}

/* Search field — strip every Bootstrap default that bleeds the wrong color
   (light-blue input border, dark-on-dark submit label) and apply the cohort's
   charcoal palette explicitly. */
.header-1-search-field {
    border: 1.5px solid var(--bs-border-color, var(--bs-border-color));
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--bs-body-bg, var(--bs-body-bg));
}

.header-1-search-field:focus-within {
    border-color: var(--bs-primary, var(--bs-body-color));
    box-shadow: 0 0 0 0.2rem rgba(17, 24, 39, 0.12);
}

.header-1-search-input.form-control {
    border: 0 !important;
    box-shadow: none !important;
    color: var(--bs-body-color, var(--bs-body-color)) !important;
    background: transparent !important;
    padding-left: 16px;
}

.header-1-search-input.form-control::placeholder {
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    opacity: 1;
}

.header-1-search-spinner {
    border: 0 !important;
    background: transparent !important;
}

.header-1-search-submit.btn.btn-primary {
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--bs-body-bg) !important;
    background: var(--bs-primary, var(--bs-body-color)) !important;
    padding-inline: 24px;
    font-weight: 600;
}
.header-1-search-submit.btn.btn-primary:hover,
.header-1-search-submit.btn.btn-primary:focus {
    background: var(--bs-btn-hover-bg) !important;
    color: var(--bs-body-bg) !important;
}

/* Search dropdown — premium floating panel */
.header-1-search-dropdown {
    border: 0;
    border-radius: 0.75rem;
    max-height: min(60vh, 480px);
    overflow-y: auto;
    z-index: 1080;
}

.header-1-search-dropdown[hidden] { display: none !important; }

.header-1-search-list a {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--bs-border-subtle, var(--bs-border-color));
    transition: background 0.15s ease;
}

.header-1-search-list a:last-child { border-bottom: 0; }
.header-1-search-list a:hover { background: var(--bs-light-primary, var(--bs-tertiary-bg)); }

.header-1-search-list img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 0.5rem;
    background: var(--bs-light-secondary, var(--bs-secondary-bg));
}

.header-1-search-name {
    font-weight: 600;
    color: var(--bs-body-color, var(--bs-body-color));
    line-height: 1.3;
    margin-bottom: 2px;
}

.header-1-search-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-weight: 600;
    color: var(--bs-primary, var(--bs-body-color));
}

.header-1-search-price-old {
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    font-size: 0.78em;
    font-weight: 500;
    text-decoration: line-through;
}

.header-1-search-empty {
    display: block;
    padding: 16px;
    text-align: center;
    color: var(--bs-secondary-color, var(--bs-secondary-color));
    font-size: 0.9rem;
}

/* Action icon buttons (User / Wishlist / Cart) — round chip that fills with
   primary on hover, icon glyph turns white. */
.header-1-action {
    color: var(--bs-body-color, var(--bs-body-color));
    text-decoration: none;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.header-1-action:hover,
.header-1-action:focus {
    color: var(--bs-body-bg) !important;
    background: var(--bs-primary, var(--bs-body-color));
    transform: translateY(-1px);
}
.header-1-action:focus { outline: none; box-shadow: 0 0 0 0.2rem rgba(17, 24, 39, 0.15); }

/* Cart + wishlist count badge — fixed 18×18 corner pip (rule 0.7) */
.site-header-cart-count,
.wishlist-count-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--bs-primary, var(--bs-body-color));
    color: var(--bs-body-bg);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--bs-body-bg, var(--bs-body-bg));
}

.site-header-cart-count[hidden],
.wishlist-count-badge[hidden] { display: none; }

/* Nav menu (driven by get_all_categories_in_menu — preserve quick-links hooks) */
.header-1-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.header-1-menu .nav-item { position: relative; }

.header-1-nav-row {
    padding-block: 6px;
    min-height: 0;
}

.header-1-menu .nav-link {
    color: var(--bs-body-color, var(--bs-body-color));
    font-weight: 500;
    font-size: 0.92rem;
    letter-spacing: 0.02em;
    padding: 8px 14px;
    border-radius: 0;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    position: relative;
}
.header-1-menu .nav-link:hover { color: var(--bs-primary, var(--bs-body-color)); }

/* Subtle gold underline on hover — premium boutique feel */
.header-1-menu > .nav-item > .nav-link::before {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 2px;
    height: 1.5px;
    background: var(--bs-warning, var(--bs-primary));
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.25s cubic-bezier(.2,.8,.2,1);
}
.header-1-menu > .nav-item > .nav-link:hover::before,
.header-1-menu > .nav-item.active > .nav-link::before {
    transform: scaleX(1);
}

/* Active/current category link */
.header-1-menu .nav-item.active > .nav-link,
.header-1-menu .nav-item.is-active > .nav-link { color: var(--bs-primary, var(--bs-body-color)); }

/* Submenu chevron — CSS triangle so size + alignment stay consistent
   (the unicode ▾ glyph rendered tiny / misaligned across fonts) */
.header-1-menu .has-child > .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.header-1-menu .has-child > .nav-link::after {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--bs-secondary-color, var(--bs-secondary-color));
    transition: transform 0.2s ease, border-top-color 0.2s ease;
}
.header-1-menu .has-child:hover > .nav-link::after,
.header-1-menu .has-child.is-expanded > .nav-link::after {
    border-top-color: var(--bs-primary, var(--bs-body-color));
}

/* Submenu container — get_all_categories_in_menu() outputs:
   <li class="nav-item has-child">
     <a class="nav-link"...>Parent</a>
     <div class="collapse menu-dropdown">
       <ul class="nav nav-sm flex-column">...</ul>
     </div>
   </li>
   The .collapse class hides everything by default — override that for the
   header dropdown panel; nested has-child uses the same div.menu-dropdown. */
.header-1-menu .has-child > .menu-dropdown {
    display: none !important;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    background: var(--bs-body-bg, var(--bs-body-bg));
    border-radius: 0.5rem;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.12);
    min-width: 240px;
    border: 1px solid var(--bs-border-subtle, var(--bs-border-color));
    overflow: hidden;
}

.header-1-menu .has-child > .menu-dropdown > ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (min-width: 992px) {
    .header-1-menu .has-child:hover > .menu-dropdown,
    .header-1-menu .has-child:focus-within > .menu-dropdown {
        display: block !important;
        position: absolute;
        top: 100%;
        left: 0;
        z-index: 1050;
    }
    /* Cascade nested dropdown to the right */
    .header-1-menu .has-child .has-child:hover > .menu-dropdown,
    .header-1-menu .has-child .has-child:focus-within > .menu-dropdown {
        top: 0;
        left: 100%;
    }
}

.header-1-menu .has-child > .menu-dropdown {
    padding: 0 !important;
    min-width: 260px;
}

.header-1-menu .has-child .menu-dropdown a {
    display: block;
    padding: 12px 22px;
    color: var(--bs-body-color, var(--bs-body-color));
    text-decoration: none;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
    line-height: 1.4;
    transition: background 0.15s ease, color 0.15s ease, padding-left 0.2s ease;
}
.header-1-menu .has-child .menu-dropdown a:hover {
    background: var(--bs-secondary-bg, var(--bs-secondary-bg));
    color: var(--bs-primary, var(--bs-body-color));
    padding-left: 28px;
}

/* Nested has-child item gets its own chevron (now points right on desktop) */
@media (min-width: 992px) {
    .header-1-menu .menu-dropdown .has-child > .nav-link::after {
        margin-left: auto;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-left: 6px solid var(--bs-secondary-color, var(--bs-secondary-color));
        border-right: 0;
    }
    .header-1-menu .menu-dropdown .has-child > .nav-link {
        justify-content: space-between;
    }
}

/* Mobile drawer (off-canvas) — Bootstrap offcanvas vibe but custom because the
   menu HTML comes from get_all_categories_in_menu() and we can't restructure it. */
@media (max-width: 991.98px) {
    .header-1-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100dvh;
        width: min(86vw, 360px);
        background: var(--bs-body-bg, var(--bs-body-bg));
        z-index: 1080;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        box-shadow: 0 0 32px rgba(17, 24, 39, 0.16);
    }

    body.is-mobile-nav-open .header-1-nav { transform: translateX(0); }

    .header-1-nav-container { padding: 16px; }

    .header-1-menu {
        flex-direction: column;
        gap: 0;
    }

    .header-1-menu > .nav-item + .nav-item { margin-left: 0; }

    .header-1-menu .nav-link {
        padding: 14px 4px !important;
        border-bottom: 1px solid var(--bs-border-color, var(--bs-border-color));
        justify-content: space-between;
        font-size: 1rem;
        position: relative;
    }
    /* Tap-affordance arrow on leaf items (no submenu) — subtle right chevron */
    .header-1-menu > .nav-item:not(.has-child) > .nav-link::after {
        content: "";
        display: inline-block;
        width: 0;
        height: 0;
        border-top: 4px solid transparent;
        border-bottom: 4px solid transparent;
        border-left: 5px solid var(--bs-secondary-color, var(--bs-secondary-color));
        opacity: 0.5;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }
    .header-1-menu > .nav-item:not(.has-child) > .nav-link:hover::after,
    .header-1-menu > .nav-item:not(.has-child) > .nav-link:active::after {
        opacity: 1;
        transform: translateX(2px);
        border-left-color: var(--bs-primary, var(--bs-body-color));
    }

    /* Mobile submenu — must use .menu-dropdown selector (the actual wrapper),
       not bare > ul, because get_all_categories_in_menu() outputs
       <li.has-child> > <a.nav-link> + <div.collapse.menu-dropdown> > <ul>. */
    .header-1-menu .has-child > .menu-dropdown {
        display: none !important;
        padding: 4px 0 12px 16px !important;
        margin: 0;
        border: 0;
        box-shadow: none;
        background: transparent;
        min-width: 0;
        position: static;
    }
    .header-1-menu .has-child.is-expanded > .menu-dropdown {
        display: block !important;
    }
    .header-1-menu .has-child.is-expanded > .nav-link::after {
        transform: rotate(180deg);
    }
    .header-1-menu .has-child > .menu-dropdown a {
        padding: 10px 4px !important;
        font-size: 0.92rem;
        border-bottom: 1px dashed var(--bs-border-color, var(--bs-border-color));
        letter-spacing: 0.02em;
    }
    .header-1-menu .has-child > .menu-dropdown a:hover {
        background: transparent !important;
        padding-left: 8px !important;
    }
    .header-1-menu .has-child > .menu-dropdown ul li:last-child a {
        border-bottom: 0;
    }

    /* Drawer footer socials — center on mobile */
    .header-1-drawer-social {
        justify-content: center !important;
    }

    .header-1-overlay {
        background: rgba(17, 24, 39, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 1070;
    }
    body.is-mobile-nav-open .header-1-overlay { opacity: 1; pointer-events: auto; }
}

@media (min-width: 992px) {
    .header-1-overlay { display: none !important; }
}

/* Mobile search overlay (full-width drop) */
@media (max-width: 991.98px) {
    .header-1-search {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        padding: 12px 16px;
        background: var(--bs-body-bg, var(--bs-body-bg));
        border-bottom: 1px solid var(--bs-border-subtle, var(--bs-border-color));
        z-index: 1040;
    }
    body.is-mobile-search-open .header-1-search { display: block; }
}
