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

body {
  overflow-x: hidden;
}

/* Scroll Reveal - Progressive Enhancement */
@media (prefers-reduced-motion: no-preference) {
  .scroll-reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
  }
  
  /* Stagger children */
  .scroll-reveal:nth-child(1) { transition-delay: 0.05s; }
  .scroll-reveal:nth-child(2) { transition-delay: 0.1s; }
  .scroll-reveal:nth-child(3) { transition-delay: 0.15s; }
  .scroll-reveal:nth-child(4) { transition-delay: 0.2s; }
  .scroll-reveal:nth-child(5) { transition-delay: 0.25s; }
  .scroll-reveal:nth-child(6) { transition-delay: 0.3s; }
}

/* Navbar scroll state */
.nav-scrolled #navbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
}

.nav-scrolled .nav-logo-text {
  color: #0f172a;
}

.nav-scrolled .nav-logo-sub {
  color: #64748b;
}

/* Smooth anchor offsets for fixed nav */
section[id] {
  scroll-margin-top: 80px;
}

/* Selection color */
::selection {
  background: #99f6e4;
  color: #134e4a;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Mobile menu transitions */
#mobile-menu {
  animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero text animation on load */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#hero .relative z-10 > div > div > * {
  animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#hero .relative z-10 > div > div > :nth-child(1) { animation-delay: 0.1s; }
#hero .relative z-10 > div > div > :nth-child(2) { animation-delay: 0.2s; }
#hero .relative z-10 > div > div > :nth-child(3) { animation-delay: 0.35s; }
#hero .relative z-10 > div > div > :nth-child(4) { animation-delay: 0.5s; }
#hero .relative z-10 > div > div > :nth-child(5) { animation-delay: 0.65s; }

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .scroll-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #hero .relative z-10 > div > div > * {
    animation: none;
  }
}
