/**
 * Program & Transport Detail - Smooth Scroll & Interactive Motion
 * Optimized for high performance (60/120fps), no layout thrashing, fast and responsive.
 */

/* ==========================================================================
   1. Scroll Reveal Animations (GPU-accelerated, composite-only)
   ========================================================================== */

/* Only activate hidden initial state when JS confirms observer support */
html.has-detail-motion [data-motion] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition:
    opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.42s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

/* Stagger delay using CSS custom property */
html.has-detail-motion [data-motion][style*="--motion-delay"] {
  transition-delay: var(--motion-delay, 0ms);
}

/* Revealed State */
html.has-detail-motion [data-motion].is-revealed {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Once revealed, remove will-change to release GPU memory */
html.has-detail-motion [data-motion].is-revealed:not(:hover) {
  will-change: auto;
}

/* Section Title Accent Line Animation */
#tour-detail .section-title h2::after {
  transform-origin: right center;
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

html.has-detail-motion #tour-detail .section-title:not(.is-revealed) h2::after {
  transform: scaleX(0);
}

html.has-detail-motion #tour-detail .section-title.is-revealed h2::after {
  transform: scaleX(1);
}

/* ==========================================================================
   2. Interactive Motion & Micro-Interactions (Cards, Buttons, Media)
   ========================================================================== */

/* Benefit Cards (مميزات الخدمة) */
#tour-detail .benefit {
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.22s ease;
}

#tour-detail .benefit:hover {
  transform: translate3d(0, -4px, 0);
  border-color: rgba(125, 11, 84, 0.2);
  box-shadow: 0 12px 28px rgba(49, 16, 71, 0.09);
}

#tour-detail .benefit .benefit-icon {
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.26s ease;
}

#tour-detail .benefit:hover .benefit-icon {
  transform: scale(1.08);
  background-color: #ffe8f2;
}

/* Service Facts Cards (تفاصيل الخدمة - 4 cards) */
#tour-detail.transport-detail-page .transport-fact-card {
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.22s ease;
}

#tour-detail.transport-detail-page .transport-fact-card:hover {
  transform: translate3d(0, -3px, 0);
  border-color: rgba(125, 11, 84, 0.22);
  box-shadow: 0 10px 24px rgba(49, 16, 71, 0.07);
}

#tour-detail.transport-detail-page .transport-fact-card .transport-fact-icon {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.24s ease;
}

#tour-detail.transport-detail-page .transport-fact-card:hover .transport-fact-icon {
  transform: scale(1.06);
  background-color: var(--brand-primary);
  color: #fff;
}

/* Booking Steps Cards (كيف يتم حجز الخدمة) */
#tour-detail .program-step-card {
  transition:
    transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.24s ease;
}

#tour-detail .program-step-card:hover {
  transform: translate3d(0, -4px, 0);
  border-color: rgba(125, 11, 84, 0.22);
  box-shadow: 0 12px 28px rgba(49, 16, 71, 0.08);
}

#tour-detail .program-step-card .program-step-number {
  transition: transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.26s ease;
}

#tour-detail .program-step-card:hover .program-step-number {
  transform: scale(1.12);
  box-shadow: 0 4px 10px rgba(125, 11, 84, 0.3);
}

#tour-detail .program-step-card .program-step-icon {
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), color 0.24s ease;
}

#tour-detail .program-step-card:hover .program-step-icon {
  transform: translateX(-3px);
  color: var(--brand-accent);
}

/* Inclusions & Exclusions Cards */
#tour-detail .include-card {
  transition:
    transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#tour-detail .include-card:hover {
  transform: translate3d(0, -3px, 0);
  box-shadow: 0 10px 24px rgba(49, 16, 71, 0.06);
}

/* Related Services Cards */
#tour-detail .related-card {
  transition:
    transform 0.26s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.26s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.26s ease;
}

#tour-detail .related-card:hover {
  transform: translate3d(0, -4px, 0);
  border-color: rgba(125, 11, 84, 0.25);
  box-shadow: 0 14px 30px rgba(49, 16, 71, 0.1);
}

#tour-detail .related-card img {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#tour-detail .related-card:hover img {
  transform: scale(1.05);
}

#tour-detail .related-card .transport-related-action {
  transition: background-color 0.2s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#tour-detail .related-card:hover .transport-related-action {
  background-color: var(--brand-primary);
  color: #fff;
  transform: translateX(-2px);
}

/* Overview Section Aside Floating Accent */
#tour-detail.transport-detail-page .transport-overview-aside {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
}

#tour-detail.transport-detail-page .transport-overview-aside:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(49, 16, 71, 0.06);
}

/* FAQ Items */
#tour-detail.transport-detail-page .transport-faq-item {
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

#tour-detail.transport-detail-page .transport-faq-item:hover {
  border-color: rgba(125, 11, 84, 0.2);
  box-shadow: 0 4px 14px rgba(49, 16, 71, 0.04);
}

#tour-detail.transport-detail-page .transport-faq-item summary {
  transition: color 0.18s ease;
}

#tour-detail.transport-detail-page .transport-faq-item:hover summary {
  color: var(--brand-primary);
}

#tour-detail.transport-detail-page .transport-faq-toggle svg {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

#tour-detail.transport-detail-page .transport-faq-item[open] .transport-faq-toggle svg {
  transform: rotate(180deg);
}

/* Buttons & Controls Feedback */
#tour-detail .primary.book-button,
#tour-detail .tour-booking-toggle {
  transition:
    transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.18s cubic-bezier(0.16, 1, 0.3, 1),
    filter 0.18s ease;
}

#tour-detail .primary.book-button:hover:not(:disabled),
#tour-detail .tour-booking-toggle:hover {
  transform: translate3d(0, -2px, 0);
  box-shadow: 0 12px 26px rgba(125, 11, 84, 0.24);
}

#tour-detail .primary.book-button:active:not(:disabled),
#tour-detail .tour-booking-toggle:active {
  transform: translate3d(0, 0, 0) scale(0.98);
}

/* Stepper Buttons (- / +) */
html body #page-wrapper #tour-detail .quick-booking-grid .transport-counter-field .transport-number-stepper button {
  transition: transform 0.14s ease, background-color 0.14s ease !important;
}

html body #page-wrapper #tour-detail .quick-booking-grid .transport-counter-field .transport-number-stepper button:hover {
  transform: scale(1.08);
}

html body #page-wrapper #tour-detail .quick-booking-grid .transport-counter-field .transport-number-stepper button:active {
  transform: scale(0.92);
}

/* Gallery Thumbnails */
#tour-detail .gallery-thumbnails button {
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, box-shadow 0.18s ease;
}

#tour-detail .gallery-thumbnails button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   3. Mobile Responsive Adjustments (Lighter movement)
   ========================================================================== */
@media (max-width: 768px) {
  html.has-detail-motion [data-motion] {
    transform: translate3d(0, 12px, 0);
    transition-duration: 0.36s;
  }

  #tour-detail .benefit:hover,
  #tour-detail.transport-detail-page .transport-fact-card:hover,
  #tour-detail .program-step-card:hover,
  #tour-detail .include-card:hover,
  #tour-detail .related-card:hover {
    transform: none; /* Keep touch interactions crisp on touch devices without stuck hovers */
  }

  #tour-detail .primary.book-button:active:not(:disabled) {
    transform: scale(0.98);
  }
}

/* ==========================================================================
   4. Accessibility: Reduced Motion (Zero delay, instant transitions)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html.has-detail-motion [data-motion] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
  }

  #tour-detail .section-title h2::after {
    transition: none !important;
    transform: none !important;
  }

  #tour-detail .benefit,
  #tour-detail.transport-detail-page .transport-fact-card,
  #tour-detail .program-step-card,
  #tour-detail .include-card,
  #tour-detail .related-card,
  #tour-detail .primary.book-button,
  #tour-detail .related-card img,
  #tour-detail.transport-detail-page .transport-faq-toggle svg {
    transition: none !important;
    transform: none !important;
  }
}
