/* HERO-DASH — hero di bluemanage.app: laptop + telefono con dentro una dashboard VIVA (22/10/2026).
   Niente screenshot: la dashboard è HTML + mini-charts.js (la stessa libreria delle Statistiche vere),
   così segue dark/light, si traduce col build delle lingue e pesa pochi KB.
   Numeri di ESEMPIO di un'azienda inventata («Demo Ltd»): mai dati veri.
   Cornici .devices* copiate da bluestay-app/home.html; il movimento allo scroll è il componente
   condiviso scroll-fx (--p, 0→1 scorrendo). In più qui c'è --i (0→1 in ~1,3 s al caricamento,
   scritto da assets/js/hero-dash.js): il portatile si APRE e lo schermo si accende anche senza scorrere.
   Le regole animate stanno sotto html.sfx-on / html.hd-anim: con "riduci movimento" o senza JS
   resta tutto fermo nella posizione finale. */

.hero{overflow-x:clip}

/* --- cornici (da bluestay) --- */
.devices{position:relative;max-width:840px;margin:52px auto 0;display:flex;justify-content:center;align-items:flex-end}
.devices__laptop{width:100%;max-width:680px;position:relative;z-index:1}
.devices__laptop-screen{position:relative;background:#0b1426;border:10px solid #1e2940;border-radius:14px 14px 0 0;overflow:hidden;box-shadow:0 24px 60px rgba(15,23,42,.22)}
.devices__laptop-base{height:14px;background:linear-gradient(#222d44,#161f33);border-radius:0 0 12px 12px;margin:0 auto;width:112%;max-width:760px;position:relative;left:50%;transform:translateX(-50%);box-shadow:0 10px 18px rgba(15,23,42,.18)}
.devices__phone{position:absolute;right:0;bottom:-8px;width:150px;border:8px solid #1e2940;border-radius:26px;overflow:hidden;background:#0b1426;box-shadow:0 18px 44px rgba(15,23,42,.30);z-index:3;container-type:inline-size}
.devices__caption{text-align:center;color:var(--muted);font-size:14px;margin-top:26px}

/* alone colorato dietro al portatile: cresce scorrendo */
.dash-glow{position:absolute;left:8%;right:8%;top:6%;bottom:0;z-index:0;border-radius:50%;
  background:radial-gradient(closest-side,rgba(59,130,246,.38),rgba(16,185,129,.20) 55%,transparent);
  filter:blur(36px);pointer-events:none}

/* --- lo schermo: la dashboard è disegnata a dimensione fissa (880×550, oppure 560×350 sui telefoni)
       e rimpicciolita con --s (scritta dal JS), così i grafici restano proporzionati a ogni larghezza --- */
.dash-view{position:relative;aspect-ratio:16/10;overflow:hidden;background:var(--bg)}
.dash{
  --color-border:var(--border); --color-text-muted:var(--muted); --color-text:var(--ink);
  --color-success:#10b981; --color-danger:#ef4444; --color-primary:#3b82f6;
  position:absolute;left:0;top:0;width:880px;height:550px;transform:scale(var(--s,.75));transform-origin:0 0;
  display:flex;background:var(--bg);color:var(--ink);font-size:13px;line-height:1.35;text-align:left;
  pointer-events:none;user-select:none}
.dash__side{width:150px;flex:none;padding:16px 10px;border-right:1px solid var(--border);background:var(--card);display:flex;flex-direction:column;gap:3px}
.dash__logo{display:flex;align-items:center;gap:7px;font-weight:800;font-size:14px;margin:0 4px 14px}
.dash__logo img{width:20px;height:auto}
.dash__logo span{background:var(--grad);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}
.dash__nav{padding:7px 10px;border-radius:8px;color:var(--muted);font-weight:500}
.dash__nav.is-on{background:rgba(59,130,246,.14);color:var(--ink);font-weight:600}
.dash__main{flex:1;min-width:0;padding:16px 18px;display:flex;flex-direction:column;gap:12px}
.dash__top{display:flex;align-items:center;justify-content:space-between;height:28px}
.dash__co{font-weight:700;font-size:16px}
.dash__yr{color:var(--muted);margin-left:6px}
.dash__live{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;color:#10b981;padding:4px 10px;border-radius:999px;background:rgba(16,185,129,.12)}
.dash__live i{width:7px;height:7px;border-radius:50%;background:#10b981;box-shadow:0 0 0 0 rgba(16,185,129,.6)}
.dash__kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}
.dash__kpi{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:11px 13px;display:flex;flex-direction:column;gap:2px;position:relative;overflow:hidden}
.dash__kpi span{color:var(--muted);font-size:12px}
.dash__kpi b{font-size:22px;font-weight:800;letter-spacing:-.02em;font-variant-numeric:tabular-nums;white-space:nowrap}
.dash__kpi em{font-style:normal;font-size:11.5px;font-weight:600;color:var(--muted)}
.dash__kpi em.up{color:#10b981}
.dash__kpi--in{border-top:3px solid #10b981}
.dash__kpi--out{border-top:3px solid #ef4444}
.dash__kpi--profit{border-top:3px solid #3b82f6}
.dash__kpi--vat{border-top:3px solid #f59e0b}
.dash__kpi.is-flash{animation:hdFlash .9s ease-out}
.dash__charts{display:grid;grid-template-columns:1.35fr 1fr;gap:10px;flex:1;min-height:0}
.dash__card{background:var(--card);border:1px solid var(--border);border-radius:12px;padding:11px 13px 6px;display:flex;flex-direction:column;min-height:0}
.dash__h{display:flex;justify-content:space-between;align-items:center;gap:8px;font-weight:600;font-size:12.5px;margin-bottom:4px}
.dash__legend{display:inline-flex;gap:10px;font-weight:500;font-size:11px;color:var(--muted)}
.dash__legend i{display:inline-block;width:8px;height:8px;border-radius:2px;margin-right:4px}
.dash__chart{flex:1;min-height:0;position:relative}
.dash__chart svg{display:block;overflow:visible}
.dash__chart .mc-tooltip{display:none!important}
.dash__settle{flex:none;padding-bottom:9px}
.dash__row{display:grid;grid-template-columns:150px 90px auto;justify-content:start;gap:14px;align-items:center;padding:6px 0;border-top:1px solid var(--border);font-size:12.5px}
.dash__row:first-of-type{border-top:0}
.dash__row b{font-variant-numeric:tabular-nums}
.dash__pill{font-size:11px;font-weight:600;padding:2px 9px;border-radius:999px}
.dash__pill--ready{background:rgba(59,130,246,.14);color:#3b82f6}
.dash__pill--paid{background:rgba(16,185,129,.14);color:#10b981}

/* versione per schermi piccoli (telefono): niente menu laterale, tre numeri, un grafico */
.dash--compact{width:560px;height:350px}
.dash--compact .dash__side,.dash--compact .dash__kpi--vat,.dash--compact .dash__card--line,.dash--compact .dash__settle{display:none}
.dash--compact .dash__kpis{grid-template-columns:repeat(3,minmax(0,1fr))}
.dash--compact .dash__charts{grid-template-columns:1fr}
.dash--compact .dash__kpi b{font-size:21px}

/* schermo che si accende + riflesso che scivola scorrendo */
.dash-boot{position:absolute;inset:0;background:#04070d;opacity:0;pointer-events:none;z-index:2}
html.hd-anim .dash-boot{opacity:calc(1 - var(--i,1))}
.dash-glare{position:absolute;inset:-20% -60%;z-index:2;pointer-events:none;
  background:linear-gradient(115deg,transparent 40%,rgba(255,255,255,.10) 49%,rgba(255,255,255,.03) 53%,transparent 60%);
  transform:translateX(calc(var(--p,1) * 70% - 35%))}

/* --- schede di vetro che "escono" dallo schermo --- */
.dash-chip{position:absolute;z-index:4;display:flex;align-items:center;gap:10px;padding:11px 15px;border-radius:14px;
  background:var(--card);background:color-mix(in srgb,var(--card) 82%,transparent);border:1px solid var(--border);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  box-shadow:0 18px 40px rgba(15,23,42,.22);font-size:13.5px;color:var(--ink);text-align:left;white-space:nowrap}
.dash-chip__ico{width:30px;height:30px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;color:#fff}
.dash-chip__ico svg{width:16px;height:16px}
.dash-chip small{display:block;color:var(--muted);font-size:12px}
.dash-chip b{font-weight:800;font-variant-numeric:tabular-nums}
.dash-chip--paid{left:0;top:16%}
.dash-chip--paid .dash-chip__ico{background:#10b981}
.dash-chip--paid b{color:#10b981}
.dash-chip--comm{right:2%;top:-4%}
.dash-chip--comm .dash-chip__ico{background:#3b82f6}

/* --- telefono: schermata di blocco con le notifiche (misure in em, scalano con la larghezza) --- */
.phone{aspect-ratio:390/844;font-size:7.6cqw;position:relative;overflow:hidden;color:#fff;text-align:left;
  background:radial-gradient(120% 70% at 20% 0%,#2a5bd7 0%,transparent 60%),radial-gradient(120% 80% at 100% 100%,#0e9f74 0%,transparent 55%),#0b1426;
  padding:3.2em 0.9em 0}
.phone__time{text-align:center;font-size:3.6em;font-weight:300;letter-spacing:-.02em;line-height:1}
.phone__co{text-align:center;font-size:1em;opacity:.8;margin:.5em 0 2em}
.phone__note{background:rgba(255,255,255,.16);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border-radius:1.2em;padding:.7em .8em;margin-bottom:.7em;line-height:1.3}
.phone__app{display:flex;align-items:center;gap:.4em;font-size:.85em;opacity:.85;margin-bottom:.25em}
.phone__app img{width:1.3em;height:auto}
.phone__app small{margin-left:auto;font-size:1em}
.phone__note b{display:block;font-size:.95em;font-weight:700}
.phone__note span{display:block;font-size:.85em;opacity:.9}

/* --- telefono stretto --- */
@media(max-width:720px){
  .devices{max-width:380px}
  .devices__phone{width:108px;right:-6px;bottom:-14px;border-width:6px}
  .dash-chip{font-size:11px;padding:7px 10px;gap:7px;border-radius:11px}
  .dash-chip small{font-size:10px}
  .dash-chip__ico{width:22px;height:22px}
  .dash-chip__ico svg{width:12px;height:12px}
  .dash-chip--paid{left:-6px;top:-10%}
  .dash-chip--comm{display:none}
}

/* ================= ANIMAZIONE (solo se il JS l'ha accesa) ================= */
/* il coperchio parte molto più indietro di bluestay (32°): ~90° all'apertura, poi lo scroll lo raddrizza */
html.sfx-on .devices--dash[data-sfx] .devices__laptop{perspective:1300px;perspective-origin:50% 20%}
html.sfx-on .devices--dash[data-sfx] .devices__laptop-screen{
  transform:rotateX(calc((1 - var(--i,1)) * 64deg + (1 - var(--p,1)) * 26deg))}
html.sfx-on .devices--dash[data-sfx]{
  transform:translate3d(0,calc((1 - var(--p,1)) * 36px),0) scale(calc(.93 + var(--p,1) * .07));
  will-change:transform}
html.sfx-on .devices--dash[data-sfx] .dash-glow{opacity:calc(.25 + var(--p,1) * .75)}
html.sfx-on .devices--dash[data-sfx] .devices__phone{
  transform:
    translate3d(calc((1 - var(--p,1)) * 90px + (1 - var(--i,1)) * 140px), calc((1 - var(--p,1)) * 70px), 0)
    rotate(calc((1 - var(--p,1)) * 8deg))}
/* schede: velocità diverse dal portatile = profondità */
html.sfx-on .devices--dash[data-sfx] .dash-chip--paid{transform:translate3d(calc((1 - var(--p,1)) * -70px),calc((1 - var(--p,1)) * 90px),0) rotate(calc((1 - var(--p,1)) * -6deg))}
html.sfx-on .devices--dash[data-sfx] .dash-chip--comm{transform:translate3d(calc((1 - var(--p,1)) * 60px),calc((1 - var(--p,1)) * 130px),0) rotate(calc((1 - var(--p,1)) * 7deg))}
@media(max-width:720px){
  html.sfx-on .devices--dash[data-sfx] .devices__phone{
    transform:translate3d(calc((1 - var(--p,1)) * 40px + (1 - var(--i,1)) * 80px),calc((1 - var(--p,1)) * 40px),0) rotate(calc((1 - var(--p,1)) * 6deg))}
  html.sfx-on .devices--dash[data-sfx] .dash-chip--paid{transform:translate3d(calc((1 - var(--p,1)) * -24px),calc((1 - var(--p,1)) * 40px),0)}
}

/* comparse a tempo (il JS mette .is-on) */
html.hd-anim .dash-chip,html.hd-anim .phone__note{opacity:0;scale:.85;transition:opacity .45s ease,scale .55s cubic-bezier(.2,1.6,.4,1)}
html.hd-anim .phone__note{translate:0 -1.2em}
html.hd-anim .phone__note.is-on{translate:0 0;transition:opacity .45s ease,scale .55s cubic-bezier(.2,1.6,.4,1),translate .55s cubic-bezier(.2,1.4,.4,1)}
html.hd-anim .dash-chip.is-on,html.hd-anim .phone__note.is-on{opacity:1;scale:1}
html.hd-anim .dash-chip.is-pop{animation:hdPop .6s cubic-bezier(.2,1.6,.4,1)}
html.hd-anim .dash__row{opacity:0;translate:0 8px;transition:opacity .4s ease,translate .5s ease}
html.hd-anim .dash__row.is-on{opacity:1;translate:0 0}
html.hd-anim .dash__live i{animation:hdPulse 1.8s ease-out infinite}

@keyframes hdPulse{0%{box-shadow:0 0 0 0 rgba(16,185,129,.6)}70%,100%{box-shadow:0 0 0 7px rgba(16,185,129,0)}}
@keyframes hdPop{0%{scale:1}35%{scale:1.12}100%{scale:1}}
@keyframes hdFlash{0%{box-shadow:inset 0 0 0 2px rgba(16,185,129,.9),0 0 22px rgba(16,185,129,.45)}100%{box-shadow:inset 0 0 0 2px rgba(16,185,129,0),0 0 0 rgba(16,185,129,0)}}
