/* ========================================
   BBH Lite - WooCommerce Navigation Styles
   Enqueued only when WooCommerce is active
   and the ecommerce header is enabled.
   ======================================== */

/* ========================================
   1. Top Utility Bar (Row 1)
   ======================================== */
.bbh-lite-utility-inner {
    display: flex;
    justify-content: space-between;
    align-content: center;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-bar {
    display: grid;
    grid-template-rows: 1fr;
    background: #005177;
    color: #fff;
    font-size: 0.8125rem;
    transition: grid-template-rows 0.3s ease;
}

/* When the sticky header is scrolled, collapse the utility bar height while
   the content slides upward and fades out. The grid-row transition keeps the
   collapse smooth without leaving an empty band behind. */
body.bbh-sticky-header.bbh-lite-scrolled .bbh-lite-utility-bar {
    grid-template-rows: 0fr;
}

body.bbh-sticky-header.bbh-lite-scrolled .bbh-lite-utility-inner {
    opacity: 0;
    transform: translateY(-100%);
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    margin: 0 auto;
    padding: 0.375rem 3rem;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-notice {
    margin: 0;
    line-height: 1.5;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-nav {
    margin: 0;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-menu {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-menu li {
    margin: 0;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-menu li + li {
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-menu a {
    display: block;
    padding: 0.25rem 0.125rem;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    line-height: 1.5;
    transition: color 0.15s ease;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-menu a:hover,
body.bbh-lite-woocommerce-active .bbh-lite-utility-menu a:focus {
    color: #fff;
    text-decoration: underline;
}

body.bbh-lite-woocommerce-active .bbh-lite-utility-nav a:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ========================================
   2. Main Ecommerce Header (Row 2)
   ======================================== */

body.bbh-lite-woocommerce-active .site-header .content-area {
    flex-wrap: nowrap;
}

/* Inline search box between branding and actions */
body.bbh-lite-woocommerce-active .bbh-lite-header-search {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 560px;
    margin: 0 auto;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-form {
    display: flex;
    align-items: center;
    width: 100%;
    border: 2px solid #0073aa;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-form label {
    flex: 1 1 auto;
    min-width: 0;
    display: block;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-field {
    width: 100%;
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.9375rem;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-field:focus-visible {
    outline: none;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.35);
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-submit {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0 1.25rem;
    border: none;
    background: #0073aa;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-submit:hover,
body.bbh-lite-woocommerce-active .bbh-lite-header-search .search-submit:focus {
    background: #005177;
}

/* Inline search replaces the toggle on desktop */
body.bbh-lite-woocommerce-active #search-toggle {
    display: none;
}

/* ========================================
   3. Shop Navigation Bar (Row 3)
   ======================================== */

body.bbh-lite-woocommerce-active .bbh-lite-shop-nav-bar {
    background: #fafafa;
    border-top: 1px solid #e5e5e5;
}

body.bbh-lite-woocommerce-active .bbh-lite-shop-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    padding: 0 3rem;
}

/* ========================================
   4. Categories Control
   ======================================== */

.bbh-lite-shop-categories {
    position: relative;
    flex-shrink: 0;
}

.bbh-lite-categories-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    min-height: 44px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #333;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-categories-toggle:hover,
.bbh-lite-categories-toggle:focus-visible {
    background-color: #f7f7f7;
    color: #0073aa;
    transition-duration: 0.15s;
}

.bbh-lite-categories-toggle:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.bbh-lite-categories-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.bbh-lite-categories-toggle-icon .icon-bar {
    display: block;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.bbh-lite-categories-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.bbh-lite-categories-toggle[aria-expanded="true"] .bbh-lite-categories-arrow {
    transform: rotate(180deg);
}

.bbh-lite-categories-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 280px;
    max-width: 360px;
    width: max-content;
    background: #fff;
    color: #333;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 100000;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.bbh-lite-categories-menu[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bbh-lite-categories-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    max-height: 70vh;
    overflow-y: auto;
}

.bbh-lite-categories-list li {
    margin: 0;
}

.bbh-lite-categories-list a {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    min-height: 44px;
    font-size: 0.875rem;
    line-height: 1.4;
    text-decoration: none;
    color: #333;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-categories-list a:hover,
.bbh-lite-categories-list a:focus {
    background-color: #f7f7f7;
    color: #0073aa;
}

.bbh-lite-categories-list a:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

.bbh-lite-categories-list li:first-child a {
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 0.25rem;
}

.bbh-lite-no-categories {
    margin: 0;
    padding: 1rem;
    font-size: 0.8125rem;
    color: #666;
    text-align: center;
}

.bbh-lite-shop-menu {
    flex: 1 1 auto;
    min-width: 0;
}

.bbh-lite-shop-nav-menu {
    justify-content: flex-end;
}

/* Shop navigation mobile toggle (visible on small screens only) */
.bbh-lite-shop-nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: 44px;
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #333;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-shop-nav-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex-shrink: 0;
}

.bbh-lite-shop-nav-toggle-icon .icon-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.bbh-lite-shop-nav-toggle:hover,
.bbh-lite-shop-nav-toggle:focus-visible {
    background-color: #f7f7f7;
    color: #0073aa;
    transition-duration: 0.15s;
}

.bbh-lite-shop-nav-toggle:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.bbh-lite-shop-home-link {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-shop-home-link:hover {
    background-color: #f7f7f7;
    color: #0073aa;
}

.bbh-lite-shop-home-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ========================================
   5. Header Actions Cluster (Row 2 right)
   ======================================== */

body.bbh-lite-woocommerce-active .bbh-lite-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 0 0 auto;
}

.bbh-lite-account-link,
.bbh-lite-orders-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 44px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-account-link:hover,
.bbh-lite-orders-link:hover,
.bbh-lite-cart-link:hover {
    background-color: #f7f7f7;
    color: #0073aa;
}

.bbh-lite-account-link:focus-visible,
.bbh-lite-orders-link:focus-visible,
.bbh-lite-cart-link:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.bbh-lite-hello-text,
.bbh-lite-returns-text {
    display: block;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    font-weight: 400;
    color: #666;
}

.bbh-lite-account-text,
.bbh-lite-orders-text {
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    color: #333;
}

.bbh-lite-header-icon {
    display: none;
}

.bbh-lite-cart-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bbh-lite-cart-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bbh-lite-cart-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #0073aa;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    position: absolute;
    top: -8px;
    right: -12px;
    transition: transform 0.2s ease;
}

.bbh-lite-cart-count.updated {
    transform: scale(1.25);
}

.bbh-lite-cart-text {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #333;
}

/* ========================================
   6. Desktop-only refinements
   ======================================== */

@media (min-width: 769px) {
    .bbh-lite-shop-menu .nav-menu > li > a {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        white-space: nowrap;
    }
}

/* ========================================
   7. Mobile: ecommerce header rows
   ======================================== */

@media (max-width: 768px) {
    body.bbh-lite-woocommerce-active .site-header .content-area {
        gap: 0.375rem;
    }

    body.bbh-lite-woocommerce-active .bbh-lite-header-actions {
        gap: 0;
    }

    .bbh-lite-account-link,
    .bbh-lite-orders-link {
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 44px;
        padding: 0;
    }

    .bbh-lite-header-icon {
        display: block;
        flex-shrink: 0;
    }

    .bbh-lite-account-line,
    .bbh-lite-orders-line,
    .bbh-lite-cart-text {
        display: none;
    }

    .bbh-lite-cart-link {
        justify-content: center;
        width: 44px;
        padding: 0;
        gap: 0;
    }

    .bbh-lite-cart-count {
        top: 0;
        right: 0;
    }

    /* The inline search box is replaced by the search toggle on mobile */
    body.bbh-lite-woocommerce-active .bbh-lite-header-search {
        display: none;
    }

    body.bbh-lite-woocommerce-active #search-toggle {
        display: flex;
    }

    body.bbh-lite-woocommerce-active .site-branding {
        flex: 0 1 auto;
        max-width: none;
    }

    body.bbh-lite-woocommerce-active .bbh-lite-shop-nav-bar {
        padding: 0 1rem;
    }

    body.bbh-lite-woocommerce-active .bbh-lite-shop-nav {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 0.25rem;
        padding: 1rem 0;
    }

    /* The utility bar is hidden on mobile; the shop controls own the row. */
    body.bbh-lite-woocommerce-active .bbh-lite-utility-bar {
        display: none;
    }

    body.bbh-lite-woocommerce-active .bbh-lite-utility-inner {
        justify-content: center;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.375rem 1rem;
    }

    body.bbh-lite-woocommerce-active .bbh-lite-utility-menu {
        justify-content: center;
    }

    .bbh-lite-shop-categories {
        order: 0;
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    .bbh-lite-categories-toggle {
        justify-content: center;
        overflow: hidden;
        width: fit-content;
        min-height: 48px;
    }

    .bbh-lite-categories-menu {
        position: static;
        width: 100%;
        max-width: none;
        min-width: 0;
        border-radius: 0;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
        transition: none;
    }

    .bbh-lite-categories-menu[aria-hidden="false"] {
        display: block;
    }

    .bbh-lite-shop-nav-toggle {
        order: 1;
        display: flex;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        min-height: 44px;
        padding: 0;
    }

    .bbh-lite-shop-menu {
        order: 3;
        display: none;
        flex: 0 0 100%;
        width: 100%;
        margin-top: 0.25rem;
        background: #fff;
        border: 1px solid #e5e5e5;
        border-radius: 4px;
    }

    .bbh-lite-shop-menu.active {
        display: block;
    }

    .bbh-lite-shop-home-link {
        order: 2;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        padding: 0;
        margin: 0;
        border-top: none;
        border-radius: 4px;
    }
}

/* Disable the sticky-header collapse animation for reduced motion users. */
@media ( prefers-reduced-motion: reduce ) {
    body.bbh-lite-woocommerce-active .bbh-lite-utility-bar,
    body.bbh-lite-woocommerce-active .bbh-lite-utility-inner,
    body.bbh-sticky-header.bbh-lite-scrolled .bbh-lite-utility-bar,
    body.bbh-sticky-header.bbh-lite-scrolled .bbh-lite-utility-inner {
        transition: none;
    }
}