/* FX Animation & Interactivity System for The Village Farmhouse */

/* Anchor scroll margin for fixed header */
section[id] {
  scroll-margin-top: 5.5rem;
}

/* Base reveal system - elements remain fully visible unless html has fx-js */
html.fx-js .fx-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: calc(var(--fx-i, 0) * 90ms);
}

/* Directional & Scale variants */
html.fx-js .fx-reveal[data-fx="left"] {
  transform: translateX(-36px);
}

html.fx-js .fx-reveal[data-fx="right"] {
  transform: translateX(36px);
}

html.fx-js .fx-reveal[data-fx="zoom"] {
  transform: scale(0.92);
}

/* On mobile screens, alternate left/right collapses to vertical translation */
@media (max-width: 767px) {
  html.fx-js .fx-reveal[data-fx="left"],
  html.fx-js .fx-reveal[data-fx="right"] {
    transform: translateY(28px);
  }
}

/* Revealed active state */
html.fx-js .fx-reveal.is-revealed {
  opacity: 1;
  transform: translate(0, 0) scale(1);
}

/* Done state: remove transition-delay so hover states aren't delayed */
.fx-reveal.fx-done {
  transition-delay: 0s !important;
}

/* Fixed Scroll Progress Bar */
#fxProgress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #c86d51, #e9c46a);
  transform-origin: 0 50%;
  transform: scaleX(0);
  z-index: 70;
  pointer-events: none;
  transition: transform 0.08s linear;
}

/* Back to Top Floating Button */
#fxTop {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem; /* Above mobile bottom contact strip */
  z-index: 45;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background-color: #1b4332;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#fxTop.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#fxTop:hover {
  background-color: #2d6a4f;
  transform: translateY(-2px);
}

@media (min-width: 768px) {
  #fxTop {
    bottom: 2rem;
    right: 2rem;
  }
}

/* Sticky Header Scroll Enhancement */
header.header-scrolled {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(220, 215, 200, 0.9);
}

/* Timeline Stem Scroll Drawing */
.timeline-stem {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 2px;
  background: linear-gradient(180deg, #c86d51 0%, #1b4332 100%);
  transform-origin: top;
  scale: 1 var(--scroll-scale, 0);
  transition: scale 0.15s linear;
}

@media (min-width: 768px) {
  .timeline-stem {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-step .timeline-icon {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, background-color 0.35s ease;
}

.timeline-step.is-center-active .timeline-icon {
  transform: scale(1.18);
  box-shadow: 0 0 0 6px rgba(200, 109, 81, 0.35), 0 12px 24px rgba(0, 0, 0, 0.2);
  background-color: #2d6a4f;
}

/* Package Cards 3D Interactive Tilt */
@media (hover: hover) and (pointer: fine) {
  .package-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.15s ease-out, box-shadow 0.25s ease-out;
  }
}

/* Scrollspy active navigation indicator */
nav a.nav-active {
  color: #1b4332 !important;
  font-weight: 800;
  position: relative;
}

nav a.nav-active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: #c86d51;
  border-radius: 9999px;
}

/* Accessible focus visible outlines */
.gallery-item:focus-visible {
  outline: 3px solid #c86d51;
  outline-offset: 3px;
}

/* Touch device gallery captions */
@media (hover: none) {
  .gallery-item .gallery-caption {
    opacity: 1 !important;
  }
}

/* Strict prefers-reduced-motion protection */
@media (prefers-reduced-motion: reduce) {
  html.scroll-smooth {
    scroll-behavior: auto !important;
  }
  
  .animate-float,
  .pulse-glow,
  .animate-pulse {
    animation: none !important;
  }
  
  html.fx-js .fx-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  
  #fxProgress {
    display: none !important;
  }
  
  .timeline-stem {
    scale: 1 1 !important;
    transition: none !important;
  }
  
  .package-card {
    transform: none !important;
    transition: none !important;
  }
  
  .timeline-step .timeline-icon {
    transform: none !important;
    transition: none !important;
  }
}
