/*
 * TTF Nav: the hub header on category pages (Hub Run Sheet H2.1).
 *
 * The light archive frame: the count line under the H1, the intro clamped to its first lines, white
 * subcategory tiles and the "Top brands" chips, inside the theme's container, in the theme's colours
 * and font. ttf-nav/header.php enqueues this file only where the header renders (page 1 of an
 * unfiltered category page); its body class ttf-hh-on scopes the intro clamp. Class prefix ttf-hh
 * (the hub template's .sh__ classes stay as they are).
 */

/* The count line: "15 subcategories · 16,246 products". */
.ttf-hh__summary {
    margin: .3rem 0 .85rem;
    font-size: .9375rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text-description, #868E96);
    font-variant-numeric: tabular-nums;
}

/* The intro: the first four lines, the rest behind "Read more" (the whole text is in the HTML). */
.ttf-hh-on .woocommerce-products-header .term-description {
    max-height: 6.8em;
    overflow: hidden;
    font-size: .9375rem;
    line-height: 1.7;
    color: var(--color-text-primary, #212529);
}
.ttf-hh-on .woocommerce-products-header .term-description p { margin: 0 0 .6rem; }
.ttf-hh-on .woocommerce-products-header .term-description p:last-child { margin-bottom: 0; }
.ttf-hh-on .woocommerce-products-header .term-description.is-clamped:not(.is-open) {
    -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
    mask-image: linear-gradient(180deg, #000 55%, transparent);
}
.ttf-hh-on .woocommerce-products-header .term-description.is-open { max-height: none; }
.woocommerce-products-header button.ttf-hh__more {
    display: inline-flex;
    height: auto;
    margin: .3rem 0 .2rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--color-primary, #EF233C);
    font: 600 .875rem/1.4 var(--theme-primary-font, "Krub", sans-serif);
    cursor: pointer;
}
.woocommerce-products-header button.ttf-hh__more:hover { background: none; opacity: .75; }

/* The block under the header. */
.ttf-hh { margin: 0 0 1.75rem; }

/* Subcategory tiles: image, name, count. position: relative holds the tiles' screen-reader text (WordPress's
   .screen-reader-text is position: absolute): on phones the grid is a sideways scroller, and without a positioned
   grid those spans were placed against .content-wrapper, outside the scroller, so they stretched the page to the
   last tile's x (/brand/qsp/ scrolled sideways by 3,400 px on a 390 px phone; 8 Oct 2026). */
.ttf-hh__grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}
.ttf-hh__grid > li { min-width: 0; margin: 0; padding: 0; }
.ttf-hh__tile {
    display: flex;
    align-items: center;
    gap: .85rem;
    height: 100%;
    padding: .55rem .85rem .55rem .55rem;
    background: #fff;
    border: 1px solid var(--color-info-dark, #DEE2E6);
    border-radius: var(--theme-theme-radius-small, 8px);
    color: var(--color-text-primary, #212529);
    text-decoration: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.ttf-hh__tile:hover,
.ttf-hh__tile:focus-visible {
    border-color: var(--color-primary, #EF233C);
    box-shadow: 0 6px 18px -10px rgba(33, 37, 41, .35);
    color: var(--color-text-primary, #212529);
}
.ttf-hh__img {
    display: flex;
    flex: 0 0 72px;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    overflow: hidden;
    border-radius: 6px;
    background: #fff;
}
.ttf-hh__img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ttf-hh__img--none { background: var(--color-info-light, #F1F3F5); }
.ttf-hh__text { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ttf-hh__name { font-size: .9375rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.ttf-hh__tile:hover .ttf-hh__name { color: var(--color-primary, #EF233C); }
.ttf-hh__count {
    font-size: .8125rem;
    line-height: 1.3;
    color: var(--color-text-description, #868E96);
    font-variant-numeric: tabular-nums;
}
.ttf-hh button.ttf-hh__all { display: none; }

/* "Top brands in {category}". */
.ttf-hh__brands {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .9rem;
    margin-top: 1.1rem;
}
.ttf-hh .ttf-hh__heading {
    --ttf-h2: .9375rem; /* ttf-page-zoom.php sizes every h2 through this property, with !important */
    margin: 0;
    font-size: .9375rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-primary, #212529);
}
.ttf-hh__chips { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.ttf-hh__chips > li { margin: 0; padding: 0; }
.ttf-hh__chip {
    display: inline-flex;
    align-items: center;
    padding: .4rem .85rem;
    border-radius: 999px;
    background: var(--color-info-light, #F1F3F5);
    color: var(--color-text-primary, #212529);
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.ttf-hh__chip:hover,
.ttf-hh__chip:focus-visible {
    background: var(--color-primary-lighter, #FFF4F6);
    color: var(--color-primary, #EF233C);
}

/* Phones: the tiles and the chips form one sideways row each; "All {N} subcategories" opens the grid. */
@media (max-width: 767.98px) {
    .ttf-hh { margin-bottom: 1.25rem; }
    .ttf-hh__tiles:not(.is-open) .ttf-hh__grid {
        display: flex;
        gap: .6rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .ttf-hh__tiles:not(.is-open) .ttf-hh__grid::-webkit-scrollbar { display: none; }
    .ttf-hh__tiles:not(.is-open) .ttf-hh__grid > li { flex: 0 0 62%; max-width: 240px; scroll-snap-align: start; }
    .ttf-hh__tiles.is-open .ttf-hh__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .ttf-hh__tile { gap: .6rem; padding: .45rem .6rem .45rem .45rem; }
    .ttf-hh__img { flex-basis: 52px; width: 52px; height: 52px; }
    .ttf-hh__name { font-size: .875rem; }
    .ttf-hh button.ttf-hh__all {
        display: flex;
        width: 100%;
        height: auto;
        margin-top: .6rem;
        padding: .6rem 1rem;
        border: 1.5px solid var(--color-form-border, #CED4DA);
        border-radius: 999px;
        background: #fff;
        color: var(--color-text-primary, #212529);
        font: 600 .875rem/1.2 var(--theme-primary-font, "Krub", sans-serif);
        cursor: pointer;
    }
    .ttf-hh button.ttf-hh__all:hover { background: var(--color-info-light, #F1F3F5); }
    .ttf-hh__brands { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .5rem; }
    .ttf-hh__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .ttf-hh__chips::-webkit-scrollbar { display: none; }
}
