/* ========================================
   Baniastav – Animations
   ======================================== */

/* --- Scroll Reveal Base --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Direction variants */
.reveal.fade-up {
  transform: translateY(40px);
}

.reveal.fade-down {
  transform: translateY(-40px);
}

.reveal.fade-left {
  transform: translateX(40px);
}

.reveal.fade-right {
  transform: translateX(-40px);
}

/* Stagger animation for grid items */
.stagger {
  transition-delay: var(--stagger-delay, 0ms);
}

/* --- Counter Animation --- */
.stat__number {
  transition: none;
}

/* --- Service Card Hover --- */
.service-card {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.service-card__icon {
  transition: transform var(--transition-base);
}

.service-card:hover .service-card__icon {
  transform: scale(1.1);
}

/* --- Button Micro-interactions --- */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn:active::after {
  width: 300px;
  height: 300px;
}

/* --- Navbar Morphing --- */
.navbar {
  transition: background 0.4s ease,
              box-shadow 0.4s ease;
}

/* --- Hero Scroll Indicator --- */
.hero__scroll-indicator {
  animation: fadeInUp 1s ease 1.5s both;
}

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

/* --- Form Focus Animation --- */
.form__input {
  transition: border-color 0.3s ease,
              box-shadow 0.3s ease,
              transform 0.2s ease;
}

.form__input:focus {
  transform: translateY(-1px);
}

/* --- Reference Card Image Zoom --- */
.ref-card__image {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Lightbox Animation --- */
.lightbox {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active .lightbox__img {
  animation: lightboxZoomIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes lightboxZoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Link Underline Effect --- */
.footer__contact a {
  position: relative;
}

.footer__contact a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width 0.3s ease;
}

.footer__contact a:hover::after {
  width: 100%;
}

/* ========================================
   BLUEPRINT ANIMATION
   ======================================== */
.blueprint {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 60% at center, transparent 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,1) 70%);
  mask-image: radial-gradient(ellipse 50% 60% at center, transparent 0%, rgba(0,0,0,0.3) 40%, rgba(0,0,0,1) 70%);
}

.blueprint__svg {
  width: 100%;
  height: 100%;
}

/* --- Stroke draw animation for house outline --- */
.bp-draw {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: blueprintDraw 2.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger each element */
.bp-draw:nth-child(1)  { animation-delay: 0.3s; }
.bp-draw:nth-child(2)  { animation-delay: 0.6s; }
.bp-draw:nth-child(3)  { animation-delay: 0.7s; }
.bp-draw:nth-child(4)  { animation-delay: 1.0s; }
.bp-draw:nth-child(5)  { animation-delay: 1.1s; }
.bp-draw:nth-child(6)  { animation-delay: 0.9s; }
.bp-draw:nth-child(7)  { animation-delay: 1.4s; }
.bp-draw:nth-child(8)  { animation-delay: 1.6s; }
.bp-draw:nth-child(9)  { animation-delay: 1.7s; }
.bp-draw:nth-child(10) { animation-delay: 1.9s; }

@keyframes blueprintDraw {
  to {
    stroke-dashoffset: 0;
  }
}

/* --- Dimension lines (draw later, dashed) --- */
.bp-draw-dim {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  animation: blueprintDraw 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 2.2s;
}

.bp-draw-dim:nth-child(2) { animation-delay: 2.3s; }
.bp-draw-dim:nth-child(3) { animation-delay: 2.3s; }
.bp-draw-dim:nth-child(4) { animation-delay: 2.5s; }
.bp-draw-dim:nth-child(5) { animation-delay: 2.5s; }
.bp-draw-dim:nth-child(6) { animation-delay: 2.5s; }
.bp-draw-dim:nth-child(7) { animation-delay: 2.7s; }
.bp-draw-dim:nth-child(8) { animation-delay: 2.7s; }
.bp-draw-dim:nth-child(9) { animation-delay: 2.7s; }

/* --- Text fade in --- */
.bp-fade {
  opacity: 0;
  animation: blueprintFade 1s ease forwards;
  animation-delay: 3.0s;
}

.bp-fade:nth-child(2) { animation-delay: 3.2s; }
.bp-fade:nth-child(3) { animation-delay: 3.4s; }

@keyframes blueprintFade {
  to {
    opacity: 1;
  }
}

/* --- Floor plan (right side, draws after house) --- */
.bp-draw-plan {
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation: blueprintDraw 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 1.8s;
}

.bp-draw-plan:nth-child(2)  { animation-delay: 2.1s; }
.bp-draw-plan:nth-child(3)  { animation-delay: 2.2s; }
.bp-draw-plan:nth-child(4)  { animation-delay: 2.5s; }
.bp-draw-plan:nth-child(5)  { animation-delay: 2.5s; }
.bp-draw-plan:nth-child(6)  { animation-delay: 2.7s; }
.bp-draw-plan:nth-child(7)  { animation-delay: 2.7s; }
.bp-draw-plan:nth-child(8)  { animation-delay: 2.9s; }
.bp-draw-plan:nth-child(9)  { animation-delay: 2.9s; }
.bp-draw-plan:nth-child(10) { animation-delay: 3.0s; }
.bp-draw-plan:nth-child(11) { animation-delay: 3.0s; }
.bp-draw-plan:nth-child(12) { animation-delay: 3.1s; }
.bp-draw-plan:nth-child(13) { animation-delay: 3.1s; }
.bp-draw-plan:nth-child(14) { animation-delay: 3.2s; }
.bp-draw-plan:nth-child(15) { animation-delay: 3.2s; }

/* Subtle continuous pulse after drawing completes */
.blueprint__svg {
  animation: blueprintPulse 6s ease-in-out 5s infinite;
}

@keyframes blueprintPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .stagger {
    transition-delay: 0ms !important;
  }

  .hero__scroll-indicator {
    animation: none;
  }

  .hero__scroll-indicator span::after {
    animation: none;
  }

  .service-card,
  .ref-card,
  .btn,
  .form__input,
  .ref-card__image,
  .navbar {
    transition: none;
  }

  .service-card:hover,
  .ref-card:hover,
  .btn:hover {
    transform: none;
  }

  .lightbox.active .lightbox__img {
    animation: none;
  }

  .bp-draw,
  .bp-draw-dim,
  .bp-draw-plan {
    stroke-dashoffset: 0;
    animation: none;
  }

  .bp-fade {
    opacity: 1;
    animation: none;
  }

  .blueprint__svg {
    animation: none;
  }

  .hero__heading::after {
    animation: none;
    display: none;
  }
}
