/**
 * Tazekka Park — Homepage FX
 * Ambient, subtle animations: mountain parallax, mist, cave droplets, reveals.
 * GPU-only (transform/opacity). Respects prefers-reduced-motion.
 */

/* ================================================
   VARIABLES
   ================================================ */
:root {
    --tp-fx-mist: rgba(240, 245, 242, 0.08);
    --tp-fx-stone: #3a3530;
    --tp-fx-stone-dark: #1f1b18;
    --tp-fx-ochre: #c89b6a;
    --tp-fx-water: #6fb8d6;
    --tp-fx-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ================================================
   HERO — Parallax mountain silhouettes + mist + sunbeam
   ================================================ */
.rt-hero {
    overflow: hidden;
}

/* Decorative layer container — sits above .rt-hero-bg but below .rt-hero-content */
.tp-hero-fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

/* Sunbeam — single soft ray rotating imperceptibly */
.tp-hero-sunbeam {
    position: absolute;
    top: -20%;
    left: 60%;
    width: 80vw;
    height: 140vh;
    background: linear-gradient(
        195deg,
        rgba(255, 226, 160, 0.22) 0%,
        rgba(255, 226, 160, 0.08) 30%,
        transparent 60%
    );
    transform-origin: top center;
    filter: blur(40px);
    opacity: 0.75;
    will-change: transform;
    animation: tp-sunbeam-drift 38s ease-in-out infinite alternate;
}

@keyframes tp-sunbeam-drift {
    0%   { transform: rotate(-4deg) translateX(0); }
    100% { transform: rotate(2deg)  translateX(-30px); }
}

/* Mist layers — soft horizontal drifts */
.tp-hero-mist {
    position: absolute;
    left: -10%;
    right: -10%;
    height: 180px;
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(255, 255, 255, 0.12) 0%,
        rgba(255, 255, 255, 0.05) 40%,
        transparent 70%
    );
    filter: blur(20px);
    will-change: transform;
}

.tp-hero-mist--a { bottom: 22%; animation: tp-mist-drift 42s linear infinite; }
.tp-hero-mist--b { bottom: 12%; opacity: 0.7; animation: tp-mist-drift 58s linear -20s infinite reverse; }
.tp-hero-mist--c { bottom: 34%; opacity: 0.4; animation: tp-mist-drift 72s linear -35s infinite; }

@keyframes tp-mist-drift {
    0%   { transform: translate3d(-15%, 0, 0); }
    100% { transform: translate3d(15%, 0, 0); }
}

/* Mountain silhouettes — 3 parallax layers */
.tp-hero-range {
    position: absolute;
    left: -5%;
    right: -5%;
    width: 110%;
    pointer-events: none;
    will-change: transform;
}

.tp-hero-range svg {
    display: block;
    width: 100%;
    height: auto;
}

.tp-hero-range--back  { bottom: 5%;  opacity: 0.28; transform: translateY(var(--tp-parallax-slow, 0px)); }
.tp-hero-range--mid   { bottom: 0;    opacity: 0.48; transform: translateY(var(--tp-parallax-mid, 0px)); }
.tp-hero-range--front { bottom: -2%;  opacity: 0.82; transform: translateY(var(--tp-parallax-fast, 0px)); }

.tp-hero-range--back svg  { fill: #2a5248; }
.tp-hero-range--mid svg   { fill: #1f3d36; }
.tp-hero-range--front svg { fill: #0f2620; }

/* Stars — tiny specks in upper half */
.tp-hero-star {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: rgba(255, 240, 200, 0.7);
    box-shadow: 0 0 4px rgba(255, 240, 200, 0.5);
    animation: tp-star-twinkle 4s ease-in-out infinite;
}

@keyframes tp-star-twinkle {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50%      { opacity: 1;   transform: scale(1.2); }
}

/* ================================================
   HERO CONTENT — staggered load
   ================================================ */
.rt-hero-content > .rt-hero-badge,
.rt-hero-content > h1,
.rt-hero-content > .rt-hero-desc,
.rt-hero-content > .rt-hero-actions {
    opacity: 0;
    transform: translateY(24px);
    animation: tp-hero-rise 1.1s var(--tp-fx-ease) forwards;
}

.rt-hero-content > .rt-hero-badge    { animation-delay: 0.15s; }
.rt-hero-content > h1                { animation-delay: 0.35s; }
.rt-hero-content > .rt-hero-desc     { animation-delay: 0.60s; }
.rt-hero-content > .rt-hero-actions  { animation-delay: 0.85s; }

@keyframes tp-hero-rise {
    to { opacity: 1; transform: translateY(0); }
}

/* Badge subtle breathing */
.rt-hero-badge {
    animation: tp-hero-rise 1.1s var(--tp-fx-ease) 0.15s forwards,
               tp-badge-breath 5s ease-in-out 2s infinite;
}

@keyframes tp-badge-breath {
    0%, 100% { box-shadow: 0 0 0 0 rgba(199, 180, 128, 0); }
    50%      { box-shadow: 0 0 0 8px rgba(199, 180, 128, 0.06); }
}

/* Scroll indicator — breathing rhythm */
.rt-scroll-indicator {
    animation: tp-scroll-breathe 2.4s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes tp-scroll-breathe {
    0%, 100% { transform: translateY(0);    opacity: 0.6; }
    50%      { transform: translateY(8px);  opacity: 1;   }
}

/* ================================================
   CAVE DIVIDER — speleology transition between sections
   ================================================ */
.tp-cave-divider {
    position: relative;
    height: 140px;
    margin: 0;
    overflow: hidden;
    background: linear-gradient(180deg, transparent 0%, rgba(31, 27, 24, 0.06) 100%);
    pointer-events: none;
}

.tp-cave-divider svg {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.tp-cave-divider svg .tp-stalactite {
    fill: #2a241f;
    opacity: 0.35;
}

/* Water drops falling */
.tp-cave-drop {
    position: absolute;
    left: var(--drop-left, 25%);
    top: 8px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #a8d8e8, #5a9fb8);
    box-shadow: 0 0 6px rgba(168, 216, 232, 0.5);
    opacity: 0;
    animation: tp-drop-fall var(--drop-duration, 4.5s) ease-in var(--drop-delay, 0s) infinite;
    will-change: transform, opacity;
}

@keyframes tp-drop-fall {
    0%   { transform: translateY(0)    scaleY(1);   opacity: 0; }
    8%   { opacity: 0.9; }
    70%  { transform: translateY(90px) scaleY(1.8); opacity: 0.8; }
    90%  { transform: translateY(115px) scaleY(0.4); opacity: 0; }
    100% { transform: translateY(115px); opacity: 0; }
}

/* Ripple at bottom where drop lands */
.tp-cave-ripple {
    position: absolute;
    bottom: 14px;
    left: var(--drop-left, 25%);
    width: 18px;
    height: 3px;
    margin-left: -9px;
    border-radius: 50%;
    border: 1px solid rgba(168, 216, 232, 0.5);
    opacity: 0;
    animation: tp-ripple-expand var(--drop-duration, 4.5s) ease-out var(--drop-delay, 0s) infinite;
}

@keyframes tp-ripple-expand {
    0%, 72%  { opacity: 0; transform: scale(0.3); }
    78%      { opacity: 0.8; transform: scale(1); }
    100%     { opacity: 0; transform: scale(3); }
}

/* ================================================
   REVEAL ON SCROLL — refined, restrained
   ================================================ */
.tp-reveal {
    opacity: 0;
    transform: translateY(32px);
    transition:
        opacity 0.9s var(--tp-fx-ease),
        transform 0.9s var(--tp-fx-ease);
    will-change: opacity, transform;
}

.tp-reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children variants */
.tp-reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity 0.8s var(--tp-fx-ease),
        transform 0.8s var(--tp-fx-ease);
}

.tp-reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0.05s; opacity: 1; transform: translateY(0); }
.tp-reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 0.15s; opacity: 1; transform: translateY(0); }
.tp-reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 0.25s; opacity: 1; transform: translateY(0); }
.tp-reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 0.35s; opacity: 1; transform: translateY(0); }
.tp-reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 0.45s; opacity: 1; transform: translateY(0); }
.tp-reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 0.55s; opacity: 1; transform: translateY(0); }

/* Slight tilt-on-hover for hike cards */
.tp-tilt {
    transition: transform 0.45s var(--tp-fx-ease), box-shadow 0.45s var(--tp-fx-ease);
    will-change: transform;
}
.tp-tilt:hover {
    transform: translateY(-6px) rotate(-0.4deg);
    box-shadow: 0 22px 40px -18px rgba(15, 38, 32, 0.35);
}

/* ================================================
   AMBIENT PARTICLES — section breathing
   ================================================ */
.tp-ambient-wrap {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.tp-ambient-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(200, 155, 106, 0.45);
    box-shadow: 0 0 6px rgba(200, 155, 106, 0.25);
    animation: tp-particle-rise var(--particle-dur, 18s) linear var(--particle-delay, 0s) infinite;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes tp-particle-rise {
    0%   { transform: translate3d(0, 20px, 0);    opacity: 0; }
    15%  { opacity: 0.8; }
    85%  { opacity: 0.6; }
    100% { transform: translate3d(var(--particle-drift, 40px), -120vh, 0); opacity: 0; }
}

/* ================================================
   COUNT-UP numbers
   ================================================ */
.tp-count-up {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ================================================
   PARALLAX — hero content gets a soft lift on scroll
   ================================================ */
.rt-hero-content {
    transform: translate3d(0, var(--tp-hero-content-y, 0px), 0);
    transition: opacity 0.3s ease;
}

/* ================================================
   REDUCED MOTION
   ================================================ */
@media (prefers-reduced-motion: reduce) {
    .tp-hero-sunbeam,
    .tp-hero-mist,
    .tp-hero-range,
    .tp-cave-drop,
    .tp-cave-ripple,
    .tp-ambient-particle,
    .rt-scroll-indicator,
    .rt-hero-badge {
        animation: none !important;
    }
    .rt-hero-content > * {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
    .tp-reveal,
    .tp-reveal-stagger > * {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .tp-tilt:hover { transform: none; }
}

/* ================================================
   MOBILE TUNING
   ================================================ */
@media (max-width: 768px) {
    .tp-hero-mist { height: 120px; filter: blur(14px); }
    .tp-hero-sunbeam { width: 140vw; opacity: 0.5; }
    .tp-cave-divider { height: 90px; }
    .tp-cave-drop { width: 4px; height: 4px; }
}
