/* ─────────────────────────────────────────────
   HTML / CSS / JS / GSAP
───────────────────────────────────────────── */

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

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

body {
  font-family: Inter, 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;
  pointer-events: none;
}

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

/* ── Trail stage ───────────────────────────── */

.rotating-image-trail {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  cursor: default;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

/* Source pool — never visible; clones are appended to the stage */
.rotating-image-trail__collection {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.rotating-image-trail__list {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

.rotating-image-trail__item {
  z-index: 10;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  will-change: transform;
}

/* Clones live as absolute children of the stage */
.rotating-image-trail > .rotating-image-trail__item {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
}

.rotating-image-trail__card {
  position: relative;
  width: min(10vw, 140px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 2px;
  background: #111;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.rotating-image-trail__card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Centered label (pointer-events none so trail still works over it) */
.rotating-image-trail__title {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  place-items: center;
  gap: 1.15em;
  margin: 0;
  padding: 1.5rem;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.rotating-image-trail__name {
  margin: 0;
  font-size: clamp(2rem, 6.5vw, 5.5rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #f2f2f2;
}

.rotating-image-trail__label {
  margin: 0;
  font-size: clamp(0.75rem, 1.35vw, 1rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.3;
  color: rgba(242, 242, 242, 0.55);
}

/* ── Responsive card size ──────────────────── */

@media (max-width: 768px) {
  .rotating-image-trail__card {
    width: min(22vw, 110px);
  }

  .rotating-image-trail__name {
    font-size: clamp(1.6rem, 8vw, 2.75rem);
  }

  .rotating-image-trail__label {
    font-size: clamp(0.65rem, 2.5vw, 0.85rem);
    letter-spacing: 0.1em;
  }
}

@media (max-width: 480px) {
  .rotating-image-trail__card {
    width: min(28vw, 96px);
  }
}

/* Prefer reduced motion: still show trail, but CSS will not fight GSAP */
@media (prefers-reduced-motion: reduce) {
  .rotating-image-trail__item {
    will-change: auto;
  }
}
