/**
 * CDA product archive and the shared product card.
 *
 * Colours come from the Elementor kit's globals (accent, secondary and the
 * Grey 900-300 swatches), with the live values as fallbacks, so a kit
 * change carries through.
 *
 * Like the landing-page product grids, the archive sits on a Grey 800
 * section (the Elementor container's background) and the cards and filter
 * rows are Grey 900 on it.
 *
 * Specificity: every rule is two classes (.cda-archive .cda-x__y), which
 * beats the theme's bare-element rules and the kit's ".elementor-kit-25 h2"
 * style rules. Two places need more, and say why where they do: the search
 * box (the kit's input rule chains two :not()s) and buttons (custom-base.css
 * forces font-weight 600 with !important, so ours don't set a weight).
 *
 * Phones and tablets (below 1024px): the filters are a bottom sheet opened
 * by the floating "Filters" button. With JS the sheet opens by class;
 * without it, by :target (#cda-filters).
 */

.cda-archive,
.cda-product-card {
    --cda-bg: var(--e-global-color-f246ce3, #100f1a); /* Grey 900 */
    --cda-panel: var(--e-global-color-3433412, #222032); /* Grey 800 */
    --cda-raised: var(--e-global-color-e30960e, #322f4c); /* Grey 700 */
    --cda-line: var(--e-global-color-e30960e, #322f4c);
    --cda-line-strong: var(--e-global-color-4205bb4, #5d6486); /* Grey 600 */
    --cda-text: var(--e-global-color-89b7035, #cdd2d7); /* Grey 300 */
    --cda-muted: var(--e-global-color-94bcddc, #868f98); /* Grey 400 */
    --cda-strong: #ffffff;
    --cda-accent: var(--e-global-color-accent, #ff2614);
    --cda-accent-hover: var(--e-global-color-secondary, #ff4131);
    --cda-radius: 6px;
    --cda-sticky-top: 72px; /* clears the site's sticky menu bar */
    --cda-title-font: "Blackbird Narrow", arial, sans-serif; /* the kit's heading font */
}

/* Theme resets ------------------------------------------------------- */
/* base.css gives every ul and li a bottom margin and sizes headings. */

.cda-archive {
    color: var(--cda-text);
    font-size: 15px;
    line-height: 1.4;
}

.cda-archive *,
.cda-archive *::before,
.cda-archive *::after {
    box-sizing: border-box;
}

.cda-archive ul,
.cda-archive li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cda-archive [hidden] {
    display: none;
}

/* Layout ------------------------------------------------------------- */

.cda-archive[aria-busy="true"] .cda-archive__main {
    opacity: 0.55;
    transition: opacity 0.15s 0.1s;
}

@media (min-width: 1024px) {
    .cda-archive:not(.cda-archive--compact) {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 32px;
        align-items: start;
    }

    .cda-archive .cda-archive__filters {
        position: sticky;
        top: var(--cda-sticky-top);
        max-height: calc(100vh - var(--cda-sticky-top) - 24px);
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .cda-archive .cda-archive__fab,
    .cda-archive .cda-archive__backdrop,
    .cda-archive .cda-filters__head {
        display: none;
    }
}

/* Filters ------------------------------------------------------------ */

.cda-archive .cda-filters__title,
.cda-archive .cda-filters__legend {
    margin: 0;
    padding: 0;
    color: var(--cda-strong);
    font-family: var(--cda-title-font);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.cda-archive .cda-filters__title {
    font-size: 20px;
}

.cda-archive .cda-filters__legend {
    margin-bottom: 6px;
    font-size: 12px;
}

.cda-archive .cda-filters__group {
    min-width: 0;
    margin: 0 0 20px;
    padding: 0;
    border: 0;
}

.cda-archive .cda-filters__search {
    margin-bottom: 16px;
}

/* The id: the kit styles inputs with a two-:not() selector. */
.cda-archive #cda-filter-search {
    width: 100%;
    height: 36px;
    padding: 0 10px 0 32px;
    border: 1px solid var(--cda-line);
    border-radius: var(--cda-radius);
    background: var(--cda-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='6' cy='6' r='4.75' fill='none' stroke='%23868f98' stroke-width='1.5'/%3E%3Cpath d='M9.5 9.5L13 13' stroke='%23868f98' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 10px center;
    box-shadow: none;
    color: var(--cda-strong);
    font: inherit;
    font-size: 13px;
}

.cda-archive #cda-filter-search::placeholder {
    color: var(--cda-muted);
}

.cda-archive #cda-filter-search:focus {
    border-color: var(--cda-line-strong);
    outline: none;
}

.cda-archive .cda-filters__no-match {
    margin: 10px 0 0;
    color: var(--cda-muted);
    font-size: 13px;
}

/* Options: full-width chip rows, 2px apart. */
.cda-archive .cda-filters__links,
.cda-archive .cda-filters__options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cda-archive .cda-filters__link,
.cda-archive .cda-filters__option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 32px;
    margin: 0;
    padding: 6px 10px;
    border-radius: 4px;
    background: var(--cda-bg);
    color: var(--cda-text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 0;
    text-decoration: none;
    text-transform: none;
    cursor: pointer;
    /* No fade: on stacked rows a fading highlight trails the cursor. */
}

.cda-archive .cda-filters__link:hover,
.cda-archive .cda-filters__option:hover {
    background: var(--cda-raised);
    color: var(--cda-strong);
}

.cda-archive .cda-filters__link[aria-current="page"] {
    background: var(--cda-raised);
    color: var(--cda-strong);
    font-weight: 600;
}

.cda-archive .cda-filters__name {
    flex: 1;
    min-width: 0;
}

.cda-archive .cda-filters__count {
    color: var(--cda-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* The real checkbox stays in the page for keyboards and screen readers;
   the label draws the box. */
.cda-archive .cda-filters__input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.cda-archive .cda-filters__option::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--cda-muted);
    border-radius: 3px;
    transition: background-color 0.15s, border-color 0.15s;
}

.cda-archive .cda-filters__input:checked + .cda-filters__option {
    color: var(--cda-strong);
}

.cda-archive .cda-filters__input:checked + .cda-filters__option::before {
    border-color: var(--cda-accent);
    background: var(--cda-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4l2.75 2.75L9 1.5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
}

.cda-archive .cda-filters__input:focus-visible + .cda-filters__option {
    outline: 2px solid var(--cda-strong);
    outline-offset: -2px;
}

/* Long groups fold after the first few options (JS only). */
.cda-archive--js .cda-filters__group:not(.is-expanded) .cda-filters__row--extra,
.cda-archive:not(.cda-archive--js) .cda-filters__more {
    display: none;
}

.cda-archive .cda-filters__more {
    margin: 4px 0 0;
    padding: 4px 10px;
    border: 0;
    background: none;
    color: var(--cda-muted);
    font-family: inherit;
    font-size: 12px;
    letter-spacing: 0;
    text-decoration: underline;
    text-transform: none;
    text-underline-offset: 3px;
    cursor: pointer;
}

.cda-archive .cda-filters__more:hover {
    background: none;
    color: var(--cda-strong);
}

.cda-archive .cda-filters__foot {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cda-archive .cda-filters__clear,
.cda-archive .cda-filters__close {
    color: var(--cda-muted);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cda-archive .cda-filters__clear:hover,
.cda-archive .cda-filters__close:hover {
    color: var(--cda-strong);
}

.cda-archive .cda-filters__apply {
    flex: 1;
    min-height: 48px;
    padding: 12px 20px;
    border: 0;
    border-radius: var(--cda-radius);
    background: var(--cda-accent);
    color: var(--cda-strong);
    font-family: var(--cda-title-font);
    font-size: 16px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s;
}

.cda-archive .cda-filters__apply:hover {
    background: var(--cda-accent-hover);
}

/* With JS, ticking applies at once; on desktop the button is only for no-JS. */
@media (min-width: 1024px) {
    .cda-archive--js .cda-filters__apply {
        display: none;
    }
}

/* Toolbar, sort and chips -------------------------------------------- */

/* Count, active chips and Sort share one row; Sort sits on the right. */
.cda-archive .cda-archive__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 20px;
}

.cda-archive .cda-archive__toolbar .cda-archive__chips {
    margin-bottom: 0;
}

.cda-archive .cda-archive__sort {
    margin-left: auto;
}

.cda-archive .cda-archive__count {
    margin: 0;
    color: var(--cda-muted);
    font-size: 13px;
}

.cda-archive .cda-archive__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.cda-archive .cda-archive__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--cda-raised);
    color: var(--cda-strong);
    font-size: 13px;
    text-decoration: none;
    transition: background-color 0.15s;
}

.cda-archive .cda-archive__chip:hover {
    background: var(--cda-accent);
    color: var(--cda-strong);
}

.cda-archive .cda-archive__chip--clear {
    background: none;
    color: var(--cda-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cda-archive .cda-archive__chip--clear:hover {
    background: none;
    color: var(--cda-strong);
}

.cda-archive .cda-archive__empty {
    padding: 48px 24px;
    border: 1px dashed var(--cda-line);
    border-radius: var(--cda-radius);
    text-align: center;
}

.cda-archive .cda-archive__empty p {
    margin: 0 0 12px;
    color: var(--cda-strong);
}

/* Dropdowns (parts/dropdown.php), in the style of SimGrid's filter
   toggles: outline button, muted name, bold value, chevron. --------- */

.cda-archive .cda-dd {
    position: relative;
}

.cda-archive .cda-dd__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--cda-line);
    border-radius: 4px;
    color: var(--e-global-color-33569c2, #e9ecef); /* Grey 200 */
    font-size: 14px;
    line-height: 1;
    white-space: nowrap;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.cda-archive .cda-dd__toggle::-webkit-details-marker {
    display: none;
}

.cda-archive .cda-dd__toggle:hover,
.cda-archive .cda-dd[open] .cda-dd__toggle {
    border-color: var(--cda-line-strong);
}

.cda-archive .cda-dd__toggle:focus-visible {
    outline: 2px solid var(--cda-strong);
    outline-offset: 2px;
}

.cda-archive .cda-dd__name {
    color: var(--cda-muted);
}

.cda-archive .cda-dd__value {
    overflow: hidden;
    max-width: 180px;
    font-weight: 700;
    text-overflow: ellipsis;
}

.cda-archive .cda-dd__chevron {
    color: var(--cda-muted);
    transition: transform 0.15s;
}

.cda-archive .cda-dd[open] .cda-dd__chevron {
    transform: rotate(180deg);
}

.cda-archive .cda-dd__menu {
    position: absolute;
    z-index: 50;
    top: 100%;
    left: 0;
    min-width: 180px;
    max-width: calc(100vw - 32px);
    max-height: 320px;
    margin-top: 4px;
    padding: 4px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--cda-raised);
    box-shadow: 0 0 60px rgba(16, 15, 26, 0.7);
    scrollbar-width: thin;
}

.cda-archive .cda-dd--end .cda-dd__menu {
    right: 0;
    left: auto;
}

.cda-archive .cda-dd__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 4px;
    color: var(--cda-text);
    font-size: 14px;
    white-space: nowrap;
    text-decoration: none;
}

.cda-archive .cda-dd__item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--cda-strong);
}

.cda-archive .cda-dd__label {
    flex: 1;
}

.cda-archive .cda-dd__count {
    color: var(--cda-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

/* The tick on the current option: CSS, not an SVG per option. */
.cda-archive .cda-dd__item::after {
    content: "";
    flex: none;
    width: 12px;
    height: 9px;
}

.cda-archive .cda-dd__item[aria-current="true"] {
    color: var(--cda-strong);
}

.cda-archive .cda-dd__item[aria-current="true"]::after {
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath d='M1 4.5l3.5 3.5L11 1.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='9' viewBox='0 0 12 9'%3E%3Cpath d='M1 4.5l3.5 3.5L11 1.5' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center;
}

/* Landing-page section (templates/compact.php) ----------------------- */

/* Clears the site's sticky header when a link jumps to #setups. */
.cda-archive--compact {
    scroll-margin-top: 96px;
}

/* Title and count on the left, the filters on the right; they wrap under
   the title when there isn't room. */
.cda-archive--compact .cda-archive__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 24px;
}

.cda-archive--compact .cda-archive__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
}

.cda-archive--compact .cda-archive__title {
    margin: 0;
    color: var(--cda-strong);
    font-family: var(--cda-title-font);
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
}

.cda-archive--compact .cda-archive__bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cda-archive--compact .cda-archive__more {
    margin-top: 28px;
    text-align: center;
}

.cda-archive--compact .cda-archive__more-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 24px;
    border: 1px solid var(--cda-line-strong);
    border-radius: var(--cda-radius);
    color: var(--cda-strong);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, background-color 0.15s;
}

.cda-archive--compact .cda-archive__more-link:hover {
    border-color: var(--cda-accent);
    background: var(--cda-accent);
    color: var(--cda-strong);
}

/* Grid and card ------------------------------------------------------ */

.cda-archive .cda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 20px;
}

.cda-product-card {
    min-width: 0;
}

.cda-product-card .cda-product-card__link {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    border-radius: var(--cda-radius);
    background: var(--cda-bg);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.05);
    color: var(--cda-text);
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.cda-product-card .cda-product-card__link:hover {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.cda-product-card .cda-product-card__link:focus-visible {
    outline: 2px solid var(--cda-strong);
    outline-offset: 2px;
}

/* The car renders are square, transparent PNGs. */
.cda-product-card .cda-product-card__media {
    display: block;
    aspect-ratio: 1;
    margin-bottom: 12px;
}

.cda-product-card .cda-product-card__media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.cda-product-card .cda-product-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    text-align: center;
}

.cda-product-card .cda-product-card__badge {
    align-self: center;
    padding: 2px 8px;
    border-radius: 3px;
    background: var(--cda-raised);
    color: var(--cda-text);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.cda-product-card .cda-product-card__title {
    margin: 0;
    color: var(--cda-text);
    font-family: var(--cda-title-font);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    text-wrap: balance;
}



/* Pagination --------------------------------------------------------- */

.cda-archive .cda-archive__pagination {
    margin-top: 40px;
}

/* paginate_links() puts .page-numbers on the list as well as the links. */
.cda-archive .cda-archive__pagination ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    border: 0;
    background: none;
}

.cda-archive .cda-archive__pagination li .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--cda-radius);
    color: var(--cda-muted);
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-decoration: none;
}

.cda-archive .cda-archive__pagination li a.page-numbers:hover {
    background: var(--cda-bg);
    color: var(--cda-strong);
}

.cda-archive .cda-archive__pagination li .current {
    background: var(--cda-accent);
    color: var(--cda-strong);
}

.cda-archive .cda-archive__pagination li .dots {
    min-width: 0;
    padding: 0 4px;
}

/* Phones and tablets: bottom sheet ----------------------------------- */

@media (max-width: 1023.98px) {
    .cda-archive:not(.cda-archive--compact) {
        padding-bottom: 72px;
    }

    .cda-archive .cda-archive__filters {
        position: fixed;
        z-index: 10001;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        max-height: 85vh;
        max-height: 85dvh;
        border-radius: 16px 16px 0 0;
        background: var(--cda-panel);
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.5);
        transform: translateY(105%);
        visibility: hidden;
        transition: transform 0.25s ease, visibility 0s 0.25s;
    }

    .cda-archive.is-sheet-open .cda-archive__filters,
    .cda-archive:not(.cda-archive--js) .cda-archive__filters:target {
        transform: none;
        visibility: visible;
        transition: transform 0.25s ease;
    }

    .cda-archive .cda-filters {
        display: flex;
        flex-direction: column;
        width: 100%;
        min-height: 0;
    }

    .cda-archive .cda-filters__head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 20px 12px;
        border-bottom: 1px solid var(--cda-line);
    }

    .cda-archive .cda-filters__search {
        margin: 0;
        padding: 12px 20px 0;
    }

    .cda-archive .cda-filters__body {
        flex: 1;
        min-height: 0;
        padding: 16px 20px 0;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .cda-archive .cda-filters__foot {
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--cda-line);
    }

    .cda-archive .cda-filters__link,
    .cda-archive .cda-filters__option {
        min-height: 40px;
        font-size: 14px;
    }

    .cda-archive .cda-archive__backdrop {
        position: fixed;
        z-index: 10000;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s;
    }

    .cda-archive.is-sheet-open .cda-archive__backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .cda-archive .cda-archive__fab {
        position: fixed;
        z-index: 9999;
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: 50%;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        min-height: 48px;
        padding: 12px 24px;
        border-radius: 999px;
        background: var(--cda-accent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
        color: var(--cda-strong);
        font-family: var(--cda-title-font);
        font-size: 16px;
        font-weight: 800;
        letter-spacing: 0.04em;
        text-decoration: none;
        text-transform: uppercase;
        transform: translateX(-50%);
    }

    .cda-archive.is-sheet-open .cda-archive__fab {
        visibility: hidden;
    }

    .cda-archive .cda-archive__fab-count {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 22px;
        height: 22px;
        padding: 0 6px;
        border-radius: 999px;
        background: var(--cda-strong);
        color: var(--cda-accent);
        font-size: 13px;
    }

    .cda-archive .cda-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .cda-product-card .cda-product-card__link {
        padding: 12px;
    }

    .cda-archive--compact .cda-archive__title {
        font-size: 22px;
    }

    /* Long product names in capitals become a wall of text at two columns. */
    .cda-product-card .cda-product-card__title {
        font-size: 15px;
        line-height: 1.25;
        text-transform: none;
    }

}

@media (min-width: 640px) and (max-width: 1023.98px) {
    .cda-archive .cda-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

html.cda-sheet-lock {
    overflow: hidden;
}

/* The standard reduced-motion switch: !important so it outranks every
   transition above without repeating each selector. */
@media (prefers-reduced-motion: reduce) {
    .cda-archive *,
    .cda-archive *::before {
        transition: none !important;
    }
}
