/*
 * motion.css — ANs Holidays Animation Layer
 * Pure CSS progressive-enhancement animations.
 * Loaded after styles.css, before extra_css block.
 * All animations use transform/opacity only (GPU-accelerated).
 */

/* ============================================================
   CONFIGURABLE INTENSITY
   ============================================================ */
:root {
  --motion-intensity: 1;
  --motion-duration: 0.6s;
  --motion-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   SCROLL-REVEAL BASE — elements start hidden, JS adds .is-visible
   ============================================================ */
[data-animate] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--motion-duration) var(--motion-ease),
              transform var(--motion-duration) var(--motion-ease);
  will-change: opacity, transform;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Animation variants */
[data-animate="fade-in"] {
  transform: none;
}
[data-animate="fade-in"].is-visible {
  opacity: 1;
  transform: none;
}

[data-animate="fade-left"] {
  transform: translateX(-30px);
}
[data-animate="fade-left"].is-visible {
  opacity: 1;
  transform: translateX(0);
}

[data-animate="fade-right"] {
  transform: translateX(30px);
}
[data-animate="fade-right"].is-visible {
  opacity: 1;
  transform: translateX(0);
}

[data-animate="scale-in"] {
  transform: scale(0.95);
}
[data-animate="scale-in"].is-visible {
  opacity: 1;
  transform: scale(1);
}

[data-animate="blur-in"] {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(16px);
  transition: opacity var(--motion-duration) var(--motion-ease),
              filter var(--motion-duration) var(--motion-ease),
              transform var(--motion-duration) var(--motion-ease);
}
[data-animate="blur-in"].is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}

/* fade-up is the default (same as base) */
[data-animate="fade-up"] {
  transform: translateY(30px);
}
[data-animate="fade-up"].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   STAGGER DELAYS — children of [data-animate-stagger]
   ============================================================ */
[data-animate-stagger] > *:nth-child(1)  { transition-delay: 0s; }
[data-animate-stagger] > *:nth-child(2)  { transition-delay: 0.08s; }
[data-animate-stagger] > *:nth-child(3)  { transition-delay: 0.16s; }
[data-animate-stagger] > *:nth-child(4)  { transition-delay: 0.24s; }
[data-animate-stagger] > *:nth-child(5)  { transition-delay: 0.32s; }
[data-animate-stagger] > *:nth-child(6)  { transition-delay: 0.40s; }
[data-animate-stagger] > *:nth-child(7)  { transition-delay: 0.48s; }
[data-animate-stagger] > *:nth-child(8)  { transition-delay: 0.56s; }
[data-animate-stagger] > *:nth-child(n+9){ transition-delay: 0.60s; }

/* Stagger children: start hidden, visible when parent gets .is-visible */
[data-animate-stagger] > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--motion-duration) var(--motion-ease),
              transform var(--motion-duration) var(--motion-ease);
  will-change: opacity, transform;
}
[data-animate-stagger].is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   HERO ENHANCEMENTS — additive only, does not break slider JS
   ============================================================ */

/* Animated gradient overlay on hero ::after */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(26, 60, 94, 0.15) 0%,
    rgba(201, 168, 76, 0.08) 50%,
    rgba(26, 60, 94, 0.2) 100%
  );
  pointer-events: none;
  z-index: 1;
  animation: heroGradientShift 8s ease-in-out infinite alternate;
}

@keyframes heroGradientShift {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Hero image subtle scale on load */
.hero-image img {
  transition: transform 8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.hero-slide.active .hero-image img {
  transform: scale(1.04);
}
.hero-slide:not(.active) .hero-image img {
  transform: scale(1);
}

/* Hero text entrance — CSS-only, triggered when slide is .active */
.hero-slide.active .hero-title {
  animation: heroTitleIn 0.8s var(--motion-ease) both;
}
.hero-slide.active .hero-subtitle {
  animation: heroSubtitleIn 0.9s var(--motion-ease) 0.15s both;
}
.hero-slide.active .hero-text .btn {
  animation: heroBtnIn 0.7s var(--motion-ease) 0.3s both;
}

@keyframes heroTitleIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroSubtitleIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes heroBtnIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hero brand glow animation */
.hero-brand .brand-claim {
  animation: brandGlow 4s ease-in-out infinite alternate;
}
@keyframes brandGlow {
  0%   { text-shadow: 0 0 0px rgba(201, 168, 76, 0); }
  100% { text-shadow: 0 2px 20px rgba(201, 168, 76, 0.4); }
}

/* ============================================================
   NAVBAR — GLASSMORPHISM (home page only, GSAP-driven)
   ============================================================ */

/* All pages: CSS transition so GSAP animates smoothly */
.header {
  transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* 
   Legacy home-page transparency overrides neutralized to favor Brand Cream/Navy theme. 
   ------------------------------------------------------------
*/
/*
.is-home .header {
  background: rgba(255, 255, 255, 0) !important;
  backdrop-filter: blur(0px);
  border-bottom-color: transparent !important;
  box-shadow: none !important;
}
.is-home .header .nav-link,
.is-home .header .nav-cta-btn {
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.is-home .header .nav-link::after {
  background: rgba(255, 255, 255, 0.6);
}
.is-home .header .nav-toggle .bar {
  background: #ffffff;
}
.is-home .header .lang {
  color: rgba(255, 255, 255, 0.75);
}
.is-home .header .lang.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}
.is-home .header .lang__sep {
  color: rgba(255, 255, 255, 0.3);
}
*/

/* ============================================================
   CARD HOVER MICRO-INTERACTIONS
   ============================================================ */

/* Destination card lift */
.destination-card {
  transition: transform 0.3s var(--motion-ease),
              box-shadow 0.3s var(--motion-ease);
  will-change: transform;
}
.destination-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(26, 60, 94, 0.15);
}

/* Card image subtle scale on hover */
.destination-card .card-image img {
  transition: transform 0.6s var(--motion-ease);
  will-change: transform;
}
.destination-card:hover .card-image img {
  transform: scale(1.06);
}

/* Property booking selection cards */
.booking-property-card {
  transition: transform 0.3s var(--motion-ease),
              box-shadow 0.3s var(--motion-ease) !important;
}
.booking-property-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(26, 60, 94, 0.12) !important;
}

/* ============================================================
   BUTTON MICRO-INTERACTIONS
   ============================================================ */

/* Press effect on all buttons */
.btn:active {
  transform: scale(0.97);
  transition: transform 0.1s ease;
}

/* Button loading state — CSS spinner */
.btn--loading {
  pointer-events: none;
  opacity: 0.75;
  position: relative;
  color: transparent !important;
}
.btn--loading::after {
  content: '';
  position: absolute;
  width: 1rem;
  height: 1rem;
  top: 50%;
  left: 50%;
  margin-top: -0.5rem;
  margin-left: -0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpinner 0.6s linear infinite;
}

@keyframes btnSpinner {
  to { transform: rotate(360deg); }
}

/* Button success state */
.btn--success {
  pointer-events: none;
  background-color: #059669 !important;
  border-color: #059669 !important;
  color: transparent !important;
  position: relative;
}
.btn--success::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

/* ============================================================
   BOOKING FLOW ENHANCEMENTS
   ============================================================ */

/* Progress bar smooth width transition */
.progress-fill {
  transition: width 0.6s ease !important;
}
.booking-progress__fill {
  transition: width 0.6s ease !important;
}

/* Panel entrance — complements [data-animate="fade-up"] */
.panel {
  transition: box-shadow 0.3s ease;
}
.panel:focus-within {
  box-shadow: 0 0 0 3px rgba(45, 58, 140, 0.08);
}

/* ============================================================
   FOOTER REVEAL
   ============================================================ */
.footer {
  transition: opacity 0.6s ease;
}

/* ============================================================
   TRUST-RAIL DIVIDER — draw from center outward on page load
   ============================================================ */

@keyframes drawDividerIn {
  from { opacity: 0; clip-path: inset(0 50% 0 50%); }
  to   { opacity: 1; clip-path: inset(0 0% 0 0%); }
}

@keyframes drawLineIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.trust-rail {
  animation: drawDividerIn 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}
.trust-rail--bottom {
  animation-delay: 0.6s;
}

.trust-rail .trust-rail-line {
  transform-origin: center;
  animation: drawLineIn 1.5s cubic-bezier(0.16, 1, 0.3, 1) 0.5s both;
}
.trust-rail--bottom .trust-rail-line {
  animation-delay: 0.7s;
}

/* ============================================================
   PREFERS-REDUCED-MOTION — kill all custom animations
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  /* Scroll-reveal: show immediately */
  [data-animate],
  [data-animate].is-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    filter: none !important;
  }

  /* Stagger children: show immediately */
  [data-animate-stagger] > *,
  [data-animate-stagger].is-visible > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* Hero animations */
  .hero::after { animation: none; }
  .hero-image img { transition: none; }
  .hero-slide.active .hero-title,
  .hero-slide.active .hero-subtitle,
  .hero-slide.active .hero-text .btn { animation: none; opacity: 1; transform: none; }
  .hero-brand .brand-claim { animation: none; text-shadow: none; }

  /* Card hovers */
  .destination-card,
  .destination-card .card-image img,
  .booking-property-card {
    transition: none !important;
    will-change: auto;
  }

  /* Button spinner */
  .btn--loading::after { animation: none; }

  /* Progress bar */
  .progress-fill,
  .booking-progress__fill { transition: none !important; }

  /* Navbar */
  .header { transition: none; }

  /* Trust-rail dividers */
  .trust-rail,
  .trust-rail .trust-rail-line {
    animation: none !important;
    opacity: 1 !important;
    clip-path: none !important;
    transform: none !important;
  }
}
