/* ============================================================================
   BAFLEH PUBLIC FINAL B14 - 2026-09-06
   Final public-site stabilisation layer.
   Scope: BaflehJewellery public catalogue/navigation only.
   Loaded after every older parity stylesheet so archive spacing and filter UX
   are deterministic instead of depending on the historical CSS cascade.
   ============================================================================ */

:root {
    --b14-ink: #171717;
    --b14-muted: #73706b;
    --b14-line: #e8e4de;
    --b14-soft: #faf9f7;
    --b14-gold: #b7a889;
}

/* Keep keyboard/anchor navigation clear of the sticky mobile header. */
html { scroll-behavior: smooth; }
body.bafleh-page-catalog #shop-results { scroll-margin-top: 22px; outline: 0; }

/* --------------------------------------------------------------------------
   HEADER / MENU
   Keep the desktop navigation compact enough for common 1366/1440 widths and
   preserve comfortable touch sizing on tablets/mobile.
   -------------------------------------------------------------------------- */
@media (min-width: 981px) {
    .bafleh-live-header-shell {
        grid-template-columns: minmax(150px, 205px) minmax(0, 1fr) minmax(250px, 300px) !important;
        column-gap: clamp(12px, 1.7vw, 28px) !important;
        padding-left: clamp(22px, 3vw, 50px) !important;
        padding-right: clamp(22px, 3vw, 50px) !important;
    }
    .bafleh-live-menu {
        gap: 0 !important;
        justify-content: center !important;
    }
    .bafleh-live-menu > li {
        margin: 0 clamp(6px, .72vw, 13px) !important;
    }
    .bafleh-live-menu > li > a,
    .bafleh-live-menu > li > button {
        min-height: 42px !important;
        height: 42px !important;
        font-size: clamp(9px, .72vw, 11px) !important;
        line-height: 1 !important;
    }
    .bafleh-live-header-actions {
        justify-content: flex-end !important;
        gap: 3px !important;
    }
}

@media (min-width: 981px) and (max-width: 1240px) {
    .bafleh-live-header-shell {
        grid-template-columns: 145px minmax(0, 1fr) 236px !important;
        padding-left: 18px !important;
        padding-right: 18px !important;
        column-gap: 8px !important;
    }
    .bafleh-live-logo img { width: 125px !important; }
    .bafleh-live-menu > li { margin: 0 5px !important; }
    .bafleh-live-menu > li > a,
    .bafleh-live-menu > li > button { font-size: 9px !important; }
    .bafleh-live-eshop a { gap: 5px !important; font-size: 12px !important; }
    .bafleh-header-action { width: 32px !important; }
}

/* --------------------------------------------------------------------------
   SHOP / CATALOGUE - VERTICAL RHYTHM
   The previous stack had 40px title padding + archive padding + active-filter
   row outside the content grid. B14 removes that dead vertical area.
   -------------------------------------------------------------------------- */
body.bafleh-page-catalog .bafleh-wp-shop-title {
    padding: 20px 0 10px !important;
    margin: 0 !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title.is-refined {
    padding-top: 13px !important;
    padding-bottom: 6px !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-heading h1 {
    margin-bottom: 2px !important;
    font-size: clamp(34px, 3vw, 42px) !important;
    line-height: 1.12 !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title.is-refined .catalog-heading h1 {
    font-size: clamp(30px, 2.5vw, 38px) !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider {
    height: 11px !important;
    margin-top: 2px !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider::before,
body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider::after {
    top: 5px !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider + p {
    margin-top: 7px !important;
    font-size: 13px !important;
    line-height: 1.55 !important;
}
body.bafleh-page-catalog .bafleh-wp-shop {
    padding-top: 4px !important;
    padding-bottom: 54px !important;
}
body.bafleh-page-catalog .bafleh-wp-shop .catalog-intro {
    margin-bottom: 18px !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
}
body.bafleh-page-catalog .bafleh-wp-shop-title .container,
body.bafleh-page-catalog .bafleh-wp-shop > .container {
    width: min(100% - 40px, 1460px) !important;
    max-width: 1460px !important;
}

/* Active filters belong to the product column, not above both columns. */
body.bafleh-page-catalog .catalog-filter-active-row {
    width: 100% !important;
    margin: 0 0 10px !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}
body.bafleh-page-catalog .catalog-filter-chip {
    min-height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 5px 9px !important;
    border: 1px solid var(--b14-line) !important;
    border-radius: 2px !important;
    background: var(--b14-soft) !important;
    color: #555 !important;
    font-size: 10px !important;
    line-height: 1.2 !important;
}
body.bafleh-page-catalog .live-clear-filters {
    color: #333 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
}

/* --------------------------------------------------------------------------
   DESKTOP FILTER UX
   One deliberate Apply action. No checkbox-triggered reloads. The filter form
   gets its own scroll area so the action buttons remain visible at the bottom.
   -------------------------------------------------------------------------- */
.catalog-filter-desktop-footer { display: none; }

@media (min-width: 981px) {
    body.bafleh-page-catalog .catalog-layout {
        grid-template-columns: 260px minmax(0, 1fr) !important;
        gap: clamp(28px, 3vw, 46px) !important;
        align-items: start !important;
    }
    body.bafleh-page-catalog .catalog-sidebar .live-filter-form {
        position: sticky !important;
        top: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        max-height: calc(100vh - 205px) !important;
        padding: 0 15px 0 0 !important;
        border-right: 1px solid var(--b14-line) !important;
        background: #fff !important;
        overflow: hidden !important;
    }
    body.bafleh-page-catalog .catalog-filter-scroll {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        padding: 0 7px 6px 1px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        scrollbar-width: thin !important;
        scrollbar-color: #cbc5bd transparent !important;
    }
    body.bafleh-page-catalog .catalog-filter-scroll::-webkit-scrollbar { width: 4px !important; }
    body.bafleh-page-catalog .catalog-filter-scroll::-webkit-scrollbar-thumb {
        border-radius: 8px !important;
        background: #cbc5bd !important;
    }
    /* Avoid a scrollbar inside another scrollbar. */
    body.bafleh-page-catalog .filter-option-list,
    body.bafleh-page-catalog .filter-category-list {
        max-height: none !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }
    body.bafleh-page-catalog .catalog-filter-desktop-footer {
        flex: 0 0 auto !important;
        display: grid !important;
        grid-template-columns: .72fr 1.28fr !important;
        gap: 8px !important;
        padding: 11px 7px 2px 1px !important;
        border-top: 1px solid var(--b14-line) !important;
        background: rgba(255,255,255,.98) !important;
    }
    body.bafleh-page-catalog .catalog-filter-clear-button,
    body.bafleh-page-catalog .catalog-filter-apply-button {
        min-height: 39px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        padding: 8px 10px !important;
        border: 1px solid #222 !important;
        border-radius: 2px !important;
        font-family: var(--bafleh-font-ui, "Montserrat", Arial, sans-serif) !important;
        font-size: 9px !important;
        font-weight: 600 !important;
        line-height: 1 !important;
        letter-spacing: .05em !important;
        text-decoration: none !important;
        text-transform: uppercase !important;
        cursor: pointer !important;
    }
    body.bafleh-page-catalog .catalog-filter-clear-button {
        background: #fff !important;
        color: #222 !important;
    }
    body.bafleh-page-catalog .catalog-filter-apply-button {
        background: #1b1b1b !important;
        color: #fff !important;
    }
    body.bafleh-page-catalog .catalog-filter-apply-button:hover,
    body.bafleh-page-catalog .catalog-filter-apply-button:focus-visible {
        background: #000 !important;
        box-shadow: 0 0 0 3px rgba(0,0,0,.08) !important;
    }
    body.bafleh-page-catalog .catalog-sidebar.has-pending-filters .catalog-filter-apply-button {
        box-shadow: 0 0 0 2px rgba(183,168,137,.42) !important;
    }
}

/* Filter typography/spacing: compact but not cramped. */
body.bafleh-page-catalog .filter-block {
    margin: 0 0 15px !important;
    padding: 0 0 14px !important;
}
body.bafleh-page-catalog .filter-title-row {
    min-height: 22px !important;
    margin-bottom: 7px !important;
}
body.bafleh-page-catalog .filter-title-row h3,
body.bafleh-page-catalog .filter-block > h3 {
    font-size: 12px !important;
    font-weight: 600 !important;
}
body.bafleh-page-catalog .filter-title-row > a {
    display: inline !important;
    color: #817d77 !important;
    font-size: 9px !important;
    text-decoration: none !important;
    border-bottom: 1px solid #d1ccc5 !important;
}
body.bafleh-page-catalog .live-filter-option {
    min-height: 30px !important;
    padding: 4px 3px !important;
}

/* Price range remains prominent, while Apply Price gives an immediate action. */
body.bafleh-page-catalog .price-filter-block { margin-bottom: 16px !important; }
body.bafleh-page-catalog .b13-price-values { margin-bottom: 8px !important; }
body.bafleh-page-catalog .b13-price-actions { min-height: 32px !important; }
body.bafleh-page-catalog .live-filter-price-button {
    min-width: 92px !important;
    min-height: 32px !important;
}

/* --------------------------------------------------------------------------
   PRODUCT RESULTS
   Make the first row arrive immediately after title/tools and keep card rhythm
   stable despite different title lengths or image aspect ratios.
   -------------------------------------------------------------------------- */
body.bafleh-page-catalog .catalog-toolbar {
    min-height: 38px !important;
    margin: 0 0 12px !important;
    gap: 16px !important;
}
body.bafleh-page-catalog .catalog-result-count {
    color: #68645f !important;
    font-size: 12px !important;
}
body.bafleh-page-catalog .catalog-sort-form select {
    min-width: 205px !important;
    height: 38px !important;
}
body.bafleh-page-catalog .live-product-grid {
    align-items: stretch !important;
    gap: 26px 20px !important;
}
body.bafleh-page-catalog .live-product-card {
    padding: 12px !important;
    background: #f5f4f2 !important;
}
body.bafleh-page-catalog .live-product-image-wrap {
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    background: #f5f4f2 !important;
}
body.bafleh-page-catalog .live-product-image-primary,
body.bafleh-page-catalog .live-product-image-secondary {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
    object-position: center !important;
}
body.bafleh-page-catalog .live-product-info {
    min-height: 78px !important;
    padding: 10px 3px 2px !important;
}
body.bafleh-page-catalog .live-product-info h3,
body.bafleh-page-catalog .live-product-card h3 {
    min-height: 38px !important;
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    margin: 0 auto 4px !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
}
body.bafleh-page-catalog .live-price-row {
    min-height: 22px !important;
}
body.bafleh-page-catalog .empty-catalog-box {
    margin: 8px 0 30px !important;
    padding: 34px 24px !important;
}
body.bafleh-page-catalog .live-pager {
    margin-top: 30px !important;
    padding-top: 3px !important;
}

/* --------------------------------------------------------------------------
   MOBILE / TABLET
   The filter/sort bar stays close to the title, drawer actions remain fixed,
   nested scroll areas are removed and products begin without a large gap.
   -------------------------------------------------------------------------- */
@media (max-width: 980px) {
    :root {
        --bafleh-mobile-header: 82px;
        --bafleh-mobile-utility: 24px;
    }
    .bafleh-live-header,
    .bafleh-live-header-shell {
        height: var(--bafleh-mobile-header) !important;
        min-height: var(--bafleh-mobile-header) !important;
    }
    .bafleh-live-header-shell {
        grid-template-columns: minmax(92px, 1fr) auto auto !important;
        padding: var(--bafleh-mobile-utility) 10px 0 !important;
    }
    .bafleh-live-logo img {
        width: clamp(100px, 30vw, 126px) !important;
        max-height: 43px !important;
    }
    .bafleh-header-action { width: 36px !important; height: 46px !important; }
    .bafleh-live-mobile-menu { width: 40px !important; height: 46px !important; }

    body.bafleh-page-catalog .bafleh-wp-shop-title {
        padding: 13px 0 5px !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title.is-refined {
        padding-top: 8px !important;
        padding-bottom: 3px !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-heading h1,
    body.bafleh-page-catalog .bafleh-wp-shop-title.is-refined .catalog-heading h1 {
        font-size: clamp(25px, 7vw, 31px) !important;
        line-height: 1.12 !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider {
        width: 128px !important;
        height: 9px !important;
        margin-top: 1px !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider::before,
    body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider::after {
        top: 4px !important;
        width: 52px !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title .catalog-title-divider + p {
        margin-top: 5px !important;
        font-size: 11px !important;
        line-height: 1.45 !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop {
        padding-top: 0 !important;
        padding-bottom: 40px !important;
    }
    body.bafleh-page-catalog .bafleh-wp-shop-title .container,
    body.bafleh-page-catalog .bafleh-wp-shop > .container {
        width: calc(100% - 24px) !important;
        max-width: none !important;
    }
    body.bafleh-page-catalog .catalog-intro {
        margin-bottom: 10px !important;
        font-size: 12px !important;
    }

    body.bafleh-page-catalog .catalog-mobile-actions {
        top: calc(var(--bafleh-mobile-header) - 1px) !important;
        grid-template-columns: .9fr 1.25fr !important;
        gap: 7px !important;
        margin: 0 -12px 9px !important;
        padding: 7px 12px !important;
        border-top: 0 !important;
    }
    body.bafleh-page-catalog .catalog-mobile-filter-button,
    body.bafleh-page-catalog .catalog-mobile-actions .catalog-sort-form select {
        min-height: 42px !important;
        height: 42px !important;
    }
    body.bafleh-page-catalog .catalog-mobile-filter-button { font-size: 10px !important; }
    body.bafleh-page-catalog .catalog-mobile-actions .catalog-sort-form select { font-size: 10px !important; }

    body.bafleh-page-catalog .catalog-filter-active-row {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        margin: 0 0 8px !important;
        padding: 0 0 4px !important;
        scrollbar-width: none !important;
    }
    body.bafleh-page-catalog .catalog-filter-active-row::-webkit-scrollbar { display: none !important; }
    body.bafleh-page-catalog .catalog-filter-chip,
    body.bafleh-page-catalog .catalog-filter-active-row .live-clear-filters {
        flex: 0 0 auto !important;
        white-space: nowrap !important;
    }

    body.bafleh-page-catalog .catalog-content > .catalog-toolbar {
        min-height: 24px !important;
        margin-bottom: 8px !important;
    }
    body.bafleh-page-catalog .catalog-result-count { font-size: 10px !important; }

    /* Drawer: one scroll surface + permanently reachable actions. */
    body.bafleh-page-catalog .catalog-sidebar,
    body.bafleh-page-catalog .catalog-sidebar.is-open {
        width: min(92vw, 390px) !important;
    }
    body.bafleh-page-catalog .catalog-filter-drawer-head {
        height: 56px !important;
        padding: 0 15px !important;
    }
    body.bafleh-page-catalog .catalog-filter-scroll {
        padding: 4px 16px 96px !important;
    }
    body.bafleh-page-catalog .filter-option-list,
    body.bafleh-page-catalog .filter-category-list {
        max-height: none !important;
        overflow: visible !important;
        padding-right: 0 !important;
    }
    body.bafleh-page-catalog .filter-block {
        margin: 0 !important;
        padding: 13px 0 !important;
    }
    body.bafleh-page-catalog .live-filter-option {
        min-height: 39px !important;
        padding: 6px 3px !important;
        font-size: 13px !important;
    }
    body.bafleh-page-catalog .catalog-filter-desktop-footer { display: none !important; }
    body.bafleh-page-catalog .catalog-filter-mobile-footer {
        padding: 9px 12px max(9px, env(safe-area-inset-bottom)) !important;
        gap: 7px !important;
    }
    body.bafleh-page-catalog .catalog-filter-mobile-footer a,
    body.bafleh-page-catalog .catalog-filter-mobile-footer button {
        min-height: 44px !important;
        border-radius: 2px !important;
        font-size: 10px !important;
    }

    body.bafleh-page-catalog .b10-price-slider { margin-top: 5px !important; margin-bottom: 4px !important; }
    body.bafleh-page-catalog .b13-price-values { margin-bottom: 7px !important; }
    body.bafleh-page-catalog .live-filter-price-button { min-height: 38px !important; }

    body.bafleh-page-catalog .live-product-grid {
        grid-template-columns: repeat(2, minmax(0,1fr)) !important;
        gap: 18px 9px !important;
    }
    body.bafleh-page-catalog .live-product-card { padding: 7px !important; }
    body.bafleh-page-catalog .live-product-info {
        min-height: 68px !important;
        padding: 8px 1px 1px !important;
    }
    body.bafleh-page-catalog .live-product-info h3,
    body.bafleh-page-catalog .live-product-card h3 {
        min-height: 35px !important;
        margin-bottom: 3px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
    }
    body.bafleh-page-catalog .live-price-row .price { font-size: 12px !important; }
    body.bafleh-page-catalog .live-pager {
        margin-top: 23px !important;
        gap: 5px !important;
    }
    body.bafleh-page-catalog .live-pager a,
    body.bafleh-page-catalog .live-pager span {
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Product detail pages: prevent a second oversized top gap below sticky header. */
    body.bafleh-page-product .product-detail-live-section {
        padding-top: 14px !important;
        padding-bottom: 28px !important;
    }
    body.bafleh-page-product .detail-breadcrumb { margin-bottom: 13px !important; }
}

@media (max-width: 420px) {
    body.bafleh-page-catalog .bafleh-wp-shop-title .container,
    body.bafleh-page-catalog .bafleh-wp-shop > .container { width: calc(100% - 20px) !important; }
    body.bafleh-page-catalog .catalog-mobile-actions {
        margin-left: -10px !important;
        margin-right: -10px !important;
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
    body.bafleh-page-catalog .live-product-grid { gap: 16px 7px !important; }
    body.bafleh-page-catalog .live-product-card { padding: 6px !important; }
    body.bafleh-page-catalog .live-product-info h3,
    body.bafleh-page-catalog .live-product-card h3 { font-size: 11px !important; }
}

@media (max-width: 330px) {
    body.bafleh-page-catalog .live-product-grid { grid-template-columns: 1fr !important; }
    body.bafleh-page-catalog .live-product-info h3,
    body.bafleh-page-catalog .live-product-card h3 { font-size: 13px !important; }
}

/* Active navigation state: E-Shop is underlined only in commerce/catalogue areas,
   and normal menu entries get the same visual state on their own page. */
@media (min-width: 981px) {
    .bafleh-live-eshop a::after {
        transform: scaleX(0) !important;
        transform-origin: center !important;
        transition: transform .18s ease !important;
    }
    .bafleh-live-eshop.is-active a::after,
    .bafleh-live-eshop a:hover::after,
    .bafleh-live-eshop a:focus-visible::after { transform: scaleX(1) !important; }
    .bafleh-live-menu > li.is-current > a::after,
    .bafleh-live-menu > li.is-current > button::after {
        left: 0 !important;
        right: 0 !important;
    }
}

/* ========================================================================== 
   B15 MOBILE SHOP FLOW FIX
   Root cause of the large blank area seen below Filter/Sort:
   bafleh-mobile-ux.css correctly makes the filter drawer fixed, but the later
   bafleh-shop-parity-b4.css rule `.bafleh-wp-shop .catalog-sidebar` changes it
   back to `position: relative !important`. The drawer is translated offscreen
   and hidden, but a relative element still reserves its full filter height in
   normal document flow. Force the mobile drawer back out of flow.
   ========================================================================== */
@media (max-width: 980px) {
    body.bafleh-page-catalog .bafleh-wp-shop .catalog-layout {
        display: block !important;
        position: relative !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar,
    body.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar.is-open {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        top: 0 !important;
        right: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        width: min(92vw, 390px) !important;
        max-width: 390px !important;
        height: 100vh !important;
        height: 100dvh !important;
        min-height: 0 !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 1660 !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar:not(.is-open) {
        transform: translate3d(-104%, 0, 0) !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar.is-open {
        transform: translate3d(0, 0, 0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-content {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-mobile-actions + .catalog-layout {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    body.bafleh-page-catalog .bafleh-wp-shop .catalog-content > .catalog-toolbar {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    /* RTL drawer leaves document flow in exactly the same way. */
    body.rtl-site.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar,
    body.rtl-site.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar.is-open {
        inset: 0 0 0 auto !important;
        right: 0 !important;
        left: auto !important;
    }
    body.rtl-site.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar:not(.is-open) {
        transform: translate3d(104%, 0, 0) !important;
    }
    body.rtl-site.bafleh-page-catalog .bafleh-wp-shop .catalog-sidebar.is-open {
        transform: translate3d(0, 0, 0) !important;
    }
}
