  /* ========================================================
   GENERALIZED MONOCHROMATIC COSMIC BACKGROUND
   Reusable cosmic starfield effect for any section
   Apply class "cosmic-section" to any section element
   ======================================================== */

/* ========== Base Cosmic Section Styling ========== */
.cosmic-section {
  position: relative;
  overflow: hidden;
  background: 
    radial-gradient(ellipse at 20% 30%, rgba(147, 197, 253, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(191, 219, 254, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(42, 42, 42, 0.3) 0%, transparent 60%),
    linear-gradient(135deg, #111827 0%, #1F1F1F 50%, #2A2A2A 100%);
  animation: cosmicPulse 15s ease-in-out infinite;
  box-shadow: inset 0 0 200px rgba(0, 0, 0, 0.3);
}

/* ========== Asymmetric Rotated Rectangle Containers ========== */
.cosmic-rect {
  position: absolute;
  border: 2px solid rgba(209, 213, 219, 0.15);
  border-radius: 20px;
  pointer-events: none;
  z-index: 1;
  will-change: transform;
  box-shadow: 0 0 20px rgba(147, 197, 253, 0.05);
}

/* Rectangle 1 - Top Left */
.cosmic-rect-1 {
  width: 400px;
  height: 300px;
  top: -100px;
  left: -150px;
  transform: rotate(-25deg);
  background: rgba(75, 75, 75, 0.05);
  animation: floatRotate1 8s ease-in-out infinite;
  opacity: 0.9;
}

/* Enhanced Starfield Background - ::before pseudo-element */
.cosmic-rect-1::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    /* Large bright stars - mostly white with subtle cyan accent */
    radial-gradient(3px 3px at 20% 30%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.4) 40%, transparent),
    radial-gradient(2.5px 2.5px at 60% 70%, rgba(147, 197, 253, 0.6), rgba(147, 197, 253, 0.3) 40%, transparent),
    radial-gradient(2px 2px at 80% 10%, rgba(209, 213, 219, 0.8), rgba(209, 213, 219, 0.4) 40%, transparent),
    /* Medium stars - grayscale */
    radial-gradient(2px 2px at 50% 50%, rgba(229, 231, 235, 0.7), transparent),
    radial-gradient(2px 2px at 90% 60%, rgba(209, 213, 219, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 15% 85%, rgba(243, 244, 246, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 75% 25%, rgba(147, 197, 253, 0.4), transparent),
    /* Small distant stars - subtle whites */
    radial-gradient(1px 1px at 33% 80%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1px 1px at 45% 15%, rgba(229, 231, 235, 0.5), transparent),
    radial-gradient(1px 1px at 88% 88%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 12% 45%, rgba(209, 213, 219, 0.5), transparent),
    radial-gradient(1px 1px at 67% 92%, rgba(243, 244, 246, 0.4), transparent);
  background-size: 200% 200%, 200% 200%, 200% 200%, 150% 150%, 150% 150%, 180% 180%, 180% 180%, 120% 120%, 120% 120%, 120% 120%, 120% 120%, 120% 120%;
  background-position: 0% 0%, 40% 40%, 80% 80%, 20% 60%, 60% 20%, 90% 90%, 30% 50%, 70% 10%, 50% 75%, 85% 35%, 10% 20%, 95% 65%;
  opacity: 0.6;
  animation: starfield-twinkle-enhanced 5s ease-in-out infinite;
  will-change: opacity, transform;
}

/* Enhanced Rotating Galaxy Nebula - ::after pseudo-element */
.cosmic-rect-1::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 180px;
  height: 180px;
  background: 
    radial-gradient(
      ellipse at 30% 30%,
      rgba(147, 197, 253, 0.15) 0%,
      rgba(107, 114, 128, 0.12) 15%,
      rgba(75, 75, 75, 0.08) 30%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at 70% 70%,
      rgba(156, 163, 175, 0.12) 0%,
      rgba(147, 197, 253, 0.08) 20%,
      transparent 50%
    );
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(60deg);
  animation: galaxyFlow 20s linear infinite, nebulaPulse 8s ease-in-out infinite;
  filter: blur(30px);
  will-change: transform, opacity;
  box-shadow: 
    0 0 50px rgba(147, 197, 253, 0.1),
    0 0 100px rgba(107, 114, 128, 0.05),
    inset 0 0 50px rgba(75, 75, 75, 0.08);
}

/* Rectangle 2 - Bottom Right */
.cosmic-rect-2 {
  width: 500px;
  height: 350px;
  bottom: -120px;
  right: -180px;
  transform: rotate(35deg);
  background: rgba(107, 114, 128, 0.05);
  animation: floatRotate2 10s ease-in-out infinite;
  opacity: 0.9;
}

.cosmic-rect-2::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    /* Large bright stars - grayscale with subtle cyan */
    radial-gradient(3px 3px at 25% 25%, rgba(147, 197, 253, 0.5), rgba(147, 197, 253, 0.25) 40%, transparent),
    radial-gradient(2.5px 2.5px at 75% 75%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4) 40%, transparent),
    radial-gradient(2px 2px at 50% 10%, rgba(209, 213, 219, 0.7), transparent),
    /* Medium stars */
    radial-gradient(2px 2px at 10% 60%, rgba(229, 231, 235, 0.6), transparent),
    radial-gradient(2px 2px at 85% 40%, rgba(243, 244, 246, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(147, 197, 253, 0.4), transparent),
    radial-gradient(1.5px 1.5px at 65% 35%, rgba(255, 255, 255, 0.5), transparent),
    /* Small stars */
    radial-gradient(1px 1px at 15% 15%, rgba(209, 213, 219, 0.5), transparent),
    radial-gradient(1px 1px at 90% 85%, rgba(229, 231, 235, 0.4), transparent),
    radial-gradient(1px 1px at 55% 55%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 30% 90%, rgba(243, 244, 246, 0.4), transparent);
  background-size: 250% 250%, 250% 250%, 200% 200%, 180% 180%, 180% 180%, 160% 160%, 160% 160%, 120% 120%, 120% 120%, 120% 120%, 120% 120%;
  background-position: 0% 0%, 50% 50%, 100% 0%, 0% 100%, 100% 100%, 25% 75%, 75% 25%, 10% 40%, 90% 60%, 60% 90%, 40% 20%;
  opacity: 0.6;
  animation: starfield-twinkle-enhanced 6s ease-in-out infinite reverse;
  will-change: opacity, transform;
}

.cosmic-rect-2::after {
  content: '';
  position: absolute;
  top: 40%;
  left: 40%;
  width: 200px;
  height: 200px;
  background: 
    radial-gradient(
      ellipse at 40% 40%,
      rgba(107, 114, 128, 0.15) 0%,
      rgba(147, 197, 253, 0.1) 20%,
      rgba(156, 163, 175, 0.08) 40%,
      transparent 70%
    ),
    radial-gradient(
      ellipse at 60% 60%,
      rgba(75, 75, 75, 0.12) 0%,
      rgba(107, 114, 128, 0.08) 25%,
      transparent 55%
    );
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(45deg);
  animation: galaxyFlow 25s linear infinite reverse, nebulaPulse 10s ease-in-out infinite;
  filter: blur(32px);
  will-change: transform, opacity;
  box-shadow: 
    0 0 60px rgba(147, 197, 253, 0.08),
    0 0 110px rgba(107, 114, 128, 0.05),
    inset 0 0 60px rgba(75, 75, 75, 0.08);
}

/* Rectangle 3 - Middle Center */
.cosmic-rect-3 {
  width: 450px;
  height: 320px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(15deg);
  background: rgba(156, 163, 175, 0.04);
  animation: floatRotate3 9s ease-in-out infinite;
  opacity: 0.9;
}

.cosmic-rect-3::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    /* Large bright stars - white and subtle cyan */
    radial-gradient(3px 3px at 15% 85%, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.4) 40%, transparent),
    radial-gradient(2.5px 2.5px at 65% 25%, rgba(147, 197, 253, 0.5), rgba(147, 197, 253, 0.25) 40%, transparent),
    radial-gradient(2px 2px at 45% 65%, rgba(229, 231, 235, 0.7), transparent),
    /* Medium stars - grayscale */
    radial-gradient(2px 2px at 85% 85%, rgba(243, 244, 246, 0.6), transparent),
    radial-gradient(2px 2px at 35% 15%, rgba(209, 213, 219, 0.6), transparent),
    radial-gradient(1.5px 1.5px at 72% 48%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 28% 52%, rgba(147, 197, 253, 0.4), transparent),
    /* Small stars */
    radial-gradient(1px 1px at 92% 12%, rgba(229, 231, 235, 0.5), transparent),
    radial-gradient(1px 1px at 8% 38%, rgba(243, 244, 246, 0.4), transparent),
    radial-gradient(1px 1px at 58% 88%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(1px 1px at 42% 32%, rgba(209, 213, 219, 0.4), transparent);
  background-size: 300% 300%, 300% 300%, 250% 250%, 200% 200%, 200% 200%, 180% 180%, 180% 180%, 130% 130%, 130% 130%, 130% 130%, 130% 130%;
  background-position: 20% 20%, 80% 80%, 50% 50%, 10% 90%, 90% 10%, 65% 35%, 35% 65%, 85% 15%, 15% 45%, 55% 85%, 45% 25%;
  opacity: 0.6;
  animation: starfield-twinkle-enhanced 7s ease-in-out infinite;
  will-change: opacity, transform;
}

.cosmic-rect-3::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220px;
  height: 220px;
  background: 
    radial-gradient(
      ellipse at 35% 35%,
      rgba(156, 163, 175, 0.12) 0%,
      rgba(147, 197, 253, 0.1) 25%,
      rgba(107, 114, 128, 0.08) 50%,
      transparent 75%
    ),
    radial-gradient(
      ellipse at 65% 65%,
      rgba(147, 197, 253, 0.1) 0%,
      rgba(156, 163, 175, 0.08) 30%,
      transparent 60%
    );
  border-radius: 50%;
  transform: translate(-50%, -50%) rotateX(30deg);
  animation: galaxyFlow 18s linear infinite, nebulaPulse 9s ease-in-out infinite;
  filter: blur(32px);
  will-change: transform, opacity;
  box-shadow: 
    0 0 55px rgba(147, 197, 253, 0.08),
    0 0 105px rgba(107, 114, 128, 0.05),
    inset 0 0 55px rgba(75, 75, 75, 0.08);
}

/* ========== Animations ========== */

/* Cosmic Pulse Animation for Background */
@keyframes cosmicPulse {
  0%, 100% {
    filter: brightness(1) contrast(1);
  }
  50% {
    filter: brightness(1.05) contrast(1.02);
  }
}

/* Galaxy Flow Animation - 360° Rotation */
@keyframes galaxyFlow {
  0% {
    transform: translate(-50%, -50%) rotateX(60deg) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotateX(60deg) rotate(360deg);
  }
}

/* Nebula Pulse Animation */
@keyframes nebulaPulse {
  0%, 100% {
    opacity: 1;
    filter: blur(30px) brightness(1);
  }
  50% {
    opacity: 0.85;
    filter: blur(35px) brightness(1.1);
  }
}

/* Enhanced Starfield Twinkle Animation */
@keyframes starfield-twinkle-enhanced {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  25% {
    opacity: 0.8;
    transform: scale(1.08);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.96);
  }
  75% {
    opacity: 0.9;
    transform: scale(1.04);
  }
}

/* Float and Rotate Animations for Rectangles */
@keyframes floatRotate1 {
  0%, 100% {
    transform: rotate(-25deg) translateY(0px) translateX(0px);
  }
  25% {
    transform: rotate(-22deg) translateY(-15px) translateX(10px);
  }
  50% {
    transform: rotate(-28deg) translateY(-8px) translateX(-5px);
  }
  75% {
    transform: rotate(-23deg) translateY(12px) translateX(8px);
  }
}

@keyframes floatRotate2 {
  0%, 100% {
    transform: rotate(35deg) translateY(0px) translateX(0px);
  }
  30% {
    transform: rotate(38deg) translateY(18px) translateX(-12px);
  }
  60% {
    transform: rotate(32deg) translateY(-10px) translateX(15px);
  }
  80% {
    transform: rotate(37deg) translateY(8px) translateX(-8px);
  }
}

@keyframes floatRotate3 {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(15deg) translateY(0px);
  }
  33% {
    transform: translate(-50%, -50%) rotate(18deg) translateY(-20px);
  }
  66% {
    transform: translate(-50%, -50%) rotate(12deg) translateY(15px);
  }
}

/* ========== Content Layer Adjustments ========== */

/* Ensure content is above cosmic background */
.cosmic-section .container {
  position: relative;
  z-index: 10;
}

/* Adjust text colors for cosmic background */
.cosmic-section .section-title,
.cosmic-section .section-subtitle,
.cosmic-section h1,
.cosmic-section h2,
.cosmic-section h3 {
  color: #F6F6F7;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.cosmic-section .badge,
.cosmic-section .inline-block {
  background: rgba(147, 197, 253, 0.15);
  border: 1px solid rgba(147, 197, 253, 0.3);
  color: #F6F6F7;
}

/* ========== Card Enhancements ========== */
.cosmic-section .info-card,
.cosmic-section .tech-provider-card,
.cosmic-section .industry-card {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(229, 231, 235, 0.3);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 1px rgba(147, 197, 253, 0.1);
}

.cosmic-section .info-card:hover,
.cosmic-section .tech-provider-card:hover,
.cosmic-section .industry-card:hover {
  border-color: rgba(147, 197, 253, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(147, 197, 253, 0.15);
  transform: translateY(-4px);
}

/* Keep card text dark for readability on white background */
.cosmic-section .info-card h3,
.cosmic-section .info-card .info-card-title,
.cosmic-section .info-card p,
.cosmic-section .info-card .info-card-description,
.cosmic-section .tech-provider-card h3,
.cosmic-section .tech-provider-card .tech-provider-name,
.cosmic-section .industry-card h3,
.cosmic-section .industry-card .info-card-title {
  color: inherit;
  text-shadow: none;
}

/* ========== Shooting Stars Effect ========== */
.cosmic-section::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 10%;
  width: 2px;
  height: 100px;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(229, 231, 235, 0.7) 50%,
    rgba(147, 197, 253, 0.6) 100%
  );
  border-radius: 50%;
  filter: blur(1px);
  animation: shootingStar 8s ease-in-out infinite;
  opacity: 0;
  z-index: 2;
  box-shadow: 0 0 8px rgba(147, 197, 253, 0.4);
}

/* Shooting Star Animation */
@keyframes shootingStar {
  0% {
    transform: translate(0, 0) rotate(-45deg);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  100% {
    transform: translate(300px, 300px) rotate(-45deg);
    opacity: 0;
  }
}

/* ========== Floating Cosmic Particles ========== */
.cosmic-section::after {
  content: '';
  position: absolute;
  top: 80%;
  left: 20%;
  width: 4px;
  height: 4px;
  background: radial-gradient(
    circle,
    rgba(229, 231, 235, 0.8) 0%,
    rgba(147, 197, 253, 0.4) 50%,
    transparent 100%
  );
  border-radius: 50%;
  animation: floatingParticles 12s ease-in-out infinite;
  opacity: 0;
  z-index: 2;
  box-shadow: 0 0 6px rgba(147, 197, 253, 0.3);
}

/* Floating Particles Animation */
@keyframes floatingParticles {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translate(100px, -150px) rotate(180deg);
    opacity: 0;
  }
}

/* ========== Responsive Adjustments ========== */
@media (max-width: 1024px) {
  .cosmic-rect-1,
  .cosmic-rect-2,
  .cosmic-rect-3 {
    width: 360px !important;
    height: 260px !important;
  }
}

@media (max-width: 768px) {
  .cosmic-rect-1,
  .cosmic-rect-2,
  .cosmic-rect-3 {
    width: 240px !important;
    height: 190px !important;
    opacity: 0.6;
  }

  .cosmic-rect-1::after,
  .cosmic-rect-2::after,
  .cosmic-rect-3::after {
    filter: blur(20px) !important;
  }

  /* Reduce animation complexity on mobile */
  .cosmic-rect {
    animation-duration: 30s !important;
  }

  .cosmic-rect::before {
    animation-duration: 8s !important;
  }

  /* Disable shooting stars on mobile for performance */
  .cosmic-section::before,
  .cosmic-section::after {
    display: none;
  }
}

@media (max-width: 480px) {
  .cosmic-rect-1,
  .cosmic-rect-2,
  .cosmic-rect-3 {
    opacity: 0.4;
  }

  .cosmic-rect-1::after,
  .cosmic-rect-2::after,
  .cosmic-rect-3::after {
    opacity: 0.5 !important;
    filter: blur(15px) !important;
  }
}

/* ========== Performance Optimizations ========== */
@media (prefers-reduced-motion: reduce) {
  .cosmic-section,
  .cosmic-rect,
  .cosmic-rect::before,
  .cosmic-rect::after,
  .cosmic-section::before,
  .cosmic-section::after {
    animation: none !important;
  }
}
