/* ===== BASE ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== NAVBAR ===== */
#navbar {
  background: transparent;
  transition: background 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease;
}

#navbar.scrolled {
  background: rgba(6, 14, 26, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
}

.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: #86efac;
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* ===== MOBILE MENU ===== */
.mobile-link {
  position: relative;
}

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

#mobile-menu.open .mobile-link {
  animation: fadeUp 0.4s ease forwards;
  opacity: 1;
}

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

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

/* Menu toggle animation */
#menu-toggle.active .menu-line:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

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

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

/* ===== HERO ANIMATIONS ===== */
.hero-element {
  opacity: 1;
  transform: translateY(0);
  animation: heroReveal 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.hero-element:nth-child(1) { animation-delay: 0.1s; }
.hero-element:nth-child(2) { animation-delay: 0.25s; }
.hero-element:nth-child(3) { animation-delay: 0.4s; }
.hero-element:nth-child(4) { animation-delay: 0.55s; }
.hero-element:nth-child(5) { animation-delay: 0.7s; }

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

.hero-orb {
  animation: orbFloat 8s ease-in-out infinite;
}

.hero-orb:nth-child(2) {
  animation-delay: -3s;
  animation-duration: 10s;
}

.hero-orb:nth-child(3) {
  animation-delay: -5s;
  animation-duration: 12s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== REVEAL ANIMATIONS (below fold only) ===== */
.reveal {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* Start from visible state — JS adds revealed class */
.reveal {
  transform: translateY(0);
}

/* ===== SERVICE CARDS ===== */
.service-card {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.service-card:hover {
  box-shadow: 0 20px 60px -20px rgba(74, 222, 128, 0.1);
}

/* ===== GALLERY ===== */
.gallery-item {
  overflow: hidden;
  border-radius: 12px;
}

.gallery-item img {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

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

::-webkit-scrollbar-track {
  background: #060e1a;
}

::-webkit-scrollbar-thumb {
  background: rgba(74, 222, 128, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(74, 222, 128, 0.5);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

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

  .hero-element {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .hero-orb {
    animation: none;
  }

  .gallery-item img {
    transition: none;
  }
}

/* ===== SELECTION ===== */
::selection {
  background: rgba(74, 222, 128, 0.3);
  color: #f0fdf4;
}
