/**
 * Titicacaways - Animations & Micro-interactions
 *
 * Scroll-triggered animations, hover effects, and keyframe animations.
 * Used with Intersection Observer (assets/js/animations.js).
 *
 * @package Titicacaways
 * @version 1.0.0
 */

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

/* Fade in from below */
@keyframes titicacaways-fade-in-up {
	from {
		opacity: 0;
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Fade in from above */
@keyframes titicacaways-fade-in-down {
	from {
		opacity: 0;
		transform: translateY(-30px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Fade in from left */
@keyframes titicacaways-fade-in-left {
	from {
		opacity: 0;
		transform: translateX(-30px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Fade in from right */
@keyframes titicacaways-fade-in-right {
	from {
		opacity: 0;
		transform: translateX(30px);
	}
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

/* Scale in */
@keyframes titicacaways-scale-in {
	from {
		opacity: 0;
		transform: scale(0.9);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

/* Fade in only */
@keyframes titicacaways-fade-in {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* WhatsApp pulse (reusable) */
@keyframes titicacaways-whatsapp-pulse {
	0% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.6);
	}
	70% {
		box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
	}
	100% {
		box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
	}
}

/* Slow bounce for scroll indicator */
@keyframes titicacaways-slow-bounce {
	0%, 100% { transform: translateY(0); opacity: 1; }
	50% { transform: translateY(12px); opacity: 0.5; }
}

/* Floating decorative elements */
@keyframes titicacaways-float-slow {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50% { transform: translateY(-20px) rotate(5deg); }
}

/* Shimmer effect for glass elements */
@keyframes titicacaways-shimmer {
	0% { background-position: -200% 0; }
	100% { background-position: 200% 0; }
}

/* ==========================================================================
   Scroll-Triggered Animation Classes
   Applied by Intersection Observer in animations.js
   ========================================================================== */

/* Base state: hidden */
.animate-on-scroll {
	opacity: 0;
	transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

/* Fallback: If JS fails to load, show elements after 2 seconds */
.no-js .animate-on-scroll,
.js-loaded .animate-on-scroll {
	opacity: 1;
	transform: none;
}

/* When JS is active, hide elements until they enter viewport */
.js-active .animate-on-scroll {
	opacity: 0;
}

/* Fade in up */
.animate-on-scroll.animate-fade-in-up {
	transform: translateY(30px);
}

.animate-on-scroll.animate-fade-in-up.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Fade in down */
.animate-on-scroll.animate-fade-in-down {
	transform: translateY(-30px);
}

.animate-on-scroll.animate-fade-in-down.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Fade in left */
.animate-on-scroll.animate-fade-in-left {
	transform: translateX(-30px);
}

.animate-on-scroll.animate-fade-in-left.is-visible {
	opacity: 1;
	transform: translateX(0);
}

/* Fade in right */
.animate-on-scroll.animate-fade-in-right {
	transform: translateX(30px);
}

.animate-on-scroll.animate-fade-in-right.is-visible {
	opacity: 1;
	transform: translateX(0);
}

/* Scale in */
.animate-on-scroll.animate-scale-in {
	transform: scale(0.9);
}

.animate-on-scroll.animate-scale-in.is-visible {
	opacity: 1;
	transform: scale(1);
}

/* Fade in only */
.animate-on-scroll.animate-fade-in {
	transform: none;
}

.animate-on-scroll.animate-fade-in.is-visible {
	opacity: 1;
}

/* Staggered children delays */
.animate-on-scroll.is-visible > *:nth-child(1) { animation-delay: 0ms; }
.animate-on-scroll.is-visible > *:nth-child(2) { animation-delay: 80ms; }
.animate-on-scroll.is-visible > *:nth-child(3) { animation-delay: 160ms; }
.animate-on-scroll.is-visible > *:nth-child(4) { animation-delay: 240ms; }
.animate-on-scroll.is-visible > *:nth-child(5) { animation-delay: 320ms; }
.animate-on-scroll.is-visible > *:nth-child(6) { animation-delay: 400ms; }

/* ==========================================================================
   Hover Effects - Cards
   ========================================================================== */

/* Tour card lift on hover */
.tour-card,
.card-hover-lift {
	transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.tour-card:hover,
.card-hover-lift:hover {
	transform: translateY(-6px);
	box-shadow: 0 12px 24px rgba(26, 26, 46, 0.15);
}

/* ==========================================================================
   Hover Effects - Buttons
   ========================================================================== */

/* Button fill effect */
.btn-fill {
	position: relative;
	overflow: hidden;
	z-index: 1;
	transition: color 0.3s ease-out;
}

.btn-fill::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 0;
	height: 100%;
	background-color: var(--color-primary, #9C0000);
	z-index: -1;
	transition: width 0.3s ease-out;
}

.btn-fill:hover::before {
	width: 100%;
}

/* Button scale on hover */
.btn-scale {
	transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
}

.btn-scale:hover {
	transform: scale(1.05);
	box-shadow: 0 4px 12px rgba(156, 0, 0, 0.3);
}

.btn-scale:active {
	transform: scale(0.98);
}

/* ==========================================================================
   Hover Effects - Images
   ========================================================================== */

/* Image zoom on hover */
.img-zoom {
	overflow: hidden;
}

.img-zoom img,
.img-zoom .img-inner {
	transition: transform 0.4s ease-out;
}

.img-zoom:hover img,
.img-zoom:hover .img-inner {
	transform: scale(1.08);
}

/* ==========================================================================
   Hover Effects - Links
   ========================================================================== */

/* Animated underline */
.link-underline {
	position: relative;
	text-decoration: none;
}

.link-underline::after {
	content: '';
	position: absolute;
	bottom: -2px;
	left: 0;
	width: 0;
	height: 2px;
	background-color: var(--color-primary, #9C0000);
	transition: width 0.3s ease-out;
}

.link-underline:hover::after {
	width: 100%;
}

/* ==========================================================================
   WhatsApp Pulse Animation
   (Also defined in whatsapp.js for self-contained fallback)
   ========================================================================== */

.titicacaways-whatsapp-btn {
	animation: titicacaways-whatsapp-pulse 2s infinite;
}

.titicacaways-whatsapp-btn:hover {
	animation: none;
}

/* ==========================================================================
   Scroll-to-Top Fade
   (Also defined in scroll-to-top.js for self-contained fallback)
   ========================================================================== */

.titicacaways-scroll-top {
	transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}

/* ==========================================================================
   New Decorative Animations
   ========================================================================== */

/* Slow bounce for scroll indicators */
.animate-slow-bounce {
	animation: titicacaways-slow-bounce 2.5s ease-in-out infinite;
}

/* Floating decorative elements */
.animate-float-slow {
	animation: titicacaways-float-slow 6s ease-in-out infinite;
}

.animate-float-slow-delayed {
	animation: titicacaways-float-slow 6s ease-in-out infinite;
	animation-delay: -3s;
}

/* Shimmer effect for glass/surface elements */
.animate-shimmer {
	background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
	background-size: 200% 100%;
	animation: titicacaways-shimmer 3s ease-in-out infinite;
}

/* ==========================================================================
   prefers-reduced-motion
   Disable all animations for users who prefer reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.animate-on-scroll {
		opacity: 1 !important;
		transform: none !important;
	}

	.animate-on-scroll.is-visible {
		opacity: 1 !important;
		transform: none !important;
	}

	.titicacaways-whatsapp-btn {
		animation: none !important;
	}

	.tour-card:hover,
	.card-hover-lift:hover {
		transform: none;
		box-shadow: none;
	}

	.btn-scale:hover {
		transform: none;
		box-shadow: none;
	}

	.img-zoom:hover img,
	.img-zoom:hover .img-inner {
		transform: none;
	}

	.btn-fill::before {
		transition: none;
	}

	.link-underline::after {
		transition: none;
		width: 100%;
	}
}

/* ==========================================================================
   Hero Slider Premium Animations
   ========================================================================== */

/* Ken Burns — zoom + pan slow dans actif slide */
@keyframes titicacaways-ken-burns {
	0% { transform: scale(1) translate(0, 0); }
	100% { transform: scale(1.1) translate(-1%, -1%); }
}

.hero-swiper .swiper-slide-active .ken-burns {
	animation: titicacaways-ken-burns 12s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* Hero vignette for cinematic depth — theme dark tones */
.hero-swiper .swiper-slide::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: 4;
	pointer-events: none;
	background: radial-gradient(ellipse at center, transparent 45%, rgba(26, 26, 46, 0.4) 100%);
}

/* Slide Reveal — premium staggered animations with cubic-bezier */
.slide-reveal {
	opacity: 0;
	transform: translateY(40px) scale(0.98);
	transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
	will-change: opacity, transform;
}

.hero-swiper .swiper-slide-active .slide-reveal {
	opacity: 1;
	transform: translateY(0) scale(1);
}
.hero-swiper .swiper-slide-active .slide-reveal[data-delay="100"] { transition-delay: 0.12s; }
.hero-swiper .swiper-slide-active .slide-reveal[data-delay="200"] { transition-delay: 0.24s; }
.hero-swiper .swiper-slide-active .slide-reveal[data-delay="300"] { transition-delay: 0.36s; }
.hero-swiper .swiper-slide-active .slide-reveal[data-delay="400"] { transition-delay: 0.48s; }

/* Enhanced slow bounce for scroll indicator */
@keyframes titicacaways-slow-bounce {
	0%, 100% { transform: translateY(0) translateX(-50%); opacity: 1; }
	50% { transform: translateY(14px) translateX(-50%); opacity: 0.4; }
}

/* Text shadow utilities for hero readability */
.drop-shadow-hero {
	text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Swiper Custom Pagination — premium dots */
.hero-pagination .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	background: rgba(255, 255, 255, 0.35);
	border-radius: 50%;
	opacity: 1;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
	margin: 0 4px !important;
	cursor: pointer;
}
.hero-pagination .swiper-pagination-bullet:hover {
	background: rgba(255, 255, 255, 0.7);
	transform: scale(1.2);
}
.hero-pagination .swiper-pagination-bullet-active {
	background: #F5B72F;
	width: 28px;
	border-radius: 5px;
	box-shadow: 0 0 12px rgba(245, 183, 47, 0.5);
}

/* ==========================================================================
   Nav Link Animated Underline — 2026 luxury pattern
   ========================================================================== */
.nav-link-hover {
	position: relative;
}
.nav-link-hover::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 0;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: width 0.25s ease;
}
.nav-link-hover:hover::after {
	width: 60%;
}

/* ==========================================================================
   Noise / Grain Overlay — adds cinematic depth
   ========================================================================== */
.noise-overlay {
	position: absolute;
	inset: 0;
	z-index: 5;
	opacity: 0.03;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
	background-size: 200px 200px;
}

/* ==========================================================================
   Tour Page — Editorial Design System
   ========================================================================== */

/* Ken Burns Hero */
@keyframes titicacaways-ken-burns {
	0% { transform: scale(1) translate(0, 0); }
	100% { transform: scale(1.08) translate(-0.5%, -0.5%); }
}

.animate-ken-burns {
	animation: titicacaways-ken-burns 20s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

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

/* Editorial Section Labels */
.editorial-label {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.editorial-label::before {
	content: '';
	width: 2rem;
	height: 1px;
	background-color: var(--color-primary, #9C0000);
}

/* Gallery hover zoom */
.tour-gallery-item img {
	transition: transform 0.7s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.tour-gallery-item:hover img {
	transform: scale(1.08);
}

/* Itinerary number hover */
.itinerary-number {
	transition: color 0.5s ease;
}

/* Sidebar dark theme inputs */
.tour-sidebar-input {
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: white;
	transition: all 0.2s ease;
}

.tour-sidebar-input:focus {
	border-color: var(--color-secondary, #F5B72F);
	box-shadow: 0 0 0 3px rgba(245, 183, 47, 0.2);
}

/* Price pulse animation */
@keyframes price-pulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(245, 183, 47, 0.3); }
	50% { box-shadow: 0 0 0 8px rgba(245, 183, 47, 0); }
}

.price-tag-pulse {
	animation: price-pulse 2s ease-in-out infinite;
}

/* Bring item hover */
.bring-item {
	transition: all 0.3s ease;
}

.bring-item:hover {
	border-color: var(--color-primary, #9C0000);
	transform: translateY(-2px);
	box-shadow: 0 8px 25px rgba(26, 26, 46, 0.1);
}

/* Includes card accent */
.includes-card {
	position: relative;
	overflow: hidden;
}

.includes-card::before {
	content: '';
	position: absolute;
	left: 0;
	top: 0;
	bottom: 0;
	width: 4px;
	background: var(--color-primary, #9C0000);
}

/* Related tour card hover */
.related-tour-card {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.related-tour-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 20px 40px rgba(26, 26, 46, 0.15);
}

/* ==========================================================================
   Mega Menu Premium — Custom Scroll & Effects
   ========================================================================== */
.mega-menu-premium {
	box-shadow: 0 25px 50px -12px rgba(26, 26, 46, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.mega-menu-scroll {
	scrollbar-width: thin;
	scrollbar-color: rgba(156, 0, 0, 0.3) transparent;
}

.mega-menu-scroll::-webkit-scrollbar {
	width: 4px;
}

.mega-menu-scroll::-webkit-scrollbar-track {
	background: transparent;
}

.mega-menu-scroll::-webkit-scrollbar-thumb {
	background-color: rgba(156, 0, 0, 0.3);
	border-radius: 4px;
}

.mega-menu-scroll::-webkit-scrollbar-thumb:hover {
	background-color: rgba(156, 0, 0, 0.5);
}

/* Mega menu tour item hover enhancement */
.mega-menu-premium a.group\/tour {
	position: relative;
}

.mega-menu-premium a.group\/tour::before {
	content: '';
	position: absolute;
	left: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 3px;
	height: 0;
	background: linear-gradient(to bottom, #9C0000, #F5B72F);
	border-radius: 0 2px 2px 0;
	transition: height 0.3s ease;
}

.mega-menu-premium a.group\/tour:hover::before {
	height: 60%;
}
