/* Scroll fixes to ensure proper scrolling behavior */

html {
  scroll-behavior: smooth;
  height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  overflow-x: hidden;
  /* Ensure proper spacing for fixed elements */
  padding-top: calc(var(--announcement-bar-height, 40px) + var(--navbar-height, 70px));
  /* Prevent scroll-locking issues */
  overflow-y: auto !important;
  position: relative;
  margin: 0;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Make sure images don't interfere with scrolling */
.hero-image {
  transition: opacity 1.5s ease-in-out;
}

/* Class to apply when hero has finished loading */
.hero-loaded .hero-image {
  opacity: 1;
}

/* Fixed navbar adjustments */
.navbar.fixed-top {
  position: fixed;
  top: var(--announcement-bar-height, 40px) !important;
  left: 0;
  right: 0;
  width: 100%;
  /* Fix for scrolling issues with fixed navbar */
  transform: none !important;
  will-change: auto;
  /* Ensure navbar doesn't jump during scrolling */
  backface-visibility: hidden;
  transition: top 0.2s ease-in-out;
  z-index: 1040;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Fix issue where clicking navbar links causes scroll position problems */
.navbar-nav .nav-link {
  position: relative;
  z-index: 1045;
}

/* Announcement bar fixes */
.announcement-bar {
  position: fixed;
  top: 0 !important;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1041;
  transform: none !important;
  will-change: auto;
  backface-visibility: hidden;
}

/* Ensure content is not hidden under fixed elements */
main {
  position: relative;
  z-index: 1;
}

/* Fix for anchor links and scroll positioning */
:target {
  scroll-margin-top: calc(var(--announcement-bar-height, 40px) + var(--navbar-height, 70px) + 20px);
}
