/**
 * 3D Effects CSS Library for CyberPoint Texas
 * Modern 3D transforms, animations, and visual effects
 * @version 1.0.0
 */

/* ============================================
   BASE 3D SETUP
   ============================================ */

/* Perspective container - wrap around 3D elements */
.perspective-container {
  perspective: 1000px;
  perspective-origin: center center;
}

.perspective-container-deep {
  perspective: 2000px;
}

.perspective-container-shallow {
  perspective: 500px;
}

/* Preserve 3D context for nested elements */
.preserve-3d {
  transform-style: preserve-3d;
}

/* Enable hardware acceleration */
.gpu-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  will-change: transform;
}

/* ============================================
   1. 3D CARD FLIP
   ============================================ */

.card-3d {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotateY(0deg);
}

.card-3d-container {
  perspective: 1000px;
}

.card-3d-front,
.card-3d-back {
  position: relative;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-3d-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: rotateY(180deg);
}

.card-3d:hover,
.card-3d.is-flipped {
  transform: rotateY(180deg);
}

/* Card flip variants */
.card-3d-x {
  transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card-3d-x:hover,
.card-3d-x.is-flipped {
  transform: rotateX(180deg);
}

.card-3d-fast {
  transition: transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.card-3d-slow {
  transition: transform 800ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   2. PARALLAX LAYERS
   ============================================ */

.parallax-container {
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
}

.parallax-layer {
  transition: transform 0.1s ease-out;
  will-change: transform;
}

/* Depth data attributes for parallax layers */
[data-parallax-depth="1"] {
  transform: translateZ(0px);
}

[data-parallax-depth="2"] {
  transform: translateZ(-50px);
}

[data-parallax-depth="3"] {
  transform: translateZ(-100px);
}

[data-parallax-depth="4"] {
  transform: translateZ(-150px);
}

[data-parallax-depth="5"] {
  transform: translateZ(-200px);
}

[data-parallax-depth="6"] {
  transform: translateZ(-250px);
}

[data-parallax-depth="7"] {
  transform: translateZ(-300px);
}

/* ============================================
   3. FLOATING ELEMENTS
   ============================================ */

.floating-element {
  animation: float 3000ms ease-in-out infinite;
  will-change: transform;
}

.floating-element-slow {
  animation: float 4000ms ease-in-out infinite;
}

.floating-element-fast {
  animation: float 2000ms ease-in-out infinite;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) translateZ(0);
  }
  50% {
    transform: translateY(var(--float-amplitude, -20px)) translateZ(0);
  }
}

/* Floating variants */
@keyframes floatRotate {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

.floating-rotate {
  animation: floatRotate 3000ms ease-in-out infinite;
}

@keyframes floatScale {
  0%, 100% {
    transform: translateY(0px) scale(1);
  }
  50% {
    transform: translateY(-20px) scale(1.05);
  }
}

.floating-scale {
  animation: floatScale 3000ms ease-in-out infinite;
}

/* ============================================
   4. GLASSMORPHISM PANELS
   ============================================ */

.glass-panel {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.glass-panel:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Glass variants */
.glass-panel-dark {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-panel-strong {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.2);
}

.glass-panel-subtle {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  background: rgba(255, 255, 255, 0.05);
}

.glass-panel-cyber {
  background: rgba(0, 170, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(0, 170, 255, 0.3);
  box-shadow: 0 8px 32px rgba(0, 170, 255, 0.1);
}

/* ============================================
   5. 3D BUTTONS
   ============================================ */

.btn-3d {
  position: relative;
  transition: all 0.15s ease;
  transform: translateY(-6px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
  will-change: transform, box-shadow;
  border: none;
  cursor: pointer;
}

.btn-3d:hover {
  transform: translateY(-9px);
  box-shadow: 0 9px 18px rgba(0, 0, 0, 0.2);
}

.btn-3d:active {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Button variants */
.btn-3d-primary {
  background: linear-gradient(135deg, #0066cc, #0052a3);
  color: white;
  padding: 12px 32px;
  border-radius: 8px;
}

.btn-3d-primary:hover {
  background: linear-gradient(135deg, #0077ed, #0066cc);
}

.btn-3d-secondary {
  background: linear-gradient(135deg, #6c757d, #545b62);
  color: white;
  padding: 12px 32px;
  border-radius: 8px;
}

.btn-3d-cyber {
  background: linear-gradient(135deg, #00aaff, #0088cc);
  color: white;
  padding: 12px 32px;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0, 170, 255, 0.3);
}

.btn-3d-cyber:hover {
  box-shadow: 0 9px 18px rgba(0, 170, 255, 0.4);
}

/* Subtle 3D button */
.btn-3d-subtle {
  transform: translateY(-3px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
}

.btn-3d-subtle:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.15);
}

.btn-3d-subtle:active {
  transform: translateY(-1px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ============================================
   6. PERSPECTIVE GRID
   ============================================ */

.perspective-grid {
  position: relative;
  perspective: 1000px;
  overflow: hidden;
}

.grid-inner {
  transform-style: preserve-3d;
  transform: rotateX(45deg);
  transform-origin: center center;
}

/* Grid pattern */
.grid-pattern {
  background-image:
    linear-gradient(rgba(0, 170, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 170, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
}

.grid-pattern-dense {
  background-size: 25px 25px;
}

.grid-pattern-sparse {
  background-size: 100px 100px;
}

/* Fade to transparent */
.grid-fade-bottom {
  mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
}

.grid-fade-top {
  mask-image: linear-gradient(to top, black 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, black 0%, transparent 100%);
}

/* Animated grid */
@keyframes gridPulse {
  0%, 100% {
    transform: rotateX(45deg) scale(1);
  }
  50% {
    transform: rotateX(45deg) scale(1.02);
  }
}

.grid-animated {
  animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridScroll {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 100px;
  }
}

.grid-scrolling {
  animation: gridScroll 2s linear infinite;
}

/* ============================================
   7. SCROLL-TRIGGERED 3D
   ============================================ */

.scroll-trigger-3d {
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-trigger-3d.scroll-trigger-pending {
  opacity: 0;
  transform: translateY(50px) translateZ(0);
}

.scroll-trigger-3d.is-visible {
  opacity: 1;
  transform: translateY(0) translateZ(0);
}

/* Effect variants */
.scroll-trigger-3d[data-effect="fadeIn"] {
  opacity: 0;
}

.scroll-trigger-3d[data-effect="fadeIn"].is-visible {
  opacity: 1;
}

.scroll-trigger-3d[data-effect="slideUp"] {
  transform: translateY(50px);
}

.scroll-trigger-3d[data-effect="slideUp"].is-visible {
  transform: translateY(0);
}

.scroll-trigger-3d[data-effect="slideLeft"] {
  transform: translateX(-50px);
}

.scroll-trigger-3d[data-effect="slideLeft"].is-visible {
  transform: translateX(0);
}

.scroll-trigger-3d[data-effect="slideRight"] {
  transform: translateX(50px);
}

.scroll-trigger-3d[data-effect="slideRight"].is-visible {
  transform: translateX(0);
}

.scroll-trigger-3d[data-effect="zoom"] {
  transform: scale(0.8);
  opacity: 0;
}

.scroll-trigger-3d[data-effect="zoom"].is-visible {
  transform: scale(1);
  opacity: 1;
}

.scroll-trigger-3d[data-effect="rotate"] {
  transform: rotateY(-90deg);
  opacity: 0;
}

.scroll-trigger-3d[data-effect="rotate"].is-visible {
  transform: rotateY(0);
  opacity: 1;
}

.scroll-trigger-3d[data-effect="flip"] {
  transform: rotateX(-90deg);
  transform-origin: bottom;
  opacity: 0;
}

.scroll-trigger-3d[data-effect="flip"].is-visible {
  transform: rotateX(0);
  opacity: 1;
}

/* Stagger delays for multiple elements */
.scroll-trigger-3d:nth-child(1) { transition-delay: 0ms; }
.scroll-trigger-3d:nth-child(2) { transition-delay: 100ms; }
.scroll-trigger-3d:nth-child(3) { transition-delay: 200ms; }
.scroll-trigger-3d:nth-child(4) { transition-delay: 300ms; }
.scroll-trigger-3d:nth-child(5) { transition-delay: 400ms; }
.scroll-trigger-3d:nth-child(6) { transition-delay: 500ms; }

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Transform utilities */
.translate-z-0 { transform: translateZ(0); }
.translate-z-10 { transform: translateZ(10px); }
.translate-z-20 { transform: translateZ(20px); }
.translate-z-30 { transform: translateZ(30px); }
.translate-z-50 { transform: translateZ(50px); }
.translate-z-100 { transform: translateZ(100px); }

.rotate-x-45 { transform: rotateX(45deg); }
.rotate-y-45 { transform: rotateY(45deg); }
.rotate-z-45 { transform: rotateZ(45deg); }

/* Depth shadows */
.shadow-3d-sm {
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 4px 8px rgba(0, 0, 0, 0.05);
}

.shadow-3d-md {
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.1),
    0 8px 16px rgba(0, 0, 0, 0.05),
    0 16px 32px rgba(0, 0, 0, 0.03);
}

.shadow-3d-lg {
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.1),
    0 16px 32px rgba(0, 0, 0, 0.05),
    0 32px 64px rgba(0, 0, 0, 0.03);
}

.shadow-3d-cyber {
  box-shadow:
    0 4px 8px rgba(0, 170, 255, 0.2),
    0 8px 16px rgba(0, 170, 255, 0.1),
    0 16px 32px rgba(0, 170, 255, 0.05);
}

/* Hover lifts */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px) translateZ(0);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.hover-lift-sm:hover {
  transform: translateY(-4px) translateZ(0);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.hover-lift-lg:hover {
  transform: translateY(-12px) translateZ(0);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
}

/* Tilt effects */
.tilt-left {
  transform: perspective(1000px) rotateY(-5deg);
  transition: transform 0.3s ease;
}

.tilt-left:hover {
  transform: perspective(1000px) rotateY(0deg);
}

.tilt-right {
  transform: perspective(1000px) rotateY(5deg);
  transition: transform 0.3s ease;
}

.tilt-right:hover {
  transform: perspective(1000px) rotateY(0deg);
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .card-3d,
  .parallax-layer,
  .floating-element,
  .btn-3d,
  .scroll-trigger-3d,
  .hover-lift,
  .tilt-left,
  .tilt-right,
  .grid-animated,
  .grid-scrolling,
  .floating-rotate,
  .floating-scale {
    animation: none !important;
    transition: none !important;
  }

  .scroll-trigger-3d {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .perspective-container {
    perspective: 800px;
  }

  .card-3d {
    transition-duration: 400ms;
  }

  .floating-element {
    animation-duration: 2000ms;
  }

  /* Reduce parallax intensity */
  [data-parallax-depth] {
    transform: translateZ(0) !important;
  }

  /* Simplify glass effect */
  .glass-panel {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }

  /* Reduce 3D button depth */
  .btn-3d {
    transform: translateY(-3px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
  }

  .btn-3d:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }
}

/* ============================================
   COMBINATION EFFECTS
   ============================================ */

/* Floating glass panel */
.floating-glass {
  animation: float 3000ms ease-in-out infinite;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* 3D card with glass effect */
.card-3d-glass .card-3d-front,
.card-3d-glass .card-3d-back {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Animated grid with parallax */
.parallax-grid {
  position: relative;
  overflow: hidden;
}

.parallax-grid::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 170, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 170, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: gridScroll 2s linear infinite;
  pointer-events: none;
}

/* ============================================
   LOADING ANIMATIONS
   ============================================ */

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.shimmer-effect {
  position: relative;
  overflow: hidden;
}

.shimmer-effect::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

/* Pulse effect */
@keyframes pulse3d {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

.pulse-3d {
  animation: pulse3d 2s ease-in-out infinite;
}

/* ============================================
   BRAND-SPECIFIC CYBER EFFECTS
   ============================================ */

.cyber-glow {
  box-shadow:
    0 0 10px rgba(0, 170, 255, 0.3),
    0 0 20px rgba(0, 170, 255, 0.2),
    0 0 30px rgba(0, 170, 255, 0.1);
  transition: box-shadow 0.3s ease;
}

.cyber-glow:hover {
  box-shadow:
    0 0 15px rgba(0, 170, 255, 0.4),
    0 0 30px rgba(0, 170, 255, 0.3),
    0 0 45px rgba(0, 170, 255, 0.2);
}

.cyber-border {
  position: relative;
  border: 2px solid transparent;
  background: linear-gradient(135deg, #000, #1a1a1a) padding-box,
              linear-gradient(135deg, #00aaff, #0088cc) border-box;
}

@keyframes cyberScan {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.cyber-scan {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 170, 255, 0.1) 25%,
    rgba(0, 170, 255, 0.2) 50%,
    rgba(0, 170, 255, 0.1) 75%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: cyberScan 3s ease-in-out infinite;
}
