/* Hero della home: slider a schermo pieno (includes/home_hero.php, script assets/js/home-hero.js,
   sfondo canvas assets/js/home-hero-bg.js). v2 14/11/2026, piano docs/plans/restyle/01-slider.md.
   Sfondo scuro fisso (anche in tema chiaro), titoli con cascata di parole, passaggi con direzione,
   tilt/parallasse solo con puntatore fine, disegni SVG a livelli con scanline.
   Stati sulla radice .hs (messi da JS):
     is-ready   dopo il primo cambio di slide: abilita la cascata (la slide 1 al primo caricamento resta statica = LCP)
     is-paused  ferma l'avanzamento (hover, focus, pulsante, fuori vista)
     is-frozen  ferma anche le animazioni (pulsante pausa, scheda nascosta, hero fuori vista)
     no-auto    reduced-motion: niente autoplay
   Con prefers-reduced-motion: tutto fermo e completo. */
@property --hs-a { syntax: '<color>'; inherits: true; initial-value: #3b82f6; }
@property --hs-b { syntax: '<color>'; inherits: true; initial-value: #a78bfa; }

.hs {
    --hs-bg: var(--ui-ink, #05070d);
    --hs-text: var(--ui-ink-text, #f5f5f7);
    --hs-muted: var(--ui-ink-muted, #a1a1aa);
    --hs-blue: #3b82f6;
    --hs-cyan: #22d3ee;
    --hs-violet: #a78bfa;
    --hs-dur: 6500ms;
    --hs-a: #3b82f6; --hs-b: #a78bfa; --hs-c: #3b82f6;
    --mx: 0; --my: 0; --dx: 1; --drag: 0px;
    position: relative;
    overflow: hidden;
    background: var(--hs-bg);
    color: var(--hs-text);
    text-align: center;
    padding: clamp(36px, 5vh, 64px) 16px 24px;
    isolation: isolate;
    transition: --hs-a 1.2s ease, --hs-b 1.2s ease;
}
/* colore per slide (--hs-c = copia non animata, letta dal canvas) */
.hs[data-slide="1"] { --hs-a: #34d399; --hs-b: #3b82f6; --hs-c: #34d399; }
.hs[data-slide="2"] { --hs-a: #f87171; --hs-b: #a78bfa; --hs-c: #f87171; }
.hs[data-slide="3"] { --hs-a: #22d3ee; --hs-b: #a78bfa; --hs-c: #22d3ee; }
.hs[data-slide="4"] { --hs-a: #a78bfa; --hs-b: #22d3ee; --hs-c: #a78bfa; }
.hs[data-dir="prev"] { --dx: -1; }

.hs-glow {
    position: absolute; inset: -20% -10% auto; height: 120%; z-index: -2; pointer-events: none;
    background:
        radial-gradient(40% 45% at 30% 55%, rgba(59, 130, 246, .35), transparent 70%),
        radial-gradient(35% 40% at 72% 45%, rgba(167, 139, 250, .28), transparent 70%),
        radial-gradient(30% 30% at 50% 90%, rgba(34, 211, 238, .18), transparent 70%);
    background:
        radial-gradient(40% 45% at 30% 55%, color-mix(in srgb, var(--hs-a) 35%, transparent), transparent 70%),
        radial-gradient(35% 40% at 72% 45%, color-mix(in srgb, var(--hs-b) 28%, transparent), transparent 70%),
        radial-gradient(30% 30% at 50% 90%, rgba(34, 211, 238, .18), transparent 70%);
    filter: blur(20px);
    translate: calc(var(--mx) * -18px) calc(var(--my) * -12px);
    animation: hs-glow 18s ease-in-out infinite alternate;
}
@keyframes hs-glow { from { transform: translate3d(-3%, 0, 0) scale(1); } to { transform: translate3d(3%, -2%, 0) scale(1.08); } }

/* sfondo generativo (home-hero-bg.js): invisibile finche' lo script non disegna */
.hs-bg {
    position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none;
    opacity: 0; transition: opacity 1.2s ease;
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 25%, #000 80%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 25%, #000 80%, transparent 100%);
}
.hs-bg.is-on { opacity: 1; }

/* le slide sono impilate nella stessa cella: l'altezza del track e' quella della slide piu' alta (niente CLS) */
.hs-track { position: relative; max-width: 1100px; margin: 0 auto; display: grid; align-items: center; }
.hs-slide {
    grid-area: 1 / 1;
    display: flex; flex-direction: column; align-items: center;
    opacity: 0; visibility: hidden;
    transform: translateX(calc(var(--dx) * 40px)) scale(.96);
    transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1), visibility 0s linear .9s;
}
.hs-slide.is-active {
    opacity: 1; visibility: visible; transform: none;
    translate: var(--drag) 0;
    transition: opacity .7s cubic-bezier(.2, .7, .2, 1) .08s, transform .9s cubic-bezier(.2, .7, .2, 1), translate .35s ease, visibility 0s;
}
.hs.is-dragging .hs-slide.is-active { transition: none; }
.hs-slide.is-leaving {
    visibility: visible;
    transform: translateX(calc(var(--dx) * -40px)) scale(1.04);
    transition: opacity .6s ease, transform .6s cubic-bezier(.4, 0, .2, 1), filter .6s ease, visibility 0s linear .6s;
}
@media (hover: hover) and (min-width: 1024px) {
    .hs-slide.is-leaving { filter: blur(10px); }
}

.hs-kicker {
    margin: 0 0 14px; font-family: Poppins, sans-serif; font-weight: 600; font-size: clamp(.9rem, 1.4vw, 1.05rem);
    letter-spacing: .02em; color: var(--hs-cyan);
}
.hs-title {
    margin: 0; font-family: Poppins, sans-serif; font-weight: 700;
    font-size: clamp(2.2rem, 5.6vw, 4.1rem); line-height: 1.04; letter-spacing: -.035em; color: var(--hs-text);
}
.hs-grad {
    background: linear-gradient(90deg, #60a5fa 0%, #a78bfa 45%, #22d3ee 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    background-size: 200% 100%; animation: hs-shine 8s linear infinite;
}
@keyframes hs-shine { from { background-position: 0% 0; } to { background-position: 200% 0; } }
.hs-sub {
    margin: 18px auto 0; max-width: 640px; font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.55; color: var(--hs-muted);
}
.hs-sub strong { color: var(--hs-text); font-weight: 700; }

/* ---- 1. cascata delle parole (span .hs-w creati da home-hero.js) ---- */
.hs-w { display: inline-block; }
/* dentro .hs-grad il gradiente passa sulle singole parole, allineato con --gx/--gw misurati in JS */
.hs-grad.is-split { background: none; -webkit-background-clip: border-box; background-clip: border-box; color: inherit; animation: none; }
.hs-grad.is-split .hs-w {
    background-image: linear-gradient(90deg, #60a5fa 0%, #a78bfa 45%, #22d3ee 100%);
    background-size: calc(var(--gw, 400px) * 2) 100%;
    background-position: calc(var(--gx, 0px) * -1) 0;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: hs-wshine 8s linear infinite;
}
@keyframes hs-wshine {
    from { background-position: calc(var(--gx, 0px) * -1) 0; }
    to { background-position: calc(var(--gx, 0px) * -1 - var(--gw, 400px) * 2) 0; }
}
.hs.is-ready .hs-slide.is-active .hs-w {
    animation: hs-word .8s cubic-bezier(.2, .7, .2, 1) both;
    animation-delay: calc(var(--i, 0) * 60ms + 150ms);
}
.hs.is-ready .hs-slide.is-active .hs-grad.is-split .hs-w {
    animation: hs-word .8s cubic-bezier(.2, .7, .2, 1) both, hs-wshine 8s linear infinite;
    animation-delay: calc(var(--i, 0) * 60ms + 150ms), 0s;
}
.hs.is-ready .hs-slide.is-active .hs-kicker { animation: hs-up .7s cubic-bezier(.2, .7, .2, 1) both; }
.hs.is-ready .hs-slide.is-active .hs-sub { animation: hs-up .8s cubic-bezier(.2, .7, .2, 1) .45s both; }
.hs.is-ready .hs-slide.is-active .hs-visual { animation: hs-reveal 1s cubic-bezier(.2, .7, .2, 1) .1s backwards; }
@keyframes hs-word { from { opacity: 0; transform: translateY(.6em) rotateX(-40deg); } to { opacity: 1; transform: none; } }
@keyframes hs-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes hs-reveal { from { clip-path: inset(0 0 100% 0 round 24px); } to { clip-path: inset(0 0 0 0 round 24px); } }
@media (hover: hover) and (min-width: 1024px) {
    @keyframes hs-word { from { opacity: 0; transform: translateY(.6em) rotateX(-40deg); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
}

/* ---- scena illustrata ---- */
.hs-visual { position: relative; width: 100%; max-width: clamp(300px, calc((100vh - 590px) * 2.1), 860px); margin-top: clamp(16px, 2.6vh, 32px); }
.hs-svg { width: 100%; height: auto; display: block; overflow: visible; }
/* scanline: fascia luminosa che spazza il disegno ogni 3 s (la slide 3 ha il suo scanner) */
.hs-visual::after {
    content: ""; position: absolute; top: 4%; bottom: 4%; left: 0; width: 7%; pointer-events: none; opacity: 0;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--hs-a) 7%, transparent) 80%, rgba(255, 255, 255, .1) 98%, transparent);
    mix-blend-mode: screen;
}
.hs-slide.is-active .hs-visual::after { animation: hs-scanline 3s linear 2.4s infinite; }
.hs-slide[data-i="2"] .hs-visual::after { display: none; }
@keyframes hs-scanline { 0% { opacity: 0; transform: translateX(-100%); } 8% { opacity: 1; } 55% { opacity: 1; } 62%, 100% { opacity: 0; transform: translateX(1400%); } }

.hs-win { fill: rgba(12, 16, 28, .82); stroke: rgba(255, 255, 255, .14); stroke-width: 1.5; }
.hs-winbar { fill: rgba(255, 255, 255, .05); }
.hs-dot.r { fill: #ff5f57; } .hs-dot.y { fill: #febc2e; } .hs-dot.g { fill: #28c840; }
.hs-tools rect { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .1); }
.hs-tools rect.on { fill: rgba(59, 130, 246, .28); stroke: #60a5fa; }
.hs-tools path, .hs-tools circle { fill: none; stroke: #cbd5e1; stroke-width: 1.6; stroke-linecap: round; }
.hs-tools rect[width="18"] { fill: none; stroke: #cbd5e1; stroke-width: 1.6; }
.hs-grid path { stroke: rgba(255, 255, 255, .05); stroke-width: 1; fill: none; }
.hs-panel > rect:first-child { fill: rgba(11, 15, 26, .85); stroke: rgba(255, 255, 255, .12); }
.hs-ptitle { fill: #f5f5f7; font: 600 13px Poppins, sans-serif; }
.hs-ptxt { fill: #d4d4d8; font: 400 12.5px Lato, sans-serif; }
.hs-prow { fill: rgba(96, 165, 250, .1); stroke: rgba(96, 165, 250, .45); }
.sw-cut { fill: #f87171; } .sw-crease { fill: #60a5fa; } .sw-zero { fill: #e4e4e7; }
.hs-cmdbox { fill: #0b0f1a; stroke: rgba(255, 255, 255, .12); }
.hs-cmdtxt { fill: #e4e4e7; font: 500 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hs-cmdtxt .p { fill: #22d3ee; }
.hs-cover { fill: #0b0f1a; }
.hs-type.t2 { opacity: 0; }
.hs-snap rect { fill: none; stroke: #22d3ee; stroke-width: 1.5; }

.draw { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.draw.cut, .ln.cut { stroke: #f87171; stroke-width: 3; }
.draw.crease { stroke: #60a5fa; stroke-width: 2.5; }
.draw.fext { stroke: #34d399; stroke-width: 2.5; }
.draw.axis { stroke: rgba(255, 255, 255, .35); stroke-width: 1.2; }
.draw.dim { stroke: #22d3ee; stroke-width: 1.6; }
/* niente filter: drop-shadow sui gruppi SVG: costa a ogni fotogramma del tilt e in Chromium lasciava
   il livello filtrato della slide uscente fuori posto (visto nei test). Bagliore solo dal glow di sfondo. */
.hs-dimtxt { fill: #22d3ee; font: 600 16px Poppins, sans-serif; text-anchor: middle; }
.fade { opacity: 0; }
.hs-chip { fill: rgba(255, 255, 255, .06); stroke-width: 1.5; }
.hs-chip.c1 { stroke: #f87171; } .hs-chip.c2 { stroke: #60a5fa; } .hs-chip.c3 { stroke: #34d399; } .hs-chip.c4 { stroke: #a78bfa; } .hs-chip.c5 { stroke: #22d3ee; }
.hs-chiptxt { fill: #e4e4e7; font: 700 12px Poppins, sans-serif; letter-spacing: .04em; text-anchor: middle; }

/* slide 2: il tracciato si compone e si "esplode" nelle due tavole EF / EM */
.hs-board { opacity: 0; transform-box: view-box; transform-origin: 400px 200px; }
.ln { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ln.fext { stroke: #34d399; stroke-width: 3; }
.ln.fint { stroke: #6ee7b7; stroke-width: 2.4; stroke-dasharray: 10 6; }
.ln.blade { stroke: #fbbf24; stroke-width: 6; }
.ln.tamp circle { fill: rgba(34, 211, 238, .15); stroke: #22d3ee; stroke-width: 2.5; }
.hs-ghost { fill: none; stroke: rgba(248, 113, 113, .4); stroke-width: 2.5; }
.hs-blt { fill: #f5f5f7; font: 700 18px Poppins, sans-serif; text-anchor: middle; letter-spacing: .08em; }
.hs-bls { fill: #a1a1aa; font: 500 12.5px ui-monospace, Menlo, Consolas, monospace; text-anchor: middle; }

/* slide 3: scanner, lente sull'interruzione, schede */
.hs-scanner rect { fill: #22d3ee; opacity: 0; }
.hs-scanner { transform-box: view-box; }
.hs-lens { opacity: 0; transform-box: view-box; transform-origin: 338px 100px; }
.hs-lensbg { fill: #0b0f1a; }
.hs-lensring { fill: none; stroke: #f87171; stroke-width: 2.5; }
.hs-lenscut { stroke: #f87171; stroke-width: 6; stroke-linecap: round; fill: none; }
.hs-lensdim { stroke: #22d3ee; stroke-width: 1.6; fill: none; }
.hs-lenstxt { fill: #22d3ee; font: 700 13px Poppins, sans-serif; text-anchor: middle; }
.hs-alert { fill: rgba(248, 113, 113, .15); stroke: #f87171; stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.hs-card { fill: rgba(14, 18, 30, .85); stroke-width: 1.5; }
.hs-card.bad { stroke: #f87171; } .hs-card.ok { stroke: #34d399; }
.hs-ico { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hs-ico.bad { stroke: #f87171; } .hs-ico.ok { stroke: #34d399; }
.hs-cardt { fill: #f5f5f7; font: 600 15px Poppins, sans-serif; }
.hs-cards { fill: #a1a1aa; font: 400 13px Lato, sans-serif; }
.hs-cardin { opacity: 0; transform-box: fill-box; }

/* slide 5: flusso API */
.hs-box { fill: rgba(14, 18, 30, .85); stroke: rgba(255, 255, 255, .18); stroke-width: 1.5; }
.hs-box-main { stroke: #60a5fa; fill: rgba(16, 28, 56, .88); }
.hs-boxt { fill: #f5f5f7; font: 600 18px Poppins, sans-serif; text-anchor: middle; }
.hs-boxs { fill: #a1a1aa; font: 400 13px Lato, sans-serif; text-anchor: middle; }
.hs-flow { fill: none; stroke: #22d3ee; stroke-width: 3; stroke-dasharray: 10 12; stroke-linecap: round; opacity: 0; }
.hs-flow.rev { stroke: #a78bfa; }
.hs-flow.thin { stroke: rgba(52, 211, 153, .7); stroke-width: 2; stroke-dasharray: 4 6; }
.hs-flowt { fill: #22d3ee; font: 700 14px Poppins, sans-serif; text-anchor: middle; letter-spacing: .08em; }
.hs-flowt.alt { fill: #c4b5fd; }
.hs-api { fill: #f5f5f7; font: 700 13px Poppins, sans-serif; text-anchor: middle; letter-spacing: .2em; }
.hs-pk circle { fill: #fff; opacity: 0; }

/* ---- tessere degli strumenti ---- */
.hs-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: clamp(8px, 1.4vw, 14px); max-width: min(520px, calc((100vh - 590px) * 1.75)); min-width: 280px; margin: 8px auto 0; perspective: 900px; }
.hs-tile {
    position: relative;
    aspect-ratio: 1; border-radius: 18px; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .02));
    border: 1px solid rgba(255, 255, 255, .1); color: #93c5fd;
    opacity: 0; transform: rotateY(-90deg) scale(.9);
}
.hs-tile svg { width: 46%; height: 46%; }
.hs-tile:nth-child(3n) { color: #c4b5fd; } .hs-tile:nth-child(4n) { color: #67e8f9; }
@media (hover: hover) and (pointer: fine) {
    .hs-tile::after {
        content: attr(data-name); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 3;
        transform: translate(-50%, 4px); opacity: 0; pointer-events: none; white-space: nowrap;
        padding: 6px 10px; border-radius: 8px; background: rgba(15, 23, 42, .96); border: 1px solid rgba(255, 255, 255, .14);
        color: #f5f5f7; font: 600 12px Poppins, sans-serif; transition: opacity .2s ease, transform .2s ease;
    }
    .hs-tile:hover { z-index: 2; border-color: rgba(147, 197, 253, .6); }
    .hs-tile:hover::after { opacity: 1; transform: translate(-50%, 0); }
}

/* ---- animazioni della slide attiva ---- */
.hs-slide.is-active .draw { animation: hs-draw 1.4s cubic-bezier(.6, 0, .2, 1) forwards; animation-delay: var(--d, 0s); }
.hs-slide.is-active .fade { animation: hs-fade .8s ease forwards; animation-delay: var(--d, 0s); }
.hs-slide.is-active .hs-tile { animation: hs-flip .8s cubic-bezier(.2, .8, .2, 1.15) forwards; animation-delay: var(--d, 0s); }
.hs-slide.is-active .hs-flow { animation: hs-fade .6s ease .6s forwards, hs-dash 1.2s linear infinite; }
.hs-slide.is-active .hs-flow.rev { animation: hs-fade .6s ease .9s forwards, hs-dash 1.2s linear infinite reverse; }
.hs-slide.is-active .hs-flow.thin { animation: hs-fade .6s ease 1.2s forwards, hs-dash 1.6s linear infinite; }
.hs-slide.is-active .hs-pk.fwd circle { animation: hs-pkf 1.8s linear 1s infinite; }
.hs-slide.is-active .hs-pk.fwd circle + circle { animation-delay: 1.9s; }
.hs-slide.is-active .hs-pk.back circle { animation: hs-pkb 1.8s linear 1.3s infinite; }
.hs-slide.is-active .hs-pk.back circle + circle { animation-delay: 2.2s; }
.hs-cursor { stroke: #e4e4e7; stroke-width: 1.5; fill: none; opacity: 0; }
.hs-slide.is-active .hs-cursor { animation: hs-cursor 4.6s ease-in-out .2s forwards; }
.hs-slide.is-active .hs-snap { animation: hs-fade .2s ease 1.15s forwards, hs-blink .5s steps(2) 1.15s 3; }
.hs-slide.is-active .hs-type.t1 .hs-cover { animation: hs-type 1s steps(18) .2s both; }
.hs-slide.is-active .hs-type.t1 { animation: hs-out .25s ease 2.1s forwards; }
.hs-slide.is-active .hs-type.t2 { animation: hs-fade .01s linear 2.35s forwards; }
.hs-slide.is-active .hs-type.t2 .hs-cover { animation: hs-type 1.1s steps(24) 2.35s both; }
.hs-slide.is-active .hs-board.ef { animation: hs-ef 1.1s cubic-bezier(.2, .7, .2, 1) 1.9s forwards; }
.hs-slide.is-active .hs-board.em { animation: hs-em 1.1s cubic-bezier(.2, .7, .2, 1) 1.9s forwards; }
.hs-slide.is-active .hs-die-main { animation: hs-out .6s ease 1.9s forwards; }
.hs-slide.is-active .hs-scanner { animation: hs-scan 1.3s cubic-bezier(.5, 0, .5, 1) .9s both; }
.hs-slide.is-active .hs-scanner rect { animation: hs-scanop 1.3s linear .9s both; }
.hs-slide.is-active .hs-lens { animation: hs-pop .6s cubic-bezier(.2, .8, .2, 1.2) 1.5s forwards; }
.hs-slide.is-active .hs-alert { animation: hs-pulse 1.4s ease-in-out 2.1s infinite; }
.hs-slide.is-active .hs-cardin { animation: hs-cardin .6s cubic-bezier(.2, .7, .2, 1) forwards; animation-delay: var(--d, 0s); }
/* la slide che esce resta col disegno completo (senza questo spariva di colpo togliendo is-active) */
.hs-slide.is-leaving .draw { stroke-dashoffset: 0; }
.hs-slide.is-leaving .fade, .hs-slide.is-leaving .hs-tile, .hs-slide.is-leaving .hs-flow, .hs-slide.is-leaving .hs-lens,
.hs-slide.is-leaving .hs-cardin, .hs-slide.is-leaving .hs-type.t2, .hs-slide.is-leaving .hs-board { opacity: 1; transform: none; }
.hs-slide.is-leaving .hs-board.ef { transform: translateX(-200px) scale(.6); }
.hs-slide.is-leaving .hs-board.em { transform: translateX(200px) scale(.6); }
.hs-slide.is-leaving .hs-die-main, .hs-slide.is-leaving .hs-type.t1, .hs-slide.is-leaving .hs-cover { opacity: 0; }
@keyframes hs-draw { to { stroke-dashoffset: 0; } }
@keyframes hs-fade { to { opacity: 1; } }
@keyframes hs-out { to { opacity: 0; } }
@keyframes hs-flip { to { opacity: 1; transform: none; } }
@keyframes hs-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes hs-cardin { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes hs-dash { to { stroke-dashoffset: -44; } }
@keyframes hs-pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .45; } }
@keyframes hs-blink { to { visibility: hidden; } }
@keyframes hs-type { from { transform: translateX(0); } to { transform: translateX(480px); } }
@keyframes hs-ef { from { opacity: 0; transform: scale(1); } 30% { opacity: 1; } to { opacity: 1; transform: translateX(-200px) scale(.6); } }
@keyframes hs-em { from { opacity: 0; transform: scale(1); } 30% { opacity: 1; } to { opacity: 1; transform: translateX(200px) scale(.6); } }
@keyframes hs-scan { from { transform: translateX(150px); } to { transform: translateX(530px); } }
@keyframes hs-scanop { 0% { opacity: 0; } 10%, 85% { opacity: .9; } 100% { opacity: 0; } }
@keyframes hs-pkf { 0% { opacity: 0; transform: translateX(0); } 10%, 90% { opacity: 1; } 100% { opacity: 0; transform: translateX(200px); } }
@keyframes hs-pkb { 0% { opacity: 0; transform: translateX(0); } 10%, 90% { opacity: 1; } 100% { opacity: 0; transform: translateX(-200px); } }
/* il mirino passa sui punti veri del disegno: centro, quadrante (raggio 100), foro in alto, estremo della quota */
@keyframes hs-cursor {
    0% { opacity: 0; transform: translate(520px, 120px); }
    8% { opacity: 1; }
    22% { transform: translate(360px, 190px); }
    44% { transform: translate(460px, 190px); }
    66% { transform: translate(360px, 114px); }
    88% { opacity: 1; transform: translate(260px, 316px); }
    100% { opacity: 0; transform: translate(240px, 330px); }
}

/* ---- 3. tilt e parallasse (solo puntatore fine e schermi larghi; --mx/--my da -1 a 1 scritti da JS) ---- */
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
    .hs-slide.is-active .hs-visual {
        transform: perspective(1200px) rotateX(calc(var(--my) * -4deg)) rotateY(calc(var(--mx) * 6deg));
        will-change: transform;
    }
    .hs-slide.is-active .hs-l1 { transform: translate(calc(var(--mx) * -6px), calc(var(--my) * -4px)); }
    .hs-slide.is-active .hs-l2 { transform: translate(calc(var(--mx) * 10px), calc(var(--my) * 7px)); }
    .hs-slide.is-active .hs-tiles { transform: translate(calc(var(--mx) * 8px), calc(var(--my) * 6px)); }
}
/* uscita allo scroll: il visual sale e sfuma (solo dove c'e' animation-timeline) */
@supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
        .hs-track { animation: hs-exit linear both; animation-timeline: view(); animation-range: exit 0% exit 100%; }
    }
}
@keyframes hs-exit { to { translate: 0 -48px; opacity: .3; } }

/* ---- pulsante unico ---- */
.hs-cta { position: relative; margin-top: clamp(18px, 2.4vw, 28px); display: flex; justify-content: center; }
.hs-btn {
    display: inline-flex; align-items: center; gap: 10px; padding: 15px 30px; border-radius: 999px;
    background: #2563eb; color: #fff !important; font: 600 1.05rem Poppins, sans-serif; text-decoration: none !important;
    box-shadow: 0 10px 30px rgba(37, 99, 235, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.hs-btn svg { width: 20px; height: 20px; }
.hs-btn:hover { background: #1d4ed8; transform: translateY(-2px) scale(1.02); box-shadow: 0 16px 40px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255, 255, 255, .25); }
.hs-btn:focus-visible { outline: 3px solid #93c5fd; outline-offset: 3px; }

/* ---- 6. navigazione: pillole (area 24 px), contatore, prossima slide, pausa ---- */
.hs-nav { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 20px; }
.hs-dots { display: flex; gap: 2px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hs-pill {
    position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: width .45s cubic-bezier(.2, .7, .2, 1);
}
.hs-bar {
    position: relative; display: block; width: 8px; height: 8px; border-radius: 999px; overflow: hidden;
    background: rgba(255, 255, 255, .35); transition: width .45s cubic-bezier(.2, .7, .2, 1), background .3s;
}
.hs-pill:hover .hs-bar { background: rgba(255, 255, 255, .6); }
.hs-pill.is-active { width: 52px; }
.hs-pill.is-active .hs-bar { width: 44px; background: rgba(255, 255, 255, .25); }
.hs-fill { position: absolute; inset: 0; width: 0; background: #fff; border-radius: inherit; }
.hs-pill.is-active .hs-fill { animation: hs-progress var(--hs-dur) linear forwards; }
.hs.is-paused .hs-pill.is-active .hs-fill { animation-play-state: paused; }
.hs.no-auto .hs-pill.is-active .hs-fill { animation: none; width: 100%; }
@keyframes hs-progress { to { width: 100%; } }
.hs-pill:focus-visible, .hs-play:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; border-radius: 999px; }
.hs-meta { display: flex; align-items: center; gap: 12px; font: 600 .82rem Poppins, sans-serif; color: var(--hs-muted); white-space: nowrap; }
.hs-num { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.hs-num b { color: var(--hs-text); font-weight: 700; }
.hs-next { display: inline-flex; align-items: center; gap: 6px; }
.hs-nl { text-transform: uppercase; font-size: .7rem; letter-spacing: .12em; opacity: .7; }
.hs-nl::after { content: " ›"; }
.hs-nts { display: grid; }
.hs-nt { grid-area: 1 / 1; opacity: 0; transform: translateY(6px); transition: opacity .5s ease, transform .5s ease; color: #e4e4e7; text-align: left; }
.hs[data-next="0"] .hs-nt[data-n="0"], .hs[data-next="1"] .hs-nt[data-n="1"], .hs[data-next="2"] .hs-nt[data-n="2"],
.hs[data-next="3"] .hs-nt[data-n="3"], .hs[data-next="4"] .hs-nt[data-n="4"] { opacity: 1; transform: none; }
.hs-play {
    width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; display: flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .08); color: #e4e4e7; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.hs-play:hover { background: rgba(255, 255, 255, .16); }
.hs-play[hidden] { display: none; }
.hs-play svg { width: 16px; height: 16px; fill: currentColor; }
.hs-play .i-play { display: none; }
.hs-play[data-state="pause"] .i-play { display: block; }
.hs-play[data-state="pause"] .i-pause { display: none; }

/* ---- pause: is-frozen ferma tutto (pulsante, scheda nascosta, fuori vista) ---- */
.hs.is-frozen .hs-slide *, .hs.is-frozen .hs-slide .hs-visual::after, .hs.is-frozen .hs-glow, .hs.is-frozen .hs-grad,
.hs.is-frozen .hs-pill.is-active .hs-fill { animation-play-state: paused; }
/* la slide appena attivata finisce l'entrata anche in pausa (altrimenti resta al fotogramma 0) */
.hs.is-frozen .hs-slide.is-entering *, .hs.is-frozen .hs-slide.is-entering .hs-visual::after { animation-play-state: running; }

@media (max-width: 640px) {
    .hs { padding-top: 40px; }
    .hs-tiles { grid-template-columns: repeat(4, 1fr); max-width: 280px; min-width: 0; }
    .hs-visual { max-width: 100%; }
    .hs-slide { justify-content: flex-start; }
    .hs-tile:nth-child(n+13) { display: none; }
    .hs-btn { padding: 14px 26px; }
    .hs-next { display: none; }
    .hs-visual::after { display: none; }
    .hs-nav { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
    .hs { transition: none; }
    .hs-glow, .hs-grad, .hs-grad.is-split .hs-w { animation: none; }
    .hs-glow, .hs-slide.is-active { translate: none; }
    .hs-slide, .hs-slide.is-active, .hs-slide.is-leaving { transition: opacity .01s, visibility 0s; transform: none; filter: none; }
    .hs-slide.is-leaving { visibility: hidden; }
    .hs-visual::after, .hs-cursor, .hs-scanner, .hs-pk, .hs-die-main, .hs-type.t1 { display: none; }
    .draw { stroke-dashoffset: 0; }
    .fade, .hs-tile, .hs-flow, .hs-lens, .hs-cardin, .hs-type.t2, .hs-snap { opacity: 1; transform: none; }
    .hs-cover { display: none; }
    .hs-board { opacity: 1; }
    .hs-board.ef { transform: translateX(-200px) scale(.6); }
    .hs-board.em { transform: translateX(200px) scale(.6); }
    .hs-slide.is-active *, .hs.is-ready .hs-slide.is-active *, .hs-slide.is-active .hs-visual::after { animation: none !important; }
    .hs-slide .hs-visual, .hs-slide .hs-l1, .hs-slide .hs-l2, .hs-slide .hs-tiles { transform: none !important; }
    .hs-nt { transition: none; }
    .hs-pill, .hs-bar { transition: none; }
}
