/* Custom styles for Manzanola Rural Fire Protection District */

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom selection color */
::selection {
  background-color: #273a22;
  color: #faf9f6;
}

/* Navbar transition */
#navbar {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#navbar.scrolled {
  background-color: rgba(15, 23, 12, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

#navbar:not(.scrolled) {
  background-color: transparent;
}

/* Mobile menu animations */
.mobile-link {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#mobileMenu.open {
  opacity: 1;
  pointer-events: all;
}

#mobileMenu.closed {
  opacity: 0;
  pointer-events: none;
}

#mobileMenu.open .mobile-link {
  opacity: 1;
  transform: translateY(0);
}

#mobileMenu.closed .mobile-link {
  opacity: 0;
  transform: translateY(10px);
}

#mobileMenu.open .mobile-link:nth-child(1) { transition-delay: 0.05s; }
#mobileMenu.open .mobile-link:nth-child(2) { transition-delay: 0.1s; }
#mobileMenu.open .mobile-link:nth-child(3) { transition-delay: 0.15s; }
#mobileMenu.open .mobile-link:nth-child(4) { transition-delay: 0.2s; }

/* Menu button animations */
.menu-line {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#menuBtn.active .menu-line:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

#menuBtn.active .menu-line:nth-child(2) {
  opacity: 0;
  transform: translateX(8px);
}

#menuBtn.active .menu-line:nth-child(3) {
  width: 6;
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Service card hover effects */
.service-card {
  border: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.service-card:hover {
  border-color: rgba(39, 58, 34, 0.1);
}

/* Scroll reveal animations (below the fold only) */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Staggered reveal delays */
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .service-card {
    transition: none;
  }

  .service-card:hover {
    transform: none;
  }
}

/* Focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #273a22;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Image aspect ratios to prevent layout shift */
img {
  max-width: 100%;
  height: auto;
}

/* Print styles */
@media print {
  #navbar,
  #mobileMenu,
  .service-card,
  footer {
    display: none;
  }

  body {
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}

/* Subtle grain texture overlay for hero */
#hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

#hero > * {
  position: relative;
  z-index: 2;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f3ed;
}

::-webkit-scrollbar-thumb {
  background: #9bb490;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #547648;
}

/* Form focus states */
input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 3px rgba(39, 58, 34, 0.1);
}
