/* =========================================================
   TCG — PRODUCT LISTING
   Styles for templates/product-archive.php
========================================================= */

html body.tcg-plp-page {
    background: #f6f4ef;
}

.tcg-plp,
.tcg-filters {
    --tcg-ink: #111111;
    --tcg-paper: #f6f4ef;
    --tcg-tile: #e9e6df;
    --tcg-line: rgba(17, 17, 17, .13);
    --tcg-edge: #d9d6cf;
    --tcg-muted: #6f6d66;
    --tcg-gutter: clamp(12px, 1.3vw, 22px);

    color: var(--tcg-ink);
    font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.tcg-plp {
    position: relative;
    z-index: 1;
    min-height: 70vh;
    padding: 84px var(--tcg-gutter) clamp(64px, 7vw, 112px);
    background: var(--tcg-paper);
}

.tcg-plp *,
.tcg-plp *::before,
.tcg-plp *::after,
.tcg-filters *,
.tcg-filters *::before,
.tcg-filters *::after {
    box-sizing: border-box;
}

.tcg-plp__head,
.tcg-plp__bar,
.tcg-plp__active,
.tcg-plp__grid,
.tcg-plp__pages,
.tcg-plp__empty {
    max-width: 1800px;
    margin-right: auto;
    margin-left: auto;
}

.tcg-plp .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}


/* ---------------------------------------------------------
   HEAD
--------------------------------------------------------- */

.tcg-plp__head {
    padding: 34px 2px 0;
}

.tcg-plp__crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    color: var(--tcg-muted);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.tcg-plp .tcg-plp__crumbs a {
    color: inherit;
    text-decoration: none;
}

.tcg-plp .tcg-plp__crumbs a:hover {
    color: var(--tcg-ink);
}

.tcg-plp__crumbs span:last-child {
    color: var(--tcg-ink);
}

.tcg-plp__headline {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-top: 16px;
}

.tcg-plp .tcg-plp__title {
    margin: 0;
    padding: 0;
    color: var(--tcg-ink);
    font-family: "Arial Narrow", "Helvetica Neue Condensed", Arial, sans-serif;
    font-size: clamp(38px, 4vw, 65px);
    font-weight: 700;
    line-height: .86;
    letter-spacing: -.05em;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.tcg-plp__count {
    padding-top: 3px;
    color: var(--tcg-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
}


/* ---------------------------------------------------------
   BAR — "Categories" (opens the full list) left, filter and sort right
--------------------------------------------------------- */

.tcg-plp__bar {
    position: relative;
    margin-top: 26px;
    padding: 0 2px;
    border-bottom: 1px solid var(--tcg-line);
}

.tcg-plp .tcg-plp__nav {
    margin: 0;
    padding: 0;
    border: 0;
}

.tcg-plp .tcg-plp__nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 50px;
    margin: 0;
    padding: 0;
    color: var(--tcg-ink);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .13em;
    text-transform: uppercase;
    list-style: none;
    cursor: pointer;
    user-select: none;
    transition: opacity .18s ease;
}

.tcg-plp__nav-toggle::-webkit-details-marker {
    display: none;
}

.tcg-plp__nav-toggle::marker {
    content: "";
}

.tcg-plp .tcg-plp__nav-toggle:hover {
    opacity: .62;
}

.tcg-plp__nav-toggle:focus {
    outline: none;
}

.tcg-plp__nav-toggle:focus-visible {
    outline: 1px solid var(--tcg-ink);
    outline-offset: 4px;
}

.tcg-plp__nav-toggle svg {
    width: 10px;
    height: 6px;
    transition: transform .3s ease;
}

.tcg-plp__nav[open] .tcg-plp__nav-toggle svg {
    transform: rotate(180deg);
}

/* every category, grouped under its parent */
.tcg-plp__nav-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 30px 40px;
    max-width: 1000px;
    padding: 12px 0 40px;
}

.tcg-plp .tcg-plp__nav-head,
.tcg-plp .tcg-plp__nav-link {
    display: inline-block;
    border-bottom: 1px solid transparent;
    text-decoration: none;
    transition: color .18s ease, border-color .18s ease;
}

.tcg-plp .tcg-plp__nav-head {
    padding-bottom: 4px;
    color: var(--tcg-ink);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .13em;
    text-transform: uppercase;
}

.tcg-plp .tcg-plp__nav-group ul {
    margin: 13px 0 0;
    padding: 0;
    list-style: none;
}

.tcg-plp .tcg-plp__nav-group li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tcg-plp .tcg-plp__nav-group li + li {
    margin-top: 8px;
}

.tcg-plp .tcg-plp__nav-link {
    padding-bottom: 2px;
    color: var(--tcg-muted);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.3;
}

.tcg-plp .tcg-plp__nav-head:hover,
.tcg-plp .tcg-plp__nav-link:hover {
    color: var(--tcg-ink);
    border-bottom-color: var(--tcg-edge);
}

.tcg-plp .tcg-plp__nav-head.is-current,
.tcg-plp .tcg-plp__nav-link.is-current {
    color: var(--tcg-ink);
    border-bottom-color: var(--tcg-ink);
}

/* the list eases open where the browser can animate it */
@supports (interpolate-size: allow-keywords) {

    .tcg-plp__nav {
        interpolate-size: allow-keywords;
    }

    .tcg-plp__nav::details-content {
        block-size: 0;
        overflow: clip;
        opacity: 0;
        transition: block-size .4s cubic-bezier(.16, .8, .24, 1), opacity .3s ease, content-visibility .4s allow-discrete;
    }

    .tcg-plp__nav[open]::details-content {
        block-size: auto;
        opacity: 1;
    }
}

.tcg-plp__tools {
    position: absolute;
    top: 0;
    right: 2px;
    display: flex;
    align-items: center;
    gap: 30px;
    height: 50px;
}

.tcg-plp .tcg-plp__filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 14px 0;
    color: var(--tcg-ink);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .13em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
}

.tcg-plp .tcg-plp__filter-btn:hover {
    color: var(--tcg-ink);
    opacity: .62;
}

.tcg-plp__filter-btn svg {
    width: 17px;
    height: 17px;
}

.tcg-plp__filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--tcg-ink);
    color: #ffffff;
    font-size: 10px;
    letter-spacing: 0;
}

.tcg-plp__sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.tcg-plp .tcg-plp__sort label {
    margin: 0;
    color: var(--tcg-muted);
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .13em;
    text-transform: uppercase;
}

#tcg-plp .tcg-plp__sort select {
    width: auto;
    height: 32px;
    margin: 0;
    padding: 0 18px 0 0;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23111' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
    color: var(--tcg-ink);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .13em;
    text-transform: uppercase;
    box-shadow: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    field-sizing: content;
}

#tcg-plp .tcg-plp__sort select:focus {
    outline: none;
}

#tcg-plp .tcg-plp__sort select:focus-visible {
    outline: 1px solid var(--tcg-ink);
    outline-offset: 4px;
}


/* ---------------------------------------------------------
   ACTIVE FILTERS
--------------------------------------------------------- */

.tcg-plp__active {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 0 2px;
}

.tcg-plp .tcg-plp__tag {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 28px;
    padding: 0 9px 0 11px;
    border-radius: 4px;
    background: var(--tcg-tile);
    color: var(--tcg-ink);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .09em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background .18s ease;
}

.tcg-plp .tcg-plp__tag:hover {
    background: #dedad1;
    color: var(--tcg-ink);
}

.tcg-plp__tag-x {
    font-size: 15px;
    font-weight: 400;
    line-height: 1;
    opacity: .6;
}

.tcg-plp .tcg-plp__clear,
.tcg-plp .tcg-plp__empty-link {
    color: var(--tcg-muted);
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tcg-plp .tcg-plp__clear {
    margin-left: 10px;
}

.tcg-plp .tcg-plp__clear:hover,
.tcg-plp .tcg-plp__empty-link:hover {
    color: var(--tcg-ink);
}


/* ---------------------------------------------------------
   GRID
--------------------------------------------------------- */

.tcg-plp__grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 38px 6px;
    margin-top: 22px;
}

.tcg-plp__empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding: 72px 2px 40px;
}

.tcg-plp .tcg-plp__empty p {
    margin: 0;
    color: var(--tcg-ink);
    font-size: 15px;
}

.tcg-plp .tcg-plp__empty-link {
    color: var(--tcg-ink);
    font-size: 11.5px;
}


/* ---------------------------------------------------------
   PAGES
--------------------------------------------------------- */

.tcg-plp__pages {
    margin-top: 64px;
}

.tcg-plp .tcg-plp__pages ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 22px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tcg-plp .tcg-plp__pages li {
    margin: 0;
    padding: 0;
}

.tcg-plp .tcg-plp__pages .page-numbers {
    display: inline-block;
    padding: 8px 2px;
    border-bottom: 2px solid transparent;
    color: var(--tcg-muted);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .06em;
    text-decoration: none;
}

.tcg-plp .tcg-plp__pages a.page-numbers:hover {
    color: var(--tcg-ink);
}

.tcg-plp .tcg-plp__pages .page-numbers.current {
    border-bottom-color: var(--tcg-ink);
    color: var(--tcg-ink);
    font-weight: 900;
}


/* ---------------------------------------------------------
   FILTER PANEL — slides in from the right
--------------------------------------------------------- */

.tcg-filters {
    position: fixed;
    inset: 0;
    z-index: 1000001;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear .4s;
}

.tcg-filters.is-open,
.tcg-filters:target {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
}

.tcg-filters__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 17, 17, .42);
    opacity: 0;
    cursor: default;
    transition: opacity .32s ease;
}

.tcg-filters.is-open .tcg-filters__overlay,
.tcg-filters:target .tcg-filters__overlay {
    opacity: 1;
}

.tcg-filters .tcg-filters__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(430px, 100%);
    margin: 0;
    padding: 0;
    background: var(--tcg-paper);
    box-shadow: -24px 0 60px rgba(17, 17, 17, .14);
    transform: translateX(100%);
    transition: transform .4s cubic-bezier(.16, .8, .24, 1);
}

.tcg-filters.is-open .tcg-filters__panel,
.tcg-filters:target .tcg-filters__panel {
    transform: none;
}

.tcg-filters__head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 26px;
    border-bottom: 1px solid var(--tcg-line);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.tcg-filters .tcg-filters__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-right: -10px;
    color: var(--tcg-ink);
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
    text-decoration: none;
}

.tcg-filters .tcg-filters__close:hover {
    color: var(--tcg-ink);
    opacity: .55;
}

.tcg-filters__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 0 26px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.tcg-filters .tcg-filters__group {
    min-width: 0;
    margin: 0;
    padding: 24px 0 22px;
    border: 0;
    border-bottom: 1px solid var(--tcg-line);
}

.tcg-filters .tcg-filters__group:last-child {
    border-bottom: 0;
}

.tcg-filters .tcg-filters__group legend {
    float: left;
    width: 100%;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    color: var(--tcg-ink);
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.tcg-filters__group legend + * {
    clear: both;
}

/* the real inputs stay in the page (keyboard, form submit) but are not drawn */
.tcg-filters .tcg-filters__box input,
.tcg-filters .tcg-filters__row input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
    pointer-events: none;
}

.tcg-filters__boxes {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.tcg-filters .tcg-filters__box {
    position: relative;
    display: block;
    margin: 0;
    cursor: pointer;
}

.tcg-filters__box span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 4px;
    border: 1px solid var(--tcg-edge);
    border-radius: 8px;
    background: #ffffff;
    color: var(--tcg-ink);
    font-size: 11.5px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .02em;
    text-transform: uppercase;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.tcg-filters__box:hover span {
    border-color: var(--tcg-ink);
}

.tcg-filters__box input:checked + span {
    border-color: var(--tcg-ink);
    background: var(--tcg-ink);
    color: #ffffff;
}

.tcg-filters__box input:focus-visible + span,
.tcg-filters__row input:focus-visible ~ .tcg-filters__name {
    outline: 1px solid var(--tcg-ink);
    outline-offset: 3px;
}

.tcg-filters__rows {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 26px;
}

.tcg-filters__rows--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.tcg-filters .tcg-filters__row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 8px 0;
    color: var(--tcg-ink);
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.3;
    cursor: pointer;
}

.tcg-filters__name {
    flex: 1 1 auto;
    min-width: 0;
}

.tcg-filters__row input:checked ~ .tcg-filters__name {
    font-weight: 700;
}

.tcg-filters__num {
    flex: none;
    color: var(--tcg-muted);
    font-size: 11.5px;
    font-variant-numeric: tabular-nums;
}

.tcg-filters__check {
    flex: none;
    width: 17px;
    height: 17px;
    border: 1px solid #b4b1a9;
    border-radius: 3px;
    background: #ffffff center / 11px 9px no-repeat;
    transition: background-color .16s ease, border-color .16s ease;
}

.tcg-filters__row:hover .tcg-filters__check {
    border-color: var(--tcg-ink);
}

.tcg-filters__row input:checked ~ .tcg-filters__check {
    border-color: var(--tcg-ink);
    background-color: var(--tcg-ink);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='9' viewBox='0 0 11 9'%3E%3Cpath d='M1 4.5l3 3 6-6.5' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E");
}

.tcg-filters__check--radio {
    border-radius: 50%;
}

.tcg-filters__row input:checked ~ .tcg-filters__check--radio {
    background-color: #ffffff;
    background-image: radial-gradient(circle, #111111 0 4px, transparent 4.6px);
    background-size: 100% 100%;
}

.tcg-filters__swatch {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(17, 17, 17, .18);
    transition: box-shadow .16s ease;
}

.tcg-filters__row input:checked ~ .tcg-filters__swatch {
    box-shadow: inset 0 0 0 1px rgba(17, 17, 17, .18), 0 0 0 2px var(--tcg-paper), 0 0 0 3px var(--tcg-ink);
}

.tcg-filters__foot {
    display: flex;
    flex: none;
    align-items: center;
    gap: 22px;
    padding: 16px 26px calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--tcg-line);
    background: var(--tcg-paper);
}

.tcg-filters .tcg-filters__reset {
    flex: none;
    color: var(--tcg-ink);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.tcg-filters .tcg-filters__reset:hover {
    color: var(--tcg-ink);
    opacity: .6;
}

#tcg-filters .tcg-filters__apply {
    flex: 1 1 auto;
    height: 52px;
    margin: 0;
    padding: 0 18px;
    border: 1px solid var(--tcg-ink);
    border-radius: 8px;
    background: var(--tcg-ink);
    color: #ffffff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .14em;
    text-transform: uppercase;
    box-shadow: none;
    cursor: pointer;
    transition: background .18s ease;
}

#tcg-filters .tcg-filters__apply:hover {
    background: #2b2a27;
    color: #ffffff;
}

/* page behind the open panel does not scroll */
html.tcg-filters-lock,
html.tcg-filters-lock body {
    overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {

    .tcg-filters,
    .tcg-filters__overlay,
    .tcg-filters .tcg-filters__panel {
        transition: none;
    }
}


/* ---------------------------------------------------------
   TABLET / MOBILE
--------------------------------------------------------- */

@media (max-width: 1024px) {

    .tcg-plp {
        padding-top: 76px;
    }

    .tcg-plp__head {
        padding-top: 22px;
    }

    /* two rows: categories, then filter and sort */
    .tcg-plp__bar {
        margin-top: 20px;
        padding: 0;
    }

    .tcg-plp .tcg-plp__nav {
        border-bottom: 1px solid var(--tcg-line);
    }

    .tcg-plp .tcg-plp__nav-toggle {
        display: flex;
        justify-content: space-between;
        height: 48px;
        padding: 0 2px;
    }

    .tcg-plp__nav-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 26px 20px;
        padding: 8px 2px 30px;
    }

    /* "All products" has no list under it: give it its own row */
    .tcg-plp__nav-group:first-child {
        grid-column: 1 / -1;
    }

    .tcg-plp__tools {
        position: static;
        justify-content: space-between;
        gap: 16px;
        height: 48px;
        padding: 0 2px;
    }

    .tcg-plp__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 6px;
        margin-top: 18px;
    }

    .tcg-filters__head,
    .tcg-filters__body,
    .tcg-filters__foot {
        padding-right: 20px;
        padding-left: 20px;
    }
}


/* ---------------------------------------------------------
   TOUCH — phones and tablets
   Text links keep the size they are drawn at and get an
   area a fingertip can hit (a transparent ::after reaching
   past the text); the small controls grow to 40px.
--------------------------------------------------------- */

@media (max-width: 1024px) {

    .tcg-plp .tcg-plp__crumbs a,
    .tcg-plp .tcg-plp__nav-head,
    .tcg-plp .tcg-plp__nav-link {
        position: relative;
    }

    .tcg-plp .tcg-plp__crumbs a::after {
        content: "";
        position: absolute;
        inset: -14px -8px;
    }

    .tcg-plp .tcg-plp__nav-head::after,
    .tcg-plp .tcg-plp__nav-link::after {
        content: "";
        position: absolute;
        inset: -8px -10px;
    }

    /* the list of categories: rows far enough apart for a thumb */
    .tcg-plp .tcg-plp__nav-group ul {
        margin-top: 18px;
    }

    .tcg-plp .tcg-plp__nav-group li + li {
        margin-top: 16px;
    }

    .tcg-plp .tcg-plp__nav-link {
        font-size: 14.5px;
    }

    .tcg-plp .tcg-plp__pages .page-numbers {
        min-width: 40px;
        padding: 13px 6px;
        text-align: center;
    }

    #tcg-plp .tcg-plp__sort select {
        height: 40px;
    }
}
