/* ==========================================================================
   Card Festival — Motion system (prototipo)
   In produzione: CSS minimo in WPCodeBox2 + JS (GSAP/ScrollTrigger) che
   aggancia gli ID dei container (#sinapps-…). Catalogo completo: MOTION.md
   Disattivato con prefers-reduced-motion e con ?nomotion (screenshot board).
   ========================================================================== */

:root { --ease-out: cubic-bezier(.2,.7,.2,1); --ease-io: cubic-bezier(.7,0,.2,1); }

/* ======================= GLOBALI ======================= */

/* G01 · Intro "mazzo distribuito" (prima visita) */
.fx-loader {
  position: fixed; inset: 0; z-index: 200; background: var(--c-dark);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 28px;
  transition: transform .9s var(--ease-io);
}
.fx-loader.is-out { transform: translateY(-100%); }
.fx-loader__deck { position: relative; width: 120px; height: 168px; }
.fx-loader__deck span {
  position: absolute; inset: 0; border-radius: 10px; border: 2px solid var(--c-on-dark);
  background: repeating-linear-gradient(45deg, var(--c-dark-surface) 0 8px, var(--c-dark) 8px 16px);
  transform-origin: 50% 130%; animation: fx-deal 1.1s var(--ease-out) forwards;
  animation-delay: calc(var(--i) * 90ms);
}
@keyframes fx-deal {
  0% { transform: translateY(40px) rotate(0); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: rotate(calc((var(--i) - 2) * 14deg)) translateX(calc((var(--i) - 2) * 18px)); opacity: 1; }
}
.fx-loader__word { font-family: var(--f-primary); font-weight: 900; letter-spacing: .3em; color: var(--c-on-dark); font-size: 14px; opacity: 0; animation: fx-fade .6s .6s forwards; }
@keyframes fx-fade { to { opacity: 1; } }

/* G02 · Transizione tra pagine: sipario con dorso carta */
.fx-curtain {
  position: fixed; inset: 0; z-index: 190; pointer-events: none;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 60px, var(--c-dark) 61px),
    repeating-linear-gradient(45deg, var(--c-dark-surface) 0 10px, var(--c-dark) 10px 20px);
  transform: translateY(100%); transition: transform .55s var(--ease-io);
}
.fx-curtain.is-cover { transform: translateY(0); }
.fx-curtain.is-gone { transform: translateY(-100%); }
.fx-curtain.no-anim { transition: none; }

/* G03 · Titoli che salgono parola per parola (maschera) */
.fx-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .1em; margin-bottom: -.1em; }
.fx-w > i { display: inline-block; font-style: normal; transform: translateY(110%); transition: transform .9s var(--ease-out); }
.fx-split.is-in .fx-w > i { transform: none; }

/* G04 · Reveal sfalsato (card, righe, accordion) */
.fx-reveal { opacity: 0; transform: translateY(40px); transition: opacity .8s ease, transform .8s var(--ease-out); }
.fx-reveal.is-in { opacity: 1; transform: none; }

/* G05 · Cursore custom (solo puntatore fine) */
.fx-cursor, .fx-ring { position: fixed; top: 0; left: 0; z-index: 180; pointer-events: none; border-radius: 50%; }
.fx-cursor { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--c-primary); }
.fx-ring {
  width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1.5px solid var(--c-primary); opacity: .5;
  transition: width .3s var(--ease-out), height .3s var(--ease-out), margin .3s var(--ease-out), border-radius .3s, opacity .3s, background-color .3s;
  display: flex; align-items: center; justify-content: center;
  font: 700 10px/1 var(--f-secondary); letter-spacing: .12em; text-transform: uppercase; color: var(--c-bg);
}
.fx-ring.is-link { width: 64px; height: 64px; margin: -32px 0 0 -32px; opacity: .9; }
.fx-ring.is-card { width: 64px; height: 90px; margin: -45px 0 0 -32px; border-radius: 8px; opacity: 1; background: var(--c-primary); }
.fx-ring.is-card::after { content: "Vedi"; }
@media (pointer: coarse) { .fx-cursor, .fx-ring { display: none; } }

/* G06 · Bottoni magnetici */
.btn.fx-mag { transition: transform .35s var(--ease-out); }

/* G07 · Tilt 3D + riflesso olografico su ogni carta */
.fx-holo { transform-style: preserve-3d; transition: transform .4s var(--ease-out), box-shadow .4s; will-change: transform; }
.fx-holo::after, .fx-fan .ph--card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light; z-index: 2;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.75) 45%, rgba(170,170,170,.4) 55%, transparent 70%);
  background-size: 250% 250%; background-position: var(--holo, 50%) 50%; opacity: var(--holo-o, 0); transition: opacity .3s;
}
.fx-fan .ph--card::after { --holo-o: 1; }
.fx-holo.is-tilting { --holo-o: 1; box-shadow: 0 30px 60px rgba(0,0,0,.35); }

/* G08 · Header che si nasconde scendendo e ricompare risalendo */
.site-header { transition: transform .45s var(--ease-out); }
.site-header.is-hidden { transform: translateY(-100%); }

/* G09 · Barra di avanzamento lettura */
.fx-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 120; background: var(--c-primary); transform-origin: 0 50%; transform: scaleX(0); }

/* G10 · Banda di testo che scorre e si inclina con la velocità di scroll */
.fx-band { overflow: hidden; padding: 28px 0; border-top: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); background: var(--c-bg); }
.fx-band__track { display: flex; width: max-content; will-change: transform; }
.fx-band__track span {
  font-family: var(--f-primary); font-weight: 900; font-size: clamp(40px, 7vw, 110px); line-height: 1;
  letter-spacing: -.02em; text-transform: uppercase; padding-right: .5em; white-space: nowrap; color: var(--c-primary);
}
.fx-band__track span:nth-child(even) { color: transparent; -webkit-text-stroke: 1.5px var(--c-primary); }

/* G11 · Wordmark gigante nel footer */
.fx-wordmark {
  max-width: var(--content-w); margin: 64px auto 0; font-family: var(--f-primary); font-weight: 900;
  font-size: clamp(48px, 12.5vw, 190px); line-height: .85; letter-spacing: -.04em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px var(--c-dark-line); overflow: hidden; text-align: center;
}
.fx-wordmark .fx-w > i { transition-duration: 1.1s; }
.fx-wordmark:hover { color: var(--c-dark-line); transition: color .6s; }

/* G12 · Ingresso pannelli tab / risultati filtro: gestito in JS (Web Animations) */

/* ======================= HOME ======================= */

/* H01 · Ventaglio di carte 3D (hero) */
.fx-fan {
  position: relative; height: clamp(380px, 46vw, 560px);
  perspective: 1200px; display: flex; align-items: center; justify-content: center;
}
.fx-fan__inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .25s ease-out; }
.fx-fan .ph--card {
  position: absolute; left: 50%; top: 50%; width: clamp(150px, 17vw, 230px);
  margin-left: calc(clamp(150px, 17vw, 230px) / -2); margin-top: calc(clamp(150px, 17vw, 230px) * -0.7);
  transform: rotate(calc(var(--i) * var(--spread, 9deg))) translateX(calc(var(--i) * var(--shift, 28px)));
  transform-origin: 50% 120%;
  box-shadow: 0 30px 60px rgba(0,0,0,.18); border: 6px solid var(--c-frame); transition: transform .2s ease-out;
}
.fx-fan .ph--card:hover { transform: rotate(calc(var(--i) * var(--spread, 9deg))) translateX(calc(var(--i) * var(--shift, 28px))) translateY(-24px); }
.fx-fan.is-dealing .ph--card { animation: fx-land 1s var(--ease-out) backwards; animation-delay: calc((var(--i) + 2) * 110ms + .2s); }
@keyframes fx-land { from { transform: translate(-60vw, -40vh) rotate(-60deg); opacity: 0; } }

/* H02 · Passeggiata orizzontale tra le aree (pin) */
.fx-pin { padding: 0 !important; }
.fx-pin__sticky {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: 36px;
  padding: 80px var(--gutter) 40px;
}
.fx-pin__head { max-width: var(--content-w); width: 100%; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.fx-pin__track { display: flex; gap: var(--gap); will-change: transform; padding-left: max(0px, calc((100vw - var(--content-w)) / 2 - var(--gutter))); }
.fx-pin__track .card { flex: 0 0 clamp(260px, 28vw, 360px); transition: transform .5s var(--ease-out); }
.fx-pin__track .card:hover { transform: translateY(-10px) rotate(-1deg); }
.fx-pin__track .card .ph { aspect-ratio: 4 / 3; min-height: 0; }
.fx-pin__track .card .idx { font-family: var(--f-primary); font-weight: 800; font-size: 14px; letter-spacing: .1em; color: var(--c-accent); }
.fx-pin__progress { max-width: var(--content-w); width: 100%; margin: 0 auto; height: 3px; background: var(--c-line); border-radius: 3px; overflow: hidden; }
.fx-pin__progress i { display: block; height: 100%; width: 0; background: var(--c-primary); }
@media (max-width: 767px) { /* mobile: niente pin, swipe nativo con snap */
  .fx-pin { height: auto !important; padding: var(--section-py) 0 !important; }
  .fx-pin__sticky { position: static; height: auto; padding: 0; }
  .fx-pin__head, .fx-pin__progress { padding: 0 var(--gutter); }
  .fx-pin__track { overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--gutter) 12px; transform: none !important; }
  .fx-pin__track .card { scroll-snap-align: start; flex-basis: 78vw; }
  .fx-pin__progress { display: none; }
}

/* H03 · Asta: timbro AGGIUDICATO + offerte live */
.fx-stamp {
  position: absolute; top: 50%; left: 50%; z-index: 3; pointer-events: none;
  font: 900 clamp(16px, 1.8vw, 24px)/1 var(--f-primary); letter-spacing: .12em; color: var(--c-on-dark);
  border: 3px solid var(--c-on-dark); padding: 10px 14px; border-radius: 6px;
  transform: translate(-50%, -50%) rotate(-14deg) scale(3); opacity: 0;
}
.is-stamped .fx-stamp { animation: fx-stamp .5s cubic-bezier(.5,0,.75,0) forwards; }
.is-stamped { animation: fx-shake .35s .45s; }
@keyframes fx-stamp { to { transform: translate(-50%, -50%) rotate(-14deg) scale(1); opacity: 1; } }
@keyframes fx-shake { 0%,100% { transform: none; } 25% { transform: translate(-4px, 2px); } 50% { transform: translate(3px, -3px); } 75% { transform: translate(-2px, 1px); } }
.fx-bid { font-size: 14px; display: flex; gap: 6px; align-items: center; }
.fx-bid b { font-family: var(--f-primary); font-size: 16px; color: var(--c-on-dark); transition: color .3s; }
.sec:not(.sec--dark) .fx-bid b { color: var(--c-primary); }
.fx-bid::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: fx-live 1.4s infinite; }
.fx-bid.is-up b { animation: fx-bump .5s var(--ease-out); }
@keyframes fx-live { 50% { opacity: .2; } }
@keyframes fx-bump { 40% { transform: translateY(-4px); } }

/* H04 · Spotlight / luci spente (Trading Night) + polvere nella luce */
[data-spotlight] { --mx: 50%; --my: 50%; overflow: hidden; isolation: isolate; }
[data-spotlight]::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle 340px at var(--mx) var(--my), rgba(255,255,255,.13), transparent 70%);
}
[data-spotlight] .fx-ghost-cards { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
[data-spotlight] .fx-ghost-cards span {
  position: absolute; width: 120px; aspect-ratio: 63 / 88; border-radius: 10px;
  border: 1px solid var(--wf-dark-ph-line); background: var(--wf-dark-ph); filter: blur(2px); opacity: .5;
  -webkit-mask-image: radial-gradient(circle 340px at var(--gx) var(--gy), #000 30%, transparent 75%);
          mask-image: radial-gradient(circle 340px at var(--gx) var(--gy), #000 30%, transparent 75%);
}
.fx-dust { position: absolute; inset: 0; z-index: -1; pointer-events: none; width: 100%; height: 100%; }
.fx-dusk { height: 30vh; background: linear-gradient(to bottom, var(--c-bg), var(--c-dark)); }

/* H05 · Timeline giorno → notte */
#sinapps-timeline { transition: background-color .4s linear; }
.timeline .step { opacity: .35; transition: opacity .4s ease; }
.timeline .step.is-on { opacity: 1; }
.timeline .step.is-on::before { animation: fx-pop-dot .5s var(--ease-out); }
@keyframes fx-pop-dot { 50% { transform: scale(1.5); } }

/* ======================= PAGINE ======================= */

/* Biglietti · riflesso foil che passa sulla card in evidenza */
.card--featured::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255,255,255,.14) 50%, transparent 65%);
  background-size: 300% 100%; animation: fx-foil 4s ease-in-out infinite;
}
@keyframes fx-foil { 0%, 60% { background-position: 120% 0; } 100% { background-position: -20% 0; } }

/* Location · hotspot che pulsano */
.hs::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--c-primary); animation: fx-ping 2s var(--ease-out) infinite; }
@keyframes fx-ping { from { transform: scale(1); opacity: .8; } to { transform: scale(2.4); opacity: 0; } }

/* Aste · numeri degli step che si collegano */
.fx-steps { position: relative; }
.fx-steps::before {
  content: ""; position: absolute; top: 22px; left: 22px; right: 22px; height: 2px; background: var(--c-primary);
  transform-origin: 0 50%; transform: scaleX(var(--p, 0)); z-index: 0;
}
.fx-steps .num { position: relative; z-index: 1; background: var(--c-bg); }
@media (max-width: 1024px) { .fx-steps::before { display: none; } }

/* Trading Night · porte che si chiudono */
.fx-doors { position: fixed; inset: 0; z-index: 150; pointer-events: none; display: flex; }
.fx-doors i { flex: 1; background: var(--c-dark); border: 1px solid var(--c-dark-line); transition: transform .7s var(--ease-io); }
.fx-doors i:first-child { transform: translateX(-101%); }
.fx-doors i:last-child { transform: translateX(101%); }
.fx-doors.is-closed i { transform: none; }
.fx-doors::after {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--c-on-dark); box-shadow: 0 0 40px 8px rgba(255,255,255,.5); opacity: 0; transition: opacity .3s;
}
.fx-doors.is-closed::after { opacity: 1; transition-delay: .6s; }
.fx-doors.is-open { opacity: 0; transition: opacity .6s; }

/* Trading Night · barra posti che si riempie */
.bar-seats i { width: 0 !important; transition: width 1.6s var(--ease-out); }
.bar-seats.is-in i { width: 68% !important; }

/* Lucchetto che vibra */
.fx-lock { display: inline-block; animation: fx-lock 3s ease-in-out infinite; }
@keyframes fx-lock { 0%, 86%, 100% { transform: none; } 88% { transform: rotate(-12deg); } 92% { transform: rotate(10deg); } 96% { transform: rotate(-6deg); } }

/* LIVE badge */
.fx-live { display: inline-flex; align-items: center; gap: 6px; }
.fx-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #ff3b3b; animation: fx-live 1.2s infinite; }

.marquee:hover .track { animation-play-state: paused; }

/* ======================= SPEGNIMENTO ======================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .fx-reveal, .fx-w > i { opacity: 1 !important; transform: none !important; }
  .timeline .step { opacity: 1; }
}
html.fx-off *, html.fx-off *::before, html.fx-off *::after { animation: none !important; transition: none !important; }
html.fx-off .fx-reveal, html.fx-off .fx-w > i { opacity: 1 !important; transform: none !important; }
html.fx-off .timeline .step { opacity: 1; }
html.fx-off .bar-seats i { width: 68% !important; }
