/* ================================================================
   3D Carousel – Frontend Styles
   ================================================================ */

/* ── Wrapper externo ───────────────────────────────────────────── */
.tdcarousel-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1em;
  width: 100%;
  padding: 2em 0;
  box-sizing: border-box;
}

/* ── Escena 3D ─────────────────────────────────────────────────── */
.tdcarousel-scene {
  display: grid;
  overflow: hidden;
  perspective: 35em;
  /* máscara de degradado lateral */
  -webkit-mask: linear-gradient(90deg, #0000, red 20% 80%, #0000);
          mask: linear-gradient(90deg, #0000, red 20% 80%, #0000);
  flex: 1;
  min-width: 0;
}

/* ── Contenedor 3D giratorio ───────────────────────────────────── */
.tdcarousel-a3d {
  display: grid;
  place-self: center;
  transform-style: preserve-3d;
  animation: tdcarousel-ry 32s linear infinite;
  /* direction y duration se sobreescriben via style="" inline */
}

@keyframes tdcarousel-ry {
  to { rotate: y 1turn; }
}

/* ── Tarjeta individual ─────────────────────────────────────────── */
.tdcarousel-card {
  --w: var(--card-width, var(--w, 280px));
  --ba: 1turn / var(--n, 1);

  grid-area: 1 / 1;
  width: var(--w);
  aspect-ratio: 7 / 10;
  object-fit: cover;
  border-radius: 1.5em;
  backface-visibility: hidden;
  transform:
    rotateY(calc(var(--i) * var(--ba)))
    translateZ(calc(-1 * (.5 * var(--w) + .5em) / tan(.5 * var(--ba))));
  transition: box-shadow 0.3s;
}

.tdcarousel-card:hover {
  box-shadow: 0 0 2em rgba(0,0,0,.35);
}

/* ── Flechas de navegación ─────────────────────────────────────── */
.tdcarousel-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: rgba(255,255,255,.75);
  color: #333;
  font-size: 1.1em;
  cursor: pointer;
  z-index: 10;
  transition: background .2s, transform .15s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.tdcarousel-arrow:hover {
  background: rgba(255,255,255,.95);
  transform: scale(1.1);
}

.tdcarousel-arrow:active {
  transform: scale(.95);
}

/* ── Movimiento reducido ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .tdcarousel-a3d {
    animation-duration: 128s !important;
  }
}
