/* Suffolk Home Renovations — custom animations & utilities */

/* Scroll-reveal: elements start hidden, animate in when visible */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Header glass effect on scroll */
#site-header.scrolled {
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 3px rgba(28, 46, 155, 0.08);
}

/* Trust badge icon hover */
.trust-icon {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.trust-icon:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(28, 46, 155, 0.25);
}

/* Premium button hover lift */
.btn-primary {
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(28, 46, 155, 0.25);
}

/* Service card hover */
.service-card {
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.35s ease;
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 40px rgba(28, 46, 155, 0.12);
}

/* Project card image zoom */
.project-card img {
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.project-card:hover img {
  transform: scale(1.06);
}

/* WhatsApp pulse */
@keyframes whatsapp-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  50% { box-shadow: 0 0 0 12px rgba(37, 211, 102, 0); }
}
.whatsapp-float {
  animation: whatsapp-pulse 2.5s ease-in-out infinite;
}

/* Accordion */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
}
.accordion-item.is-open .accordion-content {
  max-height: 500px;
}
.accordion-icon {
  transition: transform 0.3s ease;
}
.accordion-item.is-open .accordion-icon {
  transform: rotate(45deg);
}

.gallery-img {
  opacity: 0;
  background-color: #e5e7eb;
  transition: opacity 0.4s ease;
}
.gallery-img.is-loaded {
  opacity: 1;
  background-color: transparent;
}
/* Services bullet list (welcome section) */
.services-list {
  list-style: none;
  padding: 0;
}
.services-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}
.services-list li::before {
  content: '';
  flex-shrink: 0;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.55rem;
  border-radius: 9999px;
  background-color: #39b5ff;
}

[data-lightbox] {
  cursor: zoom-in;
}

/* Gallery lightbox */
#lightbox-img {
  opacity: 0;
  transition: opacity 0.3s ease;
}
#lightbox-img.is-loaded {
  opacity: 1;
}

#gallery-sentinel.hidden {
  display: none;
}

/* Gallery masonry & filters */
.gallery-masonry {
  column-count: 2;
  column-gap: 10px;
}
@media (min-width: 768px) {
  .gallery-masonry { column-count: 2; }
}
@media (min-width: 1024px) {
  .gallery-masonry { column-count: 4; }
}
.gallery-item {
  break-inside: avoid;
  margin-bottom: 10px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.gallery-item.is-hidden {
  display: none;
}
.gallery-filter-btn {
  padding: 0.4rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1C2E9B;
  border-radius: 9999px;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.gallery-filter-btn:hover {
  background-color: #eef4ff;
}
.gallery-filter-btn.is-active {
  background-color: #39B5FF;
  color: #0a1240;
}

/* Gallery lightbox */
#lightbox {
  transition: opacity 0.3s ease;
}
#lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}

.checkatrade-badge-link {
  display: inline-block;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.checkatrade-badge-link:hover {
  transform: scale(1.03);
  opacity: 0.92;
}

/* Before / After comparison slider */
.ba-compare {
  position: relative;
  overflow: hidden;
  background: #e5e7eb;
  user-select: none;
  touch-action: pan-y;
}
.ba-compare-inner {
  position: relative;
  aspect-ratio: 4 / 3;
  line-height: 0;
}
.ba-compare-after,
.ba-compare-before {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ba-compare-before-mask {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  border-right: 3px solid #fff;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}
.ba-compare-before {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  height: 100%;
  object-fit: cover;
}
.ba-compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}
.ba-compare-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: #fff;
  border: 3px solid #1C2E9B;
  box-shadow: 0 4px 14px rgba(28, 46, 155, 0.25);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%231C2E9B' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8 9l4-4 4 4m0 6l-4 4-4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.25rem;
}
.ba-compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
  z-index: 4;
}
.ba-label {
  position: absolute;
  top: 0.75rem;
  z-index: 2;
  padding: 0.25rem 0.65rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(10, 18, 64, 0.65);
  backdrop-filter: blur(4px);
  pointer-events: none;
}
.ba-label-before { left: 0.75rem; }
.ba-label-after { right: 0.75rem; }

/* Welcome section slideshow */
.welcome-slideshow {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 36rem;
  background-color: #e5e7eb;
}
.welcome-slideshow-track {
  position: absolute;
  inset: 0;
}
.welcome-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}
.welcome-slide.is-active {
  opacity: 1;
}
.welcome-slideshow-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.92);
  color: #1C2E9B;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(28, 46, 155, 0.15);
  opacity: 0;
  transition: opacity 0.25s ease, background-color 0.2s ease;
}
.welcome-slideshow:hover .welcome-slideshow-btn,
.welcome-slideshow:focus-within .welcome-slideshow-btn {
  opacity: 1;
}
.welcome-slideshow-btn:hover {
  background: #fff;
}
.welcome-slideshow-prev { left: 0.75rem; }
.welcome-slideshow-next { right: 0.75rem; }
.welcome-slideshow-dots {
  position: absolute;
  bottom: 0.875rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  background: rgba(10, 18, 64, 0.45);
  backdrop-filter: blur(6px);
}
.welcome-slideshow-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.45);
  transition: transform 0.2s ease, background-color 0.2s ease;
}
.welcome-slideshow-dot.is-active {
  background: #39B5FF;
  transform: scale(1.25);
}

/* Hero gradient animation */
@keyframes hero-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero-gradient {
  background: linear-gradient(135deg, #1C2E9B 0%, #152470 40%, #0f1a5c 100%);
  background-size: 200% 200%;
  animation: hero-shift 12s ease infinite;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .reveal,
  .service-card,
  .project-card img,
  .btn-primary,
  .whatsapp-float,
  .hero-gradient,
  .welcome-slide {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
  .welcome-slide:not(.is-active) {
    display: none;
  }
  .ba-compare-range {
    pointer-events: none;
  }
  .ba-compare-before-mask {
    width: 50% !important;
  }
}
