/* =========================================
   PAGE HEADER / BREADCRUMBS
   (verbatim from the original catalog design)
   ========================================= */
/* Element+class selector (not just .section-padding) is intentional: it
   out-specifies css/responsive.css's mobile ".section-padding { padding-top:
   50px }" rule regardless of stylesheet load order, so this <main> wrapper
   stays tight on mobile too. Plain .section-padding usages elsewhere (the
   div-based section spacers on index.html) are untouched and still pick up
   the 50px mobile value as designed. */
main.section-padding {
    padding-top: 10px;
    padding-bottom: 60px;
}

.page-header {
    padding-top: 10px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 30px;
}

.page-title {
    font-size: clamp(22px, 1.2vw + 17.7px, 32px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-main);
}

/* Category article under the grid (js/utils/category-article.js): the home
   page's SEO layout, label left and text right, full site width. Until
   «Читати повністю» (or a «Зміст» link) only the intro and contents show. */
.cat-seo { margin-top: 80px; }
.cat-seo[hidden] { display: none; }
.cat-art-row { display: grid; grid-template-columns: 4fr 8fr; column-gap: 64px; align-items: start; }
.cat-art-head, .cat-art-toc, .cat-art-sec { padding: 40px 0; border-top: 1px solid var(--border-light); }
.cat-art-sec, #catSeo .cat-art-toc { scroll-margin-top: 110px; }
.cat-art-title { margin: 0; font-size: var(--block-title-size); letter-spacing: var(--block-title-ls); text-transform: uppercase; font-weight: 600; line-height: 1.3; color: var(--text-main); }
.cat-art-label { margin: 0; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; font-weight: 600; line-height: 1.5; color: var(--text-main); }
.cat-art-intro p, .cat-art-text p, .cat-art-text li, .cat-art-faq summary + div p {
    font-size: 16px; line-height: 1.85; color: var(--text-secondary); text-wrap: pretty;
}
.cat-art-intro p:first-child { font-size: 19px; line-height: 1.6; color: var(--text-main); margin-bottom: 22px; }
.cat-art-intro p + p, .cat-art-text > * + * { margin-top: 16px; }
.cat-art-text h4 { margin-top: 28px; font-size: 16px; font-weight: 600; color: var(--text-main); }
.cat-art-text h4:first-child { margin-top: 0; }
.cat-art-text h4 + p { margin-top: 8px; }
.cat-seo strong { color: var(--text-main); font-weight: 500; }
.cat-seo a:not(.cat-art-more) { color: var(--text-main); font-weight: 500; text-decoration: none; transition: opacity 0.2s; }
@media (hover: hover) and (pointer: fine) { .cat-seo a:hover { opacity: 0.7; } }
.cat-art-text ul, .cat-art-text ol { padding-left: 22px; }
.cat-art-text ul { list-style: disc; }
.cat-art-text ol { list-style: decimal; }
.cat-art-text li + li { margin-top: 8px; }
.cat-art-text li::marker { color: var(--text-secondary); }
/* contents: numbered, two columns */
.cat-art-toc-list { columns: 2; column-gap: 48px; list-style: none; padding: 0; counter-reset: toc; }
.cat-art-toc-list li { counter-increment: toc; break-inside: avoid; padding: 7px 0; font-size: 15px; line-height: 1.5; }
.cat-art-toc-list li::before { content: counter(toc, decimal-leading-zero); display: inline-block; width: 34px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
#catSeo .cat-art-toc-list a { color: var(--text-secondary); font-weight: 400; }
/* table (шу vs шен) */
.cat-art-table { overflow-x: auto; }
/* video review row (category-article.js videoHTML): the reel left, its title,
   description and chapters right; never autoplays */
.cat-art-video { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 40px; align-items: start; }
.cat-art-video video { display: block; width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 6px; background: #000; object-fit: cover; }
.cat-art-video-title { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; color: var(--text-main); }
.cat-art-video-desc { margin-top: 10px; font-size: 15px; line-height: 1.7; color: var(--text-secondary); }
.cat-art-chapters { list-style: none; margin: 24px 0 0; padding: 0; border-top: 1px solid var(--border-light); }
.cat-art-chapters li { border-bottom: 1px solid var(--border-light); }
.cat-art-chapters button {
    display: flex; align-items: baseline; gap: 18px; width: 100%; padding: 14px 0; border: 0; background: none;
    font: inherit; font-size: 15px; line-height: 1.5; color: var(--text-main); text-align: left; cursor: pointer; transition: color 0.2s;
}
.cat-art-chapter-time { flex: 0 0 38px; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); }
.cat-art-chapters button.is-current { color: var(--accent); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .cat-art-chapters button:hover { color: var(--accent); } }
@media (max-width: 767px) {
    .cat-art-video { grid-template-columns: 1fr; gap: 22px; }
    .cat-art-video video { max-width: 320px; }
    .cat-art-video-title { font-size: 18px; }
}
.cat-art-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.cat-art-table th, .cat-art-table td { text-align: left; vertical-align: top; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--border-light); line-height: 1.6; }
.cat-art-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-main); font-weight: 600; }
.cat-art-table td { color: var(--text-secondary); }
.cat-art-table td:first-child { color: var(--text-main); white-space: nowrap; }
/* FAQ */
.cat-art-faq details { border-bottom: 1px solid var(--border-light); }
.cat-art-faq details:first-child summary { padding-top: 0; }
.cat-art-faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; font-size: 16px; font-weight: 500; color: var(--text-main); }
.cat-art-faq summary::-webkit-details-marker { display: none; }
/* «+» drawn with two bars; the vertical one folds away when open */
.cat-art-plus { position: relative; flex: 0 0 12px; height: 12px; }
.cat-art-plus::before, .cat-art-plus::after {
    content: ''; position: absolute; left: 0; top: 5.25px; width: 12px; height: 1.5px; border-radius: 1px; background: var(--text-secondary);
    transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1), opacity 0.28s;
}
.cat-art-plus::after { transform: rotate(90deg); }
.cat-art-faq details[open]:not(.is-closing) .cat-art-plus::after { transform: rotate(0deg); opacity: 0; }
.cat-art-faq summary + div { overflow: hidden; }
.cat-art-faq summary + div::after { content: ''; display: block; height: 18px; }
/* collapsed until «Читати повністю» */
.cat-seo.is-collapsed .cat-art-body { display: none; }
.cat-art-more-row { display: flex; justify-content: flex-end; border-top: 1px solid var(--border-light); padding-top: 36px; }
.cat-art-more-row > div:first-child { display: none; }
.cat-seo:not(.is-collapsed) .cat-art-more-row { display: none; }
.cat-art-more {
    background: transparent; border: 1px solid var(--border-light); border-radius: 4px; color: var(--text-main); cursor: pointer;
    padding: 14px 28px; font: 600 13px var(--font-main); letter-spacing: 1px; text-transform: uppercase; transition: border-color 0.2s;
}
@media (hover: hover) and (pointer: fine) { .cat-art-more:hover { border-color: var(--accent); } }
@media (max-width: 1024px) {
    .cat-seo { margin-top: 56px; }
    .cat-art-row { grid-template-columns: 1fr; row-gap: 18px; }
    .cat-art-head, .cat-art-toc, .cat-art-sec { padding: 30px 0; }
    .cat-art-intro p:first-child { font-size: 17px; }
    .cat-art-intro p, .cat-art-text p, .cat-art-text li { font-size: 15px; }
}
@media (max-width: 600px) {
    .cat-art-toc-list { columns: 1; }
    .cat-art-sec, #catSeo .cat-art-toc { scroll-margin-top: 80px; }
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumbs > * { flex-shrink: 0; }
.breadcrumbs a { color: var(--text-secondary); transition: 0.3s; }
@media (hover: hover) and (pointer: fine) {
    .breadcrumbs a:hover { color: var(--accent-gold); }
}
.breadcrumbs i { font-size: 9px; color: var(--text-muted); }
.breadcrumbs span { color: var(--text-secondary); }

/* =========================================
   CATALOG LAYOUT & FILTERS
   ========================================= */
.catalog-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    width: 100%;
    /* The header is `position: fixed`, so scrollIntoView({block:'start'})
       (used after pagination and filter changes) would otherwise land
       this flush against the very top of the viewport, right behind the
       header — hiding the top of .catalog-topbar underneath it instead
       of leaving the same breathing room the page naturally has at rest. */
    scroll-margin-top: calc(var(--sticky-top) + 40px);
}

/* Апдейт 113: backdrop fade timing matched to the cart's (0.3s -> 0.5s
   ease) per the user's "smooth like cart everywhere" request. The
   sidebar's own slide (if any, on mobile) keeps its own duration/curve —
   a slide is a different, intentional motion from a fade. */
/* Апдейт 119: darkness/blur matched to .cart-overlay (0.7 / blur(5px),
   was 0.85) — see the longer explanation in css/overlays.css. */
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(27, 49, 82, 0.45); -webkit-backdrop-filter: var(--blur-overlay); backdrop-filter: var(--blur-overlay);
    z-index: 7999; opacity: 0; visibility: hidden; pointer-events: none; transition: 0.5s ease;
    /* See the matching comment on .sidebar's height rule below — this
       just makes sure a 100vh/100dvh mismatch can never turn into a
       stray outer scroll here, only .sidebar-content should scroll.
       touch-action: none + overscroll-behavior: none alongside it: same
       reasoning as the identical pair on .cart-overlay in
       css/responsive.css - overflow: hidden alone doesn't stop an iOS
       touch-drag from still rubber-banding this backdrop a little,
       these two block that at the backdrop itself. */
    overflow: hidden; touch-action: none; overscroll-behavior: none;
}
.sidebar-overlay.active { opacity: 1; visibility: visible; pointer-events: all; }

.sidebar {
    width: 280px;
    flex: 0 0 280px;
    box-sizing: border-box;
    position: sticky;
    top: var(--sidebar-top);
}
/* Where the sidebar sticks: under the header, or — when the sidebar (tree +
   filters) is taller than the window — higher up, so it first scrolls along
   with the page and then stays with its bottom on screen; the whole filter is
   reachable without scrolling to the end of the products. --sidebar-h is the
   sidebar's real height, kept by js/pages/catalog.js (trackSidebarHeight). */
.catalog-layout {
    --sidebar-top: min(calc(var(--sticky-top) + 40px), calc(100vh - var(--sidebar-h, 0px) - 24px));
}
.sidebar-mobile-header, .sidebar-mobile-footer { display: none; }
.sidebar-content { padding: 0; }

/* Catalog navigation and filters used to share one continuous bordered
   box — now split into two separate boxes (the category tree, and
   everything filter-related below it) like most catalog sidebars do,
   since they're two different tasks (browse vs. narrow down) and the
   single box read as more cluttered once the tree grew a hover mega-menu
   on top of it. .sidebar-content — the actual parent of the two boxes,
   .sidebar itself only ever wraps that one div — becomes an unstyled
   flex column that positions #catalogTreeBox and #filterBox with a gap;
   each box carries its own border/background. Scoped to desktop only:
   on mobile this whole thing becomes the slide-in filter drawer instead
   (see the max-width:1024px block below), where .sidebar keeps the
   single dark panel look it always had. */
@media (min-width: 1025px) {
    .sidebar-content { display: flex; flex-direction: column; gap: 30px; }
    .sidebar-box {
        background: var(--bg-card);
        border: 1px solid var(--border-light);
        border-radius: 4px;
        padding: 25px;
    }
    /* .category-tree can get long (many categories) — this box scrolls
       on its own rather than pushing the filter box further down the
       page or forcing the whole sidebar to scroll as one unit. */
    #catalogTreeBox {
        max-height: calc(100vh - var(--sticky-top) - 120px);
        overflow-y: auto;
    }
    #catalogTreeBox::-webkit-scrollbar { width: 4px; }
    #catalogTreeBox::-webkit-scrollbar-track { background: transparent; }
    #catalogTreeBox::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }
    /* The filter box has no scroll of its own: the whole sidebar scrolls along
       with the page and stops with its bottom on screen (see --sidebar-top). */
}

.filter-group {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}
.filter-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.filter-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Наявність / Позначки / Вага checkboxes in the filter box. */
.filter-checkbox-row {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; color: var(--text-secondary); font-size: 14px; cursor: pointer; user-select: none;
}
.filter-checkbox-row input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: var(--accent-gold); cursor: pointer; flex-shrink: 0;
}
@media (hover: hover) and (pointer: fine) {
    .filter-checkbox-row:hover { color: var(--text-main); }
}
.filter-checkbox-count { color: var(--text-secondary); margin-left: auto; font-size: 13px; }

/* A broad category (e.g. the root "Чай") can have 30+ distinct weight
   values across all its products — without a cap the list would push
   the whole filter box (and the page layout around it) to an absurd
   height instead of just scrolling internally, the same problem
   #catalogTreeBox solves for a long category list. */
#weightFilterList { max-height: 240px; overflow-y: auto; padding-right: 4px; }
#weightFilterList::-webkit-scrollbar { width: 4px; }
#weightFilterList::-webkit-scrollbar-track { background: transparent; }
#weightFilterList::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* SIDEBAR CATEGORY TREE */
.category-tree { display: flex; flex-direction: column; }
.cat-tree-item { border-bottom: 1px solid var(--border-light); }
.cat-tree-item:last-child { border-bottom: none; }
.cat-tree-parent {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; color: var(--text-main); font-size: 14px; font-weight: 500;
    text-transform: uppercase; cursor: pointer; transition: 0.3s; user-select: none;
}
.cat-tree-parent.active { color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .cat-tree-parent:hover { color: var(--accent-gold); }
}
.cat-tree-parent i { font-size: 12px; transition: transform 0.3s ease; }
.cat-tree-parent.active i { transform: rotate(180deg); }
.cat-tree-sub { display: none; flex-direction: column; padding: 0 0 15px 10px; }
.cat-tree-sub.active { display: flex; }

/* Desktop: hovering a top-level category (Пуер, Улун, etc) opens its
   subcategories as a flyout panel to the SIDE instead of expanding
   downward in place. Click-to-expand-downward (the .active class toggle)
   stays exactly as it was as the fallback for non-hover-capable wide
   viewports (e.g. a touchscreen laptop) — this only changes what happens
   on :hover.

   .cat-flyout-anchor is a zero-size `position: sticky` element that
   js/pages/catalog.js inserts as .sidebar's own next sibling, with the
   same sticky `top` offset — so it starts stuck at the exact same scroll
   position as .sidebar, natively, entirely on the compositor. Earlier
   versions positioned the panel with `position: fixed` and resynced its
   coordinates from JS on every scroll/animation frame, which still
   visibly lagged half a frame behind fast trackpad scrolling and rubber-
   band overscroll since JS runs on the main thread a step behind the
   compositor. Making .cat-tree-sub `position: absolute` inside this
   anchor removes the JS tracking loop completely — the browser scrolls
   both in perfect lockstep because they're both driven by the same
   native mechanism, not because anything keeps recalculating it. */
@media (hover: hover) and (pointer: fine) {
    .cat-flyout-anchor {
        position: sticky; top: var(--sidebar-top);
        /* Height is set in JS to match .sidebar's own real rendered
           height exactly (not just copying its `max-height` CSS value,
           since .sidebar's actual height is whichever is smaller — its
           content or that max-height). A sticky element stops sticking
           once continuing to would push it past its flex container's
           own bottom edge, and that threshold depends on the element's
           OWN height — a mismatched height here is what let this anchor
           and .sidebar unstick at different scroll positions near the
           very bottom of a short page, even though they're siblings in
           the same flex row. */
        /* 999 = just under the header (1000): near the bottom of the page the
           sidebar and this anchor stop sticking and scroll up under the
           header; at 1500 the open panel used to cover the header instead */
        width: 0; overflow: visible; z-index: 999;
        /* .catalog-layout is a flex row with `gap: 40px` — inserting this
           anchor as a 3rd flex child (after .sidebar, before .catalog-main)
           adds a second 40px gap that would push the product grid an
           extra 40px to the right. This cancels it back out. */
        margin-right: -40px;
    }
    /* The panel's own height is set once in JS (from .sidebar's own
       height at the moment it opens) and shares its background/border
       color with no border on the shared edge — so it reads as a second
       half of the SAME box, not a separate tooltip next to it. Column
       count is computed in JS (grid-template-rows/columns set inline)
       from the item count, same idea as any modern mega-menu: few items
       (Пуер) → one column; many (Улун) → several. Посуд's extra grouping
       layer (Для заварювання/Для подачі/Аксесуари, needed for its
       click-accordion mobile fallback) is flattened by JS into one flat
       list of leaf categories for this panel, matching how competitors'
       mega-menus show every subcategory at once rather than a group you
       have to hover into. */
    .cat-tree-sub {
        display: none;
        position: absolute; top: 0;
        /* Diagonal tint (not a flat color): darker where the categories
           actually sit — top-left, since the grid fills that way
           (align-content/justify-content: start) — fading toward the
           empty bottom-right corner, kept dark enough overall to stay
           readable against whatever's behind it. (No more backdrop-blur:
           after repeated halving it was down around a thousandth of a
           pixel — no browser can render that, so it was doing nothing.) */
        background: linear-gradient(135deg, rgba(255,255,255,0.99) 0%, rgba(244,247,251,0.97) 100%);
        border: 1px solid var(--border-light); border-left: none;
        border-radius: 0 4px 4px 0; box-shadow: 20px 0 40px rgba(15, 30, 51, 0.08);
        padding: 30px 34px;
        overflow-y: auto;
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
    }
    .cat-tree-sub.flyout-open {
        display: grid; grid-auto-flow: column; align-content: start; justify-content: start;
        gap: 22px 40px;
        opacity: 1; visibility: visible; pointer-events: auto;
    }
    .cat-tree-sub .cat-tree-sublink, .cat-tree-sub .cat-tree-sub-item { width: auto; }
    .cat-tree-sub .cat-tree-sublink {
        font-size: 15px; color: var(--text-main); font-weight: 600;
        padding: 0 0 10px; width: 220px;
        border-bottom: 1px solid var(--border-light);
        transition: color 0.2s ease;
    }
    .cat-tree-sub .cat-tree-sublink::before { content: none; }
    .cat-tree-sub .cat-tree-sublink:hover, .cat-tree-sub .cat-tree-sublink.active { color: var(--accent-gold); }

    /* The chevron used to rotate 180° to show the click-accordion's
       expanded/collapsed state. On a hover-capable device that accordion
       never runs (hover opens the flyout instead), so a chevron that
       still flips on click looked like a stray leftover — pinned static
       here instead, pointing right always. */
    .cat-tree-parent.active i, .cat-tree-sub-parent.active i { transform: none; }
}

.cat-tree-sub-item { margin-bottom: 0; }
.cat-tree-sub-parent {
    display: flex; justify-content: space-between; align-items: center;
    color: var(--text-secondary); font-size: 12px; font-weight: 500; text-transform: uppercase;
    margin-top: 12px; margin-bottom: 8px; letter-spacing: 0.5px; cursor: pointer; transition: 0.3s;
}
.cat-tree-sub-parent.active { color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .cat-tree-sub-parent:hover { color: var(--accent-gold); }
}
.cat-tree-sub-parent i { font-size: 10px; transition: transform 0.3s ease; }
.cat-tree-sub-parent.active i { transform: rotate(180deg); }

.cat-tree-sub-sub { display: none; flex-direction: column; padding: 0 0 10px 10px; }
.cat-tree-sub-sub.active { display: flex; }

.cat-tree-sublink {
    color: var(--text-secondary); font-size: 13px; padding: 4px 0; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center;
}
.cat-tree-sublink::before { content: '-'; margin-right: 8px; color: var(--text-muted); }
.cat-tree-sublink.active { color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .cat-tree-sublink:hover { color: var(--accent-gold); }
}
.cat-tree-sublink.active::before { color: var(--accent-gold); }

/* Desktop Dual Slider */
.price-inputs-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.price-input { background: transparent; border: 1px solid var(--border-strong); color: var(--text-main); padding: 12px; border-radius: 4px; font-size: 14px; text-align: left; width: 45%; outline: none; transition: 0.3s; }
.price-input:focus { border-color: var(--accent-gold); }
.price-separator { display: none; }
.dual-slider-container { position: relative; height: 40px; display: flex; align-items: center; margin-bottom: 10px; }
.slider-track-bg { position: absolute; width: 100%; height: 4px; background: var(--border-light); border-radius: 2px; }
.slider-track { position: absolute; height: 4px; background: var(--accent-gold); border-radius: 2px; z-index: 1; }
.range-input { position: absolute; width: 100%; appearance: none; -webkit-appearance: none; background: transparent; pointer-events: none; z-index: 2; outline: none; margin: 0; }
/* Two small vertical grey grip lines, centered — a purely decorative
   drag-handle affordance. A range thumb is a browser pseudo-element, so
   it can't have real ::before/::after children — this is a tiny inline
   SVG used as the thumb's own background image instead. */
.range-input::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; width: 28px; height: 16px; border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Crect x='3' y='1' width='1.3' height='8' fill='%23999'/%3E%3Crect x='6' y='1' width='1.3' height='8' fill='%23999'/%3E%3C/svg%3E") no-repeat center / 10px 10px;
    border: 2px solid var(--accent-gold); pointer-events: auto; cursor: pointer; box-shadow: 0 2px 6px rgba(15, 30, 51, 0.06);
}
.range-input::-moz-range-thumb {
    width: 28px; height: 16px; border-radius: 8px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3E%3Crect x='3' y='1' width='1.3' height='8' fill='%23999'/%3E%3Crect x='6' y='1' width='1.3' height='8' fill='%23999'/%3E%3C/svg%3E") no-repeat center / 10px 10px;
    border: 2px solid var(--accent-gold); pointer-events: auto; cursor: pointer; box-shadow: 0 2px 6px rgba(15, 30, 51, 0.06);
}

.btn-apply-filter { width: 100%; background: var(--bg-soft); color: var(--text-main); border: 1px solid var(--border-strong); padding: 12px; border-radius: 4px; margin-top: 15px; font-weight: 500; text-transform: uppercase; font-size: 12px; letter-spacing: 1px; transition: 0.3s; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
    .btn-apply-filter:hover { background: var(--accent-gold); color: #fff; border-color: var(--accent-gold); }
}
.btn-apply-filter:active { transform: scale(0.97); }
.btn-show-results { display: none; }

/* =========================================
   CATALOG MAIN AREA / TOPBAR
   ========================================= */
.catalog-main {
    flex: 0 0 calc(100% - 280px - 40px);
    width: calc(100% - 280px - 40px);
    max-width: calc(100% - 280px - 40px);
    min-width: 0;
    box-sizing: border-box;
}
/* NOTE: no overflow:hidden here — the calc() width above already prevents
   horizontal overflow at the source, and clipping vertically would also
   cut off the product card's hover-dropdown (weight selector + "До
   кошика") for cards in the last grid row, since it expands downward
   past the card's own box. */
/* css/product-card.css sets margin-bottom:60px on .app-grid for the home
   page's rail spacing; the catalog's own .pagination-wrapper already adds
   margin-top:40px, so cancel the shared rule here to match the original
   spacing instead of stacking both. */
.catalog-main .app-grid { margin-bottom: 0; }
/* iPad landscape / small laptops: the sidebar leaves room for only ~770px, four 178px cards are too narrow */
@media (min-width: 1025px) and (max-width: 1279px) {
    .catalog-main .app-grid:not(.list-view) { grid-template-columns: repeat(3, 1fr); }
}

.catalog-topbar {
    display: flex; flex-direction: column; align-items: stretch;
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 4px;
    padding: 15px 25px; margin-bottom: 30px; gap: 15px;
}

.catalog-topbar-header { display: flex; width: 100%; justify-content: space-between; align-items: center; }

.catalog-results-count { color: var(--text-secondary); font-size: 13px; }
.catalog-results-count span { color: var(--text-main); font-weight: 500; }

.catalog-controls { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }

.sort-group { display: flex; align-items: center; gap: 15px; }
.sort-label { color: var(--text-secondary); font-size: 13px; }
.sort-buttons { display: flex; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; background: var(--bg-soft); }
.sort-btn { background: transparent; border: none; border-right: 1px solid var(--border-strong); color: var(--text-secondary); padding: 8px 15px; font-size: 13px; cursor: pointer; transition: 0.3s; }
.sort-btn:last-child { border-right: none; }
.sort-btn.active { color: var(--accent-gold); background: var(--bg-soft); }
@media (hover: hover) and (pointer: fine) {
    .sort-btn:hover { color: var(--accent-gold); background: var(--bg-soft); }
}

.view-toggles { display: flex; gap: 5px; background: var(--bg-card); padding: 4px; border-radius: 4px; border: 1px solid var(--border-light); }
.view-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); border-radius: 4px; transition: 0.3s; font-size: 14px; cursor: pointer; }
.view-btn.active { background: var(--bg-soft); color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .view-btn:hover { background: var(--bg-soft); color: var(--accent-gold); }
}

/* iPad landscape: the sort buttons keep one line each instead of breaking into two-line cells */
@media (min-width: 1025px) and (max-width: 1279px) {
    .catalog-topbar { padding: 15px 18px; }
    .catalog-controls { gap: 12px; }
    .sort-group { gap: 10px; }
    .sort-btn { white-space: nowrap; padding: 8px 10px; font-size: 12px; }
    .catalog-results-count { white-space: nowrap; }
    .sort-label { display: none; }
}

.mobile-actions { display: none; gap: 15px; align-items: center; }
.mobile-filter-btn, .mobile-sort-btn { background: transparent; border: none; color: var(--accent-gold); font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 6px; outline: none; }

/* MAIN ACTIVE FILTERS */
.main-active-filters { display: none; width: 100%; justify-content: flex-start; flex-wrap: wrap; gap: 15px; padding-top: 15px; border-top: 1px solid var(--border-light); }
.main-active-filters.active { display: flex; }
.maf-group { display: flex; align-items: center; gap: 8px; }
.maf-value { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--border-light); color: var(--text-main); padding: 7px 12px; border-radius: 4px; font-size: 14px; font-weight: 500; }
.maf-value i { color: var(--text-secondary); cursor: pointer; transition: 0.2s; font-size: 14px; }
@media (hover: hover) and (pointer: fine) {
    .maf-value i:hover { color: var(--danger); }
}

.filter-badge { background: var(--accent-gold); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; margin-left: 6px; }

@media (min-width: 1025px) {
    #mobileActiveFiltersContainer { display: none !important; }
}

/* =========================================
   LIST VIEW (desktop) — the shared card component
   ships this markup hidden by default (css/product-card.css);
   these rules turn it on.
   ========================================= */
.app-grid.list-view { display: flex; flex-direction: column; gap: 20px; }

.app-grid.list-view .card-info,
.app-grid.list-view .hover-dropdown,
.app-grid.list-view .grid-wishlist,
.app-grid.list-view .mobile-cart-btn { display: none !important; }

.app-grid.list-view .list-middle-col,
.app-grid.list-view .list-right-col { display: flex !important; }

.app-grid.list-view .card-divider { display: block !important; }
.app-grid.list-view .list-wishlist { display: flex !important; }

.app-grid.list-view .app-card { flex-direction: row; height: auto; align-items: stretch; padding: 16px; gap: 24px; }
@media (hover: hover) and (pointer: fine) {
    .app-grid.list-view .app-card:hover { transform: none; box-shadow: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; z-index: 1; }
}
.app-grid.list-view .card-image-box { width: 160px; height: 160px; flex-shrink: 0; border-radius: 4px; margin: 0; background: var(--bg-soft); }
.app-grid.list-view .list-middle-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.app-grid.list-view .status-art-row { display: flex; align-items: center; width: 100%; }
.app-grid.list-view .app-name { font-size: 18px; margin: 0 0 6px 0; min-height: auto; line-height: 1.3; }
.app-grid.list-view .art-number { display: block; font-size: 11px; color: var(--text-muted); font-weight: 500; margin-bottom: 12px; }
.app-grid.list-view .weight-selector { margin-top: auto; padding-bottom: 4px; background: transparent; display: flex; gap: 6px; width: auto; }
.app-grid.list-view .weight-selector .weight-btn { background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--text-secondary); padding: 6px 12px; font-size: 11px; font-weight: 500; flex: none; width: auto; text-align: center; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) {
    .app-grid.list-view .weight-selector .weight-btn:hover { color: var(--text-main); border-color: var(--border-strong); }
}
.app-grid.list-view .weight-selector .weight-btn.active { background: transparent; color: var(--accent-gold); border-color: var(--accent-gold); }
.app-grid.list-view .card-divider { width: 1px; background: var(--bg-soft); margin: 0 5px; }
.app-grid.list-view .list-right-col { width: 240px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end; padding-left: 10px; margin-top: 0; }
.app-grid.list-view .list-wishlist { position: relative; top: 0; right: 0; opacity: 1; visibility: visible; transform: none; background: #fff; border: 1px solid var(--border-light); width: 34px; height: 34px; border-radius: 50%; color: var(--text-main); display: flex; align-items: center; justify-content: center; font-size: 14px; cursor: pointer; transition: 0.3s; }
.app-grid.list-view .list-wishlist.w-active { border-color: var(--accent-gold); color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .app-grid.list-view .list-wishlist:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
}
.app-grid.list-view .price-wrapper { text-align: right; width: 100%; }
.app-grid.list-view .card-price { font-size: 26px; display: flex; align-items: baseline; justify-content: flex-end; margin-bottom: 12px; margin-top: 0; }
.app-grid.list-view .card-price span { font-size: 13px; color: var(--text-muted); margin-left: 4px; font-weight: 500; }
.app-grid.list-view .btn-action-cart { width: 100%; background: var(--accent-gold); color: #fff; padding: 12px; border-radius: 4px; font-weight: 500; font-size: 13px; text-transform: uppercase; cursor: pointer; border: none; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; height: auto; }
@media (hover: hover) and (pointer: fine) {
    .app-grid.list-view .btn-action-cart:hover { background: var(--accent-hover); }
}

/* =========================================
   PAGINATION
   ========================================= */
.pagination-wrapper { display: flex; justify-content: center; margin-top: 40px; margin-bottom: 80px; }
.pagination {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: 4px; padding: 6px; overflow: visible;
}
.page-btn {
    background: transparent; border: none; border-radius: 4px; color: var(--text-secondary);
    width: 38px; height: 38px; padding: 0; font-size: 14px; font-family: inherit;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
    position: relative;
}
.page-btn:has(.page-text) { width: auto; padding: 0 14px; }
@media (hover: hover) and (pointer: fine) {
    .page-btn:hover:not(.disabled):not(.dots):not(.active) { color: var(--text-main); background: var(--bg-soft); }
}
.page-btn.active { color: var(--accent-gold); font-weight: 500; background: transparent; }
.page-btn.active::after {
    content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 16px; height: 2px; background: var(--accent-gold); border-radius: 2px;
}
.page-btn.disabled { color: var(--border-strong); cursor: not-allowed; }
.page-btn.dots { cursor: default; pointer-events: none; color: var(--text-muted); width: auto; padding: 0 4px; }

/* =========================================
   MOBILE SORT BOTTOM-SHEET
   ========================================= */
/* Апдейт 113: backdrop fade timing matched to the cart's (0.3s -> 0.5s
   ease). The sheet's own slide-up keeps its 0.3s cubic-bezier — a slide
   is a different, intentional motion from a fade and doesn't need to
   match the cart's pacing. */
/* Апдейт 119: darkness matched to .cart-overlay (0.7, was 0.8) — see
   the longer explanation in css/overlays.css. */
.mobile-sort-overlay {
    position: fixed; inset: 0; background: rgba(27, 49, 82, 0.45); -webkit-backdrop-filter: var(--blur-overlay); backdrop-filter: var(--blur-overlay);
    z-index: 7000; display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; visibility: hidden; pointer-events: none; transition: 0.5s ease;
    touch-action: none; overscroll-behavior: none;
}
.mobile-sort-overlay.active { opacity: 1; visibility: visible; pointer-events: all; }

.mobile-sort-sheet {
    width: 100%; background: var(--bg-card); border-radius: 16px 16px 0 0;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 20px; border-top: 1px solid var(--border-light);
}
.mobile-sort-overlay.active .mobile-sort-sheet { transform: translateY(0); }

.ms-header { text-align: center; color: var(--text-main); font-size: 16px; font-weight: 500; padding: 20px; border-bottom: 1px solid var(--border-light); }
.ms-option { width: 100%; text-align: left; background: transparent; border: none; padding: 20px 25px; color: var(--text-main); font-size: 15px; border-bottom: 1px solid var(--border-light); display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s; }
.ms-option:active { background: var(--bg-soft); }
.ms-option.active { color: var(--accent-gold); }
.ms-option.active::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; }

/* =========================================
   RESPONSIVE
   (kept in original cascade order — do not reorder blocks)
   ========================================= */
@media (max-width: 1024px) {
    .catalog-layout { flex-direction: column; align-items: stretch; }
    /* the hover flyout's anchor (desktop only) would be a blank block of the sidebar's height in this column */
    .cat-flyout-anchor { display: none; }

    /* Sidebar becomes position:fixed here (leaves the flex flow entirely),
       so catalog-main must go back to full width — the desktop calc()
       above assumes the sidebar is still taking up flex space. */
    .catalog-main {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }

    .sidebar {
        width: 360px; max-width: 85vw;
        /* height: 100dvh (100vh kept right before as the fallback for
           browsers without dvh support) — same iOS Safari 100vh mismatch
           as .mobile-menu-drawer/.cart-container (see their comments in
           css/overlays.css / css/responsive.css): plain 100vh can be
           taller than the actually visible screen, silently pushing the
           bottom of the filter list past the fold. */
        position: fixed; top: 0; left: -100%; bottom: auto; height: 100vh; height: 100dvh; max-height: none;
        z-index: 8000; border-radius: 0; transform: none; padding: 0;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border: none; border-right: 1px solid var(--border-light); background: var(--bg-card); display: flex; flex-direction: column;
    }
    .sidebar.active { left: 0; }
    .sidebar-content { flex: 1; overflow-y: auto; padding: 25px; }

    .sidebar-mobile-header {
        display: flex; justify-content: center; align-items: center;
        padding: 0 20px; border-bottom: 1px solid var(--border-light); position: relative;
        min-height: 60px; flex-shrink: 0; background: var(--bg-card);
    }
    .sidebar-mobile-header h3 { color: var(--text-main); font-size: 16px; font-weight: 500; margin: 0; }
    .sm-close { position: absolute; left: 20px; color: var(--text-secondary); font-size: 18px; cursor: pointer; padding: 10px; margin-left: -10px; }

    #mobileActiveFiltersContainer.active { display: block !important; }

    .btn-show-results { display: block; width: 100%; background: var(--accent-gold); color: #fff; padding: 16px; border-radius: 4px; font-weight: 500; font-size: 15px; border: none; cursor: pointer; transition: 0.3s; margin-top: 30px; text-align: center; }
    @media (hover: hover) and (pointer: fine) {
        .btn-show-results:hover { background: var(--accent-hover); }
    }
    .btn-show-results:active { transform: scale(0.97); }

    .hide-on-mobile { display: none !important; }

    .price-inputs-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
    .price-input { background: transparent; border: 1px solid var(--border-strong); color: var(--text-main); padding: 15px; border-radius: 4px; font-size: 15px; text-align: left; width: 45%; }
    .price-separator { display: none; }

    .dual-slider-container { display: flex; }

    .catalog-results-count { display: block; }
    .catalog-controls { display: none !important; }

    .catalog-topbar { display: flex; flex-direction: column; align-items: stretch; padding: 15px 20px; gap: 15px; }
    .catalog-topbar-header { display: flex; width: 100%; justify-content: space-between; align-items: center; }

    .mobile-actions { display: flex; width: 100%; justify-content: space-between; align-items: center; }

    /* Active-filter chips ("Тільки в наявності ×", "Позначки"/"Топ
       продажу ×") — sized down from the desktop 14px here already
       (not just ≤600px, see below), since this whole ≤1024px block is
       what actually controls the mobile/tablet topbar these chips
       live in. */
    /* nowrap + horizontal scroll instead of wrapping onto extra lines —
       several active filters used to stretch this bar taller and taller;
       now it just scrolls sideways, same idea as .breadcrumbs' own
       overflow-x above. */
    .main-active-filters {
        display: none; width: 100%; justify-content: flex-start; flex-wrap: nowrap; gap: 8px;
        padding-top: 10px; margin-top: 15px; border-top: 1px solid var(--border-light);
        overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    }
    .main-active-filters::-webkit-scrollbar { display: none; }
    .main-active-filters.active { display: flex; }
    .maf-group { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
    .maf-value { display: flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border-light); color: var(--text-main); padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; white-space: nowrap; }
    .maf-value i { color: var(--text-secondary); cursor: pointer; transition: 0.2s; font-size: 10px; }
    @media (hover: hover) and (pointer: fine) {
        .maf-value i:hover { color: var(--danger); }
    }
    .filter-badge { background: var(--accent-gold); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; margin-left: 6px; }

    .app-grid.list-view .app-card { flex-direction: column; gap: 15px; padding: 16px; }
    .app-grid.list-view .card-image-box { width: 100%; height: auto; aspect-ratio: 1/1; border: none; margin: 0; }
    .app-grid.list-view .card-divider { display: none !important; }
    .app-grid.list-view .list-right-col { width: 100%; padding-left: 0; align-items: stretch; }
    .app-grid.list-view .list-wishlist { position: absolute; top: 16px; right: 16px; }
    .app-grid.list-view .status-art-row { flex-direction: column; align-items: flex-start; gap: 5px; }
}

@media (max-width: 600px) {
    .app-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    /* Unlike the other page-specific stylesheets (about.css, delivery.css,
       etc.), catalog.css had no mobile override for .page-title at all —
       it stayed at the 36px desktop size on phones (visibly oversized,
       e.g. a subcategory title like "ШУ ПУЕР"). Brought in line with the
       ~24px the rest of the site now uses on mobile. */

    .catalog-topbar { padding: 15px; gap: 15px; }
    .catalog-topbar-header { display: none; }
    .mobile-actions { display: flex; width: 100%; justify-content: space-between; align-items: center; }
    .mobile-filter-btn, .mobile-sort-btn { font-size: 14px; }

    .main-active-filters { padding-top: 15px; }

    .pagination { flex-wrap: nowrap; justify-content: center; padding: 6px; gap: 2px; }
    .page-btn { width: 34px; height: 34px; font-size: 13px; margin-bottom: 0; }
    .page-btn:has(.page-text) { padding: 0 12px; }
    .page-text { display: none; }

    .app-grid.list-view .app-name { font-size: 16px; }
    .app-grid.list-view .card-price { font-size: 22px; }

}

/* Mobile filter drawer's "clear all" button (was inline styles plus
   onmouseover/onmouseout handlers in catalog.html). */
.clear-all-filters-btn {
    width: 100%; background: transparent; border: 1px solid var(--border-strong); color: var(--text-main);
    padding: 12px; border-radius: 4px; font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1px; cursor: pointer;
    transition: border-color 0.3s, color 0.3s;
}
@media (hover: hover) and (pointer: fine) {
    .clear-all-filters-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
}
.clear-all-filters-btn:active { border-color: var(--accent-gold); color: var(--accent-gold); }


/* characteristic filters (js/pages/catalog.js refreshSpecCounts) */
.filter-checkbox-row.is-empty { opacity: 0.45; }
.filter-more { margin-top: 4px; padding: 4px 0; border: 0; background: none; color: var(--accent); font-size: 13px; cursor: pointer; }
