/* ===== JD Builders - animations.css =====
   Link AFTER your main stylesheet:
   <link rel="stylesheet" href="animations.css">
*/

/* ---------- 1. Scroll reveal ---------- */
/* Only hide elements when JS is running (the .js class comes from a one-line script in your <head>) */
.js .reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: var(--delay, 0s);
  will-change: opacity, transform;
}
.js .reveal-left  { transform: translateX(-40px); }
.js .reveal-right { transform: translateX(40px); }
.js .reveal-zoom  { transform: scale(0.94); }

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

/* ---------- 2. Hero: slow zoom + headline entrance ---------- */
.hero { position: relative; overflow: hidden; }

.hero-bg,
.hero video.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.hero-bg {
  background-size: cover;
  background-position: center;
  animation: heroZoom 18s ease-out forwards;
}
@keyframes heroZoom {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

/* dark overlay so text stays readable */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), rgba(0,0,0,.35));
  z-index: 1;
}
.hero-content { position: relative; z-index: 2; }

.hero-content > * {
  opacity: 0;
  transform: translateY(24px);
  animation: heroIn 0.9s ease forwards;
}
.hero-content > *:nth-child(1) { animation-delay: 0.2s; }
.hero-content > *:nth-child(2) { animation-delay: 0.45s; }
.hero-content > *:nth-child(3) { animation-delay: 0.7s; }
.hero-content > *:nth-child(4) { animation-delay: 0.95s; }
@keyframes heroIn {
  to { opacity: 1; transform: none; }
}

/* ---------- 3. Cards: hover lift ---------- */
.card,
.service-card,
.project-card {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.card:hover,
.service-card:hover,
.project-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

/* Image zoom inside project cards */
.project-card { overflow: hidden; }
.project-card img {
  transition: transform 0.6s ease;
  display: block;
  width: 100%;
}
.project-card:hover img { transform: scale(1.08); }

/* ---------- 4. Buttons ---------- */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

/* ---------- 5. Sticky header shrink ---------- */
header, .navbar {
  transition: padding 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}
header.scrolled, .navbar.scrolled {
  padding-top: 8px;
  padding-bottom: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ---------- 6. Scroll progress bar ---------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, #d4af37, #f7df87);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.6);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* ---------- 7. Gallery filter animation ---------- */
.gallery-item {
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.gallery-item.hide {
  opacity: 0;
  transform: scale(0.92);
  pointer-events: none;
  display: none !important;
  visibility: hidden;
}

/* ---------- 8. Process timeline ---------- */
.timeline { position: relative; }
.timeline-line {
  position: absolute;
  left: 20px;
  top: 0;
  width: 3px;
  height: 0;
  background: linear-gradient(180deg, #d4af37, #f7df87);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
  transition: height 0.2s linear;
}

/* ---------- 9. Before / After slider ---------- */
.ba-slider {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  overflow: hidden;
  user-select: none;
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--gold-border, rgba(212, 175, 55, 0.3));
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  aspect-ratio: 16 / 9;
  background: #090a0d;
}
.ba-slider img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ba-slider .ba-after {
  position: absolute;
  inset: 0;
  clip-path: inset(0 50% 0 0);
}
.ba-slider .ba-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: var(--gold-primary, #d4af37);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.8);
  pointer-events: none;
  z-index: 10;
}
.ba-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  margin: 0;
  z-index: 20;
}

/* ---------- 10. Respect reduced-motion settings ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
