/* ============================================================
   HERO CAROUSEL — Cover-flow style hero slider
   Markup expected (already in index.html):
   <section class="hero-carousel" id="heroCarousel">
     <div class="hero-track" id="heroTrack"></div>
     <div class="hero-dots" id="heroDots"></div>
   </section>
   All slide elements are created dynamically by hero-carousel.js

   Active/side card dimensions below are matched 1:1 to the
   reference implementation (mobile 220x315 / 160x229, tablet
   195x279 / 155x222, desktop 215x308 / 170x243) so sizing and
   the active-vs-side contrast look identical at every breakpoint.
   ============================================================ */

.hero-carousel {
  --hc-active-w: 220px;
  --hc-active-h: 315px;
  --hc-side-w: 160px;
  --hc-side-h: 229px;
  --hc-gap: 12px;
  --hc-transition: 420ms cubic-bezier(0.25, 1, 0.5, 1);
  position: relative;
  width: 100%;
  min-height: 300px;
  padding: 28px 0 22px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(144, 61, 224, 0.28), transparent 60%),
    linear-gradient(180deg, #0c0714 0%, #150a24 55%, #0c0714 100%);
  isolation: isolate;
}

.hero-carousel::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.25;
  pointer-events: none;
}

.hero-track {
  position: relative;
  width: 100%;
  height: calc(var(--hc-active-h) + 12px);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  opacity: 0;
  transition: opacity 320ms ease;
}

.hero-track.is-ready {
  opacity: 1;
}

/* ---------------- Loading skeleton ----------------
   Shown the instant the page loads (before hero-slides.json
   resolves) so there's never an empty flash. Sizes are driven
   off the same active/side variables as the real cards, so they
   line up exactly at every breakpoint. */
.hero-skeleton {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--hc-gap);
  padding: 0 16px;
  transition: opacity 300ms ease;
}

.hero-skeleton.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.hero-skeleton-card {
  flex: 0 0 auto;
  width: var(--hc-side-w);
  height: var(--hc-side-h);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  animation: heroSkeletonPulse 1.4s ease-in-out infinite;
}

.hero-skeleton-card.is-active {
  width: var(--hc-active-w);
  height: var(--hc-active-h);
}

@keyframes heroSkeletonPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-skeleton-card { animation: none; opacity: 0.75; }
}

.hero-track.dragging .hero-slide {
  transition: none;
}

.hero-slide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--hc-active-w);
  height: var(--hc-active-h);
  border-radius: 14px;
  overflow: hidden;
  background: #1b1024;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  will-change: transform, opacity;
  transition: transform var(--hc-transition), opacity var(--hc-transition), box-shadow var(--hc-transition);
  transform: translate(-50%, -50%);
}

.hero-slide.active {
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(144, 61, 224, 0.35), 0 0 26px rgba(144, 61, 224, 0.28);
}

.hero-slide-imgwrap {
  position: absolute;
  inset: 0;
  background: #1b1024;
}

.hero-slide-imgwrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 320ms ease;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

.hero-slide-imgwrap img.loaded {
  opacity: 1;
}

.hero-slide.hero-slide-error .hero-slide-imgwrap {
  background: linear-gradient(160deg, #241432, #150a1f);
}

/* Rating badge and title are only shown on the active card — matches
   the reference behavior where side cards show artwork only. */
.hero-rating {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(10, 6, 16, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  z-index: 2;
  opacity: 0;
  transition: opacity 250ms ease;
}

.hero-slide.active .hero-rating {
  opacity: 1;
}

.hero-rating-star {
  color: #ffc94d;
  font-size: 11px;
}

.hero-slide-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 10px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 3, 12, 0.55) 45%, rgba(6, 3, 12, 0.92) 100%);
  opacity: 0;
  transition: opacity 250ms ease;
}

.hero-slide.active .hero-slide-overlay {
  opacity: 1;
}

.hero-slide-title {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: break-word;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.hero-dots {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  padding: 0 16px;
}

.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background 220ms ease, transform 220ms ease, width 220ms ease;
}

.hero-dot.active {
  width: 18px;
  border-radius: 4px;
  background: #903de0;
}

/* ---------------- Responsive breakpoints ---------------- */
@media (min-width: 768px) {
  .hero-carousel {
    --hc-active-w: 195px;
    --hc-active-h: 279px;
    --hc-side-w: 155px;
    --hc-side-h: 222px;
    padding: 34px 0 26px;
  }
  .hero-slide-title { font-size: 14px; }
}

@media (min-width: 1024px) {
  .hero-carousel {
    --hc-active-w: 215px;
    --hc-active-h: 308px;
    --hc-side-w: 170px;
    --hc-side-h: 243px;
    padding: 44px 0 30px;
  }
  .hero-slide-title { font-size: 15px; }
  .hero-rating { font-size: 12px; padding: 4px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-carousel { --hc-transition: 1ms linear; }
  .hero-slide-imgwrap img { transition: none; }
}
