/**
 * Header Unified V3 - Additions & Overrides (TEST BUILD)
 *
 * Identical to v2-additions.css plus section 13 which adds the mobile
 * hide-on-scroll nav using the sticky-negative-offset approach.
 *
 * Load AFTER header-unified.css. Rules extend and override v1/v2 for:
 *   1. Promo bar no-wrap
 *   2. Keyword highlight in search suggest results
 *   3. Amazon-style 2-row mobile header layout
 *   4. Mobile search suggest dropdown positioning (header row)
 *   5. Mobile menu inline suggest (slide-out panel)
 *   6. Mobile-only suggest product rows (name only)
 *  13. Mobile sticky nav — promo scrolls away, nav hides/shows on scroll
 */

/* ========================================
   1. PROMO BAR – WRAPPING TEXT
   Allow text to wrap naturally so longer promo copy
   is never truncated on any screen size.
   ======================================== */
.wr-promo-bar__text {
    white-space: normal;
    overflow: visible;
    min-width: 0;
}

/* ========================================
   2. KEYWORD HIGHLIGHT IN SEARCH RESULTS
   Bold only — matches Newegg / Amazon style.
   ======================================== */
.wr-suggest-hl {
    font-weight: 700;
    background: transparent;
    color: inherit;
    border-radius: 0;
    padding: 0;
    font-style: normal;
}

/* ========================================
   3. MOBILE 2-ROW HEADER LAYOUT  (≤768px)
   Row 1: [≡ logo]          [user] [cart]
   Row 2: [search                       ]
   ======================================== */
@media (max-width: 768px) {
    /* Promo bar: remove fixed height so wrapping text can grow the bar */
    .wr-promo-bar {
        height: auto;
        min-height: var(--wr-promo-height, 36px);
        max-height: none;
        overflow: visible;
        padding: 8px 16px;
        text-align: center;
    }

    /* Promo slide must also be allowed to wrap */
    .wr-promo-bar__slide {
        flex-wrap: wrap;
        gap: 4px 8px;
    }

    .wr-header-row {
        padding: 0;
    }

    .wr-header-row__inner {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 0;
        padding: 0;
        justify-content: initial; /* remove any inherited flex centering */
    }

    /* Row 1, col 1: hamburger + logo */
    .wr-header-row__logo {
        grid-column: 1;
        grid-row: 1;
        padding: 8px 12px;
    }

    /* Row 1, col 2: account + cart */
    .wr-header-icons {
        grid-column: 2;
        grid-row: 1;
        padding: 8px 12px;
    }

    /* Row 2: full-width search bar (was hidden in v1) */
    .wr-search--wide {
        display: flex !important; /* override v1 display:none */
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: none;
        width: 100%;
        padding: 0 12px 10px;
        box-sizing: border-box;
    }
}

/* ========================================
   4. MOBILE SUGGEST DROPDOWN – HEADER ROW
   Fixed to viewport; JS sets top = header.getBoundingClientRect().bottom
   ======================================== */
@media (max-width: 768px) {
    .wr-header-row .wr-search-suggest {
        position: fixed;
        top: 0; /* overridden by JS */
        left: 0;
        right: 0;
        min-width: 0;
        max-width: none;
        border-radius: 0 0 8px 8px;
        border-top: none;
        z-index: 1001;
    }

    .wr-header-row .wr-search-suggest__inner {
        display: block;
        max-height: 60vh;
        overflow-y: auto;
    }

    .wr-header-row .wr-search-suggest__products {
        border-right: none;
    }

    .wr-header-row .wr-search-suggest__sidebar {
        background: var(--wr-white, #fff);
        border-top: 1px solid var(--wr-gray-100, #f5f5f5);
    }
}

/* ========================================
   5. MOBILE MENU INLINE SUGGEST (slide-out)
   Flows in-page so wr-mobile-menu overflow:hidden won't clip it.
   ======================================== */
.wr-mobile-menu .wr-search-suggest {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
    box-shadow: none;
    border: none;
    border-top: 1px solid var(--wr-gray-200, #e5e7eb);
    border-radius: 0;
    margin: 8px -20px 0; /* bleed to panel edges */
    max-height: 55vh;
    overflow-y: auto;
    min-width: 0;
    display: none; /* hidden until is-visible */
}

.wr-mobile-menu .wr-search-suggest.is-visible {
    display: block;
}

.wr-mobile-menu .wr-search-suggest__inner {
    display: block;
    max-height: none;
    overflow: visible;
}

.wr-mobile-menu .wr-search-suggest__products {
    border-right: none;
}

.wr-mobile-menu .wr-search-suggest__sidebar {
    background: transparent;
}

/* ========================================
   6. MOBILE-ONLY PRODUCT ROWS (name only, no image/price)
   ======================================== */
.wr-search-suggest__product--mobile {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: #111827;
    border-bottom: 1px solid var(--wr-gray-100, #f5f5f5);
    transition: background 0.1s;
}

.wr-search-suggest__product--mobile:last-child {
    border-bottom: none;
}

.wr-search-suggest__product--mobile:hover,
.wr-search-suggest__product--mobile.is-focused {
    background: #f9fafb;
}

.wr-search-suggest__product--mobile .wr-search-suggest__product-name {
    font-size: 14px;
    font-weight: 400;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
}

/* ========================================
   7. BRAND PILL CHIPS (Newegg-style, mobile suggest top)
   ======================================== */
.wr-search-suggest__brand-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px 10px;
}

.wr-search-suggest__brand-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: var(--wr-gray-100, #f5f5f5);
    border: 1px solid var(--wr-gray-300, #cccccc);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--wr-gray-800, #333333);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.wr-search-suggest__brand-chip:hover,
.wr-search-suggest__brand-chip.is-focused {
    background: var(--wr-gray-200, #e5e7eb);
    border-color: var(--wr-gray-500, #888888);
    color: var(--wr-black, #151515);
}

/* ========================================
   8. SEARCH BUTTON OFFSET FIX (mobile header row)
   ======================================== */
@media (max-width: 768px) {
    .wr-header-row .wr-search--wide .wr-search__btn {
        margin-top: -5px;
        right: 10px;
    }
}

/* ========================================
   9. MOBILE SLIDE-OUT MENU – 90% WIDTH
   Leaves 10% visible so users see it's a panel overlay.
   Shadow only when open so it never peeks at the viewport edge when closed.
   ======================================== */
.wr-mobile-menu {
    right: auto;
    width: 90%;
    max-width: 385px;
    z-index: 1001;
    /* No box-shadow here — avoid it showing at viewport edge when closed */
}

.wr-mobile-menu.is-open {
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

/* ========================================
   10. PROMO BAR ON MOBILE
   Promo bar is visible. Height is auto (set above in the
   main mobile block) so long copy wraps instead of clipping.
   ======================================== */

/* ========================================
   11. MOBILE MENU INNER – GREY BACKGROUND
   ======================================== */
.wr-mobile-menu__inner {
    background: var(--wr-gray-100, #f5f5f5);
}

/* ========================================
   12. MOBILE MENU HEADER BAND (dark blue, Amazon-style)
   Full-bleed wrapper that breaks out of the 20px inner padding.
   ======================================== */
.wr-mobile-menu__header-band {
    background: #0B2739;
    margin: -20px -20px 0;       /* bleed to panel edges */
    padding: 14px 16px 14px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Override v1's wr-mobile-menu__header (now inside the band) */
.wr-mobile-menu__header-band .wr-mobile-menu__header {
    display: contents; /* let its children participate in the band's flex layout */
}

/* "Browse / Walcott Radio" title */
.wr-mobile-menu__title {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wr-mobile-menu__title-browse {
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.75);
    letter-spacing: 0.01em;
}

.wr-mobile-menu__title-brand {
    font-size: 1.0625rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* Close button on dark background */
.wr-mobile-menu__header-band .wr-mobile-menu__close {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    flex-shrink: 0;
}

.wr-mobile-menu__header-band .wr-mobile-menu__close:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

/* ========================================
   13. MOBILE STICKY HEADER — HIDE/SHOW ON SCROLL
   ──────────────────────────────────────────────
   Strategy: sticky <header> + CSS transform.

   The entire header (promo bar + nav row) is position:sticky at top:0.
   JS adds .is-nav-hidden which translates the whole header off-screen.
   Removing the class slides it back in via CSS transition.

   No JS height measurements, no per-frame top updates, no fixed
   positioning — the browser handles all layout naturally.
   ======================================== */
@media (max-width: 768px) {

    /* Sticky header — overrides base CSS position:relative on mobile */
    .wr-header {
        position: sticky;
        top: 0;
        z-index: 1001;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Slide entire header (promo + nav) off the top of the viewport */
    .wr-header.is-nav-hidden {
        transform: translateY(-100%);
    }

    /* Reset any positioning left over from previous iterations */
    .wr-header-row {
        position: relative;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    }
}
