/* ES Builder (Derby) Limited - custom styles */

html { scroll-behavior: smooth; }
body { overflow-x: hidden; }

/* =============================================
   HERO SLIDER (professional crossfade)
============================================= */
#hero-slider {
  position: relative;
  isolation: isolate;
  background-color: #0f3d3e;
}

/* Each slide is stacked; only the active one is visible via opacity.
   No visibility toggling / no z-index swapping = no blink between slides. */
.hero-slide {
  opacity: 0;
  z-index: 0;
  pointer-events: none;
  transition: opacity 1.1s ease-in-out;
  will-change: opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.hero-slide.is-active {
  opacity: 1;
  z-index: 1;
  pointer-events: auto;
}

/* Strong dark scrim so white text is readable on ANY image (fixes bright-bathroom case) */
.hero-overlay {
  background:
    linear-gradient(90deg,
      rgba(15, 61, 62, 0.95) 0%,
      rgba(15, 61, 62, 0.82) 38%,
      rgba(15, 61, 62, 0.55) 70%,
      rgba(15, 61, 62, 0.35) 100%),
    linear-gradient(to top, rgba(15, 61, 62, 0.65) 0%, rgba(15, 61, 62, 0) 55%);
}

/* Extra legibility for text elements */
.hero-heading { text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55); }
.hero-sub { text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.hero-badges span { text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }

/* Subtle Ken Burns zoom — only runs on the active slide, resets instantly when hidden.
   Guard against the flash by not transitioning the reset. */
.hero-slide-bg {
  transform: scale(1.06);
  transition: none;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.hero-slide.is-active .hero-slide-bg {
  transform: scale(1);
  animation: heroKenBurns 8s ease-out forwards;
}

@keyframes heroKenBurns {
  from { transform: scale(1); }
  to   { transform: scale(1.09); }
}

/* Content entrance animation on the active slide */
.hero-slide-content > * {
  opacity: 0;
  transform: translateY(18px);
}
.hero-slide.is-active .hero-slide-content > * {
  animation: heroContentIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero-slide.is-active .hero-slide-content > *:nth-child(1) { animation-delay: 0.15s; }
.hero-slide.is-active .hero-slide-content > *:nth-child(2) { animation-delay: 0.28s; }
.hero-slide.is-active .hero-slide-content > *:nth-child(3) { animation-delay: 0.40s; }
.hero-slide.is-active .hero-slide-content > *:nth-child(4) { animation-delay: 0.52s; }
.hero-slide.is-active .hero-slide-content > *:nth-child(5) { animation-delay: 0.64s; }

@keyframes heroContentIn {
  to { opacity: 1; transform: none; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  .hero-slide { transition: opacity 0.3s ease; }
  .hero-slide-bg,
  .hero-slide.is-active .hero-slide-bg { transform: none; animation: none; }
  .hero-slide.is-active .hero-slide-content > * { animation: none; opacity: 1; transform: none; }
}

/* =============================================
   NAVIGATION
============================================= */
#site-header {
  transition: box-shadow 0.3s ease, background-color 0.3s ease;
}

/* Hamburger lines smooth animation */
.hamburger-line {
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}

/* Services mega-dropdown fade-in */
.group:hover .group-hover\:block {
  animation: fadeSlideDown 0.18s ease forwards;
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* =============================================
   FORM INPUTS
============================================= */
.form-input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  outline: none;
  border-color: #E3A008;
  box-shadow: 0 0 0 3px rgba(227,160,8,.15);
}

/* =============================================
   REVEAL ON SCROLL ANIMATION
============================================= */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s ease, transform .7s ease;
}
.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* =============================================
   GALLERY
============================================= */
.gallery-item {
  transition: opacity .35s ease, transform .35s ease;
}
.gallery-item.hide {
  display: none;
}

/* =============================================
   CUSTOM SCROLLBAR
============================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #E3A008; }

img { max-width: 100%; }
