/* Base & Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  overflow-x: hidden;
}

/* Scroll Reveal - Progressive Enhancement */
@media (prefers-reduced-motion: no-preference) {
  .scroll-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  }

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

  .scroll-reveal:nth-child(2) { transition-delay: 0.08s; }
  .scroll-reveal:nth-child(3) { transition-delay: 0.16s; }
  .scroll-reveal:nth-child(4) { transition-delay: 0.24s; }
  .scroll-reveal:nth-child(5) { transition-delay: 0.32s; }
  .scroll-reveal:nth-child(6) { transition-delay: 0.40s; }
}

/* Diagonal clip for about section */
.clip-diagonal {
  clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
}

/* Navbar scrolled state */
.nav-scrolled {
  background: rgba(4, 11, 24, 0.92) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(78, 201, 176, 0.08);
}

/* Mobile menu active state */
.mobile-menu-open {
  opacity: 1 !important;
  pointer-events: all !important;
}

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

.menu-open .menu-line:nth-child(2) {
  opacity: 0;
}

.menu-open .menu-line:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
  width: 20px;
}

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

/* Selection color */
::selection {
  background: rgba(78, 201, 176, 0.3);
  color: white;
}

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

::-webkit-scrollbar-track {
  background: #040B18;
}

::-webkit-scrollbar-thumb {
  background: #1B3A70;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2AB596;
}

/* Focus styles */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #4EC9B0;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Mobile menu links */
.mobile-link {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.2s ease;
}

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

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