/**
 * TC Discovery archive filtering.
 *
 * The sidebar shell (panel, flyout, accordions) is styled by the shop
 * bundle via the shared tc-shop-filters / tc-accordion classes; this file
 * only covers the discovery-specific pieces: option rows, counts, loading
 * state, and no-JS affordances.
 */

/* Slide-out title bar mirrors the mobile navigation header: navy bar,
   white title and close. Full-bleed across the panel top (the panel pads
   --pad-card-lg), inner padding re-aligns the title with the facet column.
   Desktop keeps the plain heading — there is no bar to mimic there. */
@media all and (max-width: 767px) {
    .tc-df .tc-filters-head {
        background: var(--navy-700);
        height: 72px;
        min-height: 72px;
        margin: calc(-1 * var(--pad-card-lg)) calc(-1 * var(--pad-card-lg)) var(--space-3);
        padding: 0 var(--pad-card-lg);
    }

    .tc-df .tc-filters-head h2 {
        color: #fff;
    }

    .tc-df .tc-filters-close {
        color: #fff;
        /* The 40px hit area stays; pulled right so the X glyph's CENTER
           sits on the chevron column's center (the X is 20px wide, the
           chevrons 12px, so edge-alignment reads 4px off). */
        margin-right: -14px;
    }

    .tc-df .tc-filters-close:hover,
    .tc-df .tc-filters-close:focus-visible {
        background: rgba(255, 255, 255, 0.14);
    }
}

/* Chevrons: point right when closed, rotate down when open — and smaller
   than the shared accordion default. Scoped to the discovery sidebar so
   other site accordions keep their existing behavior. */
.tc-df .tc-accordion-chev {
    transform: rotate(-90deg);
}

.tc-df .tc-accordion.active .tc-accordion-chev {
    transform: rotate(0deg);
}

.tc-df .tc-accordion-chev .icon {
    height: 12px;
    width: 12px;
}

/* Even vertical rhythm: the gap between the last option and the next
   section's border matches the heading's 12px padding below that border.
   (Three classes: the accordion component zeroes ul:last-child margins with
   higher specificity than two.) */
.tc-df .tc-accordion-content .tc-df-options {
    list-style: none;
    margin: 0 0 var(--space-3);
    padding: 0;
}

.tc-df .tc-df-option {
    margin: 0;
}

.tc-df .tc-df-option label {
    align-items: center;
    cursor: pointer;
    display: flex;
    gap: 8px;
    padding: 5px 0;
}

.tc-df .tc-df-option:last-child label {
    padding-bottom: 0;
}

/* Checkboxes follow the Product Add-ons design: hidden native input, a
   drawn box with 2px border, navy fill + white check + soft glow when
   selected (sized down from the add-ons 24px for the denser filter list). */
.tc-df .tc-df-option input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.tc-df .tc-df-check {
    align-items: center;
    background: var(--surface-0, #fff);
    border: 2px solid var(--border-control);
    border-radius: 6px;
    display: inline-flex;
    flex: 0 0 auto;
    height: 20px;
    justify-content: center;
    transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
    width: 20px;
}

.tc-df .tc-df-check::after {
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    content: "";
    height: 4px;
    opacity: 0;
    transform: translateY(-1px) rotate(-45deg);
    transition: opacity 0.18s ease;
    width: 8px;
}

.tc-df .tc-df-option label:hover .tc-df-check {
    border-color: var(--ink-400);
}

.tc-df .tc-df-option input:checked + .tc-df-check {
    background: var(--navy-700);
    border-color: var(--navy-700);
    box-shadow: 0 0 0 4px rgba(32, 153, 197, 0.14);
}

.tc-df .tc-df-option input:checked + .tc-df-check::after {
    opacity: 1;
}

.tc-df .tc-df-option input:focus-visible + .tc-df-check {
    box-shadow: 0 0 0 4px rgba(32, 153, 197, 0.22);
}

.tc-df .tc-df-option-label {
    flex: 1 1 auto;
}

.tc-df .tc-df-option-count {
    color: #757575;
    flex: 0 0 auto;
    font-size: 13px;
}

/* The Reviews star bar: five radio stars, click the Nth for "N & up".
   Stars fill up to the selection; hovering previews a new threshold. */
.tc-df .tc-df-rating {
    align-items: center;
    display: flex;
    gap: 2px;
    margin: 0 0 var(--space-3);
}

.tc-df .tc-df-rating-star {
    cursor: pointer;
    display: inline-flex;
    padding: 2px;
    position: relative;
}

.tc-df .tc-df-rating-star input {
    clip: rect(0, 0, 0, 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.tc-df .tc-df-rating-star .tc-star {
    fill: var(--ink-100);
    height: 18px;
    transition: fill 0.12s ease;
    width: 18px;
}

/* Fill the selected star and every star before it. */
.tc-df .tc-df-rating-star:has(input:checked) .tc-star,
.tc-df .tc-df-rating-star:has(~ .tc-df-rating-star input:checked) .tc-star {
    fill: var(--warning-500);
}

/* Hover preview: fill up to the hovered star, overriding the selection. */
.tc-df .tc-df-rating:has(.tc-df-rating-star:hover) .tc-df-rating-star:not(.is-disabled) .tc-star {
    fill: var(--warning-500);
}

.tc-df .tc-df-rating:has(.tc-df-rating-star:hover) .tc-df-rating-star:hover ~ .tc-df-rating-star .tc-star {
    fill: var(--ink-100);
}

.tc-df .tc-df-rating-star.is-disabled {
    cursor: default;
    opacity: 0.35;
}

.tc-df .tc-df-rating-star.is-disabled .tc-star {
    fill: var(--ink-100) !important;
}

.tc-df .tc-df-rating-star:has(input:focus-visible) {
    border-radius: 4px;
    outline: 2px solid var(--navy-700);
    outline-offset: 1px;
}

.tc-df .tc-df-rating-status {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 4px;
}

/* Selected-but-now-zero options stay visible so they can be unchecked. */
.tc-df .tc-df-option-empty .tc-df-option-label,
.tc-df .tc-df-option-empty .tc-df-option-count {
    opacity: 0.5;
}

/* The first visible filter section carries no top border — the panel head
   already separates it. Fallback rule first; the :nth-child(1 of …) form
   also skips groups hidden by the min-choices rule. */
.tc-df .tc-df-groups > .tc-accordion:first-child {
    border-top: 0;
}

.tc-df .tc-df-groups > :nth-child(1 of .tc-accordion:not([hidden])) {
    border-top: 0;
}

/* Reset sits below the filters, set off by the same section rule. */
.tc-df .tc-df-clear {
    border-top: 1px solid var(--line-soft);
    display: block;
    font-size: 14px;
    margin: 0;
    padding: var(--space-3) 0;
    text-decoration: underline;
}

/* Show More / Show Less inside an option list. */
.tc-df .tc-df-more-row {
    list-style: none;
    margin: 0;
}

.tc-df .tc-df-more {
    background: none;
    border: 0;
    color: var(--color-link, #0A7497);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 0 0;
    text-decoration: underline;
}

.tc-df .tc-df-more:hover {
    text-decoration: none;
}

/* No-JS: real submit button. With JS, changes apply instantly. */
.tc-js .tc-df .tc-df-apply {
    display: none;
}

.tc-df .tc-df-apply {
    margin-top: 12px;
}

/* Grid updating: keep layout, dim content, block accidental clicks. */
.tc-df-loading ul.products {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity 150ms ease;
}

@media (prefers-reduced-motion: reduce) {
    .tc-df-loading ul.products {
        transition: none;
    }
}
