/* Hero 3D phone showcase — pairs with hero-parallax.js */

.hero-visual {
  position: relative;
  width: 100%;
  height: 620px;
  max-height: 78vh;
  --rx: 4deg;
  --ry: -8deg;
  --tile-rx: 0deg;
  --tile-ry: 0deg;
}

/* ── Phone stage ── */
.phone-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px;
  height: 460px;
  z-index: 10;
  perspective: 1200px;
  opacity: 0;
  padding-bottom: 1.5rem;
  animation: phone-in 1s 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.phone-tilt {
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--float-y, 0px));
  transition: transform 0.12s ease-out;
  will-change: transform;
}

.phone-device {
  position: relative;
  width: 100%;
  height: 100%;
  background: linear-gradient(155deg, #3a3a3c 0%, #1c1c1e 42%, #0a0a0b 100%);
  border-radius: 36px;
  padding: 10px;
  box-shadow:
    0 2px 6px rgba(10, 6, 24, 0.12),
    0 20px 48px -8px rgba(10, 6, 24, 0.35),
    0 40px 80px -16px rgba(204, 0, 0, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  background: #0a0618;
}

.phone-screen .screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.phone-screen .screen.active {
  opacity: 1;
}

.phone-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Ambient glow (mobile) + screen dots (all viewports) */
.phone-glow {
  display: none;
}

.phone-dots {
  display: flex;
}

.phone-glow {
  position: absolute;
  inset: -18% -28%;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 55%,
    rgba(204, 0, 0, 0.28) 0%,
    rgba(75, 0, 130, 0.14) 42%,
    transparent 72%
  );
  filter: blur(20px);
  animation: phone-glow-pulse 4.5s ease-in-out infinite;
}

.phone-dots {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  gap: 0.5rem;
  align-items: center;
  z-index: 12;
  max-width: calc(100% + 2rem);
  flex-wrap: wrap;
  justify-content: center;
}

.phone-dots--compact {
  gap: 0.35rem;
  max-width: 120%;
}

.phone-dots--compact .phone-dot {
  width: 5px;
  height: 5px;
}

.phone-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(75, 0, 130, 0.22);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.phone-dot.active {
  background: var(--brand-purple, #4b0082);
  transform: scale(1.35);
}

@keyframes phone-glow-pulse {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

/* ── Orbiting tiles (hero-visual context) ── */
.hero-visual .tile {
  z-index: 2;
  transform: rotate(var(--r, 0deg)) scale(0.7) translateY(40px)
    rotateX(var(--tile-rx)) rotateY(var(--tile-ry));
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), filter 0.45s ease;
}

.hero-visual .tile.tile-near {
  z-index: 5;
  opacity: 0.92;
}

.hero-visual .tile.tile-far {
  z-index: 2;
  opacity: 0.78;
  filter: saturate(0.92);
}

.hero-visual .tile:hover {
  transform: rotate(0deg) translateY(-10px) scale(1.04)
    rotateX(var(--tile-rx)) rotateY(var(--tile-ry));
  z-index: 20;
}

/* Tile positions — orbit around centered phone */
.hero-visual .tile-hair {
  --r: -6deg;
  width: 148px;
  height: 124px;
  top: 4%;
  left: 0%;
  animation-delay: 0.55s;
}

.hero-visual .tile-event {
  --r: 5deg;
  width: 140px;
  height: 106px;
  top: 2%;
  right: 0%;
  animation-delay: 0.7s;
}

.hero-visual .tile-club {
  --r: -4deg;
  width: 142px;
  height: 186px;
  top: 28%;
  right: 2%;
  animation-delay: 0.85s;
}

.hero-visual .tile-fitness {
  --r: 6deg;
  width: 132px;
  height: 102px;
  top: 62%;
  left: 2%;
  animation-delay: 0.95s;
}

.hero-visual .tile-vehicle {
  --r: -3deg;
  width: 138px;
  height: 112px;
  top: 58%;
  right: 4%;
  animation-delay: 1.05s;
}

.hero-visual .tile-review {
  --r: -2deg;
  width: 220px;
  height: 84px;
  bottom: 2%;
  left: 2%;
  z-index: 12;
  animation-delay: 1.22s;
}

@keyframes phone-in {
  0% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.85);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes tile-in {
  0% {
    opacity: 0;
    transform: rotate(var(--r, 0deg)) scale(0.7) translateY(40px)
      rotateX(var(--tile-rx)) rotateY(var(--tile-ry));
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: rotate(var(--r, 0deg)) scale(1) translateY(0)
      rotateX(var(--tile-rx)) rotateY(var(--tile-ry));
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .phone-stage {
    animation: none;
    opacity: 1;
    transform: translate(-50%, -50%);
  }

  .phone-tilt {
    transition: none;
    transform: rotateX(2deg) rotateY(0deg);
  }

  .hero-visual--mobile-fx .phone-tilt {
    transform: rotateX(2deg) rotateY(0deg);
  }

  .hero-visual .tile {
    animation: none;
    opacity: 1;
    transform: rotate(var(--r, 0deg)) scale(1) translateY(0);
  }

  .phone-screen .screen {
    transition: none;
  }
}

/* ── Narrow desktop / tablet ── */
@media (max-width: 1100px) {
  .hero-visual {
    height: 540px;
  }

  .phone-stage {
    width: 190px;
    height: 398px;
  }

  .hero-visual .tile-hair     { width: 124px; height: 104px; }
  .hero-visual .tile-club    { width: 118px; height: 154px; }
  .hero-visual .tile-fitness { width: 112px; height: 86px; }
  .hero-visual .tile-event   { width: 118px; height: 90px; }
  .hero-visual .tile-vehicle { width: 116px; height: 94px; }
  .hero-visual .tile-review  { width: 190px; height: 76px; }
}

/* ── Mobile — touch tilt, float, swipe, ambient glow ── */
@media (max-width: 900px) {
  .hero-visual {
    display: block;
    height: auto;
    max-height: none;
    margin: 10px auto 1.5rem;
    width: min(220px, 58vw);
    aspect-ratio: 220 / 500;
    --float-y: 0px;
    touch-action: pan-y;
  }

  .phone-stage {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: 100%;
    height: 100%;
    padding-bottom: 1.75rem;
    animation: phone-in-mobile 0.9s 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  .phone-glow {
    display: block;
  }

  .phone-dots {
    display: flex;
  }

  .phone-tilt {
    transition: none;
    transform: rotateX(2deg) rotateY(0deg);
  }

  .hero-visual--mobile-fx .phone-tilt {
    transform: rotateX(var(--rx)) rotateY(var(--ry)) translateY(var(--float-y, 0px));
  }

  .hero-visual .tile {
    display: none;
  }

  @keyframes phone-in-mobile {
    0% {
      opacity: 0;
      transform: translateY(24px) scale(0.92);
    }
    100% {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .phone-stage {
      animation: none;
      opacity: 1;
      transform: none;
    }

    .phone-glow {
      animation: none;
      opacity: 0.85;
    }
  }
}
