/**
 * Hero 3D cylindrical carousel
 * Core 3D: perspective on scene, preserve-3d on rig/track, rotateY + translateZ on panels.
 */

/* Fully transparent outer wrapper (no glass card, border, or shadow) */
.hero-cylinder-wrap {
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.hero-cylinder {
  --hc-radius: 380px;
  --hc-panel-w: 280px;
  --hc-panel-h: 280px;
  --hc-transition: 1.2s cubic-bezier(0.22, 1, 0.36, 1);
  --hc-zoom-ease: cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Camera: perspective defines how “deep” the 3D space feels */
.hero-cylinder__scene {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 300px;
  perspective: 1200px;
  perspective-origin: 50% 45%;
  overflow: visible;
}

/* preserve-3d keeps child transforms in the same 3D space as the parent */
.hero-cylinder__rig,
.hero-cylinder__track {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  transform-style: preserve-3d;
}

.hero-cylinder__track {
  transition: transform var(--hc-transition);
  will-change: transform;
}

.hero-cylinder__track.is-transitioning {
  will-change: transform;
}

/* Slow ambient cylinder spin (background layer) */
.hero-cylinder__ambient {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--hc-radius);
  height: var(--hc-radius);
  margin-left: calc(var(--hc-radius) / -2);
  margin-top: calc(var(--hc-radius) / -2);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(139, 92, 246, 0.12) 0%,
    rgba(59, 130, 246, 0.06) 40%,
    transparent 70%
  );
  transform-style: preserve-3d;
  animation: heroCylinderAmbient 48s linear infinite;
  pointer-events: none;
  opacity: 0.85;
}

.hero-cylinder.is-paused .hero-cylinder__ambient,
.hero-cylinder.is-reduced-motion .hero-cylinder__ambient {
  animation-play-state: paused;
}

@keyframes heroCylinderAmbient {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

/* Each panel sits on the cylinder ring: rotateY(angle) translateZ(radius) */
.hero-cylinder__panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--hc-panel-w);
  height: var(--hc-panel-h);
  margin-left: calc(var(--hc-panel-w) / -2);
  margin-top: calc(var(--hc-panel-h) / -2);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--hc-transition),
    filter var(--hc-transition);
  opacity: 0.35;
  filter: blur(4px);
  will-change: transform, opacity, filter;
}

.hero-cylinder__face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 1rem;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(30, 27, 75, 0.85));
  border: 1px solid rgba(139, 92, 246, 0.2);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transform-origin: center center;
  transition:
    transform 1s var(--hc-zoom-ease),
    box-shadow 1s var(--hc-zoom-ease),
    filter 1s var(--hc-zoom-ease);
  animation: heroCylinderFloat 5s ease-in-out infinite;
}

.hero-cylinder__panel:nth-child(odd) .hero-cylinder__face {
  animation-delay: -1.5s;
}

.hero-cylinder__panel:nth-child(3n) .hero-cylinder__face {
  animation-delay: -2.8s;
}

@keyframes heroCylinderFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero-cylinder__face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Active: front-facing, zoomed, sharp */
.hero-cylinder__panel.is-active {
  opacity: 1;
  filter: none;
  z-index: 10;
  pointer-events: auto;
}

.hero-cylinder__panel.is-active .hero-cylinder__face {
  transform: scale(1.15);
  box-shadow:
    0 28px 60px rgba(59, 130, 246, 0.25),
    0 0 40px rgba(139, 92, 246, 0.2),
    0 0 0 1px rgba(167, 139, 250, 0.35) inset;
  border-color: rgba(139, 92, 246, 0.45);
}

/* Previous slide: zooming out, fading */
.hero-cylinder__panel.is-prev {
  opacity: 0.55;
  filter: blur(2px);
}

.hero-cylinder__panel.is-prev .hero-cylinder__face {
  transform: scale(0.92);
}

/* Inactive sides */
.hero-cylinder__panel:not(.is-active):not(.is-prev) {
  opacity: 0.28;
  filter: blur(5px);
}

.hero-cylinder__panel:not(.is-active):not(.is-prev) .hero-cylinder__face {
  transform: scale(0.88);
}

/* Depth push for non-active (applied via JS on inner face when needed) */
.hero-cylinder__panel.is-depth-back .hero-cylinder__face {
  transform: scale(0.82);
  opacity: 0.7;
}

/* Vignette + floor shadow */
.hero-cylinder__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: transparent;
}

.hero-cylinder__floor {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: 70%;
  height: 24px;
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(139, 92, 246, 0.35) 0%,
    rgba(59, 130, 246, 0.12) 45%,
    transparent 70%
  );
  filter: blur(12px);
  pointer-events: none;
}

/* Dot indicators */
.hero-cylinder__dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1rem;
  z-index: 20;
}

.hero-cylinder__dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 9999px;
  background: rgba(148, 163, 184, 0.4);
  cursor: pointer;
  transition:
    width 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.3s ease;
}

.hero-cylinder__dot.is-active {
  width: 1.25rem;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.hero-cylinder__dot:hover {
  background: rgba(139, 92, 246, 0.6);
}

/* Light mode adjustments */
:root:not(.dark) .hero-cylinder__face {
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

/* Dark luxury glow */
.dark .hero-cylinder__panel.is-active .hero-cylinder__face {
  box-shadow:
    0 28px 70px rgba(0, 0, 0, 0.5),
    0 0 50px rgba(139, 92, 246, 0.25),
    0 0 0 1px rgba(167, 139, 250, 0.2) inset;
}

.dark .hero-cylinder__ambient {
  opacity: 1;
  background: radial-gradient(
    ellipse at center,
    rgba(139, 92, 246, 0.18) 0%,
    rgba(59, 130, 246, 0.08) 45%,
    transparent 72%
  );
}

/* Tablet */
@media (max-width: 1024px) {
  .hero-cylinder {
    --hc-radius: 300px;
    --hc-panel-w: 220px;
    --hc-panel-h: 220px;
    min-height: 280px;
  }

  .hero-cylinder__scene {
    perspective: 1000px;
    min-height: 260px;
  }
}

/* Mobile */
@media (max-width: 640px) {
  .hero-cylinder {
    --hc-radius: 220px;
    --hc-panel-w: 168px;
    --hc-panel-h: 168px;
    min-height: 240px;
  }

  .hero-cylinder__scene {
    perspective: 800px;
    min-height: 220px;
  }

}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-cylinder.is-reduced-motion .hero-cylinder__ambient {
    animation: none;
  }

  .hero-cylinder.is-reduced-motion .hero-cylinder__track {
    transition-duration: 0.01ms;
  }

  .hero-cylinder.is-reduced-motion .hero-cylinder__panel,
  .hero-cylinder.is-reduced-motion .hero-cylinder__face {
    animation: none;
    transition-duration: 0.01ms;
  }

  .hero-cylinder.is-reduced-motion .hero-cylinder__panel.is-active .hero-cylinder__face {
    transform: scale(1.05);
  }
}
