/* Portada · sección "Explora en 3D" (inc/home-3d.php) */

.h3d {
    --h3d-rojo: #d90014;
    --h3d-fondo: #ffffff;
    --h3d-negro: #111111;
    --h3d-panel: #f1f1f1;
    --h3d-texto: #111111;
    --h3d-suave: rgba(17, 17, 17, .6);
    --h3d-borde: rgba(17, 17, 17, .10);
    position: relative;
    overflow: hidden;
    background: var(--h3d-fondo);
    color: var(--h3d-texto);
    padding: clamp(48px, 7vw, 104px) 16px clamp(56px, 7vw, 112px);
    isolation: isolate;
}

/* ---------- fondo ---------- */
.h3d-fondo { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.h3d-glow {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 1;
}
.h3d-glow-1 { width: 56vw; height: 56vw; max-width: 820px; max-height: 820px; left: 50%; top: -18%; transform: translateX(-50%);
    background: radial-gradient(circle, rgba(217, 0, 20, .16) 0%, rgba(217, 0, 20, 0) 65%); }
.h3d-glow-2 { width: 40vw; height: 40vw; max-width: 600px; max-height: 600px; right: -10%; bottom: -30%;
    background: radial-gradient(circle, rgba(17, 17, 17, .06) 0%, rgba(17, 17, 17, 0) 70%); }
.h3d-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(17, 17, 17, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, .05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 70%);
            mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 70%);
}

.h3d-inner { max-width: 1320px; margin: 0 auto; }

/* ---------- encabezado ---------- */
.h3d-head { text-align: center; max-width: 820px; margin: 0 auto clamp(32px, 5vw, 64px); }
.h3d-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    margin: 0 0 18px; padding: 7px 16px;
    border: 1px solid var(--h3d-borde); border-radius: 999px;
    background: #fff;
    font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--h3d-suave);
}
.h3d-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--h3d-rojo); box-shadow: 0 0 0 0 rgba(217, 0, 20, .7); animation: h3d-pulso 2s infinite; }
@keyframes h3d-pulso { 0% { box-shadow: 0 0 0 0 rgba(217, 0, 20, .7); } 70% { box-shadow: 0 0 0 10px rgba(217, 0, 20, 0); } 100% { box-shadow: 0 0 0 0 rgba(217, 0, 20, 0); } }

.h3d-title {
    margin: 0; color: var(--h3d-negro);
    font-size: clamp(34px, 5.6vw, 76px); line-height: 1.02; font-weight: 800; letter-spacing: -.03em;
}
.h3d-title { display: flex; flex-wrap: wrap; justify-content: center; column-gap: .26em; }
.h3d-w { display: block; overflow: hidden; padding-bottom: .06em; line-height: 1.04; }
.h3d-wi { display: inline-block; line-height: 1.04; }
.h3d-acento { color: var(--h3d-rojo); position: relative; }
.h3d-sub { margin: 20px auto 0; max-width: 560px; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.55; color: var(--h3d-suave); }

/* ---------- tarjetas ---------- */
.h3d-cards {
    display: flex; flex-wrap: wrap; justify-content: center; gap: clamp(16px, 2vw, 28px);
    perspective: 1400px;
}
.h3d-card { flex: 1 1 0; min-width: 210px; max-width: 320px; }
/* más de 5 productos: pasan a filas de 4 */
.h3d-cards[data-total="6"] .h3d-card, .h3d-cards[data-total="7"] .h3d-card, .h3d-cards[data-total="8"] .h3d-card { flex: 0 1 calc(25% - 21px); }
@media (min-width: 768px) and (max-width: 1199px) {
    .h3d-card { flex: 0 1 calc(33.333% - 19px); }
}
.h3d-card-in {
    height: 100%;
    display: flex; flex-direction: column;
    border-radius: 20px;
    background: #fafafa;
    border: 1px solid var(--h3d-borde);
    padding: 10px;
    transform-style: preserve-3d;
    transition: border-color .3s, box-shadow .3s;
    will-change: transform;
}
.h3d-card:hover .h3d-card-in,
.h3d-card.is-activa .h3d-card-in { border-color: rgba(217, 0, 20, .55); box-shadow: 0 30px 60px -24px rgba(217, 0, 20, .30); }

.h3d-media {
    position: relative; display: block; overflow: hidden;
    aspect-ratio: 1 / 1; border-radius: 14px;
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, var(--h3d-panel) 75%);
}
.h3d-foto {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain; padding: 6%;
    transition: opacity .6s ease, transform .9s cubic-bezier(.2, .8, .2, 1);
}
.h3d-visor { position: absolute; inset: 0; opacity: 0; transition: opacity .6s ease; }
.h3d-visor model-viewer { width: 100%; height: 100%; --poster-color: transparent; background: transparent; }

/* estado 3D activo: la foto se va, entra el modelo */
.h3d-card.is-3d .h3d-foto { opacity: 0; transform: scale(.88) rotate(-4deg); }
.h3d-card.is-3d .h3d-visor { opacity: 1; }
.h3d-card.h3d-sin-foto .h3d-visor { opacity: 1; }

/* cargando */
.h3d-cargando { position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px 0 0 -21px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.h3d-cargando i { display: block; width: 100%; height: 100%; border-radius: 50%; border: 3px solid rgba(0, 0, 0, .1); border-top-color: var(--h3d-rojo); animation: h3d-giro .8s linear infinite; }
.h3d-card.is-cargando .h3d-cargando { opacity: 1; }
@keyframes h3d-giro { to { transform: rotate(360deg); } }

.h3d-badge {
    position: absolute; top: 12px; left: 12px; z-index: 2;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px; border-radius: 999px;
    background: var(--h3d-negro); color: #fff;
    font-size: 12px; font-weight: 800; letter-spacing: .06em;
}
.h3d-badge i { color: var(--h3d-rojo); font-size: 14px; }
.h3d-hint {
    position: absolute; left: 50%; bottom: 12px; z-index: 2; transform: translateX(-50%);
    white-space: nowrap; padding: 6px 12px; border-radius: 999px;
    background: rgba(11, 11, 13, .78); color: #fff; font-size: 12px;
    transition: opacity .3s, transform .3s;
}
.h3d-card.is-3d .h3d-hint, .h3d-card.h3d-sin-foto .h3d-hint { opacity: 0; transform: translate(-50%, 8px); }

.h3d-body { padding: 16px 8px 8px; display: flex; flex-direction: column; flex: 1; }
.h3d-nombre { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 700; color: var(--h3d-negro); }
.h3d-nombre a { color: inherit; text-decoration: none; }
.h3d-codigo { margin: 6px 0 0; font-size: 13px; color: var(--h3d-suave); letter-spacing: .04em; }
.h3d-acciones { margin-top: auto; padding-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.h3d-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 42px; padding: 0 16px; border-radius: 10px;
    font-size: 14px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background .2s, color .2s, transform .2s;
}
.h3d-btn-3d { flex: 1; background: var(--h3d-rojo); color: #fff; }
.h3d-btn-3d:hover { background: #b80011; color: #fff; transform: translateY(-2px); }
.h3d-btn-link { flex: 1; color: var(--h3d-negro); border: 1px solid rgba(17, 17, 17, .2); }
.h3d-btn-link:hover { background: var(--h3d-negro); color: #fff; }

/* ---------- celular: carrusel deslizable ---------- */
@media (max-width: 767px) {
    .h3d { padding-left: 0; padding-right: 0; }
    .h3d-head { padding: 0 16px; }
    .h3d-cards {
        flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto;
        scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
        padding: 6px 16px 16px; scrollbar-width: none;
    }
    .h3d-cards::-webkit-scrollbar { display: none; }
    .h3d-card { flex: 0 0 78%; min-width: 0; max-width: none; scroll-snap-align: center; }
    .h3d-cards[data-total="1"] { justify-content: center; }
    .h3d-btn { padding: 0 12px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .h3d-dot, .h3d-cargando i { animation: none; }
    .h3d-foto, .h3d-visor { transition: none; }
}
