/* ─────────────────────────────────────────────
   3D Cards Tornado
   HTML / CSS / GSAP (Observer + ScrollTrigger)
───────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000;
  color: #fff;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: none;
  -webkit-user-drag: none;
  user-select: none;
}

.app {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #000;
  overflow: hidden;
}

/* ── Tornado stage ─────────────────────────── */

.cards-tornado {
  cursor: grab;
  touch-action: none;
  width: 100%;
  height: 100%;
  height: 100dvh;
  position: relative;
  overflow: clip;
  background: #000;
  -webkit-user-select: none;
  user-select: none;
}

.cards-tornado:active {
  cursor: grabbing;
}

.cards-tornado__collection {
  width: 100%;
  height: 100%;
  position: relative;
}

.cards-tornado__list {
  /* em-based sizing drives card width via font-size */
  font-size: clamp(0.5em, 0.75vw, 1.5em);
  width: 100%;
  height: 100%;
  perspective: 75em;
  transform-style: preserve-3d;
  position: relative;
}

.cards-tornado__item {
  transform-style: preserve-3d;
  backface-visibility: visible;
  will-change: transform, filter;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Start hidden until first render to avoid flash */
  opacity: 0;
}

/* ── Card ──────────────────────────────────── */

.demo-card {
  aspect-ratio: 4 / 5;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  background-color: #1a1a1a;
  border-radius: 1em;
  width: 18em;
  position: relative;
  overflow: hidden;
  box-shadow:
    0 0.25em 1.5em rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.cover-image {
  object-fit: cover;
  border-radius: inherit;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

/* ── Reduced motion ────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .cards-tornado__item {
    transition: none !important;
  }
}

/* ── Small screens — slightly tighter cards ── */

@media (max-width: 640px) {
  .cards-tornado__list {
    font-size: clamp(0.45em, 2.2vw, 0.85em);
  }
}
