/**
 * Stacked Cards Carousel with Text Widget Styles
 * Pretpot Elementor Kit
 */

/* ── Widget Container ───────────────────────────────────────────────────────── */
.pretpot-stacked-cards-carousel {
    position: relative;
    width: 100%;
    min-height: 500px;
    overflow: hidden;
}

/* ── Text Content Area ──────────────────────────────────────────────────────── */
.pretpot-scc-text-content {
    position: relative;
    z-index: 1;
    max-width: 100%;
    text-align: center;
    padding: 40px 20px;
}

.pretpot-scc-text-content .scc-heading {
    margin: 0 0 20px 0;
    font-size: clamp(1.5rem, 4vw, 3rem);
    line-height: 1.2;
    font-weight: 600;
}

.pretpot-scc-text-content .scc-subheading {
    margin: 0;
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.5;
    opacity: 0.9;
}

/* ── Stack Container – positionable via CSS variables ───────────────────────── */
.pretpot-scc-stack-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.pretpot-scc-stack-container {
    position: absolute;
    left: calc(50% + var(--scc-stack-x, 0px));
    top: calc(50% + var(--scc-stack-y, -50px));
    transform: translate(-50%, -50%);
    width: var(--scc-card-width, 200px);
    height: var(--scc-card-height, 280px);
    pointer-events: auto;
}

/* ── Individual Stack Cards ─────────────────────────────────────────────────── */
.pretpot-scc-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--scc-card-radius, 12px);
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    background: #1a1a1a;
    opacity: 0;
    pointer-events: auto;
    cursor: pointer;
    transform: translateY(60px) scale(0.9);
    /* Promote to its own compositor layer for smooth animation */
    will-change: transform, opacity;
}

/* Media covers the card completely.
   !important on height/max-width/max-height overrides the
   `img { height: auto; max-width: 100% }` reset that WordPress
   core and most themes inject globally. Without it, images collapse
   to "height: auto" on mobile and object-fit: cover has no effect.
   Videos are unaffected by that reset — which is why videos covered
   correctly but images didn't. */
.pretpot-scc-card img,
.pretpot-scc-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    display: block;
}

/* ── Stacked positions – Back to Front ──────────────────────────────────────── */
.pretpot-scc-card:nth-child(1) {
    z-index: 1;
    --scc-rot: -1deg;
    --scc-ty: -20px;
    --scc-tx: -2px;
    --scc-delay: 0ms;
}
.pretpot-scc-card:nth-child(2) {
    z-index: 2;
    --scc-rot: 2deg;
    --scc-ty: -15px;
    --scc-tx: 3px;
    --scc-delay: 150ms;
}
.pretpot-scc-card:nth-child(3) {
    z-index: 3;
    --scc-rot: -2deg;
    --scc-ty: -10px;
    --scc-tx: -2px;
    --scc-delay: 300ms;
}
.pretpot-scc-card:nth-child(4) {
    z-index: 4;
    --scc-rot: 1deg;
    --scc-ty: -5px;
    --scc-tx: 2px;
    --scc-delay: 450ms;
}
.pretpot-scc-card:nth-child(5) {
    z-index: 5;
    --scc-rot: -1deg;
    --scc-ty: 0px;
    --scc-tx: 0px;
    --scc-delay: 600ms;
}

/* ── Entrance animation ─────────────────────────────────────────────────────── */
@keyframes sccStackEntrance {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform:
            translateY(var(--scc-ty))
            translateX(var(--scc-tx))
            rotate(var(--scc-rot))
            scale(1);
    }
}

/* ── Fade-out animation ─────────────────────────────────────────────────────── */
@keyframes sccStackFadeOut {
    0% {
        opacity: 1;
        transform:
            translateY(var(--scc-ty))
            translateX(var(--scc-tx))
            rotate(var(--scc-rot));
    }
    100% {
        opacity: 0;
        transform:
            translateY(var(--scc-ty))
            translateX(var(--scc-tx))
            rotate(var(--scc-rot))
            translateY(-30px);
    }
}

.pretpot-scc-card.scc-entrance {
    animation: sccStackEntrance 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: var(--scc-delay);
}

.pretpot-scc-card.scc-fadeout {
    animation: sccStackFadeOut 0.5s ease forwards;
}

/* ── Carousel Section ───────────────────────────────────────────────────────── */
.pretpot-scc-carousel-section {
    width: 100%;
    padding: 20px 0;
    margin-top: var(--scc-carousel-gap, 20px);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    position: relative;
    overflow: hidden;
}

.pretpot-scc-carousel-section.scc-visible {
    opacity: 1;
    transform: translateY(0);
}

.pretpot-scc-carousel-wrapper {
    width: 100%;
    overflow: hidden;
    position: relative;
    /* Hide scrollbar */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.pretpot-scc-carousel-wrapper::-webkit-scrollbar {
    display: none;
}

.pretpot-scc-carousel-track {
    display: flex;
    gap: 15px;
    width: max-content;
    animation: sccScrollLeft 25s linear infinite;
    /* GPU-accelerated scrolling – critical for mobile smoothness */
    will-change: transform;
}

.pretpot-scc-carousel-track.scc-reverse {
    animation: sccScrollRight 25s linear infinite;
}

@keyframes sccScrollLeft {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes sccScrollRight {
    0%   { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

/* ── Carousel Cards ─────────────────────────────────────────────────────────── */
.pretpot-scc-carousel-card {
    position: relative;          /* needed for absolute media children */
    flex-shrink: 0;
    width: var(--scc-carousel-card-width, 150px);
    height: var(--scc-carousel-card-height, 200px);
    border-radius: var(--scc-card-radius, 10px);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    background: #1a1a1a;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.pretpot-scc-carousel-card:hover {
    transform: scale(1.05);
}

/* Media fully covers each carousel card — same !important reasoning as stack cards above */
.pretpot-scc-carousel-card img,
.pretpot-scc-carousel-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover;
    display: block;
}

/* ── Video thumbnail (when carousel autoplay is off) ────────────────────────── */
.pretpot-scc-video-thumb {
    position: absolute;
    inset: 0;
    background: #111 center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pretpot-scc-play-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #111;
    padding-left: 3px; /* optical centering of ▶ */
    pointer-events: none;
}

/* ── Pause on hover ─────────────────────────────────────────────────────────── */
.pretpot-scc-carousel-wrapper:hover .pretpot-scc-carousel-track {
    animation-play-state: paused;
}

/* ── Lightbox ───────────────────────────────────────────────────────────────── */
.pretpot-scc-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.pretpot-scc-lightbox.scc-active {
    opacity: 1;
    visibility: visible;
}

.pretpot-scc-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.pretpot-scc-lightbox-content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.pretpot-scc-lightbox.scc-active .pretpot-scc-lightbox-content {
    transform: scale(1);
}

.pretpot-scc-lightbox-media {
    max-width: 600px;
    max-height: 50vh;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

.pretpot-scc-lightbox-media img,
.pretpot-scc-lightbox-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 50vh;
    display: block;
}

.pretpot-scc-lightbox-info {
    text-align: center;
    color: #fff;
    max-width: 500px;
    padding: 0 20px;
}

.pretpot-scc-lightbox-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.pretpot-scc-lightbox-description {
    font-size: 1rem;
    opacity: 0.85;
    line-height: 1.5;
    margin-bottom: 20px;
}

.pretpot-scc-lightbox-button {
    display: inline-block;
    padding: 12px 30px;
    background: #fff;
    color: #000;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 500;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pretpot-scc-lightbox-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 255, 255, 0.2);
}

.pretpot-scc-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    z-index: 3;
}

.pretpot-scc-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .pretpot-stacked-cards-carousel {
        min-height: 400px;
    }

    .pretpot-scc-text-content {
        padding: 30px 15px;
    }

    .pretpot-scc-stack-container {
        width: var(--scc-card-width-mobile, 160px);
        height: var(--scc-card-height-mobile, 220px);
    }

    .pretpot-scc-carousel-card {
        width: var(--scc-carousel-card-width-mobile, 120px);
        height: var(--scc-carousel-card-height-mobile, 160px);
    }

    .pretpot-scc-carousel-section {
        margin-top: var(--scc-carousel-gap-mobile, 15px);
    }
}

@media (min-width: 768px) and (max-width: 1024px) {
    .pretpot-scc-stack-container {
        width: var(--scc-card-width-tablet, 180px);
        height: var(--scc-card-height-tablet, 250px);
    }
}