/* TitanCart for Elementor — layout + category cards.
 * Product cards themselves are styled by core titancart.css; this file only
 * lays them out and adds the category card styles. Colours default to core's
 * --tc-* tokens so a store's palette carries over; Elementor controls override. */

.tce {
    --tce-cols: 4;
    --tce-gap: 24px;
    --tce-link: var(--tc-accent, #2563eb);
    --tce-ratio: 1 / 1;
    --tce-overlay: rgba(0, 0, 0, .45);
    --tce-ph-bg: var(--tc-accent, #2563eb);
    width: 100%;
}

/* ── Section header ── */
.tce-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tce-title { margin: 0; }
.tce-head__right { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.tce-viewall {
    color: var(--tce-link);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}
.tce-viewall:hover { text-decoration: underline; }
.tce-arrows { display: flex; gap: 8px; }
.tce-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid currentColor;
    background: transparent;
    color: var(--tce-link);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: opacity .15s ease;
}
.tce-arrow[disabled] { opacity: .3; cursor: default; }

/* ── Grid ── */
.tce-track {
    display: grid;
    gap: var(--tce-gap);
    grid-template-columns: repeat(var(--tce-cols), minmax(0, 1fr));
}
.tce-item { min-width: 0; }
.tce-item > .product-card { height: 100%; }

/* ── Carousel (CSS scroll-snap; arrows in carousel.js) ── */
.tce--carousel .tce-track {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--tce-cols) - 1) * var(--tce-gap)) / var(--tce-cols));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.tce--carousel .tce-track::-webkit-scrollbar { display: none; }
.tce--carousel .tce-item { scroll-snap-align: start; }

/* ── Product card tweaks off the shop page ── */
/* Quick view's handler lives in core shop.js (shop app only) — dead here. */
.tce--products .tc-quickview-btn { display: none !important; }
.tce-hide-brand .product-card__brand,
.tce-hide-swatches .product-card__swatches,
.tce-hide-ribbons .tc-ribbons,
.tce-hide-icons .product-hover-actions { display: none !important; }

/* ── Category cards ── */
.tce-cat {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    position: relative;
    transition: background-color .15s ease, box-shadow .15s ease;
}
.tce-cat__media {
    display: block;
    position: relative;
    overflow: hidden;
    aspect-ratio: var(--tce-ratio);
    background: var(--tce-ph-bg);
}
.tce-cat__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.tce--zoom .tce-cat:hover .tce-cat__media img { transform: scale(1.06); }
.tce-cat__ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: .02em;
}
.tce-cat__body { display: flex; flex-direction: column; gap: 2px; padding: 12px 4px 0; }
.tce-cat__name { font-weight: 600; line-height: 1.3; color: var(--tc-text, #0a0a0a); }
.tce-cat__count { font-size: .85em; color: var(--tc-muted, #737373); }

/* Image tile — name over the image */
.tce-cat--tile { border-radius: 12px; }
.tce-cat--tile .tce-cat__body {
    position: absolute;
    inset: auto 0 0 0;
    padding: 40px 16px 14px;
    background: linear-gradient(to top, var(--tce-overlay), transparent);
    z-index: 1;
}
.tce-cat--tile .tce-cat__name,
.tce-cat--tile .tce-cat__count { color: #fff; }

/* Image + caption */
.tce-cat--caption .tce-cat__media { border-radius: 12px; }

/* Circle */
.tce-cat--circle { align-items: center; text-align: center; }
.tce-cat--circle .tce-cat__media {
    width: 100%;
    max-width: 180px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
}
.tce-cat--circle .tce-cat__body { align-items: center; }

/* Text pill */
.tce-cat--pill {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid var(--tc-border, #e5e5e5);
    border-radius: 999px;
}
.tce-cat--pill .tce-cat__body { padding: 0; flex-direction: row; align-items: baseline; gap: 8px; }
.tce-cat--pill:hover { border-color: var(--tce-link); }

/* ── Testimonials (V4 widget: titancart-testimonials) ──
 * Columns come from a class, not an inline value, so tablets and phones step
 * down on their own: 1 on phones, at most 2 on tablets, the chosen number above.
 * Everything visual is a --tcet-* variable so a theme can restyle it in one rule. */
.tce--testimonials {
    --tce-cols: 1;
    --tcet-bg: var(--tc-bg-subtle, #fafafa);
    --tcet-border: var(--tc-border, #e5e5e5);
    --tcet-radius: var(--tc-radius-lg, 12px);
    --tcet-pad: 24px;
    --tcet-text: var(--tc-text, #0a0a0a);
    --tcet-muted: var(--tc-text-muted, #737373);
    --tcet-star: #f59e0b;
    --tcet-star-off: #d4d4d4;
}
@media (min-width: 641px) {
    .tce--testimonials.tcet-cols-2,
    .tce--testimonials.tcet-cols-3,
    .tce--testimonials.tcet-cols-4 { --tce-cols: 2; }
}
@media (min-width: 1025px) {
    .tce--testimonials.tcet-cols-3 { --tce-cols: 3; }
    .tce--testimonials.tcet-cols-4 { --tce-cols: 4; }
}
.tce--testimonials .tce-head { justify-content: flex-end; margin-bottom: 14px; }
.tce--testimonials .tce-arrow { color: var(--tcet-text); }

.tce-testi {
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    margin: 0;
    padding: var(--tcet-pad);
    background: var(--tcet-bg);
    border: 1px solid var(--tcet-border);
    border-radius: var(--tcet-radius);
    color: var(--tcet-text);
    box-sizing: border-box;
}
.tce-testi__stars { display: flex; gap: 2px; font-size: 16px; line-height: 1; }
.tce-testi__star { color: var(--tcet-star-off); }
.tce-testi__star.is-on { color: var(--tcet-star); }
.tce-testi__quote { margin: 0; padding: 0; border: 0; background: none; font-style: normal; flex: 1 1 auto; }
.tce-testi__quote::before,
.tce-testi__quote::after { content: none; }
.tce-testi__title { margin: 0 0 6px; font-weight: 600; line-height: 1.35; }
.tce-testi__text { margin: 0; line-height: 1.6; overflow-wrap: anywhere; }
.tce-testi__author { display: flex; align-items: center; gap: 10px; margin: 0; }
.tce-testi__avatar {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--tcet-text);
    background: var(--tcet-border);
}
.tce-testi__name { font-weight: 600; font-size: .95em; }

/* ── V4 widgets: responsive columns from a class ──
 * Phones show at most 2, tablets at most 3, desktop the chosen number
 * (posts: phones 1, tablets 2). No inline values, so nothing to keep in sync. */
.tce-v4 { --tce-cols: 2; }
.tce-v4.tce-cols-1 { --tce-cols: 1; }
.tce-v4.tce--posts { --tce-cols: 1; }
@media (min-width: 641px) {
    .tce-v4.tce-cols-3,
    .tce-v4.tce-cols-4,
    .tce-v4.tce-cols-5,
    .tce-v4.tce-cols-6 { --tce-cols: 3; }
    .tce-v4.tce--posts { --tce-cols: 2; }
    .tce-v4.tce--posts.tce-cols-1 { --tce-cols: 1; }
}
@media (min-width: 1025px) {
    .tce-v4.tce-cols-4 { --tce-cols: 4; }
    .tce-v4.tce-cols-5 { --tce-cols: 5; }
    .tce-v4.tce-cols-6 { --tce-cols: 6; }
    .tce-v4.tce--posts.tce-cols-3 { --tce-cols: 3; }
    .tce-v4.tce--posts.tce-cols-4 { --tce-cols: 4; }
}
.tce-v4 > .tce-head { justify-content: flex-end; margin-bottom: 14px; }

/* ── Category tabs ── */
.tce-tabs__list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 28px;
    margin: 0 0 24px;
}
.tce-tabs__tab {
    appearance: none;
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 6px 2px;
    font: inherit;
    font-size: 1.15em;
    color: var(--tc-text-muted, #737373);
    cursor: pointer;
}
.tce-tabs__tab:hover { color: var(--tc-text, #0a0a0a); }
.tce-tabs__tab.is-active { color: var(--tc-text, #0a0a0a); border-bottom-color: currentColor; }
.tce-tabs__panel[hidden] { display: none; }
.tce-tabs__more { margin: 20px 0 0; text-align: center; }

/* ── Categories: plain link list ── */
.tce-catlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tce-catlist__link { color: inherit; text-decoration: none; }
.tce-catlist__link:hover { text-decoration: underline; }

/* ── Categories: list with hover image ── */
.tce-hover {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: var(--tce-gap);
    align-items: stretch;
}
.tce-hover__list {
    list-style: none;
    margin: 0;
    padding: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    background: var(--tc-bg-subtle, #fafafa);
}
.tce-hover__link {
    font-size: 1.5em;
    line-height: 1.25;
    text-decoration: none;
    color: var(--tc-text-muted, #737373);
    transition: color .15s ease;
}
.tce-hover__link:hover,
.tce-hover__link:focus-visible,
.tce-hover__link.is-active { color: var(--tc-text, #0a0a0a); }
.tce-hover__media { position: relative; min-height: 360px; overflow: hidden; background: var(--tce-ph-bg); }
.tce-hover__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity .3s ease;
}
.tce-hover__img.is-active { opacity: 1; }
.tce-hover__ph { display: flex; align-items: center; justify-content: center; font-size: 4rem; font-weight: 700; color: #fff; }
@media (max-width: 640px) {
    .tce-hover { grid-template-columns: 1fr; }
    .tce-hover__media { min-height: 220px; order: -1; }
    .tce-hover__list { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    .tce-hover__img,
    .tce-hover__link { transition: none; }
}

/* ── Latest posts ── */
.tce-post { display: flex; flex-direction: column; height: 100%; }
.tce-post__media { display: block; overflow: hidden; aspect-ratio: 16 / 10; background: var(--tc-bg-subtle, #fafafa); }
.tce-post__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tce-post__body { display: flex; flex-direction: column; gap: 6px; padding-top: 14px; }
.tce-post__date { font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--tc-text-muted, #737373); }
.tce-post__title { margin: 0; font-size: 1.15em; line-height: 1.3; }
.tce-post__title a { color: inherit; text-decoration: none; }
.tce-post__title a:hover { text-decoration: underline; }
.tce-post__excerpt { margin: 0; color: var(--tc-text-muted, #737373); line-height: 1.55; }

/* ── Editor-only empty state ── */
.tce-empty {
    padding: 18px 20px;
    border: 1px dashed #c3c4c7;
    border-radius: 8px;
    color: #50575e;
    background: #f6f7f7;
    font-size: 13px;
}
