/* =========================================================
   PHIAT LUX – Effetti dinamici (si appoggia a style.css)
   ========================================================= */

/* ---------- Barra di avanzamento lettura ---------- */
.scroll-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; transform: scaleX(0); box-shadow: 0 0 12px rgba(255, 194, 26, .7); pointer-events: none; }

/* ---------- Cursore ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 400; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--accent); pointer-events: none; opacity: 0; transition: width .3s var(--ease), height .3s var(--ease), background .3s, opacity .3s, border-color .3s; }
.cursor::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--accent); }
.cursor.on { opacity: 1; }
.cursor.hover { width: 64px; height: 64px; background: rgba(255, 194, 26, .12); border-color: rgba(255, 194, 26, .6); }
.cursor.hover::after { opacity: 0; }

/* ---------- Hero: rete luminosa + parallasse col mouse ---------- */
.hero__fx { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .25) 0%, rgba(0, 0, 0, .55) 40%, #000 75%);
          mask-image: linear-gradient(90deg, rgba(0, 0, 0, .25) 0%, rgba(0, 0, 0, .55) 40%, #000 75%); }
.hero__slide { transform: translate(calc(var(--hx, 0) * -22px), calc(var(--hy, 0) * -16px)) scale(1.06); transition: opacity 1.2s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.hero__text { transform: translate(calc(var(--hx, 0) * 10px), calc(var(--hy, 0) * 8px)); transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.hero__scroll { position: absolute; z-index: 3; left: 50%; bottom: 140px; translate: -50% 0; width: 26px; height: 42px; border: 2px solid rgba(255, 255, 255, .45); border-radius: 14px; }
.hero__scroll::after { content: ""; position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--accent); animation: wheel 1.8s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- Titoli che salgono parola per parola ---------- */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; }
.split .w > span { display: inline-block; transform: translateY(110%) rotate(4deg); transition: transform .9s var(--ease); transition-delay: calc(var(--i) * 45ms); }
.split.is-in .w > span { transform: none; }

/* Linea dell'etichetta che si allunga */
.reveal .eyebrow::before, .reveal .eyebrow::after { width: 0; transition: width .8s var(--ease) .35s; }
.reveal.is-in .eyebrow::before, .reveal.is-in .eyebrow::after { width: 34px; }

/* ---------- Elenchi a cascata ---------- */
.fx-stagger > * { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: calc(var(--i) * 80ms + .15s); }
.fx-stagger.is-in > * { opacity: 1; transform: none; }

/* ---------- Immagini con sipario luminoso ---------- */
.fx-img::after { content: ""; position: absolute; inset: 0; z-index: 4; background: linear-gradient(120deg, var(--accent), var(--accent-2)); transform: scaleX(0); transform-origin: left; pointer-events: none; }
.fx-img:not(.is-in) img { opacity: 0; }
.fx-img.is-in::after { animation: curtain 1.3s cubic-bezier(.77, 0, .18, 1) both; }
.fx-img.is-in img { animation: imgIn 1.4s var(--ease) .6s backwards; }
@keyframes curtain { 0% { transform: scaleX(0); transform-origin: left; } 48% { transform: scaleX(1); transform-origin: left; } 52% { transform: scaleX(1); transform-origin: right; } 100% { transform: scaleX(0); transform-origin: right; } }
@keyframes imgIn { from { opacity: 0; transform: scale(1.3); } to { opacity: 1; transform: scale(1); } }

/* Galleria: le foto si aprono una dopo l'altra */
.fx-clip .gallery__item { clip-path: inset(100% 0 0 0 round var(--radius)); transition: clip-path 1.1s cubic-bezier(.77, 0, .18, 1); transition-delay: calc(var(--i) * 110ms); }
.fx-clip.is-in .gallery__item { clip-path: inset(0 0 0 0 round var(--radius)); }

/* Pannello "Per chi" che entra con zoom */
.audience__panel.is-active .audience__media img { animation: imgIn 1.2s var(--ease) both; }

/* ---------- Grandi parole di sfondo che scorrono ---------- */
.has-word { overflow: clip; }
.has-word > .container { position: relative; z-index: 1; }
.bg-word { position: absolute; top: clamp(20px, 4vw, 50px); left: 0; z-index: 0; white-space: nowrap; pointer-events: none; user-select: none;
  font-family: var(--display); font-weight: 700; text-transform: uppercase; line-height: .8; font-size: clamp(7rem, 19vw, 18rem); letter-spacing: 4px;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .07); will-change: transform; }
.section--light .bg-word { -webkit-text-stroke-color: rgba(11, 18, 32, .07); }

/* ---------- Sezioni scure: griglia in movimento + luce che segue il mouse ---------- */
.section:not(.section--light) > .container { position: relative; z-index: 1; }
.section:not(.section--light)::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 64px 64px; animation: gridPan 30s linear infinite;
  -webkit-mask-image: radial-gradient(ellipse at 70% 30%, #000 0, transparent 70%); mask-image: radial-gradient(ellipse at 70% 30%, #000 0, transparent 70%); }
.section:not(.section--light)::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(520px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 194, 26, .09), transparent 65%); }
.section.glow::after { opacity: 1; }
@keyframes gridPan { to { background-position: 64px 64px, 64px 64px; } }

/* ---------- Schede 3D con riflesso ---------- */
.tilt { position: relative; transform-style: preserve-3d; will-change: transform; }
.tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 3; opacity: 0; transition: opacity .4s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .16), transparent 45%); }
.tilt.is-tilting::after { opacity: 1; }

/* ---------- Bottoni: riflesso che attraversa ---------- */
.btn:not(.btn--ghost):not(.btn--dark)::after { content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .65), transparent); transform: skewX(-20deg); animation: shine 4.5s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -60%; } 85%, 100% { left: 130%; } }
.btn, .hero__arrow, .whatsapp { transition: transform .3s var(--ease), box-shadow .3s, translate .35s var(--ease), background .3s, color .3s; }

/* Link del menu con sottolineatura */
.nav__link { position: relative; }
.nav__link::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .4s var(--ease); }
.nav__link:hover::after, .nav__item:hover > .nav__link::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Icone vive ---------- */
.feature:hover .feature__icon svg, .info-card:hover .info-card__icon svg, .card:hover .card__icon svg { animation: wiggle .7s var(--ease); }
@keyframes wiggle { 0%, 100% { transform: none; } 25% { transform: rotate(-14deg) scale(1.15); } 60% { transform: rotate(10deg) scale(1.1); } }
.feature__icon, .card__icon { position: relative; }
.feature__icon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--accent); opacity: 0; animation: ring 3s ease-out infinite; animation-delay: var(--d, 0s); }
@keyframes ring { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.6); } }
.service-card__icon { transition: background .35s, color .35s, transform .5s var(--ease); }
.service-card:hover .service-card__icon { transform: rotate(-10deg) scale(1.08); }
.area__icon { transition: transform .5s var(--ease); }
.area:hover .area__icon { transform: translateY(-6px) rotate(-8deg); }

/* ---------- Come lavoriamo: linea di corrente ---------- */
.process::after { content: ""; position: absolute; top: 43px; left: 10%; right: 10%; height: 4px; border-radius: 4px; z-index: 0;
  background: linear-gradient(90deg, transparent 0 40%, #fff 50%, transparent 60% 100%) 0 0 / 300% 100%, linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0); transform-origin: left; transition: transform 2.2s cubic-bezier(.65, 0, .35, 1); animation: current 2.8s linear infinite; }
.process.is-in::after { transform: scaleX(1); }
@keyframes current { from { background-position: 150% 0, 0 0; } to { background-position: -150% 0, 0 0; } }
.process__icon { z-index: 1; }
.process.is-in .process__icon { animation: lightUp 1s var(--ease) backwards; animation-delay: calc(var(--n) * .42s + .2s); }
@keyframes lightUp { 0% { box-shadow: 0 0 0 0 rgba(255, 194, 26, .8); } 100% { box-shadow: 0 0 0 26px rgba(255, 194, 26, 0); } }
@media (max-width: 1100px) { .process::after { display: none; } }

/* ---------- Contatori: strisce in movimento ---------- */
.stats::before { animation: stripes 2.5s linear infinite; }
@keyframes stripes { to { background-position: 62.2px 0; } }
.stat strong { transition: transform .4s var(--ease); }
.stat:hover strong { transform: scale(1.08); }

/* ---------- Secondo nastro inclinato ---------- */
.marquee--alt { background: var(--accent); color: var(--ink); border: 0; padding: 18px 0; transform: rotate(-1.6deg); margin: 0 -20px; position: relative; box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .6); }
.marquee--alt .marquee__item { font-size: clamp(1.2rem, 2.2vw, 1.8rem); }
.marquee--alt .marquee__item:nth-child(even) { color: var(--ink); -webkit-text-stroke: 0; }
.marquee--alt .marquee__item svg { color: var(--ink); width: 24px; height: 24px; }
.marquee--alt .marquee__track { animation-direction: reverse; animation-duration: 32s; }

/* ---------- Bordi luminosi rotanti ---------- */
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
.wizard, .help-bar {
  border: 1.5px solid transparent;
  background: linear-gradient(var(--panel), var(--panel)) padding-box,
              conic-gradient(from var(--ang), rgba(255, 255, 255, .08) 0 70%, var(--accent) 85%, rgba(255, 255, 255, .08) 100%) border-box;
  animation: spinBorder 5s linear infinite;
}
@keyframes spinBorder { to { --ang: 360deg; } }

/* WhatsApp che pulsa */
.whatsapp::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #25d366; z-index: -1; animation: ring 2.2s ease-out infinite; }

/* ---------- Accessibilità ---------- */
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .split .w > span, .fx-stagger > * { transform: none; opacity: 1; }
  .fx-img:not(.is-in) img { opacity: 1; }
  .fx-clip .gallery__item { clip-path: none; }
  .bg-word, .hero__fx, .cursor { display: none; }
}
@media (max-width: 640px) { .hero__scroll { display: none; } .bg-word { font-size: 6rem; } }
.marquee-wrap { overflow: clip; padding: 20px 0; margin: -32px 0 -20px; position: relative; z-index: 2; pointer-events: none; }
.marquee-wrap .marquee { pointer-events: auto; }
