/**
 * ZD Carrusel con Selector for Creative Elements - front styles
 */
.zdtc {
    position: relative;
    --zdtc-per: 4;
    --zdtc-gap: 16px;
    --zdtc-media-h: 240px;
    --zdtc-card-bg: #f4f4f2;
    --zdtc-card-radius: 6px;
    --zdtc-tab-fg: #444;
    --zdtc-tab-bg: #fff;
    --zdtc-tab-bd: #d9d9d9;
    --zdtc-tab-fg-on: #fff;
    --zdtc-tab-bg-on: #1f4032;
    --zdtc-tab-radius: 6px;
}

/* ---- header ---- */
.zdtc-head {
    text-align: center;
}

.zdtc-heading {
    margin: 0 0 6px;
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 800;
    line-height: 1.15;
    color: #111;
}

.zdtc-subheading {
    margin: 0;
    font-size: 1rem;
    line-height: 1.55;
    color: #6b6b6b;
}

/* ============================================================
   Tab selector
   ============================================================ */

.zdtc-tabs {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 18px 0 22px;
}

.zdtc-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--zdtc-tab-bd);
    border-radius: var(--zdtc-tab-radius);
    background-color: var(--zdtc-tab-bg);
    color: var(--zdtc-tab-fg);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    overflow: hidden;
    transition: color 0.35s ease, background-color 0.35s ease,
        border-color 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.35s ease;
}

.zdtc-tab:hover {
    transform: translateY(-2px);
}

.zdtc-tab.is-active {
    background-color: var(--zdtc-tab-bg-on);
    border-color: var(--zdtc-tab-bg-on);
    color: var(--zdtc-tab-fg-on);
}

.zdtc-tab-badge {
    font-weight: 800;
    letter-spacing: 0.02em;
}

.zdtc-tab-badge + .zdtc-tab-label::before {
    content: '·';
    margin-right: 8px;
    opacity: 0.55;
}

.zdtc-tab-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 0 !important;
}

/* ---- 2. segmented: one rail, the active cell is filled ---- */
.zdtc-tabs-segmented .zdtc-tabs {
    gap: 0;
    padding: 4px;
    border: 1px solid var(--zdtc-tab-bd);
    border-radius: 999px;
    background-color: var(--zdtc-tab-bg);
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.zdtc-tabs-segmented .zdtc-tab {
    border: 0;
    border-radius: 999px;
    background-color: transparent;
}

.zdtc-tabs-segmented .zdtc-tab:hover {
    transform: none;
    color: var(--zdtc-tab-bg-on);
}

.zdtc-tabs-segmented .zdtc-tab.is-active {
    background-color: var(--zdtc-tab-bg-on);
}

/* ---- 3. underline ---- */
.zdtc-tabs-underline .zdtc-tab {
    padding-left: 4px;
    padding-right: 4px;
    margin: 0 10px;
    border: 0;
    border-radius: 0;
    background-color: transparent;
    overflow: visible;
}

.zdtc-tabs-underline .zdtc-tab::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 2px;
    background-color: var(--zdtc-tab-bg-on);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-tabs-underline .zdtc-tab:hover::after,
.zdtc-tabs-underline .zdtc-tab.is-active::after {
    transform: scaleX(1);
}

.zdtc-tabs-underline .zdtc-tab.is-active {
    background-color: transparent;
    color: var(--zdtc-tab-bg-on);
}

.zdtc-tabs-underline .zdtc-tab:hover {
    transform: none;
}

/* ---- 4. cards with an icon ---- */
.zdtc-tabs-cards .zdtc-tab {
    flex-direction: row;
    gap: 10px;
    padding: 12px 18px;
    border-radius: var(--zdtc-tab-radius);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.zdtc-tabs-cards .zdtc-tab-icon {
    width: 30px;
    height: 30px;
}

.zdtc-tabs-cards .zdtc-tab.is-active {
    box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.5);
}

/* ---- 5. minimal with a dot ---- */
.zdtc-tabs-minimal .zdtc-tab {
    border: 0;
    background-color: transparent;
    padding: 8px 10px;
    overflow: visible;
}

.zdtc-tabs-minimal .zdtc-tab::before {
    content: '';
    width: 6px;
    height: 6px;
    margin-right: 2px;
    border-radius: 50%;
    background-color: currentColor;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-tabs-minimal .zdtc-tab.is-active::before {
    opacity: 1;
    transform: scale(1);
}

.zdtc-tabs-minimal .zdtc-tab.is-active {
    background-color: transparent;
    color: var(--zdtc-tab-bg-on);
}

/* ---- 6. solid: the colour sweeps in ---- */
.zdtc-tabs-solid .zdtc-tab::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    background-color: var(--zdtc-tab-bg-on);
    transform: translateY(101%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-tabs-solid .zdtc-tab:hover::before,
.zdtc-tabs-solid .zdtc-tab.is-active::before {
    transform: translateY(0);
}

.zdtc-tabs-solid .zdtc-tab > * {
    position: relative;
    z-index: 1;
}

.zdtc-tabs-solid .zdtc-tab:hover {
    color: var(--zdtc-tab-fg-on);
    transform: none;
}

/* ============================================================
   Carousel
   ============================================================ */

.zdtc-viewport {
    position: relative;
    overflow: hidden;
}

.zdtc-track {
    display: flex;
    gap: var(--zdtc-gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding-bottom: 2px;
}

.zdtc-track::-webkit-scrollbar {
    display: none;
}

.zdtc-card {
    position: relative;
    flex: 0 0 calc((100% - (var(--zdtc-per) - 1) * var(--zdtc-gap)) / var(--zdtc-per));
    min-width: 0;
    scroll-snap-align: start;
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* a card belonging to another tab is taken out of the flow entirely */
.zdtc-card[hidden] {
    display: none;
}

.zdtc-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.zdtc-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.zdtc-card-media {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--zdtc-media-h);
    border-radius: var(--zdtc-card-radius);
    background-color: var(--zdtc-card-bg);
    overflow: hidden;
}

.zdtc-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0 !important;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-card-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    padding: 5px 10px;
    border-radius: 999px;
    background-color: #fff;
    color: #111;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.25);
}

.zdtc-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 6px 0;
    text-align: center;
}

.zdtc-card-title {
    position: relative;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: #111;
}

.zdtc-card-sub {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #777;
}

.zdtc-price {
    font-weight: 700;
    color: #111;
}

.zdtc-price-old {
    opacity: 0.65;
    text-decoration: line-through;
}

/* ---- card hover ---- */
.zdtc-hover-lift .zdtc-card:hover {
    transform: translateY(-6px);
}

.zdtc-hover-lift .zdtc-card:hover .zdtc-card-media {
    box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.45);
}

.zdtc-hover-zoom .zdtc-card:hover .zdtc-card-media img {
    transform: scale(1.07);
}

.zdtc-hover-sheen .zdtc-card-media::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    background-image: linear-gradient(
        115deg,
        transparent 32%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 64%
    );
    transform: translateX(-120%);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-hover-sheen .zdtc-card:hover .zdtc-card-media::after {
    transform: translateX(120%);
}

.zdtc-hover-underline .zdtc-card-title::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 1px;
    background-color: currentColor;
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.zdtc-hover-underline .zdtc-card:hover .zdtc-card-title::after {
    transform: scaleX(1);
}

/* ---- arrows ---- */
.zdtc-arrow {
    position: absolute;
    top: calc(var(--zdtc-media-h) / 2);
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    background-color: #fff;
    color: #111;
    cursor: pointer;
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.4);
    transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.zdtc-arrow:hover {
    background-color: #111;
    color: #fff;
}

.zdtc-arrow[disabled] {
    opacity: 0;
    pointer-events: none;
}

.zdtc-prev { left: -14px; }
.zdtc-next { right: -14px; }

.zdtc-prev svg { transform: scaleX(-1); }

/* ---- dots ---- */
.zdtc-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.zdtc-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.3s ease;
}

.zdtc-dot.is-active {
    width: 26px;
    background-color: var(--zdtc-tab-bg-on);
}

/* ============================================================
   Tab switch animation
   ============================================================ */

[class*="zdtc-switch-"] .zdtc-card.is-in {
    animation-duration: 560ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
    animation-fill-mode: both;
    animation-delay: calc(var(--zdtc-i, 0) * 70ms);
}

.zdtc-switch-up .zdtc-card.is-in { animation-name: zdtc-in-up; }
.zdtc-switch-fade .zdtc-card.is-in { animation-name: zdtc-in-fade; }
.zdtc-switch-zoom .zdtc-card.is-in { animation-name: zdtc-in-zoom; }
.zdtc-switch-slide .zdtc-card.is-in { animation-name: zdtc-in-slide; }

@keyframes zdtc-in-up {
    from { opacity: 0; transform: translate3d(0, 26px, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes zdtc-in-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zdtc-in-zoom {
    from { opacity: 0; transform: scale(0.93); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes zdtc-in-slide {
    from { opacity: 0; transform: translate3d(40px, 0, 0); }
    to { opacity: 1; transform: translate3d(0, 0, 0); }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
    .zdtc {
        --zdtc-per: 3;
    }
}

@media (max-width: 767px) {
    .zdtc {
        --zdtc-per: 1.25;
        --zdtc-media-h: 230px;
    }

    .zdtc-tabs {
        /* a single scrollable row keeps every tab reachable on a phone */
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scrollbar-width: none;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    .zdtc-tabs::-webkit-scrollbar {
        display: none;
    }

    .zdtc-tab {
        flex: 0 0 auto;
    }

    .zdtc-tabs-segmented .zdtc-tabs {
        width: auto;
    }

    /* the arrows would sit on top of the cards on a narrow screen */
    .zdtc-arrow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .zdtc-card,
    .zdtc-card-media img,
    .zdtc-tab,
    .zdtc-tab::before,
    .zdtc-tab::after,
    .zdtc-card-media::after {
        transition-duration: 0.01ms !important;
        animation: none !important;
    }

    .zdtc-track {
        scroll-behavior: auto;
    }
}
