/* ==========================================================================
   WILD-WEST METAL FEST 2027 — ANIMATIONS 3D FAR WEST (partagées par toutes les pages)
   Aucune bibliothèque : CSS 3D + wildwest-3d.js. Tout est coupé si
   l'utilisateur demande moins d'animations (prefers-reduced-motion).
   ========================================================================== */

/* ---- 1. Titres « marqués au fer » : bascule 3D à l'apparition ---- */
.fx-brand {
    opacity: 0;
    transform: perspective(800px) rotateX(75deg) translateY(20px);
    transform-origin: 50% 100%;
    transition: transform 1.1s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.7s ease;
}
.fx-brand.fx-in { opacity: 1; transform: perspective(800px) rotateX(0deg) translateY(0); }

/* ---- 2. Cartes inclinables + reflet doré qui suit le curseur ---- */
.comptoir-box { --fx-lift: -10px; }
.info-card    { --fx-lift: -5px; }
.step-card    { --fx-lift: -6px; }
.fx-tilt { will-change: transform; }
.fx-tilt > .fx-glare {
    position: absolute; inset: 0; z-index: 3; pointer-events: none;
    background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 228, 160, 0.20) 0%, rgba(245, 204, 109, 0.06) 30%, transparent 60%);
    mix-blend-mode: screen; opacity: 0; transition: opacity 0.4s ease;
}
.fx-tilt.fx-tilting > .fx-glare { opacity: 1; }

/* ---- 3. Logo du hero en relief (parallaxe 3D) ---- */
.hero-logo-container { transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1); }
.hero h1 { transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1); }

/* ---- 4. Compte à rebours : chiffres qui basculent ---- */
.countdown-number.fx-flip { animation: fx-flip 0.55s cubic-bezier(0.19, 1, 0.22, 1); }
@keyframes fx-flip {
    0%   { transform: perspective(300px) rotateX(-90deg); opacity: 0.2; }
    60%  { transform: perspective(300px) rotateX(14deg); opacity: 1; }
    100% { transform: perspective(300px) rotateX(0deg); }
}

/* ---- 5. Étoile de shérif en 3D (couches extrudées) ---- */
.fx-sheriff-star { width: var(--star-size, 110px); height: var(--star-size, 110px); margin: 0 auto 18px; perspective: 700px; }
.fx-star-spin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: fx-star-spin 9s linear infinite; }
.fx-star-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-star-layer.is-face { filter: drop-shadow(0 0 10px rgba(204, 153, 51, 0.45)); }
@keyframes fx-star-spin {
    from { transform: rotateX(10deg) rotateY(0deg); }
    to   { transform: rotateX(10deg) rotateY(360deg); }
}

/* ---- 6. Virevoltant (tumbleweed) qui traverse l'écran ---- */
.fx-tumbleweed {
    position: fixed; left: 0; bottom: var(--tw-bottom, 4vh); z-index: 1; pointer-events: none;
    width: var(--tw-size, 70px); height: var(--tw-size, 70px);
    opacity: 0; transform: translateX(-25vw);
}
.fx-tumbleweed.rolling { animation: fx-tw-cross var(--tw-dur, 9s) linear forwards; }
.fx-tumbleweed:not(.rolling) * { animation-play-state: paused; }
@keyframes fx-tw-cross {
    0%   { transform: translateX(-25vw); opacity: 0; }
    6%   { opacity: 0.85; }
    94%  { opacity: 0.85; }
    100% { transform: translateX(125vw); opacity: 0; }
}
.fx-tw-bounce { position: relative; width: 100%; height: 100%; animation: fx-tw-bounce 1.15s infinite; }
@keyframes fx-tw-bounce {
    0%   { transform: translateY(0); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
    50%  { transform: translateY(-42%); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4); }
    100% { transform: translateY(0); }
}
.fx-tw-roll { display: block; width: 100%; height: 100%; animation: fx-tw-roll 1.3s linear infinite; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)); }
@keyframes fx-tw-roll {
    from { transform: rotateX(18deg) rotateZ(0deg); }
    to   { transform: rotateX(18deg) rotateZ(360deg); }
}
.fx-tw-shadow {
    position: absolute; left: 12%; right: 12%; bottom: -8%; height: 14%; border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75), transparent 70%);
    animation: fx-tw-shadow 1.15s ease-in-out infinite;
}
@keyframes fx-tw-shadow {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50%      { transform: scale(0.5); opacity: 0.3; }
}

/* ---- 7. Grain de vieux film western posé sur toute la page (fixe, sans clic) ---- */
html::after {
    content: ''; position: fixed; inset: -50%; z-index: 9500; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .92 0 0 0 0 .82 0 0 0 0 .6 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    opacity: 0.07;
    animation: fx-grain 0.9s steps(4) infinite;
}
@keyframes fx-grain {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-3%, 2%); }
    50%  { transform: translate(2%, -3%); }
    75%  { transform: translate(-2%, -1%); }
    100% { transform: translate(0, 0); }
}

/* ---- Accessibilité : aucune animation 3D si l'utilisateur le demande ---- */
@media (prefers-reduced-motion: reduce) {
    .fx-brand { opacity: 1; transform: none; transition: none; }
    .fx-star-spin { animation: none; transform: rotateX(10deg) rotateY(-20deg); }
    .fx-tumbleweed { display: none; }
    .countdown-number.fx-flip { animation: none; }
    html::after { animation: none; }
}
