/* ═══════════════════════════════════════════════════════
   WEBGL CARDS — Atomic scroll animations + lightbox
   ═══════════════════════════════════════════════════════ */

/* ── Card materialize animation ─────────────────────── */
.webgl-card {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  filter: blur(6px);
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.4s ease;
  position: relative;
  overflow: hidden;
}

.webgl-card--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

/* Glow border on appear */
.webgl-card--visible::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    135deg,
    var(--card-accent, #5bd1d8) 0%,
    transparent 40%,
    transparent 60%,
    var(--card-accent, #5bd1d8) 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  animation: glow-border-in 1.2s 0.3s ease forwards;
}

@keyframes glow-border-in {
  0% { opacity: 0; }
  50% { opacity: 0.6; }
  100% { opacity: 0.15; }
}

/* Card hover tilt effect */
.webgl-card--visible:hover {
  box-shadow:
    0 0 20px rgba(91, 209, 216, 0.08),
    0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px) scale(1.01);
}

/* ── Section atomic reveal — alternate orbit direction ── */
.webgl-section {
  opacity: 0;
  transition:
    opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Odd sections slide from left orbit */
.webgl-section:nth-child(odd) {
  transform: translateX(-60px) rotate(-1deg);
}

/* Even sections slide from right orbit */
.webgl-section:nth-child(even) {
  transform: translateX(60px) rotate(1deg);
}

.webgl-section--visible {
  opacity: 1;
  transform: translateX(0) rotate(0deg);
}

/* Staggered children reveal */
.webgl-section--visible > *:nth-child(1) { transition-delay: 0s; }
.webgl-section--visible > *:nth-child(2) { transition-delay: 0.1s; }
.webgl-section--visible > *:nth-child(3) { transition-delay: 0.2s; }
.webgl-section--visible > *:nth-child(4) { transition-delay: 0.3s; }
.webgl-section--visible > *:nth-child(5) { transition-delay: 0.4s; }

/* ── Photo/Video hover effect ───────────────────────── */
.photo-strip-img,
.video-strip-clip {
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, filter 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
}

.photo-strip-img:hover,
.video-strip-clip:hover {
  transform: scale(1.05) translateY(-4px);
  box-shadow:
    0 0 24px rgba(91, 209, 216, 0.15),
    0 12px 40px rgba(0, 0, 0, 0.4);
  filter: brightness(1.1);
  border-color: rgba(91, 209, 216, 0.2);
}

/* ── Lightbox ───────────────────────────────────────── */
.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: lightbox-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  cursor: default;
  animation: lightbox-content-in 0.5s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lightbox-content-in {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
    filter: blur(0);
  }
}

.lightbox-media {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 0 60px rgba(91, 209, 216, 0.1),
    0 24px 80px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  transform: rotate(90deg);
}

/* ── Energy rings around lightbox media ──────────────── */
.lightbox-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(91, 209, 216, 0.15);
  border-radius: 50%;
  pointer-events: none;
}

.lightbox-ring--1 {
  width: 110%;
  height: 110%;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: ring-orbit 8s linear infinite;
  border-style: dashed;
  border-color: rgba(91, 209, 216, 0.1);
}

.lightbox-ring--2 {
  width: 120%;
  height: 120%;
  transform: translate(-50%, -50%) rotate(0deg);
  animation: ring-orbit 12s linear infinite reverse;
  border-color: rgba(241, 194, 122, 0.08);
}

.lightbox-ring--3 {
  width: 130%;
  height: 60%;
  transform: translate(-50%, -50%) rotate(30deg);
  animation: ring-orbit 6s linear infinite;
  border-color: rgba(182, 209, 143, 0.06);
}

@keyframes ring-orbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ── Particle burst (injected by JS) ─────────────────── */
.webgl-particle-burst {
  will-change: transform, opacity;
}

/* ── 3D Tilt on scroll ──────────────────────────────── */
.webgl-card {
  perspective: 1000px;
  transform-style: preserve-3d;
}

/* Alternating left/right orbit entry */
.webgl-card--visible {
  animation: card-orbit-right 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Even cards enter from right, odd from left */
.webgl-section:nth-child(odd) .webgl-card--visible {
  animation-name: card-orbit-left;
}
.webgl-section:nth-child(even) .webgl-card--visible {
  animation-name: card-orbit-right;
}

@keyframes card-orbit-left {
  0% {
    opacity: 0;
    transform: perspective(1200px) translateX(-120px) rotateY(25deg) rotateZ(-3deg) scale(0.85);
    filter: blur(8px);
  }
  40% {
    opacity: 0.7;
    transform: perspective(1200px) translateX(-20px) rotateY(8deg) rotateZ(-1deg) scale(0.97);
    filter: blur(2px);
  }
  70% {
    opacity: 1;
    transform: perspective(1200px) translateX(8px) rotateY(-2deg) rotateZ(0.5deg) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: perspective(1200px) translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
    filter: blur(0);
  }
}

@keyframes card-orbit-right {
  0% {
    opacity: 0;
    transform: perspective(1200px) translateX(120px) rotateY(-25deg) rotateZ(3deg) scale(0.85);
    filter: blur(8px);
  }
  40% {
    opacity: 0.7;
    transform: perspective(1200px) translateX(20px) rotateY(-8deg) rotateZ(1deg) scale(0.97);
    filter: blur(2px);
  }
  70% {
    opacity: 1;
    transform: perspective(1200px) translateX(-8px) rotateY(2deg) rotateZ(-0.5deg) scale(1.01);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: perspective(1200px) translateX(0) rotateY(0deg) rotateZ(0deg) scale(1);
    filter: blur(0);
  }
}

/* Mouse-driven 3D tilt on hover */
.webgl-card--visible:hover {
  transition: box-shadow 0.3s ease;
  box-shadow:
    0 0 24px rgba(91, 209, 216, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

/* ── Atomic carousel for photos/videos ─────────────── */
.atomic-carousel {
  position: relative;
  padding: clamp(40px, 6vw, 80px) 0;
  overflow: visible;
}

.atomic-carousel-orbit {
  display: flex;
  gap: clamp(12px, 2vw, 24px);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  padding: 20px clamp(20px, 4vw, 48px);
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.atomic-carousel-orbit::-webkit-scrollbar {
  display: none;
}

.atomic-carousel-item {
  flex: 0 0 auto;
  scroll-snap-align: center;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  transform: perspective(800px) rotateY(0deg);
}

.atomic-carousel-item::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  border: 1px solid rgba(91, 209, 216, 0.08);
  pointer-events: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  z-index: 2;
}

.atomic-carousel-item:hover {
  transform: perspective(800px) rotateY(-3deg) translateY(-8px) scale(1.04);
  z-index: 10;
}

.atomic-carousel-item:hover::before {
  border-color: rgba(91, 209, 216, 0.3);
  box-shadow:
    0 0 30px rgba(91, 209, 216, 0.12),
    inset 0 0 20px rgba(91, 209, 216, 0.03);
}

/* Electron dots orbiting around hovered item */
.atomic-carousel-item:hover::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5bd1d8;
  box-shadow: 0 0 12px #5bd1d8;
  top: -3px;
  left: 50%;
  z-index: 3;
  animation: electron-orbit-item 2s linear infinite;
}

@keyframes electron-orbit-item {
  0% { top: -3px; left: 50%; }
  25% { top: 50%; left: calc(100% + 3px); }
  50% { top: calc(100% + 3px); left: 50%; }
  75% { top: 50%; left: -3px; }
  100% { top: -3px; left: 50%; }
}

.atomic-carousel-item img,
.atomic-carousel-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease, transform 0.3s ease;
}

.atomic-carousel-item:hover img,
.atomic-carousel-item:hover video {
  filter: brightness(1.15) contrast(1.05);
  transform: scale(1.02);
}

/* Carousel navigation arrows */
.atomic-carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(91, 209, 216, 0.1);
  border: 1px solid rgba(91, 209, 216, 0.2);
  color: #5bd1d8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

.atomic-carousel-nav:hover {
  background: rgba(91, 209, 216, 0.2);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 0 20px rgba(91, 209, 216, 0.2);
}

.atomic-carousel-nav--prev { left: 8px; }
.atomic-carousel-nav--next { right: 8px; }

/* Orbital track line under carousel */
.atomic-carousel-track {
  height: 1px;
  margin: 16px auto 0;
  max-width: 200px;
  background: linear-gradient(90deg, transparent, rgba(91, 209, 216, 0.3), transparent);
  position: relative;
}

.atomic-carousel-track::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5bd1d8;
  box-shadow: 0 0 10px #5bd1d8;
  top: -3px;
  left: var(--track-position, 50%);
  transition: left 0.3s ease;
}

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .webgl-card,
  .webgl-section {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
  .webgl-card--visible::before { display: none; }
  .lightbox-ring { display: none; }
  .lightbox-content { animation: none; opacity: 1; transform: none; }
}
