/* ─── Base & Utilities ─── */
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

::selection {
  background: rgba(22, 101, 52, 0.2);
  color: #064E3B;
}

/* ─── Hero Gradient ─── */
.hero-gradient {
  background: linear-gradient(
    135deg,
    #022c22 0%,
    #064E3B 25%,
    #166534 50%,
    #15803d 75%,
    #064E3B 100%
  );
}

/* ─── Scroll Reveal ─── */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal[data-reveal="delay-1"] { transition-delay: 0.1s; }
.reveal[data-reveal="delay-2"] { transition-delay: 0.2s; }
.reveal[data-reveal="delay-3"] { transition-delay: 0.3s; }

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(30px);
  }

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

/* ─── Card Elevation ─── */
.card-elevated {
  box-shadow: 0 1px 3px rgba(6, 78, 59, 0.04),
              0 4px 16px rgba(6, 78, 59, 0.04);
  transition: box-shadow 0.5s ease, transform 0.5s ease;
}

.card-elevated:hover {
  box-shadow: 0 4px 12px rgba(6, 78, 59, 0.08),
              0 12px 32px rgba(6, 78, 59, 0.08);
  transform: translateY(-4px);
}

/* ─── Header Scroll State ─── */
#site-header.scrolled {
  background: rgba(2, 44, 34, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(255, 251, 240, 0.06);
}

#site-header.scrolled .menu-line {
  background: #FFFBF0;
}

/* ─── Mobile Menu ─── */
#mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}

#mobile-menu.open .mobile-nav-link {
  animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Hamburger Animation ─── */
#menu-btn.active .menu-line:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

#menu-btn.active .menu-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

#menu-btn.active .menu-line:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
  width: 1.25rem;
}

/* ─── Subtle Grain Overlay (optional texture) ─── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' 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)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ─── Focus Styles ─── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ─── Smooth image loading ─── */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
