/* Rock Box - Header masthead + category archive layout */
/*                                                                 */
/* Desktop masthead (Rough Trade style): single black bar with     */
/* logo LEFT, big AWS search CENTRE, LOGIN + record bag icon       */
/* RIGHT. Nav menu (white bar) sits below.                         */
/*                                                                 */
/* Mobile masthead (#rb-mobile-masthead): two rows - primary       */
/* [menu | logo | account | bag] + search. Sticky behaviour is     */
/* section 7, driven by rb-header.js.                              */
/*                                                                 */
/* Also handles category archive page layout: hides the left       */
/* sidebar on desktop (search + genre/artist filters) since the    */
/* AWS header search + filter dropdown replaces that functionality.*/
/* Sidebar still shows on mobile via existing .d-lg-none classes.  */
/*                                                                 */
/* Enqueued site-wide by rb_enqueue_header() in wc-functions.php   */
/* on wp_enqueue_scripts priority 20.                              */


/* === 1. Desktop masthead (#topbar) ================================ */

#topbar {
    background: #000;
    padding: 20px 0;
}

.rb-masthead {
    display: flex;
    align-items: center;
    gap: 40px;
}

/* Logo */
.rb-masthead-logo {
    flex: 0 0 auto;
    align-self: center;
    display: flex;
    align-items: center;
}

.rb-masthead-logo a {
    display: inline-block;
}

.rb-masthead-logo a img {
    height: 56px;
    width: auto;
    display: block;
}

/* Search bar - hero element, ~50% of masthead width */
.rb-masthead-search {
    flex: 1 1 50%;
    max-width: 700px;
    margin: 0 auto;
}

.rb-masthead-search .aws-container,
.rb-masthead-search .aws-search-form,
.rb-masthead-search .aws-wrapper {
    width: 100%;
    height: 46px;
}

.rb-masthead-search input[type="text"],
.rb-masthead-search input[type="search"] {
    width: 100%;
    height: 46px;
    padding: 0 60px 0 16px;
    font-family: "Cabin", sans-serif;
    font-size: 15px;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}

/* AWS submit button - it's a DIV with class .aws-search-btn, not a button element */
.rb-masthead-search .aws-search-btn {
    background: var(--rb-red, #e4032c) !important;
    color: #fff !important;
    border: 0;
    border-radius: 0;
    cursor: pointer;
}

.rb-masthead-search .aws-search-btn:hover {
    background: #b3021f !important;
}

.rb-masthead-search .aws-search-btn_icon svg {
    fill: #fff !important;
}

.rb-masthead-search .aws-search-btn_icon path {
    fill: #fff !important;
}

/* Utility cluster - LOGIN + Record Bag */
.rb-masthead-utility {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 24px;
}

.rb-masthead-login {
    color: #fff;
    font-family: "Raleway", sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.rb-masthead-login i {
    font-size: 16px;
}

.rb-masthead-login:hover,
.rb-masthead-login:focus {
    color: var(--rb-red, #e4032c);
    text-decoration: none;
}

/* Record bag icon + count */
.rb-masthead-bag {
    position: relative;
}

.rb-masthead-bag .dropdown-toggle {
    background: transparent;
    border: 0;
    padding: 0;
    color: #fff;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.rb-masthead-bag .dropdown-toggle::after {
    display: none;
}

.rb-masthead-bag .rb-masthead-bag-icon {
    height: 26px;
    width: auto;
    filter: brightness(0) invert(1);
    vertical-align: middle;
}

.rb-masthead-bag .cart-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--rb-red, #e4032c);
    color: #fff;
    font-family: "Cabin", sans-serif;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* === 2. Category archive - hide sidebar on desktop ================ */

@media (min-width: 992px) {
    .post-type-archive-product #content aside#sidebar,
    .tax-product_cat #content aside#sidebar,
    .tax-genres #content aside#sidebar,
    .tax-artist #content aside#sidebar {
        display: none;
    }

    .post-type-archive-product #content .row .col-lg-9,
    .tax-product_cat #content .row .col-lg-9,
    .tax-genres #content .row .col-lg-9,
    .tax-artist #content .row .col-lg-9 {
        flex: 0 0 100%;
        max-width: 100%;
        padding-left: 0 !important;
    }
}


/* === 5. Mobile masthead (#rb-mobile-masthead) =====================
   Two-row layout: [menu | logo | account | bag] then [AWS search]. */

.rb-mobile-masthead {
    background: #1e1e1c;
    color: #fff;
    padding: 0 15px;
}

.rb-mobile-masthead-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rb-mobile-masthead-row-primary {
    padding: 10px 0;
    justify-content: space-between;
}

.rb-mobile-masthead-row-search {
    padding: 0 0 10px 0;
}

/* Hamburger */
.rb-mobile-masthead-menu {
    background: transparent;
    border: 0;
    color: #fff;
    padding: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.rb-mobile-masthead-menu i {
    color: #fff;
    font-size: 20px;
}

/* Logo */
.rb-mobile-masthead-logo {
    display: inline-flex;
    align-items: center;
    flex: 0 1 auto;
}

.rb-mobile-masthead-logo img {
    height: 36px;
    width: auto;
    display: block;
}

/* Utility cluster */
.rb-mobile-masthead-utility {
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 0 0 auto;
}

.rb-mobile-masthead-account {
    color: #fff;
    display: inline-flex;
    align-items: center;
    font-size: 20px;
    padding: 6px;
}

.rb-mobile-masthead-account:hover,
.rb-mobile-masthead-account:focus {
    color: var(--rb-red, #e4032c);
}

.rb-mobile-masthead-bag {
    position: relative;
    color: #fff;
    display: inline-flex;
    align-items: center;
    padding: 6px;
}

.rb-mobile-masthead-bag .rb-mobile-masthead-bag-icon {
    height: 24px;
    width: 24px;
    filter: brightness(0) invert(1);
    vertical-align: middle;
}

.rb-mobile-masthead-bag .cart-count {
    position: absolute;
    top: 0;
    right: -6px;
    background: var(--rb-red, #e4032c);
    color: #fff;
    font-family: "Cabin", sans-serif;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* AWS search styling for mobile row 2 */
.rb-mobile-masthead-row-search .aws-container,
.rb-mobile-masthead-row-search .aws-search-form,
.rb-mobile-masthead-row-search .aws-wrapper {
    width: 100%;
    height: 36px;
}

.rb-mobile-masthead-row-search input[type="text"],
.rb-mobile-masthead-row-search input[type="search"] {
    width: 100%;
    height: 36px;
    padding: 0 50px 0 12px;
    font-family: "Cabin", sans-serif;
    font-size: 14px;
    border: 0;
    border-radius: 0;
    background: #fff;
    color: #333;
    box-sizing: border-box;
}

.rb-mobile-masthead-row-search .aws-search-btn {
    background: var(--rb-red, #e4032c) !important;
    color: #fff !important;
    border: 0;
    cursor: pointer;
}

.rb-mobile-masthead-row-search .aws-search-btn:hover {
    background: #b3021f !important;
}

.rb-mobile-masthead-row-search .aws-search-btn_icon svg,
.rb-mobile-masthead-row-search .aws-search-btn_icon path {
    fill: #fff !important;
}


/* === 7. Sticky masthead ===========================================
   Masthead pins to the top of the viewport and stays put. A scroll
   away variant (hide on scroll down, return on scroll up) was built
   and rejected 21 July 2026: on iOS Safari the animated transform on
   a position: sticky element catches partway through the transition.
   Tried shorter durations, removing will-change, and scroll delta
   thresholds - none settled it. Keeping search and the record bag
   permanently reachable is the point, and a static sticky bar does
   that without the motion.

   #header stays static by default so its 10px padding strip does not
   show below the masthead when the menu is closed. It becomes sticky
   only while the collapse is open, keeping the menu in view at any
   scroll position. */

:root {
    --rb-mobile-masthead-height: 102px;
}

@media (max-width: 991.98px) {
    .rb-mobile-masthead {
        position: sticky;
        top: 0;
        z-index: 1030;
    }

    #header {
        position: static;
        padding: 0;
    }

    #header:has(.navbar-collapse.show),
    #header:has(.navbar-collapse.collapsing) {
        position: sticky;
        top: var(--rb-mobile-masthead-height);
        z-index: 1029;
        max-height: calc(100vh - var(--rb-mobile-masthead-height));
        overflow-y: auto;
        padding: 10px 0;
    }
}
