/* ============================================================
   BROS & BOLTS HEADER — header.css
   ============================================================ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
    --bbh-bg:     #050506;
    --bbh-text:   #d4d4d8;
    --bbh-accent: #f97316;
    --bbh-h:      72px;
    --bbh-logo-h: 60px;
    --bbh-z:      9900;
    --bbh-radius: 10px;
    --bbh-trans:  0.3s cubic-bezier(.4,0,.2,1);
}

/* ── Global reset for header ───────────────────────────────── */
#bbh-header,
#bbh-header * {
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}
#bbh-header ul { list-style: none; margin: 0; padding: 0; }
#bbh-header a  { text-decoration: none; }

/* ── Main bar ──────────────────────────────────────────────── */
#bbh-header {
    position: relative;
    top: 0; left: 0; right: 0;
    width: 100%;
    height: var(--bbh-h);
    max-height: var(--bbh-h);   /* hard cap — nothing can stretch it */
    overflow: hidden;
    background: var(--bbh-bg);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    z-index: var(--bbh-z);
    transition: background var(--bbh-trans), box-shadow var(--bbh-trans);
}

/* Sticky */
#bbh-header.bbh-sticky { position: fixed; }

/* Body offset — applied via JS class */
body.bbh-has-header { padding-top: var(--bbh-h) !important; }

/* Scrolled glass */
#bbh-header.bbh-scrolled {
    background: rgba(5,5,6,0.92) !important;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 4px 32px rgba(0,0,0,0.45);
}

/* Transparent top (hero pages) */
#bbh-header.bbh-transparent:not(.bbh-scrolled) {
    background: linear-gradient(to bottom, rgba(5,5,6,0.85), transparent) !important;
    border-bottom-color: transparent !important;
}

/* Admin bar nudge */
.admin-bar #bbh-header.bbh-sticky { top: 32px; }
@media (max-width: 782px) { .admin-bar #bbh-header.bbh-sticky { top: 46px; } }
@media (max-width: 600px) { .admin-bar #bbh-header.bbh-sticky { top: 0; } }

/* ── Container ─────────────────────────────────────────────── */
#bbh-header .bbh-container {
    display: flex;
    align-items: center;
    height: var(--bbh-h);
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 28px;
    gap: 20px;
    overflow: hidden;   /* prevent logo from breaking layout */
}

/* ── Logo ──────────────────────────────────────────────────── */
#bbh-header .bbh-logo {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0;
    gap: 10px;
    transition: opacity 0.2s;
    /* Hard cap — logo can never be taller than the header bar */
    max-height: var(--bbh-h);
    overflow: hidden;
    max-width: 240px;    /* prevent super-wide logos breaking layout */
}
#bbh-header .bbh-logo:hover { opacity: 0.82; }

/* All !important needed: WoodMart resets img { height: auto !important } globally */
#bbh-header .bbh-logo img {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    height: var(--bbh-logo-h, 44px) !important;
    max-height: calc(var(--bbh-h) - 16px) !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
}
#bbh-header .bbh-logo-text {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.02em;
}

/* ── Desktop navigation ────────────────────────────────────── */
#bbh-header .bbh-nav {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Force-override WoodMart's global li/ul styles */
#bbh-header .bbh-nav-list,
#bbh-header nav ul.bbh-nav-list {
    display: flex !important;
    align-items: center !important;
    gap: 2px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
}
#bbh-header .bbh-nav-list > li {
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    vertical-align: middle !important;
    position: relative;
    border: none !important;
    background: none !important;
}

#bbh-header .bbh-nav-list > li > a {
    display: flex !important;
    align-items: center !important;
    height: 40px !important;
    padding: 0 13px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: var(--bbh-text) !important;
    border-radius: var(--bbh-radius) !important;
    transition: color 0.2s, background 0.2s !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    text-decoration: none !important;
}
#bbh-header .bbh-nav-list > li > a:hover,
#bbh-header .bbh-nav-list > li.current-menu-item > a,
#bbh-header .bbh-nav-list > li.current_page_item > a {
    color: #fff !important;
    background: rgba(255,255,255,0.07) !important;
}

/* Dropdown sub-menu */
#bbh-header .bbh-nav-list .sub-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: #0c0c0e;
    border: 1px solid #1c1c1e;
    border-radius: 12px;
    padding: 6px;
    min-width: 190px;
    z-index: 10;
    box-shadow: 0 16px 40px rgba(0,0,0,0.55);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    pointer-events: none;
}
#bbh-header .bbh-nav-list > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}
#bbh-header .bbh-nav-list .sub-menu a {
    display: block;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #a1a1aa !important;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
#bbh-header .bbh-nav-list .sub-menu a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff !important;
}

/* ── Actions bar ───────────────────────────────────────────── */
#bbh-header .bbh-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Icon buttons (account + cart) */
#bbh-header .bbh-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: var(--bbh-radius);
    color: var(--bbh-text) !important;
    transition: color 0.2s, background 0.2s;
}
#bbh-header .bbh-icon-btn:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.08);
}
#bbh-header .bbh-icon-btn svg { display: block; flex-shrink: 0; }

/* Cart icon + total value group — desktop */
#bbh-header .bbh-cart-btn {
    width: auto !important;
    padding: 0 12px !important;
    gap: 8px;
}
#bbh-header .bbh-cart-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.25;
}
#bbh-header .bbh-cart-total {
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
}
#bbh-header .bbh-cart-items {
    font-size: 10px;
    color: #71717a;
    white-space: nowrap;
}

/* Cart count badge — hidden on desktop (group shows instead),
   shown on mobile via responsive rule */
#bbh-header .bbh-cart-count {
    position: absolute;
    top: 5px; right: 5px;
    min-width: 16px; height: 16px;
    border-radius: 99px;
    background: var(--bbh-accent);
    color: #000 !important;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
#bbh-header .bbh-cart-count.has-items {
    opacity: 1;
    transform: scale(1);
}

/* Vertical divider */
#bbh-header .bbh-divider {
    width: 1px; height: 24px;
    background: rgba(255,255,255,0.12);
    margin: 0 8px;
    flex-shrink: 0;
}

/* CTA button */
#bbh-header .bbh-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 22px;
    height: 40px;
    border-radius: 99px;
    background: var(--bbh-accent);
    color: #000 !important;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
}
#bbh-header .bbh-cta-btn:hover {
    background: #ea6a0c;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(249,115,22,.35);
}

/* ── Hamburger ─────────────────────────────────────────────── */
#bbh-header .bbh-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px; height: 40px;
    padding: 0;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--bbh-radius);
    cursor: pointer;
    margin-left: 6px;
    transition: background 0.2s;
}
#bbh-header .bbh-hamburger:hover { background: rgba(255,255,255,0.1); }
#bbh-header .bbh-bar {
    display: block;
    width: 20px; height: 2px;
    background: #d4d4d8;
    border-radius: 99px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Hamburger → X animation */
#bbh-header.bbh-open .bbh-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#bbh-header.bbh-open .bbh-bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
#bbh-header.bbh-open .bbh-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile slide-in menu ──────────────────────────────────── */
#bbh-mobile-menu {
    position: fixed;
    top: var(--bbh-h);
    left: 0; right: 0; bottom: 0;
    background: #050506;
    z-index: calc(var(--bbh-z) - 1);
    transform: translateX(105%);
    transition: transform var(--bbh-trans);
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.06);
}
#bbh-mobile-menu.bbh-open {
    transform: translateX(0);
}

.admin-bar #bbh-mobile-menu { top: calc(var(--bbh-h) + 32px); }
@media (max-width: 782px) { .admin-bar #bbh-mobile-menu { top: calc(var(--bbh-h) + 46px); } }

#bbh-header .bbh-mobile-inner {
    padding: 20px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Mobile nav list */
#bbh-mobile-menu .bbh-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
#bbh-mobile-menu .bbh-mobile-list li a {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    font-size: 16px;
    font-weight: 600;
    color: #d4d4d8 !important;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
#bbh-mobile-menu .bbh-mobile-list li a:hover,
#bbh-mobile-menu .bbh-mobile-list li.current-menu-item > a {
    background: rgba(249,115,22,.08);
    color: var(--bbh-accent) !important;
    border-color: rgba(249,115,22,.15);
}

/* Sub-menu in mobile */
#bbh-mobile-menu .bbh-mobile-list .sub-menu {
    margin: 4px 0 4px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
#bbh-mobile-menu .bbh-mobile-list .sub-menu a {
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    color: #71717a !important;
}

/* Mobile bottom actions */
#bbh-header .bbh-mobile-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.07);
}
#bbh-header .bbh-mobile-acct-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    font-size: 14px;
    font-weight: 600;
    color: #d4d4d8 !important;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    transition: background 0.15s, color 0.15s;
}
#bbh-header .bbh-mobile-acct-btn:hover { background: rgba(255,255,255,0.09); color: #fff !important; }

#bbh-header .bbh-mobile-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #000 !important;
    border-radius: 12px;
    background: var(--bbh-accent);
    transition: background 0.15s, transform 0.15s;
}
#bbh-header .bbh-mobile-cta-btn:hover { background: #ea6a0c; transform: translateY(-1px); }

/* ── Dark overlay ──────────────────────────────────────────── */
#bbh-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: calc(var(--bbh-z) - 2);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}
#bbh-overlay.bbh-show {
    opacity: 1; pointer-events: auto;
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — four breakpoints
   1024px  tablet landscape → show hamburger, hide desktop nav
    768px  tablet portrait  → tighten spacing, shrink logo
    480px  large phones     → hide cart total text, CTA, divider
    360px  very small phones→ tighten further
   ════════════════════════════════════════════════════════════ */

/* ── ≤ 1024px : Tablet landscape ───────────────────────────── */
@media (max-width: 1024px) {
    #bbh-header .bbh-nav       { display: none !important; }
    #bbh-header .bbh-hamburger { display: flex; }
}

/* ── ≤ 768px : Tablet portrait ─────────────────────────────── */
@media (max-width: 768px) {
    :root { --bbh-h: 64px; --bbh-logo-h: 48px; }

    #bbh-header .bbh-container {
        padding: 0 20px;
        gap: 10px;
    }
    /* Tighten action bar */
    #bbh-header .bbh-actions { gap: 2px; }

    /* Icon buttons slightly smaller */
    #bbh-header .bbh-icon-btn {
        width: 38px; height: 38px;
        border-radius: 9px;
    }

    /* Hamburger */
    #bbh-header .bbh-hamburger {
        width: 38px; height: 38px;
        margin-left: 4px;
        gap: 4px;
    }

    /* Mobile menu top offset */
    #bbh-mobile-menu { top: var(--bbh-h); }
}

/* ── ≤ 480px : Large phones ─────────────────────────────────── */
@media (max-width: 480px) {
    :root { --bbh-h: 60px; --bbh-logo-h: 40px; }

    #bbh-header .bbh-container { padding: 0 16px; gap: 6px; }

    /* Hide desktop-only elements */
    #bbh-header .bbh-divider  { display: none !important; }
    #bbh-header .bbh-cta-btn  { display: none !important; }

    /* Cart: on small screens hide the total text block,
       show a simple icon-only button with the badge instead */
    #bbh-header .bbh-cart-btn {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
    #bbh-header .bbh-cart-group { display: none !important; }

    /* Re-enable the count badge for mobile */
    #bbh-header .bbh-cart-count {
        display: flex !important;
        opacity: 1 !important;
        transform: scale(1) !important;
    }

    /* Account icon */
    #bbh-header .bbh-icon-btn {
        width: 36px; height: 36px;
        border-radius: 8px;
    }

    /* Hamburger */
    #bbh-header .bbh-hamburger {
        width: 36px; height: 36px;
        margin-left: 2px;
    }
    #bbh-header .bbh-bar { width: 18px; }
}

/* ── ≤ 360px : Very small phones ────────────────────────────── */
@media (max-width: 360px) {
    :root { --bbh-h: 56px; --bbh-logo-h: 34px; }

    #bbh-header .bbh-container { padding: 0 12px; gap: 4px; }

    /* Hide account icon to save space on tiny screens */
    #bbh-header .bbh-account-btn { display: none !important; }

    #bbh-header .bbh-icon-btn { width: 34px; height: 34px; }
    #bbh-header .bbh-hamburger { width: 34px; height: 34px; }
}

/* ── Admin bar offsets at every breakpoint ──────────────────── */
.admin-bar #bbh-header.bbh-sticky { top: 32px; }
@media (max-width: 782px) {
    .admin-bar #bbh-header.bbh-sticky   { top: 46px; }
    .admin-bar #bbh-mobile-menu         { top: calc(var(--bbh-h) + 46px); }
}
@media (max-width: 600px) {
    /* WP admin bar hides at 600px */
    .admin-bar #bbh-header.bbh-sticky { top: 0; }
    .admin-bar #bbh-mobile-menu       { top: var(--bbh-h); }
}

/* ── Mobile menu inner padding — respects notch/safe area ───── */
@media (max-width: 480px) {
    #bbh-header .bbh-mobile-inner {
        padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 40px);
    }
    #bbh-mobile-menu .bbh-mobile-list li a {
        padding: 12px 16px;
        font-size: 15px;
    }
    #bbh-header .bbh-mobile-acct-btn  { padding: 12px 16px; }
    #bbh-header .bbh-mobile-cta-btn   { padding: 13px 16px; font-size: 14px; }
}

/* ── Prevent horizontal scroll caused by wide children ─────── */
#bbh-header,
#bbh-mobile-menu {
    overflow-x: hidden;
}
