/* Video Background Styles for Hero Section */

/* Video container and positioning */
.video-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

/* Video element styling */
.video-background video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: -1;
}

/* Fallback image for browsers that don't support video */
.video-background .fallback-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

/* Enhanced overlay for better text readability over video */
.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1;
}

/* Hero section specific adjustments */
#heroSection {
  position: relative;
  overflow: hidden;
  /* Add top padding to account for fixed header height */
  /* Top nav bar (8px padding * 2) + main nav with logo (85px) + some buffer = ~110px */
  padding-bottom: 0 !important;
  /* Ensure no margin spacing */
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Ensure navigation has no bottom margin */
.main-nav {
  margin-bottom: 0 !important;
}

/* Ensure body has no margin/padding that could affect layout */
body {
  margin: 0 !important;
  padding: 0 !important;
}

#heroSection .position_relative {
  position: relative;
  z-index: 2;
}

/* Responsive adjustments for different screen sizes */
@media screen and (max-width: 1024px) {
  .video-background video {
    /* Ensure video covers the container on tablets */
    min-width: 120%;
    min-height: 120%;
  }
  
  /* Adjust hero section padding for tablet screens */
  #heroSection {
    padding-top: 100px !important;
  }
}

@media screen and (max-width: 768px) {
  .video-background video {
    /* Optimize for mobile devices */
    min-width: 150%;
    min-height: 150%;
  }
  
  /* On mobile, we might want to pause video to save bandwidth */
  .video-background video {
    display: none;
  }
  
  .video-background .fallback-image {
    display: block;
  }
  
  /* Adjust hero section padding for mobile screens */
  #heroSection {
    padding-top: 90px !important;
  }
}

@media screen and (max-width: 480px) {
  /* Ensure fallback image is always shown on very small screens */
  .video-background video {
    display: none !important;
  }
  
  .video-background .fallback-image {
    display: block !important;
  }
}

/* Accessibility: Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .video-background video {
    display: none;
  }
  
  .video-background .fallback-image {
    display: block;
  }
}

/* Performance optimization: Hide video on slow connections */
@media (prefers-reduced-data: reduce) {
  .video-background video {
    display: none;
  }
  
  .video-background .fallback-image {
    display: block;
  }
}

/* Loading state */
.video-background.loading video {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.video-background.loaded video {
  opacity: 1;
}

/* Ensure proper stacking context */
.video-background {
  isolation: isolate;
}

/* Additional styling for better video presentation */
.video-background video {
  filter: brightness(0.8) contrast(1.1);
}

/* Print styles - hide video background */
@media print {
  .video-background {
    display: none;
  }
}