/* Advanced Sticky Header with Auto-Hide Functionality */

/* Header Base Styles */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(45, 122, 62, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.3s ease,
              box-shadow 0.3s ease;
  will-change: transform;
  contain: layout style paint;
}

/* Header States */
.header.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header.hidden {
  transform: translateY(-100%);
}

.header.visible {
  transform: translateY(0);
}

/* Header Content */
.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  height: 70px;
}

/* Logo Styles */
.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #2d7a3e;
  font-weight: 700;
  font-size: 1.5rem;
  transition: color 0.3s ease;
}

.header-logo:hover {
  color: #4caf50;
}

.header-logo img {
  height: 40px;
  width: auto;
  margin-left: 0.5rem;
}

/* Navigation Styles */
.header-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  position: relative;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.nav-link:hover {
  color: #2d7a3e;
  background: rgba(45, 122, 62, 0.1);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #2d7a3e;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 80%;
}

/* CTA Button */
.header-cta {
  background: linear-gradient(135deg, #2d7a3e 0%, #4caf50 100%);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(45, 122, 62, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}

.header-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(45, 122, 62, 0.4);
  color: white;
}

.header-cta:active {
  transform: translateY(0);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 4px;
}

.mobile-menu-toggle span {
  width: 25px;
  height: 3px;
  background: #333;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile Navigation */
.mobile-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(45, 122, 62, 0.1);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.mobile-nav.active {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
  list-style: none;
  margin: 0;
}

.mobile-nav-item {
  border-bottom: 1px solid rgba(45, 122, 62, 0.1);
}

.mobile-nav-link {
  display: block;
  padding: 1rem 2rem;
  color: #333;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.mobile-nav-link:hover {
  background: rgba(45, 122, 62, 0.1);
  color: #2d7a3e;
}

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

/* Scroll Offset for Fixed Header */
.section {
  scroll-margin-top: 80px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    padding: 1rem;
    height: 60px;
  }
  
  .header-nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .header-cta {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .header-logo {
    font-size: 1.25rem;
  }
  
  .header-logo img {
    height: 35px;
  }
}

@media (max-width: 480px) {
  .header-content {
    padding: 0.75rem;
  }
  
  .header-cta {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }
}

/* Focus States for Accessibility */
.nav-link:focus,
.header-cta:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid #2d7a3e;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .header {
    background: white;
    border-bottom: 2px solid #000;
  }
  
  .nav-link {
    color: #000;
  }
  
  .nav-link:hover {
    background: #000;
    color: #fff;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .header,
  .nav-link,
  .header-cta,
  .mobile-nav,
  .mobile-menu-toggle span {
    transition: none;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Print Styles */
@media print {
  .header {
    position: static;
    background: white;
    box-shadow: none;
    border-bottom: 1px solid #000;
  }
  
  .mobile-menu-toggle,
  .header-cta {
    display: none;
  }
}