/* ==========================================================================
   Rodney Groenbroek — custom styles
   Tailwind (CDN) handles the layout; this file holds the reusable component
   classes, the scroll-reveal animation and the hero background.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Base
   -------------------------------------------------------------------------- */

/* Offset for anchor jumps so the fixed header never covers a heading.
   (Tailwind's `scroll-mt-24` on each section does this too — this is the
   fallback for browsers without those utilities loaded yet.) */
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

/* Prevent horizontal overflow from the hero glow */
body {
  overflow-x: hidden;
}

/* Locks background scrolling while the mobile menu is open */
body.menu-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   2. Scroll reveal
   Elements start slightly offset + transparent, then get `.is-visible`
   from the IntersectionObserver in script.js.
   Only `opacity` and `transform` are animated → no layout shift, GPU-composited.
   -------------------------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition:
    opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Drop the compositing hint once the animation is done */
.reveal.is-done {
  will-change: auto;
}

/* Stagger helpers — add .reveal-d1 / .reveal-d2 / .reveal-d3 to delay */
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }

/* --------------------------------------------------------------------------
   3. Navigation
   -------------------------------------------------------------------------- */
.nav-link {
  position: relative;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8; /* slate-400 */
  transition: color 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: #fff;
}

/* Animated underline */
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: #22d3a5;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

/* Solid header state — toggled by JS after ~20px of scroll */
#site-header.nav-scrolled {
  background-color: rgba(8, 11, 15, 0.85);
  border-bottom-color: rgba(27, 37, 51, 0.9);
  box-shadow: 0 10px 30px -20px rgba(0, 0, 0, 0.9);
}

.mobile-link {
  border-radius: 0.75rem;
  padding: 0.75rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: #cbd5e1;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-link:hover,
.mobile-link:focus-visible {
  background-color: rgba(27, 37, 51, 0.7);
  color: #fff;
}

/* Hamburger → X animation */
.burger-bars {
  display: block;
  position: relative;
  width: 18px;
  height: 12px;
}

.burger-bars span {
  position: absolute;
  left: 0;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.3s ease, opacity 0.2s ease;
}

.burger-bars span:nth-child(1) { top: 0; }
.burger-bars span:nth-child(2) { top: 5px; }
.burger-bars span:nth-child(3) { top: 10px; }

#menu-toggle[aria-expanded="true"] .burger-bars span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
#menu-toggle[aria-expanded="true"] .burger-bars span:nth-child(2) {
  opacity: 0;
}
#menu-toggle[aria-expanded="true"] .burger-bars span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   4. Hero background
   Two decorative layers: a slowly drifting radial glow and a faint grid.
   Both are `pointer-events: none` and cost nothing to paint.
   -------------------------------------------------------------------------- */
.hero-glow,
.hero-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-glow {
  background:
    radial-gradient(45rem 30rem at 15% 20%, rgba(34, 211, 165, 0.16), transparent 60%),
    radial-gradient(38rem 28rem at 85% 15%, rgba(14, 164, 127, 0.14), transparent 60%),
    radial-gradient(40rem 30rem at 60% 90%, rgba(34, 211, 165, 0.08), transparent 60%);
  animation: heroDrift 18s ease-in-out infinite alternate;
}

@keyframes heroDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, -2.5%, 0) scale(1.08); }
}

.hero-grid {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 64px 64px;
  /* Fade the grid out toward the edges */
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 40%, transparent 100%);
}

/* Gradient text for the surname in the hero */
.text-gradient {
  background: linear-gradient(100deg, #22d3a5 0%, #5eeac4 45%, #ffffff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* --------------------------------------------------------------------------
   5. Section headings
   -------------------------------------------------------------------------- */
.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #22d3a5;
}

.section-eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.section-title {
  margin-top: 0.75rem;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
}

/* --------------------------------------------------------------------------
   6. Cards (services)
   -------------------------------------------------------------------------- */
.card {
  border-radius: 1.25rem;
  border: 1px solid #1b2533;
  background: linear-gradient(180deg, rgba(17, 24, 35, 0.9), rgba(11, 15, 20, 0.9));
  padding: 2rem 1.75rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 165, 0.4);
  box-shadow: 0 24px 50px -24px rgba(34, 211, 165, 0.35);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.5rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(34, 211, 165, 0.25);
  background: rgba(34, 211, 165, 0.1);
  color: #22d3a5;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.card:hover .card-icon {
  background: rgba(34, 211, 165, 0.18);
  transform: scale(1.05);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.card-text {
  margin-top: 0.6rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   7. Portfolio cards
   -------------------------------------------------------------------------- */
.portfolio-card {
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid #1b2533;
  background: rgba(17, 24, 35, 0.7);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.portfolio-card:hover {
  transform: translateY(-6px);
  border-color: rgba(34, 211, 165, 0.4);
  box-shadow: 0 24px 50px -24px rgba(34, 211, 165, 0.3);
}

/* Fixed 4:3 ratio → the image slot never collapses or shifts */
.portfolio-media {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0b0f14;
}

/* --------------------------------------------------------------------------
   8. Stats
   -------------------------------------------------------------------------- */
.stat-card {
  border-radius: 1.5rem;
  border: 1px solid #1b2533;
  background: linear-gradient(180deg, rgba(17, 24, 35, 0.9), rgba(11, 15, 20, 0.6));
  padding: 2.5rem 2rem;
  text-align: center;
}

.stat-number {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #fff;
  /* Tabular figures keep the width steady while counting up → no jitter */
  font-variant-numeric: tabular-nums;
}

.stat-label {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   9. Contact + footer links
   -------------------------------------------------------------------------- */
.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 1.25rem;
  border: 1px solid #1b2533;
  background: rgba(17, 24, 35, 0.7);
  padding: 1.25rem 1.5rem;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.contact-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 165, 0.45);
  box-shadow: 0 20px 40px -24px rgba(34, 211, 165, 0.4);
}

.contact-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  background: rgba(34, 211, 165, 0.12);
  color: #22d3a5;
}

.footer-link {
  color: #94a3b8;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #22d3a5;
}

/* --------------------------------------------------------------------------
   10. Accessibility — respect reduced-motion preferences
   Everything still shows, it just appears instantly.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .hero-glow { animation: none; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Visible focus ring for keyboard users */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #22d3a5;
  outline-offset: 3px;
  border-radius: 0.5rem;
}
