/**
 * Listing cards — cover first (visual system 2026-09, S5c W2)
 *
 * One anatomy for the three card markups the site renders:
 *   1. WooCommerce loop  — ul.products li.product (shop, search, related)
 *   2. Tickera browser   — .tc-single-event (home "Todos los eventos", SSR + AJAX)
 *   3. Event card        — .tev-card (destacados rail, empty-cart suggestions, sold-out "próximos")
 *
 * Cover 1:1 (object-fit: contain, radius 8) · date gold 14/600 · title Inter 18/600
 * two lines · venue muted 14 · price muted 14 LAST. No surface, no border, no
 * button — the whole card is the link. Phones: one-column feed (owner's pick,
 * 2026-08-29); ≥600px 2 columns, ≥900px 3, ≥1200px 4. Sold out: AGOTADO badge
 * bottom-left of the cover (container units) + muted text.
 *
 * @package TicketSystemTango
 */

/* ── Layouts ── */
.woocommerce ul.products,
.woocommerce-page ul.products,
.tc-display-filter-events,
.tev-card-grid {
    display: grid !important; /* keep: vendor — Storefront floats li.product, Tickera's sheet sets the wrap */
    grid-template-columns: 1fr;
    gap: var(--ts-space-8) var(--ts-space-6);
    margin: 0;
    padding: 0;
    list-style: none;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after {
    content: none !important; /* keep: vendor — Storefront's clearfix pseudo-elements would occupy grid cells */
    display: none !important;
}

.tc-display-filter-events {
    margin-top: var(--ts-space-4);
}

@media (min-width: 600px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .tc-display-filter-events,
    .tev-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .tc-display-filter-events,
    .tev-card-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .tc-display-filter-events,
    .tev-card-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ── Card boxes: bare, on the page ground ── */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
.tc-single-event,
.tev-card {
    position: relative;
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: auto !important;   /* keep: vendor — Storefront/Tickera column widths */
    max-width: none !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    float: none !important;
    clear: none !important;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    transition: none;
    transform: none;
}

.woocommerce ul.products li.product:hover,
.tc-single-event:hover,
.tev-card:hover {
    transform: none;
    box-shadow: none;
    background: transparent;
    border-color: transparent;
}

/* The link that wraps the whole WooCommerce card */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link {
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none !important; /* keep: theme — entry-content underlines links */
}

.woocommerce ul.products li.product a.woocommerce-LoopProduct-link:hover {
    opacity: 1;
}

/* ── Cover 1:1 ── */
.woocommerce ul.products li.product a.woocommerce-LoopProduct-link > img,
.tc-single-event .tc-get-featured-image,
.tev-card__cover {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    margin: 0;
    border-radius: var(--ts-radius);
    background: var(--ts-surface-2);
    overflow: hidden;
    object-fit: contain;
    object-position: center top;
}

.tc-single-event .tc-get-featured-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.tc-single-event .tc-get-featured-image img,
.tev-card__cover img {
    display: block;
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    object-position: center top;
    filter: none;
    transform: none;
    transition: transform var(--ts-transition-slow) var(--ts-ease-out);
}

.woocommerce ul.products li.product:hover a.woocommerce-LoopProduct-link > img,
.tc-single-event:hover .tc-get-featured-image img,
.tev-card:hover .tev-card__cover img {
    transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
    .woocommerce ul.products li.product:hover a.woocommerce-LoopProduct-link > img,
    .tc-single-event:hover .tc-get-featured-image img,
    .tev-card:hover .tev-card__cover img {
        transform: none;
    }
}

/* ── Body: date · title · venue · price ── */
.woocommerce ul.products li.product .product-content-wrapper,
.tc-single-event .tc-event-content-wrap,
.tev-card__body {
    display: flex;
    flex-direction: column;
    gap: var(--ts-space-1);
    flex: 1 1 auto;
    height: auto;
    margin: 0;
    padding: var(--ts-space-3) 0 0;
    min-width: 0;
    text-align: left; /* Storefront centres li.product */
}

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
    text-align: left;
}

/* Tickera keeps date/price/location inside .tc-event-date-wrap; let them join
   the body's flex order (date first, price last). */
.tc-single-event .tc-event-date-wrap {
    display: contents;
}

.tc-single-event .tc-event-date {
    display: none !important; /* keep: vendor — raw "28/08/2026 20:00" line; tev-card-when replaces it */
}

.tc-single-event .tc-event-excerpt,
.tc-single-event .tc-excerpt-wrap,
.tc-single-event .tev-category-tags {
    display: none;
}

/* Order inside the Tickera card */
.tc-single-event .tev-card-when { order: 1; }
.tc-single-event h4,
.tc-single-event .tc-event-title { order: 2; }
.tc-single-event .tc-event-location { order: 3; }
.tc-single-event .tev-card-price { order: 4; }

/* Date */
.woocommerce ul.products li.product .ts-meta-when,
.tc-single-event .tev-card-when,
.tev-card__when {
    display: block;
    color: var(--ts-gold);
    font-family: var(--font-body);
    font-size: var(--ts-fs-sm);
    font-weight: var(--ts-fw-semibold);
    line-height: var(--ts-lh-normal);
}

.tc-single-event .tev-card-when::before {
    content: none;
}

/* Title */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.tc-single-event h4,
.tc-single-event .tc-event-title,
.tev-card__title {
    display: var(--ts-card-title-display, -webkit-box);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--ts-card-title-lines, 2);
    line-clamp: var(--ts-card-title-lines, 2);
    overflow: var(--ts-card-text-overflow, hidden);
    overflow-wrap: var(--ts-card-wrap, normal);
    margin: 0;
    padding: 0;
    color: var(--ts-on-surface);
    font-family: var(--font-body);
    font-size: var(--ts-fs-lg);
    font-weight: var(--ts-fw-semibold);
    line-height: 1.3;
    letter-spacing: 0;
    text-wrap: pretty;
}

.tc-single-event h4 a,
.tc-single-event .tc-event-title a,
.tev-card__title a {
    color: inherit;
    text-decoration: none !important; /* keep: theme — entry-content underlines links */
}

.tc-single-event h4 a:hover,
.tev-card__title a:hover {
    color: var(--ts-gold);
    opacity: 1;
}

/* The title anchor stretches over the .tev-card: one link, one tab stop */
.tev-card__title a::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
}

.tev-card:focus-within {
    outline: none;
}

.tev-card:has(.tev-card__title a:focus-visible) .tev-card__cover {
    box-shadow: var(--ts-focus-ring);
}

/* Venue */
.woocommerce ul.products li.product .ts-meta-venue,
.tc-single-event .tc-event-location,
.tev-card__venue {
    display: block;
    color: var(--ts-on-surface-muted);
    font-family: var(--font-body);
    font-size: var(--ts-fs-sm);
    font-weight: var(--ts-fw-regular);
    line-height: var(--ts-lh-normal);
    white-space: var(--ts-card-venue-wrap, nowrap);
    overflow-wrap: var(--ts-card-wrap, normal);
    overflow: var(--ts-card-text-overflow, hidden);
    text-overflow: var(--ts-card-text-ellipsis, ellipsis);
}

.tc-single-event .tc-event-location {
    width: auto;
    float: none;
    gap: 0;
}

.tc-single-event .tc-event-location svg,
.tc-single-event .tc-event-location::before {
    display: none;
}

.tc-single-event .tc-event-location span {
    color: inherit;
    font-size: inherit;
    white-space: var(--ts-card-venue-wrap, nowrap);
    overflow-wrap: var(--ts-card-wrap, normal);
    overflow: var(--ts-card-text-overflow, hidden);
    text-overflow: var(--ts-card-text-ellipsis, ellipsis);
}

.woocommerce ul.products li.product .ts-event-metadata {
    display: contents;
}

/* Price — the quiet last line */
.woocommerce ul.products li.product .ts-loop-price,
.tc-single-event .tev-card-price,
.tev-card__price {
    display: block;
    margin: 0;
    color: var(--ts-mediumgrey-text) !important; /* keep: vendor — WooCommerce paints .price */
    font-family: var(--font-body);
    font-size: var(--ts-fs-sm);
    font-weight: var(--ts-fw-regular);
    line-height: var(--ts-lh-normal);
    white-space: nowrap;
}

.woocommerce ul.products li.product .ts-loop-price .woocommerce-Price-amount,
.woocommerce ul.products li.product .ts-loop-price bdi,
.tc-single-event .tev-card-price .woocommerce-Price-amount,
.tc-single-event .tev-card-price bdi,
.tev-card__price .woocommerce-Price-amount,
.tev-card__price bdi {
    color: inherit !important; /* keep: vendor — WooCommerce paints the amount */
    font-size: inherit;
    font-weight: inherit;
}

/* ── Badges on the cover: bottom-left, measured from the card's own width
   (the cover is a square as wide as the card) ── */
.ts-card__badge,
.tac-sold-out-banner,
.tev-card__badge {
    position: absolute;
    left: var(--ts-space-3);
    top: calc(100cqw - var(--ts-space-3));
    transform: translateY(-100%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    width: auto;
    padding: 4px 8px;
    border-radius: var(--ts-radius-xs);
    background: var(--ts-danger-surface);
    color: #ffffff;
    font-family: var(--font-body);
    font-size: var(--ts-fs-xs);
    font-weight: var(--ts-fw-bold);
    letter-spacing: var(--ts-ls-caps);
    line-height: 1.3;
    text-transform: uppercase;
    text-align: left;
    box-shadow: none;
    pointer-events: none;
}

.tev-card__badge--featured {
    top: var(--ts-space-3);
    transform: none;
    background: rgba(198, 166, 100, 0.92);
    color: var(--ts-black);
}

/* Sold out: the cover dims, text goes muted */
.woocommerce ul.products li.product.outofstock .woocommerce-loop-product__title,
.woocommerce ul.products li.product.outofstock .ts-meta-when,
.tc-single-event:has(.tac-sold-out-banner) h4,
.tc-single-event:has(.tac-sold-out-banner) .tev-card-when,
.tev-card.is-sold-out .tev-card__title,
.tev-card.is-sold-out .tev-card__when {
    color: var(--ts-on-surface-muted);
}

.woocommerce ul.products li.product.outofstock a.woocommerce-LoopProduct-link > img,
.tc-single-event:has(.tac-sold-out-banner) .tc-get-featured-image img,
.tev-card.is-sold-out .tev-card__cover img {
    opacity: 0.75;
}

/* Leftovers of the old anatomy that vendor/legacy markup may still print */
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .ts-view-tickets-button,
.woocommerce ul.products li.product .onsale,
.tc-single-event .tev-card-footer,
.tc-single-event .tc-event-cta,
.tc-single-event .tc-view-event {
    display: none !important; /* keep: vendor — WooCommerce/Tickera print these unconditionally */
}

/* ── Destacados rail: full-width covers on phones, four up on desktop ── */
.tev-destacados__track .tev-card {
    flex: 0 0 calc(100% - 48px);
    min-width: 0;
    scroll-snap-align: start;
}

@media (min-width: 600px) {
    .tev-destacados__track .tev-card {
        flex-basis: calc((100% - var(--ts-space-6)) / 2);
    }
}

@media (min-width: 900px) {
    .tev-destacados__track .tev-card {
        flex-basis: calc((100% - 2 * var(--ts-space-6)) / 3);
    }
}

@media (min-width: 1200px) {
    .tev-destacados__track .tev-card {
        flex-basis: calc((100% - 3 * var(--ts-space-6)) / 4);
    }
}

/* ── Home browser: the "Ver todos los eventos" button under the feed ── */
.ts-event-browser__all {
    display: flex;
    justify-content: center;
    margin: var(--ts-space-8) 0 0;
}

@media (max-width: 767px) {
    .ts-event-browser__all .ts-btn {
        width: 100%;
    }
}

/* Read/update feedback stays separate from the currently usable event cards. */
.tc-event-listing-container .tc-listing-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--ts-space-3);
    margin: var(--ts-space-4) 0;
    color: var(--ts-on-surface-muted);
    font-size: var(--ts-fs-sm);
    line-height: var(--ts-lh-normal);
}

.tc-event-listing-container .tc-listing-status.is-error {
    padding: var(--ts-space-4);
    border: 1px solid var(--ts-border-color);
    border-radius: var(--ts-radius);
    background: var(--ts-surface-1);
    color: var(--ts-on-surface);
}

.tc-event-listing-container .tc-listing-retry {
    min-height: var(--ts-tap);
    white-space: normal;
}

.tc-event-listing-container .tc-listing-retry[hidden] {
    display: none;
}

/* ── Shop header row: WooCommerce's result count + sort select ── */
.woocommerce .woocommerce-result-count {
    margin: 0;
    color: var(--ts-on-surface-muted);
    font-size: var(--ts-fs-sm);
}

/* ── Related products on the product page keep the same cards, three up ── */
.related ul.products,
.up-sells ul.products,
.cross-sells ul.products {
    display: grid !important; /* keep: theme — ui-overhaul set flex on these */
    justify-content: stretch;
}

.related ul.products li.product,
.up-sells ul.products li.product,
.cross-sells ul.products li.product {
    max-width: none;
}

/* V2V-134: preserve the complete venue/address on sold-out alternatives. */
@media (max-width: 767px) {
    .tev-soldout__grid .tev-card__venue {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: anywhere;
    }
}


/* Responsive card tokens preserve the existing vendor-cascade selectors. */
@media (max-width: 767px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .tc-single-event,
    .tev-card {
        --ts-card-title-display: block;
        --ts-card-title-lines: none;
        --ts-card-text-overflow: visible;
        --ts-card-text-ellipsis: clip;
        --ts-card-venue-wrap: normal;
        --ts-card-wrap: anywhere;
    }
}


/* Desktop cards retain full event names and venues, as the phone feed does. */
@media (min-width: 1024px) {
    .woocommerce ul.products,
    .woocommerce-page ul.products,
    .tc-single-event,
    .tev-card {
        --ts-card-title-display: block;
        --ts-card-title-lines: none;
        --ts-card-text-overflow: visible;
        --ts-card-text-ellipsis: clip;
        --ts-card-venue-wrap: normal;
        --ts-card-wrap: anywhere;
    }

    /* One or two featured events use the rail width without oversized posters. */
    .tev-destacados__track:not(:has(> :nth-child(3))) .tev-card {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
        align-items: start;
        gap: var(--ts-space-5);
        flex-basis: calc((100% - var(--ts-space-6)) / 2);
    }

    .tev-destacados__track:not(:has(> :nth-child(3))) .tev-card__body {
        padding-top: 0;
    }

    .tev-destacados__track:not(:has(> :nth-child(3))) .tev-card__cover {
        position: relative;
        container-type: inline-size;
    }
}

.ts-search-recovery {
    max-width: 640px;
    margin: 24px 0 48px;
}
.ts-search-recovery label { display: block; margin-bottom: 8px; }
.ts-search-recovery__fields { display: flex; flex-wrap: wrap; gap: 12px; }
.ts-search-recovery input[type="search"] { flex: 1 1 220px; min-width: 0; min-height: 44px; }
/* Storefront's input[type="search"]:focus (0,2,1) paints #ededed under the theme's
   #E0E0E0 text (1.1:1); keep the theme's dark focus fill instead. */
.ts-search-recovery input[type="search"]:focus {
    background-color: var(--ts-surface-8);
    color: var(--ts-lightgrey);
}
.ts-search-recovery > a { display: inline-flex; align-items: center; min-height: 44px; margin-right: 20px; }
/* MOE-6-045: the same field refines a search that has results, above sort and count. */
.ts-search-refine { margin: 0 0 var(--ts-space-6, 24px); }
/* From 1280px the header shows its own search pill with the query; one field is enough. */
@media (min-width: 1280px) {
    .ts-search-refine { display: none; }
}

.tev-catalogue-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
    width: 100%;
    margin: 0 0 24px;
}
.tev-catalogue-filters label { flex: 1 1 220px; min-width: 0; }
.tev-catalogue-filters select { display: block; width: 100%; min-height: 44px; margin-top: 8px; }
/* Same dark control as the sort select: WebKit paints appearance:auto menulists light
   regardless of background (round-9 check of MOE-6-293; see theme-core G-3-003). */
.tev-catalogue-filters select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    background-color: var(--ts-surface-2);
    color: var(--ts-lightgrey);
    border: 1px solid var(--ts-border-color);
    border-radius: var(--ts-radius-sm);
    padding: 10px 36px 10px 14px;
    font-size: 1rem;
}
/* The border shorthand above resets theme-core's select:focus gold bottom border
   (the only cue left after its outline:none): restore it plus a keyboard ring. */
.tev-catalogue-filters select:focus {
    border-bottom-color: var(--ts-gold);
}
.tev-catalogue-filters select:focus-visible {
    outline: 2px solid var(--ts-gold);
    outline-offset: 2px;
}
.tev-catalogue-filters > a { display: inline-flex; align-items: center; min-height: 44px; }
