/**
 * Theme shadow of the module's megamenu.css — PrestaShop serves this file instead of the
 * vendor stylesheet (theme override of module assets), so it loads only while ets_megamenu
 * is enabled and disappears with the module. Styles the rebuilt pch-mm markup.
 */
/* base look comes from utilities on the markup; here lives only what utilities cannot express:
   responsive positioning, hover/state mechanics and animations */

.pch-mm__list {
    --header-color: var(--bs-black);
    --tabs-border-right-width: 2px;
}

/* knobs for the theme's .grid-auto-columns when routed onto the category lists */
.pch-mm__cats {
    /* preferred tracks the list width (% resolves against it in grid-template-columns):
       floors at 7rem in narrow columns, caps at 9rem once the list passes 45rem */
    --column-preferred-width: clamp(7rem, 20%, 9rem);
    --column-min-width: 7rem;
    --pch-mm-cat-img-w: 10rem;
    gap: 0.5rem;
}

/* category menu thumbnails (cat-thumbs modes) */
.pch-mm__cat-img {
    width: 100%;
    max-width: var(--pch-mm-cat-img-w);
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    aspect-ratio: 1;
}

.pch-mm__cat-link {
    gap: var(--pch-mm-cat-link-gap, 0.5rem);
}

/* blocks stick while the panel scrolls; double class outranks the utility's top: 0 */
.pch-mm__block.sticky-top {
    top: calc(var(--sticky-header-height, 0) + var(--sticky-treshold, 1rem));
}

/* thumb links: half the cell space left over beyond the image becomes padding (clamped),
   while the bottom keeps the image-to-title gap; !important outranks the p-1 utility the
   template puts on thumb-mode links */
.pch-mm__cat-link:has(.pch-mm__cat-img) {
    padding: clamp(0.25rem, calc((100% - var(--pch-mm-cat-img-w)) / 2), 1rem) !important;
    padding-bottom: var(--pch-mm-cat-link-gap, 0.5rem) !important;
}

.pch-mm .btn.pch-mm__link--plain {
    --bs-btn-color: var(--header-color);
    --bs-btn-hover-color: var(--header-hover-color);
    --bs-btn-active-color: var(--bs-secondary);
}

.pch-mm .nav-link {
    color: var(--header-color);
}
.pch-mm .nav-link:hover {
    color: var(--header-hover-color);
}
@media (min-width: 992px) {
    .pch-mm__item--has-sub .pch-mm__chevron {
        font-size: 1.25em;
        transition: transform 0.2s ease;
    }
    .pch-mm__item--has-sub:hover .pch-mm__chevron {
        transform: rotate(180deg);
    }
    .pch-mm__panel {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        z-index: 1020;
        /* never past the viewport bottom — the panel scrolls internally instead */
        max-height: calc(100vh - var(--header-height, 170px) - var(--sticky-treshold, 1rem));
        overflow-y: auto;
        box-shadow: 0 16px 24px rgba(0, 0, 0, 0.12);
        /* border-top: 1px solid var(--bs-border-color); */
        opacity: 0;
        visibility: hidden;
        /* the delays are the hover intent: skimming across the bar never opens a panel */
        transition: opacity 0.15s ease 0.12s, visibility 0s linear 0.27s;
    }
    .pch-mm__item--has-sub:hover > .pch-mm__panel,
    .pch-mm__item--has-sub:focus-within > .pch-mm__panel {
        opacity: 1;
        visibility: visible;
        transition-delay: 0.12s, 0.12s;
    }
    /* while asleep (before the first interaction) panel contents are skipped so their lazy
       images do not load — the hidden panels keep a layout box inside the viewport, which
       alone would trigger lazy loading. The panel element itself stays rendered, so the
       opacity intent transitions are unaffected when megamenu.js wakes the menu. */
    .pch-mm--sleep .pch-mm__panel {
        content-visibility: hidden;
    }
    /* no-JS fallback: waking is one-shot in megamenu.js (a recurring :hover skip would blank
       the panel mid-fade-out and re-render contents on every entry); this only guarantees the
       panels are never empty should the script not run */
    .pch-mm--sleep:hover .pch-mm__panel,
    .pch-mm--sleep:focus-within .pch-mm__panel {
        content-visibility: visible;
    }
    /* tabs-transparent panels: drop-shadow follows the alpha shape of the visible boxes
       (rail items + content), unlike box-shadow which paints the whole panel rectangle */
    .pch-mm__panel.bg-transparent {
        box-shadow: none;
        filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.12));
    }
    /* page backdrop while a mega panel is open — only when the BO overlay switch is on
       (ETS_MM_ACTIVE_BG_GRAY -> .pch-mm--overlay; opacity/color from the BO too).
       Plain :hover, no hover-driven :has(): the pseudo sits at negative z inside the
       header's stacking context, so the whole header stays above it while the page below
       dims; same intent delays as the panel */
    .pch-mm--overlay .pch-mm__item--has-sub::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -1;
        background-color: var(--pch-mm-overlay-bg, #000);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.15s ease 0.12s;
    }
    .pch-mm--overlay .pch-mm__item--has-sub:hover::before,
    .pch-mm--overlay .pch-mm__item--has-sub:focus-within::before {
        opacity: var(--pch-mm-overlay-opacity, 0.5);
    }
    /* megamenu.js toggles this while a submenu item is hovered/focused (with a short grace
       so the backdrop fade-out keeps its stacking context) — a permanent lift would sit the
       header above modal and offcanvas backdrops */
    .header.pch-mm-open {
        z-index: var(--offcanvas-zindex, 9999999);
    }
    .pch-mm__tabs {
        --bs-nav-link-padding-y: 1.25rem;
        border-right: var(--tabs-border-right-width) solid var(--bs-tertiary-variant-1);
    }
    /* BO "Tab item width" set -> two-track template: rail exactly that wide, content the rest
       (below lg the wrapper stays a plain block, so the drill view stacks) */
    .pch-mm__tab-grid {
        display: grid;
        grid-template-columns: var(--pch-mm-rail-w, 25%) 1fr;
    }
    .pch-mm__tab.active {
        background: var(--bs-primary);
        font-weight: 600;
        --header-color: var(--bs-white);
        --header-hover-color: var(--bs-white);
    }
    .power-tools .pch-mm__tab.active {
        background: var(--bs-tertiary-variant-3);
    }
}

/* panes holding an image block share ONE tile lattice: the pane grid takes the lists'
   auto-fill template, the category column/list dissolve into it (display: contents) and
   the image spans the last two tracks — the column split always lands on a tile edge,
   so tiles match the image-less panes exactly (same width, template and gap) */
@media (min-width: 768px) {
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) {
        --column-preferred-width: clamp(7rem, 20%, 9rem);
        --column-min-width: 7rem;
        --bs-gap: 0.5rem;
        grid-template-columns: repeat(auto-fill, minmax(min(max(var(--column-preferred-width), var(--column-min-width)), 100%), 1fr));
        /* row 1 sized by the tiles (they stretch equal there), the flexible row 2 absorbs
           the spanning image's height instead of inflating row 1 */
        grid-template-rows: auto 1fr;
    }
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) > div:not(:has(.pch-mm__block-img)),
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) > div:not(:has(.pch-mm__block-img)) > .pch-mm__block,
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) > div:not(:has(.pch-mm__block-img)) .pch-mm__block-html,
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) > div:not(:has(.pch-mm__block-img)) .pch-mm__cats {
        /* !important: the cat:d-grid token puts display: grid !important on the list */
        display: contents !important;
    }
    .pch-mm__panes .tab-pane > .grid:has(.pch-mm__block-img) > div:has(.pch-mm__block-img) {
        /* !important outranks the g-col span utilities the cols: field puts on the cell */
        grid-column: -3 / -1 !important;
        grid-row: 1 / span 15;
        /* wider breathing room between the tiles and the image than the tile gap alone */
        margin-left: var(--pch-mm-img-col-gap, 1rem);
    }
}

@media (max-width: 991.98px) {
    .pch-mm .offcanvas-header .logo {
        filter: invert(1);
        max-width: var(--pch-mm-logo-w, 120px);
    }
    .header-nav__container {
        padding: 0;
    }
    /* mobile-bar copies share the row in equal halves, labels centered
       (!important outranks the duplicated link's justify-content-start utility) */
    .pch-mm__mobile-bar > * {
        flex: 1 0 0;
        justify-content: center !important;
    }
    .pch-mm__mobile-bar .pch-mm__link {
        --bs-nav-link-padding-y: .75rem;
    }
    /* 2026-11-24: Hand Tools / Power Tools stay in the hamburger drawer too (they used to
       hide there because the mobile bar shows them); the bar still opens only its own menu */
    /* a drawer opened from the bar shows only that menu — the root list belongs to the
       hamburger (megamenu.js toggles the state) */
    .pch-mm--bar-opened .pch-mm__list > .pch-mm__item:not(.is-open) {
        display: none;
    }
    /* drawer tax switcher (moved in by megamenu.js): labels only — the switch control hides
       (!important outranks its d-flex utility), the module outlines the active label itself */
    .pch-mm__item--switcher .form-switch {
        display: none !important;
    }
    .pch-mm__item--switcher .priceswitcher__switch-container {
        padding: 1rem .75rem;
    }
    /* the active side (checked = tax-incl) reads as an outlined pill */
    .pch-mm__item--switcher .priceswitcher__label {
        --bs-border-width: 2px;
        padding: .5rem 1.5rem;
        border: var(--bs-border-width) solid transparent;
        border-radius: 50rem;
        font-size: var(--bs-btn-font-size);
    }
    .pch-mm__item--switcher .priceswitcher__switch-container:not(:has(.priceswitcher_tax_toggle:checked)) .priceswitcher__label--excl,
    .pch-mm__item--switcher .priceswitcher__switch-container:has(.priceswitcher_tax_toggle:checked) .priceswitcher__label--incl {
        border-color: var(--bs-primary);
        font-weight: 700;
    }
    /* drawer rows follow the nav-link spacing vars; !important outranks the py-2 utility */
    .pch-mm__link {
        --bs-nav-link-padding-x: .75rem;
        --bs-nav-link-padding-y: 1rem;
        padding: var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x) !important;
    }
    /* the drawer's rail tabs (native .nav-link padding) match the row spacing */
    .pch-mm .nav-link {
        --bs-nav-link-padding-x: .75rem;
        --bs-nav-link-padding-y: 1rem;
    }
    .pch-mm__panel {
        display: none;
    }
    .pch-mm__item.is-open > .pch-mm__panel {
        display: block;
    }
    /* drill: the open submenu owns the offcanvas — siblings hide, the open bar becomes the header */
    .pch-mm__list.has-open .pch-mm__item:not(.is-open) {
        display: none;
    }
    .pch-mm__item {
        border-bottom: 1px solid var(--bs-border-color);
    }
    .pch-mm__list > .pch-mm__item:last-child {
        border-bottom: 0;
    }
    .pch-mm__item.is-open > .pch-mm__bar {
        background: var(--bs-tertiary-bg);
    }
    .pch-mm__item.is-open > .pch-mm__bar .js-mm-drill .material-icons {
        transform: rotate(180deg);
    }
    /* tabbed menus drill one level deeper: entering shows the tab list alone, a tab's drill
       reveals its pane over it (mirrors the item drill; megamenu.js toggles the classes).
       Flex comes from here, not a d-flex utility — its !important would defeat the
       sibling-hiding rule below */
    .pch-mm__tabs .nav-item {
        display: flex;
    }
    .pch-mm__panel:not(.pch-mm__panel--tabs-open) .pch-mm__rail + div {
        display: none;
    }
    /* on the second drill level only the open tab heads the drawer — the menu bar above it
       steps aside like the sibling items do (!important outranks the bar's d-flex utility) */
    .pch-mm__item:has(> .pch-mm__panel--tabs-open) > .pch-mm__bar {
        display: none !important;
    }
    .pch-mm__panel--tabs-open .pch-mm__tabs .nav-item:not(.is-open) {
        display: none;
    }
    .pch-mm__tabs .nav-item.is-open .js-mm-drill .material-icons {
        transform: rotate(180deg);
    }
    .pch-mm__panes .tab-pane {
        display: none;
    }
    .pch-mm__panel--tabs-open .pch-mm__panes .tab-pane.active {
        display: block;
    }

    @media (prefers-reduced-motion: no-preference) {
        .pch-mm__item.is-open > .pch-mm__panel {
            animation: pch-mm-drill-in 0.25s ease;
        }
        /* --still: the item whose drill just closed — it never left the screen (megamenu.js) */
        .pch-mm__list:not(.has-open) > .pch-mm__item:not(.pch-mm__item--still) {
            animation: pch-mm-drill-back 0.25s ease;
        }
        .pch-mm__panel--tabs-open .pch-mm__panes .tab-pane.active {
            animation: pch-mm-drill-in 0.25s ease;
        }
        .pch-mm__panel:not(.pch-mm__panel--tabs-open) .pch-mm__tabs .nav-item:not(.pch-mm__item--still) {
            animation: pch-mm-drill-back 0.25s ease;
        }
    }
}

@keyframes pch-mm-drill-in {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pch-mm-drill-back {
    from {
        opacity: 0;
        transform: translateX(-1rem);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
