/* AM Serveis Digitals · capa visual "fx": animacions, profunditat i llum.
   Només transform/opacity (sense canvis de layout). Tot s'activa amb html.fx (el posa js/fx.js).
   Amb "reduir moviment" només queden els acabats estàtics. */

/* ---------- Barra de progrés de scroll ---------- */
.fx-progress { position: fixed; z-index: 120; left: 0; top: 0; height: 3px; width: 100%; transform: scaleX(0); transform-origin: left; pointer-events: none;
  background: linear-gradient(90deg, #0056C4, #5aa0ff 55%, #FF8C00); box-shadow: 0 0 12px rgba(90,160,255,.7); will-change: transform; }

/* ---------- Llum del cursor (només ratolí) ---------- */
.fx-cursor { position: fixed; z-index: 60; left: 0; top: 0; width: 520px; height: 520px; margin: -260px 0 0 -260px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, rgba(90,160,255,.17), rgba(255,140,0,.06) 45%, rgba(0,0,0,0) 68%); transition: opacity .4s; will-change: transform; }
.fx-cursor.on { opacity: 1; }
html[data-theme="dark"] .fx-cursor { mix-blend-mode: screen; }

/* ---------- HERO ---------- */
.fx .hero-bg { overflow: hidden; }
.fx-aur { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; will-change: transform; }
.fx-aur.a1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -18vmax; background: radial-gradient(circle, #0b63d6, rgba(11,99,214,0) 70%); animation: fxA1 18s ease-in-out infinite alternate; }
.fx-aur.a2 { width: 38vmax; height: 38vmax; right: -10vmax; top: 6vmax; background: radial-gradient(circle, #5aa0ff, rgba(90,160,255,0) 70%); opacity: .4; animation: fxA2 22s ease-in-out infinite alternate; }
.fx-aur.a3 { width: 28vmax; height: 28vmax; left: 30%; bottom: -16vmax; background: radial-gradient(circle, #FF8C00, rgba(255,140,0,0) 70%); opacity: .28; animation: fxA3 26s ease-in-out infinite alternate; }
@keyframes fxA1 { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.15); } }
@keyframes fxA2 { to { transform: translate3d(-12vmax, 8vmax, 0) scale(.9); } }
@keyframes fxA3 { to { transform: translate3d(-14vmax, -6vmax, 0) scale(1.25); } }
.fx-net { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; pointer-events: none; }
.fx-spot { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .5s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 40%), rgba(120,175,255,.20), rgba(120,175,255,0) 60%); }
.hero.fx-hover .fx-spot { opacity: 1; }

/* Titular: paraula a paraula */
.fx .hero h1 .fx-w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.fx .hero h1 .fx-w > span { display: inline-block; transform: translateY(110%) rotate(5deg); opacity: 0; transform-origin: left bottom;
  animation: fxWord .9s cubic-bezier(.2,.8,.2,1) calc(var(--i) * 80ms + 150ms) forwards; }
@keyframes fxWord { to { transform: none; opacity: 1; } }
.fx .hero h1 .hl { display: inline-block; background-size: 220% 100%; animation: fxRise .9s cubic-bezier(.2,.8,.2,1) .75s both, fxShimmer 6s linear 1.8s infinite; }
@keyframes fxShimmer { to { background-position: -220% 0; } }
@keyframes fxRise { from { opacity: 0; transform: translateY(40%) scale(.94); } to { opacity: 1; transform: none; } }
.fx .hero .eyebrow { animation: fxRise .8s cubic-bezier(.2,.8,.2,1) both; }
.fx .hero .hero-sub { animation: fxRise .9s cubic-bezier(.2,.8,.2,1) .55s both; }
.fx .hero .hero-ctas { animation: fxRise .9s cubic-bezier(.2,.8,.2,1) .75s both; }
.fx .hero .hero-trust li { animation: fxRise .7s cubic-bezier(.2,.8,.2,1) both; }
.fx .hero .hero-trust li:nth-child(1) { animation-delay: .95s; } .fx .hero .hero-trust li:nth-child(2) { animation-delay: 1.07s; } .fx .hero .hero-trust li:nth-child(3) { animation-delay: 1.19s; }
.fx .hero .hero-trust .icon { animation: fxTick 2.8s ease-in-out 2s infinite; }
@keyframes fxTick { 0%, 80%, 100% { transform: scale(1); } 90% { transform: scale(1.35); } }

/* Targeta 3D amb inclinació, reflex i òrbites */
.fx .hero-visual { perspective: 1000px; }
.fx-tilt { position: relative; transform-style: preserve-3d; width: min(100%, 360px); transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .35s cubic-bezier(.2,.8,.2,1); animation: fxCardIn 1.1s cubic-bezier(.2,.8,.2,1) .3s both; }
@keyframes fxCardIn { from { opacity: 0; transform: translateY(40px) rotateX(18deg) scale(.9); } to { opacity: 1; } }
.fx-tilt .nfc-card { width: 100%; position: relative; overflow: hidden; }
.fx-shine { position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.75) 50%, rgba(255,255,255,0) 65%); transform: translateX(-120%); animation: fxShine 5.5s ease-in-out 2s infinite; }
@keyframes fxShine { 0%, 55% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
.fx .nfc-stars { animation: fxStars 3.2s ease-in-out infinite; }
@keyframes fxStars { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 6px rgba(255,180,0,.9)); } }
.fx .nfc-waves { animation: fxWaves 2.4s ease-in-out infinite; transform-origin: left center; }
@keyframes fxWaves { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.fx-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; pointer-events: none; border: 1px solid rgba(255,255,255,.18); transform: translate(-50%, -50%); }
.fx-ring.r1 { width: 112%; aspect-ratio: 1; animation: fxSpin 40s linear infinite; }
.fx-ring.r2 { width: 138%; aspect-ratio: 1; border-style: dashed; border-color: rgba(255,255,255,.12); animation: fxSpin 70s linear infinite reverse; }
.fx-ring::after { content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #FF8C00; box-shadow: 0 0 16px 3px rgba(255,140,0,.8); }
.fx-ring.r2::after { background: #7fb2ff; box-shadow: 0 0 16px 3px rgba(127,178,255,.8); }
@keyframes fxSpin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.fx .float-chip { translate: calc(var(--px, 0) * var(--k, 18px)) calc(var(--py, 0) * var(--k, 18px) + var(--sy, 0) * var(--sk, -30px)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.fx .chip-1 { --k: 34px; --sk: -50px; } .fx .chip-2 { --k: -28px; --sk: -22px; }
.fx .hero-visual .fx-tilt { translate: calc(var(--px, 0) * -8px) calc(var(--sy, 0) * -26px); }

/* ---------- Capçaleres de secció ---------- */
.fx .section-head h2 { position: relative; padding-bottom: .55rem; }
.fx .section-head h2::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 84px; height: 4px; margin-left: -42px; border-radius: 4px; background: linear-gradient(90deg, #0056C4, #5aa0ff, #FF8C00);
  transform: scaleX(0); transform-origin: center; transition: transform .9s cubic-bezier(.2,.8,.2,1) .25s; }
.fx .section-head.fx-in h2::after { transform: scaleX(1); }
.fx .section-head .eyebrow::before { transform: scaleX(0); transform-origin: right; transition: transform .6s ease .1s; }
.fx .section-head.fx-in .eyebrow::before { transform: scaleX(1); }

/* ---------- Revelat amb profunditat ---------- */
.fx.js-reveal .reveal { opacity: 0; transform: translateY(46px) scale(.94); filter: blur(7px); transition: opacity .9s cubic-bezier(.2,.8,.2,1), transform .9s cubic-bezier(.2,.8,.2,1), filter .9s ease, box-shadow .3s, border-color .3s !important; transition-delay: calc(var(--fx-d, 0) * 90ms) !important; }
.fx.js-reveal .reveal.is-visible { opacity: 1; transform: none; filter: none; }
.fx.js-reveal .reveal.is-visible:hover { transition-delay: 0s !important; transition-duration: .9s, .3s, .9s, .3s, .3s !important; }

/* ---------- Targetes de servei ---------- */
.fx .service-card { background-image: radial-gradient(340px circle at var(--gx, 50%) var(--gy, -40%), rgba(0,86,196,.13), rgba(0,86,196,0) 60%); }
.fx .service-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,140,0,.10), rgba(255,140,0,0) 60%); }
.fx .service-card:hover::after { opacity: 1; }
.fx .service-card:hover { transform: translateY(-9px); box-shadow: 0 30px 50px -24px rgba(0,56,140,.45), 0 0 0 1px rgba(0,86,196,.25); }
.fx .service-card .service-icon { transition: transform .5s cubic-bezier(.2,.8,.2,1), background-color .3s, color .3s; }
.fx .service-card:hover .service-icon { transform: translateY(-3px) rotate(-8deg) scale(1.12); }
.fx .service-card .card-link { transition: letter-spacing .3s, color .3s; }
.fx .service-card:hover .card-link { letter-spacing: .02em; }
html[data-theme="dark"].fx .service-card { background-image: radial-gradient(340px circle at var(--gx, 50%) var(--gy, -40%), rgba(90,160,255,.16), rgba(90,160,255,0) 60%); }

/* ---------- Passos ---------- */
.fx .steps { position: relative; }
.fx .step .step-n { position: relative; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.fx .step.is-visible .step-n { animation: fxPop .7s cubic-bezier(.2,.9,.3,1.4) both; animation-delay: calc(var(--fx-d, 0) * 90ms + .3s); }
.fx .step .step-n::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--primary); opacity: 0; }
.fx .step.is-visible .step-n::after { animation: fxPing 2.8s ease-out infinite; animation-delay: calc(var(--fx-d, 0) * 300ms + 1.2s); }
@keyframes fxPop { 0% { transform: scale(.2) rotate(-90deg); } 100% { transform: none; } }
@keyframes fxPing { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.9); } }
.fx .step:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.fx .step { transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; }

/* ---------- Seccions fosques i suaus: llum viva ---------- */
.fx .section-dark, .fx .section-soft { position: relative; overflow: hidden; isolation: isolate; }
.fx .section-dark::before, .fx .section-soft::before { content: ""; position: absolute; z-index: -1; width: 60vmax; height: 60vmax; left: -20vmax; top: -20vmax; border-radius: 50%; pointer-events: none;
  animation: fxA1 24s ease-in-out infinite alternate; }
.fx .section-dark::before { background: radial-gradient(circle, rgba(0,110,255,.30), rgba(0,110,255,0) 70%); }
.fx .section-soft::before { background: radial-gradient(circle, rgba(0,86,196,.10), rgba(0,86,196,0) 70%); }
.fx .section-dark::after, .fx .section-soft::after { content: ""; position: absolute; z-index: -1; width: 44vmax; height: 44vmax; right: -16vmax; bottom: -22vmax; border-radius: 50%; pointer-events: none; animation: fxA2 28s ease-in-out infinite alternate; }
.fx .section-dark::after { background: radial-gradient(circle, rgba(255,140,0,.16), rgba(255,140,0,0) 70%); }
.fx .section-soft::after { background: radial-gradient(circle, rgba(255,140,0,.08), rgba(255,140,0,0) 70%); }

/* ---------- Botons ---------- */
.fx .btn { position: relative; overflow: hidden; translate: var(--bx, 0) var(--by, 0); transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease), color .2s, border-color .2s, translate .25s cubic-bezier(.2,.8,.2,1); }
.fx .btn-accent::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.55) 50%, rgba(255,255,255,0) 70%); transform: translateX(-130%); animation: fxShine 4.8s ease-in-out 3s infinite; }
.fx .btn-accent { animation: fxGlow 3.4s ease-in-out infinite; }
@keyframes fxGlow { 0%, 100% { box-shadow: 0 10px 24px -8px rgba(255,122,0,.55); } 50% { box-shadow: 0 14px 36px -4px rgba(255,122,0,.85), 0 0 0 6px rgba(255,122,0,.12); } }

/* ---------- Banda final ---------- */
.fx .cta-band-inner { position: relative; overflow: hidden; background: linear-gradient(120deg, #00439a, #0056C4 30%, #2a73d8 55%, #0056C4 80%, #00439a); background-size: 260% 100%; animation: fxFlow 12s ease-in-out infinite alternate; }
@keyframes fxFlow { to { background-position: 100% 0; } }
.fx .cta-band-inner::before, .fx .cta-band-inner::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.fx .cta-band-inner::before { width: 340px; height: 340px; right: -90px; top: -150px; background: radial-gradient(circle, rgba(255,255,255,.22), rgba(255,255,255,0) 68%); animation: fxA2 9s ease-in-out infinite alternate; }
.fx .cta-band-inner::after { width: 260px; height: 260px; left: -70px; bottom: -130px; background: radial-gradient(circle, rgba(255,140,0,.35), rgba(255,140,0,0) 68%); animation: fxA1 11s ease-in-out infinite alternate; }
.fx .cta-band-inner > * { position: relative; z-index: 1; }

/* ---------- Pàgines interiors ---------- */
.fx .fx-r { opacity: 0; transform: translateY(32px); filter: blur(5px); transition: opacity .8s cubic-bezier(.2,.8,.2,1), transform .8s cubic-bezier(.2,.8,.2,1), filter .8s ease; transition-delay: calc(var(--fx-d, 0) * 70ms); }
.fx .fx-r.fx-in { opacity: 1; transform: none; filter: none; }
.fx .check-list li.fx-r.fx-in .icon { animation: fxPop .6s cubic-bezier(.2,.9,.3,1.4) both; animation-delay: calc(var(--fx-d, 0) * 70ms + .15s); }
.fx .page-hero.fx-hover .fx-spot { opacity: 1; }
.fx .page-hero-scene.has-svp { max-width: 480px; }
.svp { position: relative; width: 100%; display: grid; place-items: center; }
.svp .sv-stage { width: 100%; }
@media (max-width: 900px) { .svp .sv-stage { width: min(80vw, 320px); } .fx .page-hero-scene.has-svp { max-width: 340px; } }
.fx .related a { transition: transform .25s cubic-bezier(.2,.8,.2,1), border-color .2s, box-shadow .25s; }
.fx .related a:hover { transform: translateY(-3px); box-shadow: 0 10px 20px -10px rgba(0,56,140,.45); }
.fx .faq-item { transition: box-shadow .3s, transform .3s cubic-bezier(.2,.8,.2,1), opacity .8s cubic-bezier(.2,.8,.2,1), filter .8s ease; }
.fx .faq-item:hover { box-shadow: var(--shadow); }

/* ---------- Mòbil / poc rendiment ---------- */
@media (max-width: 720px) {
  .fx-aur { filter: blur(40px); }
  .fx .hero h1 .hl { animation-name: fxRise; animation-iteration-count: 1; }
  .fx-ring.r2 { display: none; }
}

/* ---------- Reduir moviment: res es mou, però queda net ---------- */
@media (prefers-reduced-motion: reduce) {
  .fx-progress, .fx-cursor, .fx-net, .fx-spot, .fx-aur, .fx-ring, .fx-shine { display: none !important; }
  .fx .fx-r { opacity: 1; transform: none; filter: none; }
}
