/* ============================================================
   3D Product Carousel — Frontend Styles
   Version: 2.1.0
   ============================================================ */

/* ── Variables ─────────────────────────────────────────── */
.p3dc {
    --accent:       #1b4332;
    --glow:         rgba(180, 230, 200, .5);
    --bg:           #ffffff;
    --transition:   0.7s cubic-bezier(0.34, 1.4, 0.4, 1);
    --trans-fast:   0.1s ease;
    --font-title:   'Syne', 'Inter', sans-serif;
    --font-body:    'Inter', 'Segoe UI', sans-serif;
}

.p3dc *, .p3dc *::before, .p3dc *::after {
    font-family: var(--font-body);
    box-sizing: border-box;
}

/* ── Sección principal ─────────────────────────────────── */
.p3dc {
    width: 100%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 56px 0 48px;
    position: relative;
    overflow: hidden;
    font-family: var(--font-body);
    transition: background var(--transition);
}

/* Modo pantalla completa */
.p3dc--fullscreen {
    min-height: 100vh;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
}

/* Gradiente de fondo animado */
.p3dc::before {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 80vw;
    max-width: 900px;
    height: 50vh;
    background: radial-gradient(ellipse at center, var(--glow) 0%, transparent 70%);
    pointer-events: none;
    transition: background 0.6s ease;
    border-radius: 50%;
    z-index: 0;
}

/* ── Encabezado ────────────────────────────────────────── */
.p3dc-head {
    text-align: center;
    padding: 0 clamp(24px, 5vw, 80px);
    margin-bottom: 28px;
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 100%;
}

.p3dc-eyebrow {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: var(--body-case, none);
    color: var(--accent);
    margin: 0 0 10px;
    transition: color 0.4s ease;
}

.p3dc-title {
    font-family: var(--font-title) !important;
    font-size: clamp(1.6rem, 4.5vw, var(--title-size, 3.5rem));
    font-weight: 600;
    color: var(--accent);
    line-height: 1.1;
    letter-spacing: -1px;
    text-transform: var(--title-case, uppercase);
    margin: 0 0 14px;
    word-break: break-word;
    overflow-wrap: break-word;
    transition: color 0.4s ease;
}

.p3dc-title b,
.p3dc-title strong {
    font-weight: 900;
}

.p3dc-sub {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.6vw, var(--body-size, 0.98rem));
    text-transform: var(--body-case, none);
    color: #6b7280;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Tabs ──────────────────────────────────────────────── */
.p3dc-tabs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-bottom: 0;
    flex-wrap: wrap;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}

.p3dc-tab {
    padding: 8px 20px;
    border-radius: 40px;
    border: 1.5px solid #e5e7eb;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    color: #6b7280;
    transition: all 0.22s ease;
    user-select: none;
    -webkit-user-select: none;
}

.p3dc-tab:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.p3dc-tab.p3dc-tab--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.p3dc-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.25);
    width: 19px;
    height: 19px;
    border-radius: 50%;
    font-size: 0.68rem;
    font-weight: 700;
    margin-left: 6px;
}

.p3dc-tab:not(.p3dc-tab--active) .p3dc-tab-count {
    background: #f3f4f6;
    color: #9ca3af;
}

/* ── Stage ─────────────────────────────────────────────── */
.p3dc-stage {
    position: relative;
    width: 100%;
    height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 20px 0;
    z-index: 2;
}

/* ── Flechas ────────────────────────────────────────────── */
.p3dc-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    background: #fff;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.22s ease;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.p3dc-arrow:hover {
    background: var(--accent);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.2);
}

.p3dc-arrow--l { left: 10px; }
.p3dc-arrow--r { right: 10px; }

/* ── Slider ─────────────────────────────────────────────── */
.p3dc-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* NO flex centering — los items se posicionan explicitamente en JS */
}

/* ── Item ───────────────────────────────────────────────── */
/* IMPORTANTE: left:50% y top:50% se ponen via JS inline style
   para garantizar centrado independiente del tema de WordPress */
.p3dc-item {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* transform se establece desde JS: translate(calc(-50% + Xpx), -50%) scale(S) */
    transition:
        transform var(--transition),
        opacity   var(--transition),
        filter    var(--transition);
    will-change: transform, opacity, filter;
    user-select: none;
    -webkit-user-select: none;
}

/* Visibility control for the new DOM structure */
.p3dc-item-center { display: none; }
.p3dc-item.center .p3dc-item-center { display: flex; flex-direction: column; align-items: center; }
.p3dc-item-logo { display: block; }
.p3dc-item.center .p3dc-item-logo { display: none; }

/* ══════════════════════════════════════════════════════════
   PRODUCTO CENTRAL — EFECTO 3D CON MOUSE
══════════════════════════════════════════════════════════ */

/* Escena: contiene sombra + producto */
.p3dc-prod-scene {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Sombra flotante — capa parallax independiente */
.p3dc-prod-shadow {
    position: absolute;
    bottom: var(--shadow-y, -16px);
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 36px;
    background: radial-gradient(ellipse at center,
        color-mix(in srgb, var(--shadow-color, #000) calc(var(--shadow-op, 0.28) * 100%), transparent) 0%,
        transparent 72%);
    border-radius: 50%;
    filter: blur(var(--shadow-blur, 16px));
    opacity: 0.22;
    pointer-events: none;
    will-change: transform, filter, opacity;
    z-index: 0;
}

.p3dc-item.center .p3dc-prod-shadow { opacity: 1; }

/* Wrap con perspectiva para el efecto 3D */
.p3dc-prod-wrap {
    position: relative;
    perspective: 1000px;
    cursor: pointer;
    z-index: 1;
}

/* Contenedor que recibe el transform 3D */
.p3dc-prod-inner {
    position: relative;
    width: clamp(180px, 20vw, 300px);
    /* SIN height fija — la imagen dicta la altura, elimina el margen blanco */
    transform-style: preserve-3d;
    will-change: transform;
    background: transparent !important;
}

/* Imagen del producto — altura automática, sin caja blanca */
.p3dc-prod-img {
    width: 100%;
    height: auto !important;         /* altura natural de la imagen */
    max-height: clamp(240px, 32vw, 420px);
    object-fit: contain;
    display: block;
    background: transparent !important;
    /* Sombra via JS (drop-shadow dinámico) */
    filter: drop-shadow(0 24px 48px rgba(0,0,0,.20));
    pointer-events: none;
}

/* Soporte para modelo 3D GLB y Video */
.p3dc-prod-glb,
.p3dc-prod-video {
    width: 100%;
    height: clamp(240px, 32vw, 420px);
    background: transparent !important;
    outline: none;
    --poster-color: transparent;
    object-fit: contain;
    filter: drop-shadow(0 24px 48px rgba(0,0,0,.20));
}
.p3dc-prod-video {
    pointer-events: none;
}

    pointer-events: none;
}

/* ── Brillo especular (Removido para evitar caja rectangular en PNGs transparentes) ── */

/* Flotación suave cuando no hay interacción */
.p3dc-item.center:not(.p3dc--interacting) .p3dc-prod-inner {
    animation: p3dcFloat 4s ease-in-out infinite;
}
.p3dc-item.center.p3dc--interacting .p3dc-prod-inner {
    animation: none;
}

@keyframes p3dcFloat {
    0%, 100% { transform: rotateY(0deg) rotateX(0deg) translateY(0px); }
    25%       { transform: rotateY(4deg) rotateX(-1.5deg) translateY(-8px); }
    50%       { transform: rotateY(0deg) rotateX(0deg) translateY(-14px); }
    75%       { transform: rotateY(-4deg) rotateX(1.5deg) translateY(-8px); }
}

/* Nombre del producto */
.p3dc-prod-name {
    font-family: var(--font-body);
    font-size: clamp(0.72rem, 1.1vw, 0.85rem);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: var(--body-case, none);
    color: var(--accent);
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity 0.35s ease 0.15s,
        transform 0.35s ease 0.15s,
        color 0.4s ease;
    padding: 6px 18px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    margin-top: 14px;
    white-space: nowrap;
    position: relative;
    z-index: 2;
}

.p3dc-item.center .p3dc-prod-name {
    opacity: 1;
    transform: translateY(0);
}

/* ── Logo lateral ───────────────────────────────────────── */
.p3dc-logo {
    width: clamp(80px, 10vw, 140px);
    height: clamp(80px, 10vw, 140px);
    aspect-ratio: 1/1;
    border-radius: 50%;
    border: 1.5px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    cursor: pointer;
    transition: all 0.22s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.p3dc-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 255, 255, 0.55) 0%,
        transparent 56%);
    pointer-events: none;
}

.p3dc-logo img,
.p3dc-logo svg {
    width: 78%;
    height: 78%;
    object-fit: contain;
    filter: grayscale(1) opacity(.4);
    transition: filter 0.22s;
    pointer-events: none;
    background: transparent !important;
}

.p3dc-item:not(.center):hover .p3dc-logo {
    border-color: var(--accent);
    background: #f0f4ff;
    transform: scale(1.07);
}

.p3dc-item:not(.center):hover .p3dc-logo img,
.p3dc-item:not(.center):hover .p3dc-logo svg {
    filter: grayscale(0.3) opacity(0.78);
}

/* ── Dots de paginación ──────────────────────────────────── */
.p3dc-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 10px 0;
    position: relative;
    z-index: 2;
}

.p3dc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #d1d5db;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s ease;
    outline: none;
}

.p3dc-dot.p3dc-dot--active {
    background: var(--accent);
    width: 22px;
    border-radius: 3.5px;
}

/* ── CTAs ─────────────────────────────────────────────────── */
.p3dc-ctas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 24px;
    margin-top: 24px;
    position: relative;
    z-index: 2;
}

.p3dc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 32px;
    border-radius: 40px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s ease;
    border: 2px solid var(--accent);
    line-height: 1;
}

.p3dc-btn--solid {
    background: var(--accent);
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}

.p3dc-btn--solid:hover {
    background: transparent;
    color: var(--accent) !important;
    transform: translateY(-2px);
}

.p3dc-btn--ghost {
    background: transparent;
    color: var(--accent) !important;
}

.p3dc-btn--ghost:hover {
    background: var(--accent);
    color: #fff !important;
    transform: translateY(-2px);
}

/* Vacío */
.p3dc-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 0.9rem;
    font-family: var(--font-body);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
    .p3dc-stage { height: 420px; }
}

@media (max-width: 768px) {
    .p3dc-stage { height: 360px; }
    .p3dc-prod-inner { width: 170px; }
    .p3dc-prod-img { max-height: 240px; }
    .p3dc-logo { width: 78px; padding: 14px; }
    .p3dc-arrow { width: 42px; height: 42px; }
    .p3dc-arrow--l { left: 8px; }
    .p3dc-arrow--r { right: 8px; }
}

@media (max-width: 480px) {
    .p3dc { padding: 40px 0 36px; }
    .p3dc-stage { height: 300px; }
    .p3dc-prod-inner { width: 145px; }
    .p3dc-prod-img { max-height: 200px; }
    .p3dc-logo { width: 62px; padding: 10px; }
    .p3dc-title { font-size: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    .p3dc-item.center .p3dc-prod-inner { animation: none !important; }
    .p3dc-item { transition-duration: 0.01ms !important; }
}
