/* Smooth scroll for entire page */
html {
  scroll-behavior: smooth;
}

/* Subnav sticky behavior */
.elementor-element-f0c6ca0 {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: all 0.3s ease;
}

/* Backdrop blur and shadow when sticky is active */
.elementor-element-f0c6ca0.elementor-sticky--effects {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Mobile horizontal scroll for subnav links */
@media (max-width: 767px) {
  .elementor-element-f0c6ca0 .elementor-element-87636db {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .elementor-element-f0c6ca0 .elementor-element-87636db::-webkit-scrollbar {
    display: none;
  }

  .elementor-element-f0c6ca0 .elementor-element-87636db > * {
    scroll-snap-align: start;
  }
}

/* Return to Your Build bar */
.return-to-build-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: #1E42A3;
  color: #FFFFFF;
  padding: 16px 20px;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  z-index: 90;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease, background 0.2s ease;
  border: none;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.12);
}

@media (max-width: 767px) {
  .return-to-build-bar {
    display: flex;
  }
}

.return-to-build-bar.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.return-to-build-bar:hover,
.return-to-build-bar:focus {
  background: #163580;
}

.return-to-build-bar svg {
  flex-shrink: 0;
}

/* Results summary card scroll margin */
.results-summary-card,
.configurator-summary {
  scroll-margin-top: 100px;
}

/* Cost Calculator scroll animations */
#cost {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#cost.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger the three timeline cards */
#cost.is-visible .timeline-card {
  opacity: 0;
  transform: translateY(20px);
  animation: tcoFadeUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#cost.is-visible .timeline-card[data-material="steel"] {
  animation-delay: 0.15s;
}

#cost.is-visible .timeline-card[data-material="aluminum"] {
  animation-delay: 0.30s;
}

#cost.is-visible .timeline-card[data-material="pangolin"] {
  animation-delay: 0.45s;
}

/* Stagger the three cost result cards */
#cost.is-visible .cost-card {
  opacity: 0;
  transform: translateY(20px);
  animation: tcoFadeUp 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#cost.is-visible .steel-card {
  animation-delay: 0.6s;
}

#cost.is-visible .alum-card {
  animation-delay: 0.75s;
}

#cost.is-visible .pangolin-card {
  animation-delay: 0.9s;
}

@keyframes tcoFadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* On mobile keep Pangolin first in the stagger order */
@media (max-width: 767px) {
  #cost.is-visible .pangolin-card {
    animation-delay: 0.6s;
  }

  #cost.is-visible .alum-card {
    animation-delay: 0.75s;
  }

  #cost.is-visible .steel-card {
    animation-delay: 0.9s;
  }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #cost,
  #cost.is-visible .timeline-card,
  #cost.is-visible .cost-card {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
    transition: none !important;
  }

  .return-to-build-bar {
    transition: none !important;
  }
}