/* ================================================
   Carousel 3D Widget
   ================================================ */

.c3d-section {
    --c3d-card-width:  260px;
    --c3d-card-height: 462px;
    --c3d-card-radius: 24px;
    --c3d-scale-1:     0.82;
    --c3d-scale-2:     0.66;
    --c3d-rotateY:     18deg;
    --c3d-z:          -120px;
    --c3d-transition:  0.48s cubic-bezier(0.4, 0, 0.2, 1);

    position: relative;
    width: 100%;
    padding: 48px 0 56px;
    box-sizing: border-box;
    background-color: #e8e8e8;
    touch-action: pan-y;

    /* Clip solo en X para que las tarjetas laterales
       se vean pero no creen scroll horizontal */
    overflow-x: clip;
    overflow-y: visible;
}

/* ── Etiqueta superior ── */
.c3d-label {
    text-align: center;
    letter-spacing: 0.18em;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #666;
    margin: 0 0 28px;
}

/* ══════════════════════════════════════════════
   STAGE — contiene todas las tarjetas apiladas
   ══════════════════════════════════════════════ */
.c3d-stage {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    perspective: 1200px;
    perspective-origin: 50% 40%;
    /* overflow visible para el efecto 3D lateral */
    overflow: visible;
}

/*
   ELEMENTO FANTASMA — establece la altura del stage.
   Tiene el mismo ancho y aspect-ratio que la tarjeta central,
   pero es invisible. Así el stage ocupa el espacio correcto
   aunque los slides sean position:absolute.
*/
.c3d-stage-sizer {
    display: block;
    width: var(--c3d-card-width);
    height: var(--c3d-card-height);
    visibility: hidden;
    pointer-events: none;
    flex-shrink: 0;
}

/* ── Slide wrapper ── */
.c3d-slide {
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--c3d-card-width);
    height: var(--c3d-card-height);
    cursor: pointer;
    will-change: transform, opacity;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;

    /* ESTADO BASE DE SEGURIDAD (sin JS):
       Todas las tarjetas parten centradas y ocultas detrás
       del activo. El JS las reposiciona en cuanto carga.
       Esto evita que una tarjeta se vea a tamaño completo
       sin transform si el script tarda en ejecutar. */
    transform: translateX(-50%) scale(0.6);
    opacity: 0;
    z-index: 0;
}

/* La primera tarjeta (is-active) sí se muestra centrada
   incluso antes de que el JS calcule las posiciones 3D */
.c3d-slide.is-active {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    z-index: 10;
}

/* Transición suave solo al soltar (JS agrega .c3d-snap) */
.c3d-slide.c3d-snap {
    transition:
        transform var(--c3d-transition),
        opacity   var(--c3d-transition);
}

/* ── Tarjeta visual ── */
.c3d-card {
    width: 100%;
    height: 100%;
    border-radius: var(--c3d-card-radius);
    overflow: hidden;
    position: relative;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

/* ── Media ── */
.c3d-media {
    position: relative;
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    overflow: hidden;
}

.c3d-media img {
    width: 100%;
    height: 100%;
    /* object-fit y object-position son editables desde
       Elementor (Estilo > General > Ajuste de imagen).
       Estos son solo los valores por defecto. */
    object-fit: cover;
    object-position: center center;
    display: block;
    pointer-events: none;
    transition: transform 0.4s ease;
}

.c3d-slide.is-active .c3d-media img {
    transform: scale(1.03);
}

/* ── Botón Play ── */
.c3d-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 2;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.c3d-play-btn:hover  { transform: translate(-50%,-50%) scale(1.1); background: #fff; }
.c3d-play-btn:active { transform: translate(-50%,-50%) scale(0.95); }
.c3d-play-btn svg    { fill: #1a1a1a; margin-left: 3px; }

/* ── Overlay de video ── */
.c3d-video-overlay {
    position: absolute;
    inset: 0;
    background: #000;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--c3d-card-radius);
    overflow: hidden;
}

.c3d-video-iframe,
.c3d-video-player {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

/* ── Botón cerrar ── */
.c3d-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    transition: background 0.2s;
}
.c3d-close-btn:hover { background: rgba(0,0,0,0.85); }
.c3d-close-btn svg   { fill: #fff; }

/* ── Títulos ── */
.c3d-titles {
    display: flex;
    justify-content: center;
    margin-top: 28px;
    padding: 0 20px;
    position: relative;
    min-height: 60px;
}

.c3d-slide-title {
    position: absolute;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    max-width: 360px;
    color: #888;
    margin: 0;
    transition: opacity 0.4s ease, color 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
}
.c3d-slide-title.is-active {
    color: #1a1a1a;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Flechas ── */
.c3d-arrows {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}
.c3d-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,0.2);
    background: rgba(255,255,255,0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.c3d-arrow:hover  { background: #fff; border-color: rgba(0,0,0,0.4); transform: scale(1.05); }
.c3d-arrow:active { transform: scale(0.95); }
.c3d-arrow svg    { fill: #333; }

/* ================================================
   RESPONSIVE — solo perspectiva 3D (rotateY, z, scale).
   El ancho/alto/radio de la tarjeta los controla Elementor
   de forma nativa via los 'selectors' de cada control
   responsive en widget.php — NO se tocan aquí para evitar
   que estos breakpoints fijos (900px/540px) entren en
   conflicto con los breakpoints configurables de Elementor
   (que por defecto son ~1024px / ~767px).
   ================================================ */
@media (max-width: 900px) {
    .c3d-section {
        --c3d-rotateY: 14deg;
        --c3d-z:      -80px;
        --c3d-scale-1: 0.78;
        --c3d-scale-2: 0.60;
    }
}

@media (max-width: 540px) {
    .c3d-section {
        --c3d-rotateY: 10deg;
        --c3d-z:      -60px;
        --c3d-scale-1: 0.74;
        --c3d-scale-2: 0.54;
        padding: 36px 0 44px;
    }
    .c3d-label         { font-size: 10px; margin-bottom: 20px; }
    .c3d-slide-title   { font-size: 15px; max-width: 85vw; }
    .c3d-play-btn      { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
    .c3d-slide,
    .c3d-slide-title,
    .c3d-media img { transition: none !important; }
}
