/* Scrollytelling «Il viaggio di un documento» — la scena resta ferma, il racconto scorre. */

.fx-story-page {
  --st-bg: #081421; --st-bg2: #10263c; --st-ink: #eaf1f8; --st-soft: #9fb3c8;
  --st-risk: #ff7a59; --st-line: rgba(255,255,255,.14);
  background: radial-gradient(90% 70% at 70% 30%, var(--st-bg2), var(--st-bg) 70%) fixed, var(--st-bg);
  color: var(--st-ink);
}
body.brand-do .fx-story-page { --st-bg: #0b1325; --st-bg2: #1b2c52; --st-soft: #b3bfd8; }

.st { position: relative; display: grid; grid-template-columns: minmax(340px, 480px) 1fr; }
.st-steps { grid-column: 1; grid-row: 1; position: relative; z-index: 2; }
.st-stage { grid-column: 2; grid-row: 1; position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.st-stage canvas, .st-stage svg.st-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.st-stage canvas { opacity: 0; transition: opacity 1.2s ease; }
.st-stage canvas.on { opacity: 1; }

/* ── I passi ─────────────────────────────────────────────────────── */
.st-step {
  min-height: 100vh; min-height: 100svh; display: flex; align-items: center;
  padding: 0 28px 0 max(24px, calc((100vw - var(--maxw)) / 2 + 24px));
}
.st-card { max-width: 420px; }
.st-num { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .16em; color: var(--st-soft); text-transform: uppercase; }
.st-num b { color: #fff; font-weight: 500; }
.st-card h2 { color: #fff; font-family: var(--font-display); font-size: clamp(1.7rem, 2.6vw, 2.35rem); line-height: 1.15; letter-spacing: -.02em; margin: 12px 0 16px; }
.st-card h2 em { font-style: normal; color: var(--st-accent, #6db6ff); }
.st-card p { color: var(--st-soft); font-size: 1.05rem; line-height: 1.65; }
.st-card p strong { color: #fff; font-weight: 600; }
.st-card .st-fact { margin-top: 18px; padding: 14px 16px; border-left: 2px solid var(--st-risk); background: rgba(255,255,255,.04); border-radius: 0 10px 10px 0; font-size: .92rem; color: var(--st-ink); }
.st-card .st-fact small { display: block; color: var(--st-soft); margin-top: 4px; font-size: .78rem; }
.st-card .st-fact.ok { border-left-color: var(--st-accent, #6db6ff); }
.st-src { font-size: .78rem !important; color: #6f859b !important; margin-top: 12px; }
.st-src a { color: inherit; }

.st-hero .st-card { max-width: 460px; }
.st-hero h1 { color: #fff; font-family: var(--font-display); font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1.06; letter-spacing: -.03em; margin: 14px 0 18px; }
.st-hero h1 em { font-style: normal; color: var(--st-accent, #6db6ff); }
.st-hint { display: flex; align-items: center; gap: 12px; margin-top: 30px; color: var(--st-soft); font-size: .88rem; }
.st-hint [data-lottie] { width: 30px; height: 45px; }

.st-cta .btn { margin: 22px 10px 0 0; }
.st-cta .btn.ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5); background: transparent; }
.st-cta .st-core { width: 180px; height: 120px; display: block; margin: 0 0 6px -8px; }

/* comparsa dei testi: guidata dallo scroll dove si può */
.st-card > * { transition: opacity .8s var(--fx-ease, ease), transform .8s var(--fx-ease, ease), filter .8s; }
.st-step:not(.st-in) .st-card > * { opacity: 0; transform: translateY(24px); filter: blur(6px); }
.st-card > :nth-child(2) { transition-delay: .06s; } .st-card > :nth-child(3) { transition-delay: .12s; }
.st-card > :nth-child(4) { transition-delay: .18s; } .st-card > :nth-child(5) { transition-delay: .24s; }
@supports (animation-timeline: view()) {
  .st-step .st-card > * { transition: none; opacity: 1; transform: none; filter: none;
    animation: stIn linear both, stOut linear both; animation-timeline: view(), view();
    animation-range: entry 0% entry 100%, exit 30% exit 100%; }
  .st-step:last-child .st-card > * { animation: stIn linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
}
@keyframes stIn { from { opacity: 0; transform: translateY(40px); filter: blur(8px); } }
@keyframes stOut { to { opacity: .12; transform: translateY(-30px); } }

/* ── Rotaia dei capitoli ─────────────────────────────────────────── */
.st-rail { position: absolute; right: 22px; top: 50%; translate: 0 -50%; display: grid; gap: 12px; z-index: 3; }
.st-rail a { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.25); transition: all .4s var(--fx-ease, ease); display: block; }
.st-rail a.on { background: #fff; height: 26px; border-radius: 6px; }

/* ── Etichette della scena ───────────────────────────────────────── */
.st-scene text { font-family: var(--font-mono); fill: var(--st-soft); letter-spacing: .08em; }
.st-scene .lbl { font-size: .045px; text-transform: uppercase; }
.st-scene .big { font-family: var(--font-display); font-size: .13px; fill: #fff; letter-spacing: -.02em; font-weight: 700; }
.st-scene .risk { fill: var(--st-risk); }
.st-scene [data-show] { transition: opacity .25s linear; }
.st-offline { font-family: var(--font-mono); font-size: .04px; }
.st-lock { position: absolute; width: 88px; height: 88px; translate: -50% -50%; pointer-events: none; opacity: 0; transition: opacity .5s; }

/* ── Telefono: la scena sta dietro, le schede ci scorrono sopra ──── */
@media (max-width: 860px) {
  .st { grid-template-columns: 1fr; }
  .st-stage { grid-column: 1; grid-row: 1; }
  .st-steps { grid-column: 1; grid-row: 1; }
  .st-step { align-items: flex-end; padding: 0 16px 9vh; }
  .st-card { background: rgba(8, 20, 33, .78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--st-line); border-radius: 18px; padding: 20px 20px 22px; }
  .st-hero .st-card { background: rgba(8, 20, 33, .55); }
  .st-card h2 { font-size: 1.45rem; }
  .st-card p { font-size: .96rem; }
  .st-rail { right: 10px; }
  .st-stage svg.st-scene, .st-stage canvas { height: 62%; }
}

@media (prefers-reduced-motion: reduce) {
  .st-card > * { opacity: 1 !important; transform: none !important; filter: none !important; animation: none !important; }
}
.st-scene [data-show] { opacity: 0; }

/* ── Intestazione scura sulla pagina storia ──────────────────────── */
body:has(.fx-story-page) header.site,
html.fx.fx-scrolled body:has(.fx-story-page) header.site {
  background: rgba(8, 20, 33, .94); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: rgba(255, 255, 255, .08); box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .6);
}
body.brand-do:has(.fx-story-page) header.site,
html.fx.fx-scrolled body.brand-do:has(.fx-story-page) header.site { background: rgba(11, 19, 37, .95); }
body:has(.fx-story-page) nav.main a { color: rgba(234, 241, 248, .82); }
body:has(.fx-story-page) nav.main a:hover { color: #fff; }
body:has(.fx-story-page) nav.main a::after { background: var(--st-accent, #6db6ff); }
body.brand-ch:has(.fx-story-page) .logo .agimg { filter: brightness(0) invert(1); }
body.brand-ch:has(.fx-story-page) .logo .tagline { color: rgba(255, 255, 255, .55); }
body.brand-do:has(.fx-story-page) .logo { color: #fff; }
body.brand-do:has(.fx-story-page) .logo .dot { color: var(--st-accent, #ff6b7a); }
