/* ============================================
   AnointTech - Modern Design System
   Advanced UI with Glassmorphism, Gradients & Innovation
   ============================================ */

/* ============================================
   Modern Color Palette & Gradients
   ============================================ */
:root {
  /* Enhanced Color System */
  --color-primary-gradient: linear-gradient(135deg, #0B2545 0%, #13315C 50%, #1B4173 100%);
  --color-secondary-gradient: linear-gradient(135deg, #D4AF37 0%, #F2D475 50%, #FFEB99 100%);
  --color-accent-gradient: linear-gradient(135deg, #8B4513 0%, #A0522D 50%, #CD853F 100%);

  /* Animated Mesh Gradients */
  --gradient-mesh-1: radial-gradient(at 40% 20%, hsla(235, 77%, 20%, 1) 0px, transparent 50%),
                      radial-gradient(at 80% 0%, hsla(45, 74%, 54%, 0.3) 0px, transparent 50%),
                      radial-gradient(at 0% 50%, hsla(235, 77%, 30%, 0.5) 0px, transparent 50%),
                      radial-gradient(at 80% 50%, hsla(45, 74%, 54%, 0.2) 0px, transparent 50%),
                      radial-gradient(at 0% 100%, hsla(235, 77%, 25%, 0.7) 0px, transparent 50%),
                      radial-gradient(at 80% 100%, hsla(45, 74%, 54%, 0.3) 0px, transparent 50%);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  --glass-blur: 10px;

  /* Modern Shadows */
  --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.3);
  --shadow-glow-lg: 0 0 40px rgba(212, 175, 55, 0.4);
  --shadow-neumorphic: 12px 12px 24px rgba(0, 0, 0, 0.2),
                       -12px -12px 24px rgba(255, 255, 255, 0.05);
  --shadow-elevated: 0 20px 60px rgba(0, 0, 0, 0.3),
                     0 10px 20px rgba(0, 0, 0, 0.22);

  /* Modern Gradients for Backgrounds */
  --bg-gradient-1: linear-gradient(135deg, #0B2545 0%, #13315C 100%);
  --bg-gradient-2: linear-gradient(45deg, #13315C 0%, #0B2545 50%, #1B4173 100%);
  --bg-gradient-3: radial-gradient(circle at 20% 50%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
                    radial-gradient(circle at 80% 80%, rgba(11, 37, 69, 0.3) 0%, transparent 50%);

  /* Text Gradients */
  --text-gradient-gold: linear-gradient(135deg, #D4AF37 0%, #F2D475 50%, #FFD700 100%);
  --text-gradient-primary: linear-gradient(135deg, #0B2545 0%, #1B4173 100%);
  --text-gradient-vibrant: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* Animation Easings */
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out-cubic: cubic-bezier(0.645, 0.045, 0.355, 1);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Dark Theme Enhancements */
[data-theme="dark"] {
  --glass-bg: rgba(11, 37, 69, 0.1);
  --glass-border: rgba(212, 175, 55, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);

  --gradient-mesh-1: radial-gradient(at 40% 20%, hsla(235, 77%, 10%, 1) 0px, transparent 50%),
                      radial-gradient(at 80% 0%, hsla(45, 74%, 54%, 0.2) 0px, transparent 50%),
                      radial-gradient(at 0% 50%, hsla(235, 77%, 15%, 0.7) 0px, transparent 50%),
                      radial-gradient(at 80% 50%, hsla(45, 74, 54%, 0.15) 0px, transparent 50%);
}

/* ============================================
   Glassmorphic Components
   ============================================ */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--glass-shadow);
  transition: all 0.4s var(--ease-out-expo);
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--glass-shadow), var(--shadow-glow);
  border-color: rgba(212, 175, 55, 0.4);
}

.glass-panel {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--spacing-8);
}

/* ============================================
   Neumorphic Design
   ============================================ */
.neuro-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-neumorphic);
  padding: var(--spacing-8);
  transition: all 0.3s var(--ease-in-out-cubic);
}

.neuro-card:hover {
  box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.15),
              -8px -8px 16px rgba(255, 255, 255, 0.08);
}

.neuro-button {
  background: var(--color-bg-secondary);
  border: none;
  border-radius: var(--radius-full);
  box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.2),
              -6px -6px 12px rgba(255, 255, 255, 0.05);
  padding: var(--spacing-4) var(--spacing-8);
  cursor: pointer;
  transition: all 0.2s ease;
}

.neuro-button:active {
  box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.2),
              inset -4px -4px 8px rgba(255, 255, 255, 0.05);
}

/* ============================================
   Modern Gradient Backgrounds
   ============================================ */
.gradient-mesh-bg {
  position: relative;
  background: var(--color-bg);
  overflow: hidden;
}

.gradient-mesh-bg::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-mesh-1);
  opacity: 1;
  animation: meshMove 20s ease-in-out infinite;
  z-index: 0;
}

.gradient-mesh-bg > * {
  position: relative;
  z-index: 1;
}

@keyframes meshMove {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(30px, -50px) scale(1.1);
  }
  66% {
    transform: translate(-20px, 20px) scale(0.95);
  }
}

/* ============================================
   Animated Gradient Blob
   ============================================ */
.blob-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  animation: blobFloat 20s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation-delay: 0s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(11, 37, 69, 0.3) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation-delay: -10s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(139, 69, 19, 0.3) 0%, transparent 70%);
  top: 50%;
  right: 20%;
  animation-delay: -5s;
}

@keyframes blobFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  33% {
    transform: translate(30px, -50px) rotate(120deg);
  }
  66% {
    transform: translate(-20px, 20px) rotate(240deg);
  }
}

/* ============================================
   3D Card Effects
   ============================================ */
.card-3d {
  position: relative;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: all 0.6s var(--ease-out-expo);
}

.card-3d:hover {
  transform: rotateX(5deg) rotateY(5deg) scale(1.05);
}

.card-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, transparent 100%);
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.card-3d:hover::before {
  opacity: 1;
}

/* ============================================
   Gradient Text Effects
   ============================================ */
.text-gradient {
  background: var(--text-gradient-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
  animation: gradientShift 3s ease infinite;
  background-size: 200% 200%;
}

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

.text-glow {
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.5),
               0 0 40px rgba(212, 175, 55, 0.3);
}

/* ============================================
   Magnetic Button Effect
   ============================================ */
.btn-magnetic {
  position: relative;
  overflow: hidden;
  transition: all 0.3s var(--ease-out-expo);
}

.btn-magnetic::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-magnetic:hover::before {
  width: 300px;
  height: 300px;
}

.btn-magnetic:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-elevated), var(--shadow-glow);
}

/* ============================================
   Floating Animation
   ============================================ */
.floating {
  animation: floating 3s ease-in-out infinite;
}

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

.floating-slow {
  animation: floating 6s ease-in-out infinite;
}

/* ============================================
   Particle Background
   ============================================ */
.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.8) 0%, transparent 70%);
  border-radius: 50%;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) translateX(var(--x-drift, 0)) scale(1);
    opacity: 0;
  }
}

/* ============================================
   Bento Grid Layout
   ============================================ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-6);
  grid-auto-rows: 200px;
  margin: var(--spacing-12) 0;
}

.bento-item {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-6);
  transition: all 0.4s var(--ease-out-expo);
  position: relative;
  overflow: hidden;
}

.bento-item:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-elevated), var(--shadow-glow);
}

.bento-item-large {
  grid-column: span 2;
  grid-row: span 2;
}

.bento-item-tall {
  grid-row: span 2;
}

.bento-item-wide {
  grid-column: span 2;
}

/* ============================================
   Modern Navigation
   ============================================ */
.nav-modern {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.nav-link-modern {
  position: relative;
  padding: var(--spacing-3) var(--spacing-5);
  transition: all 0.3s var(--ease-out-expo);
}

.nav-link-modern::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--color-secondary-gradient);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease-out-expo);
}

.nav-link-modern:hover::after,
.nav-link-modern.active::after {
  width: 80%;
}

/* ============================================
   Hover Reveal Effects
   ============================================ */
.hover-reveal {
  position: relative;
  overflow: hidden;
}

.hover-reveal::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  border-radius: 50%;
  pointer-events: none;
}

.hover-reveal:hover::before {
  width: 500px;
  height: 500px;
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-base);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ============================================
   Scroll Reveal Animations
   ============================================ */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s var(--ease-out-expo);
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.scroll-reveal-left {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s var(--ease-out-expo);
}

.scroll-reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.scroll-reveal-right {
  opacity: 0;
  transform: translateX(50px);
  transition: all 0.8s var(--ease-out-expo);
}

.scroll-reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   Custom Cursor
   ============================================ */
.custom-cursor {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-secondary);
  border-radius: 50%;
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  transition: all 0.15s ease;
  mix-blend-mode: difference;
}

.custom-cursor.hover {
  transform: scale(2);
  background: rgba(212, 175, 55, 0.2);
}

/* ============================================
   Responsive Adjustments
   ============================================ */

/* Tablet Adjustments */
@media (max-width: 1024px) {
  .hero {
    min-height: auto !important;
    padding: var(--spacing-12) 0 !important;
  }

  .hero .container > div {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-8) !important;
  }

  .hero .floating {
    max-width: 500px;
    margin: 0 auto;
  }

  .card-3d:hover {
    transform: translateY(-4px) scale(1.02) !important;
  }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  /* Hide custom cursor on mobile */
  .custom-cursor {
    display: none;
  }

  /* Bento Grid Mobile */
  .bento-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
    gap: var(--spacing-4);
  }

  .bento-item-large,
  .bento-item-tall,
  .bento-item-wide {
    grid-column: span 1;
    grid-row: span 1;
    min-height: 250px;
  }

  .bento-item {
    padding: var(--spacing-5);
  }

  /* Hero Mobile Adjustments */
  .hero {
    min-height: auto !important;
    padding: var(--spacing-10) 0 !important;
  }

  .hero .glass-card {
    height: auto !important;
    min-height: 300px !important;
  }

  .hero .tech-icon-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--spacing-4) !important;
  }

  /* Stats Grid Mobile */
  .bento-item-wide > div {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-4) !important;
  }

  /* Services Mobile */
  .services-preview > div > div:last-child {
    grid-template-columns: 1fr !important;
    gap: var(--spacing-6) !important;
  }

  .card-3d {
    min-height: 350px !important;
    padding: var(--spacing-6) !important;
  }

  /* Disable 3D effects on mobile */
  .card-3d:hover {
    transform: translateY(-4px) !important;
  }

  /* Blobs - reduce size and blur on mobile */
  .blob {
    filter: blur(60px);
  }

  .blob-1,
  .blob-2,
  .blob-3 {
    width: 250px;
    height: 250px;
  }

  /* Reduce particle count on mobile */
  .particle:nth-child(n+15) {
    display: none;
  }

  /* Glass Panel Mobile */
  .glass-panel {
    padding: var(--spacing-6) !important;
  }

  /* CTA Section Mobile */
  .cta-section .glass-panel {
    padding: var(--spacing-8) !important;
  }

  .cta-section .btn-large {
    width: 100%;
    justify-content: center;
  }

  /* Text Gradient Mobile - ensure readability */
  .text-gradient {
    -webkit-text-fill-color: var(--color-primary);
    background: none;
  }

  [data-theme="dark"] .text-gradient {
    -webkit-text-fill-color: var(--color-secondary);
  }

  /* Magnetic buttons - disable on mobile */
  .btn-magnetic:hover {
    transform: translateY(-4px) !important;
  }

  /* Floating animation - reduce on mobile */
  .floating {
    animation: floating 8s ease-in-out infinite;
  }

  /* Floating slow - add missing mobile optimization */
  .floating-slow {
    animation: floating 12s ease-in-out infinite;
  }

  /* CRITICAL FIX: Disable mesh gradient animation on mobile */
  .gradient-mesh-bg::before {
    animation: none !important;
    transform: translate(0, 0) scale(1) !important;
  }

  /* CRITICAL FIX: Disable blob animations on mobile */
  .blob,
  .blob-1,
  .blob-2,
  .blob-3 {
    animation: none !important;
  }

  /* CRITICAL FIX: Reduce backdrop-filter blur */
  .glass-card,
  .glass-panel,
  .bento-item {
    backdrop-filter: blur(5px) !important;
    -webkit-backdrop-filter: blur(5px) !important;
  }

  /* CRITICAL FIX: Optimize particle performance */
  .particle {
    animation-duration: 15s !important;
  }

  .particle:nth-child(n+10) {
    display: none !important;
  }

  /* CRITICAL FIX: Disable parallax on mobile */
  [data-parallax] {
    transform: none !important;
  }

  /* CRITICAL FIX: Simplify hover reveal */
  .hover-reveal::before {
    display: none !important;
  }

  /* CRITICAL FIX: Performance hints */
  .blob,
  .particle,
  .gradient-mesh-bg::before {
    will-change: auto !important;
  }

  /* Contact info - stack on mobile */
  .cta-section a[href^="mailto"],
  .cta-section a[href^="tel"] {
    font-size: var(--font-size-sm) !important;
  }
}

/* Small Mobile Adjustments */
@media (max-width: 480px) {
  /* Further reduce spacing */
  .hero,
  .features,
  .services-preview,
  .cta-section {
    padding: var(--spacing-8) 0 !important;
  }

  /* Trust indicators - stack vertically */
  .hero-content > div:last-child {
    flex-direction: column !important;
    gap: var(--spacing-4) !important;
  }

  /* Reduce font sizes */
  .text-gradient,
  .hero-title {
    font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
  }

  /* Glass card adjustments */
  .glass-card {
    padding: var(--spacing-5) !important;
  }

  /* Hide decorative elements on very small screens */
  .blob-3 {
    display: none;
  }

  /* Service cards - reduce padding */
  .card-3d {
    min-height: 300px !important;
    padding: var(--spacing-5) !important;
  }

  /* Bento items - adjust height */
  .bento-item {
    min-height: 200px !important;
  }

  .bento-item-large {
    min-height: 300px !important;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto !important;
    padding: var(--spacing-8) 0 !important;
  }

  .hero .container > div {
    grid-template-columns: 1fr 1fr !important;
    align-items: center;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Disable hover animations on touch devices */
  .card-3d:hover,
  .btn-magnetic:hover,
  .hover-reveal:hover {
    transform: none !important;
    animation: none !important;
  }

  /* Use active states instead */
  .card-3d:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
  }

  .btn-magnetic:active {
    transform: scale(0.97) !important;
    transition: transform 0.1s ease !important;
  }

  .social-link:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
  }

  /* Disable ripple effects */
  .btn-magnetic::before,
  .hover-reveal::before {
    display: none !important;
  }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 768px) {
    /* iOS Mobile Safari - backdrop-filter causes performance issues */
    .glass-card,
    .glass-panel {
      backdrop-filter: none !important;
      -webkit-backdrop-filter: none !important;
      background: rgba(255, 255, 255, 0.98) !important;
    }

    [data-theme="dark"] .glass-card,
    [data-theme="dark"] .glass-panel {
      background: rgba(11, 37, 69, 0.98) !important;
    }

    /* Fix transform stuttering on iOS */
    .card-3d,
    .btn-magnetic {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
      -webkit-backface-visibility: hidden;
      backface-visibility: hidden;
    }
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .blob,
  .particle,
  .floating,
  .floating-slow,
  .scroll-reveal,
  .scroll-reveal-left,
  .scroll-reveal-right,
  .gradient-mesh-bg::before {
    animation: none !important;
  }

  .card-3d:hover {
    transform: none !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .glass-card,
  .glass-panel {
    border: 2px solid var(--color-border);
    background: var(--color-bg);
    backdrop-filter: none;
  }

  .text-gradient {
    -webkit-text-fill-color: var(--color-primary);
    background: none;
  }
}
