@tailwind base;
@tailwind components;
@tailwind utilities;

@layer utilities {
  .bg-pattern-gradient {
    background: 
      radial-gradient(rgba(255, 255, 255, 0.4) 2px, transparent 2px) 0 0 / 40px 40px,
      linear-gradient(180deg, #EAE5E2 0%, #CBE0D8 100%);
  }

  /* Glass effect with fallback for browsers without backdrop-filter */
  .glass {
    background: rgba(255, 255, 255, 0.85); /* opaque fallback */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  }
  @supports ((-webkit-backdrop-filter: blur(12px)) or (backdrop-filter: blur(12px))) {
    .glass {
      background: rgba(255, 255, 255, 0.7);
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
    }
  }

  .text-gradient {
    @apply bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary;
  }
}

/* =============================================
   OLDER DEVICE FALLBACKS
   Targets: Android 5+ (Chrome 45+), iOS 10+
   ============================================= */

/* -webkit-backdrop-filter prefix for iOS Safari 9–15 */
/* Applied globally to any element using Tailwind's backdrop-blur */
.backdrop-blur-md,
.backdrop-blur-sm {
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

/* aspect-ratio fallback for iOS < 15 & Chrome < 88 */
/* These provide padding-based aspect ratios as a fallback */
@supports not (aspect-ratio: 1 / 1) {
  .aspect-square {
    position: relative;
    height: 0 !important;
    padding-bottom: 100% !important;
    overflow: hidden;
  }
  .aspect-square > * {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  }
  .aspect-video {
    position: relative;
    height: 0 !important;
    padding-bottom: 56.25% !important;
    overflow: hidden;
  }
  .aspect-video > * {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  }
  .aspect-\[4\/5\] {
    position: relative;
    height: 0 !important;
    padding-bottom: 125% !important;
    overflow: hidden;
  }
  .aspect-\[4\/5\] > * {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  }
  .aspect-\[4\/3\] {
    position: relative;
    height: 0 !important;
    padding-bottom: 75% !important;
    overflow: hidden;
  }
  .aspect-\[4\/3\] > * {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  }
  .aspect-\[3\/4\] {
    position: relative;
    height: 0 !important;
    padding-bottom: 133.33% !important;
    overflow: hidden;
  }
  .aspect-\[3\/4\] > * {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
  }
}

/* Animations */
.fade-up {
  opacity: 0;
  -webkit-transform: translateY(30px);
  transform: translateY(30px);
  -webkit-transition: opacity 0.8s ease-out, -webkit-transform 0.8s ease-out;
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-up.visible {
  opacity: 1;
  -webkit-transform: translateY(0);
  transform: translateY(0);
}

.delay-100 { -webkit-transition-delay: 100ms; transition-delay: 100ms; }
.delay-200 { -webkit-transition-delay: 200ms; transition-delay: 200ms; }
.delay-300 { -webkit-transition-delay: 300ms; transition-delay: 300ms; }

/* Custom blob backgrounds */
.bg-blob {
  position: absolute;
  -webkit-filter: blur(80px);
  filter: blur(80px);
  z-index: -1;
  border-radius: 50%;
  -webkit-animation: float 10s infinite ease-in-out alternate;
  animation: float 10s infinite ease-in-out alternate;
  opacity: 0.6;
  will-change: transform;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

@-webkit-keyframes float {
  0% { -webkit-transform: translate(0, 0) scale(1); transform: translate(0, 0) scale(1); }
  50% { -webkit-transform: translate(30px, -30px) scale(1.05); transform: translate(30px, -30px) scale(1.05); }
  100% { -webkit-transform: translate(-30px, 30px) scale(0.95); transform: translate(-30px, 30px) scale(0.95); }
}
@keyframes float {
  0% { -webkit-transform: translate(0, 0) scale(1); transform: translate(0, 0) scale(1); }
  50% { -webkit-transform: translate(30px, -30px) scale(1.05); transform: translate(30px, -30px) scale(1.05); }
  100% { -webkit-transform: translate(-30px, 30px) scale(0.95); transform: translate(-30px, 30px) scale(0.95); }
}

/* Fallback for backdrop-blur on header/cards — make backgrounds more opaque
   on browsers that don't support backdrop-filter */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  #main-header {
    background: rgba(10, 15, 26, 0.98) !important;
  }
  .bg-white\/80 {
    background: rgba(255, 255, 255, 0.95) !important;
  }
  .bg-white\/70 {
    background: rgba(255, 255, 255, 0.92) !important;
  }
}
