/* =========================================================================
   All Categories page
   Modern, full-width card grid. Reuses the site's HSL design tokens
   (--base, --dark, --white, --border, --light-2, --black, --box-shadow,
   --heading-font) so the page stays visually consistent with the rest of
   the storefront.
   ========================================================================= */

.categories-page {
    background-color: hsl(var(--white));
    color: hsl(var(--body-color));
    padding-bottom: 70px;
}

/* ---------- Breadcrumb row ---------- */
.categories-breadcrumb {
    background-color: hsl(var(--light-2));
    padding: 14px 0;
    border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.categories-breadcrumb .breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 14px;
    color: hsl(var(--body-color));
}

.categories-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "\203A";
    padding: 0 8px;
    color: hsl(var(--dark) / 0.35);
}

.categories-breadcrumb .breadcrumb-item a {
    color: hsl(var(--dark) / 0.7);
    text-decoration: none;
    transition: color 0.15s ease;
}

.categories-breadcrumb .breadcrumb-item a:hover,
.categories-breadcrumb .breadcrumb-item a:focus {
    color: hsl(var(--base));
}

.categories-breadcrumb .breadcrumb-item.active {
    color: hsl(var(--dark));
    font-weight: 600;
}

/* ---------- Page hero ---------- */
.categories-hero {
    background-color: hsl(var(--white));
    padding: 24px 0 20px;
    border-bottom: 4px solid hsl(var(--base));
}

.categories-hero__inner {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.categories-hero__eyebrow {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: hsl(var(--base));
    margin-bottom: 12px;
}

.categories-hero__title {
    font-family: var(--heading-font, "Poppins", sans-serif);
    color: hsl(var(--dark));
    font-size: 32px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0;
}

.categories-hero__subtitle {
    margin: 12px auto 0;
    max-width: 620px;
    font-size: 16px;
    line-height: 1.5;
    color: hsl(var(--dark) / 0.7);
}

/* ---------- Body ---------- */
.categories-body {
    padding: 24px 0 0;
}

.category-tree__empty {
    column-span: all;
    -webkit-column-span: all;
}

/* ---------- Card packing: CSS columns (Pinterest-style masonry) ----------
   CSS columns flow cards into vertical columns top-to-bottom. Each card is
   sized to its own content (no row-stretching), so a short card like
   "Fire Fighting" no longer stretches to match a tall card like
   "Hydraulics" — instead it sits at its natural height and the next card
   packs underneath it in the same column. break-inside: avoid on the card
   keeps a single card from splitting across columns. */
.category-tree__grid {
    column-count: 3;
    column-gap: 24px;
}

@media (max-width: 1199.98px) {
    .category-tree__grid {
        column-count: 2;
    }
}

@media (max-width: 767.98px) {
    .category-tree__grid {
        column-count: 1;
        column-gap: 0;
    }
}

/* ---------- Each category card ----------
   Content-driven height (no fixed pixel height, no height: 100%). Cards
   stack into columns naturally and pack tight at the top of each column. */
.category-tree-item {
    background-color: hsl(var(--white));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 24px 24px 28px;
    margin: 0 0 24px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 575.98px) {
    .category-tree-item {
        padding: 20px 18px 22px;
        margin-bottom: 18px;
    }
}

.category-tree-item:hover {
    border-color: hsl(var(--base) / 0.4);
    box-shadow: 0 10px 24px hsl(var(--black) / 0.06);
    transform: translateY(-2px);
}

/* ---------- Card header (parent category) ---------- */
.category-tree-item .parent-category {
    margin-bottom: 16px;
}

.category-tree-item .parent-category a {
    display: flex !important;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    text-align: left;
}

.category-tree-item .parent-category img {
    width: 56px !important;
    height: 56px !important;
    max-width: none;
    object-fit: contain;
    border-radius: 8px;
    background-color: hsl(var(--light-2));
    padding: 8px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.category-tree-item:hover .parent-category img {
    transform: scale(1.05);
}

.category-tree-item .parent-category .title {
    font-family: var(--heading-font, "Poppins", sans-serif);
    color: hsl(var(--dark));
    font-weight: 700 !important;
    font-size: 1.125rem !important;
    line-height: 1.3;
    transition: color 0.15s ease;
    text-align: left;
}

.category-tree-item .parent-category a:hover .title,
.category-tree-item:hover .parent-category .title {
    color: hsl(var(--base)) !important;
}

/* Divider between parent header and subcategory list */
.parent-category__divider {
    height: 1px;
    background: linear-gradient(to right, hsl(var(--border)), hsl(var(--border) / 0));
    margin: 4px 0 14px;
}

/* ---------- Inner category tree (subcategory list inside each card) ----------
   The list inside each card is intentionally generous: full names stay
   visible (no ellipsis, no character truncation), the hierarchy reads
   through font-weight / size / colour rather than literal dash markers,
   and nested levels sit on a soft left guide line with extra indent. */

/* Top-level subcategory list — single vertical column inside every card.
   One item per line so the format is consistent across all cards
   (including ones like "Fire Fighting" that previously showed items in a
   side-by-side sub-grid). */
.child-category {
    list-style: none;
    padding: 0;
    margin: 0;
    display: block;
}

.child-category > li {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    break-inside: avoid;
}

/* Row holding the (optional) depth-1 icon and the category link. */
.child-category__row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    line-height: 1.5;
    min-width: 0;
}

/* Top-level subcategory typography: prominent, dark, semi-bold. */
.child-category > li > .child-category__row {
    font-weight: 600;
    font-size: 0.9375rem;
    color: hsl(var(--dark));
}

.child-category > li > .child-category__row .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 3px;
}

.child-category > li > .child-category__row .icon .icon-img {
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    object-fit: contain;
}

/* Link: full name always visible. Word-breaking handles very long single
   tokens so nothing overflows its column. */
.child-category > li > .child-category__row .category-name {
    color: hsl(var(--dark));
    text-decoration: none;
    transition: color 0.15s ease;
    flex: 1;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.5;
}

.child-category > li > .child-category__row .category-name:hover,
.child-category > li > .child-category__row .category-name:focus {
    color: hsl(var(--base));
}

/* ---------- Nested deeper-level subcategories ----------
   Beyond the first level we render as a single vertical list with a left
   guide line, so the hierarchy stays easy to follow even when the card
   width is constrained. */
.child-category ul.child-category {
    margin: 6px 0 8px 22px;
    padding-left: 14px;
    border-left: 2px solid hsl(var(--border));
    display: block;
    grid-template-columns: none;
    column-gap: 0;
    row-gap: 0;
}

.child-category ul.child-category > li {
    margin: 0;
    padding: 0;
}

.child-category ul.child-category > li > .child-category__row {
    font-weight: 400 !important;
    font-size: 0.875rem;
    padding: 5px 0;
    color: hsl(var(--body-color));
    gap: 6px;
}

.child-category ul.child-category > li > .child-category__row .category-name {
    color: hsl(var(--body-color));
    font-weight: 400;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.child-category ul.child-category > li > .child-category__row .category-name:hover,
.child-category ul.child-category > li > .child-category__row .category-name:focus {
    color: hsl(var(--base));
}

/* Level 3+: smaller, lighter, slightly more indent, softer guide line. */
.child-category ul.child-category ul.child-category {
    margin-left: 14px;
    padding-left: 12px;
    border-left-color: hsl(var(--border) / 0.55);
}

.child-category ul.child-category ul.child-category > li > .child-category__row {
    font-size: 0.8125rem;
    padding: 4px 0;
    color: hsl(var(--body-color) / 0.85);
}

.child-category ul.child-category ul.child-category > li > .child-category__row .category-name {
    color: hsl(var(--body-color) / 0.85);
}

/* =========================================================================
   Responsive breakpoints — keep hero/body paddings and typography scaled.
   ========================================================================= */
@media (max-width: 991.98px) {
    .categories-hero {
        padding: 20px 0 16px;
    }

    .categories-hero__title {
        font-size: 28px;
    }

    .categories-body {
        padding-top: 20px;
    }
}

@media (max-width: 767.98px) {
    .categories-page {
        padding-bottom: 56px;
    }

    .categories-hero {
        padding: 16px 0 14px;
    }

    .categories-hero__title {
        font-size: 26px;
    }

    .categories-body {
        padding-top: 18px;
    }

    .categories-hero__subtitle {
        font-size: 15px;
    }
}

@media (max-width: 575.98px) {
    .categories-hero {
        padding: 14px 0 12px;
        border-bottom-width: 3px;
    }

    .categories-hero__title {
        font-size: 22px;
        line-height: 1.25;
    }

    .categories-hero__eyebrow {
        font-size: 11px;
        letter-spacing: 0.15em;
        margin-bottom: 8px;
    }

    .category-tree-item .parent-category .title {
        font-size: 1.0625rem !important;
    }

    .category-tree-item .parent-category img {
        width: 48px !important;
        height: 48px !important;
    }
}
