/* Formazione: movimento e infografica "dalla stanza vuota al primo lavoro".
   Gli stati nascosti valgono solo con html.fx, aggiunta da formazione.js se il sistema non chiede "riduci movimento".
   Senza script l'infografica mostra la scena finale. */

/* Infografica */
.train-journey{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,.92fr);gap:clamp(24px,5vw,76px);align-items:start}
.train-figure{position:sticky;top:96px;margin:0;padding:18px 22px 16px;background:var(--brand-ivory,#E4E9E3);border-radius:8px}
.train-figure svg{display:block;width:100%;height:auto;max-height:calc(100vh - 220px);overflow:visible}
.tf-progress{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;margin-top:12px}
.tf-progress i{height:4px;border-radius:4px;background:#7A2E3B;transition:background-color .4s}
.tf-caption{display:flex;align-items:baseline;gap:14px;margin-top:12px;font-size:17px;font-weight:600;color:#3D5449}
.tf-caption b{font:italic 400 34px/1 var(--accent,Georgia);color:#7A2E3B}

.tf{fill:none;stroke:#3D5449;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.tf .wall{fill:#F6F4EF}
.tf .sage{fill:#91A79A}
.tf .sand{fill:#D9C9BB}
.tf .wine{fill:#7A2E3B}
.tf .deep{fill:#3D5449}
.tf .cream{fill:#F6F4EF}
.tf .thin{stroke-width:2}
.tf .accent{stroke:#7A2E3B}
.tf .plan{stroke:#7A2E3B;stroke-width:2;stroke-dasharray:7 7}
.tf .none{stroke:none}
.tf [data-until]{display:none}

.fx .tf [data-until]{display:inline}
.fx .tf [data-from]{opacity:0;visibility:hidden;transform:translateY(14px);transition:opacity .5s ease,transform .8s cubic-bezier(.22,1,.36,1),visibility 0s linear .5s}
.fx .tf [data-from].on{opacity:1;visibility:visible;transform:none;transition:opacity .5s ease var(--d,0s),transform .8s cubic-bezier(.22,1,.36,1) var(--d,0s),visibility 0s}
.fx .tf [data-from].drop{transform:translateY(-70px)}
.fx .tf [data-from].drop.on{transform:none}
.fx .tf .draw{stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.2s ease var(--d,.15s)}
.fx .train-figure.is-live .tf .house .draw,.fx .tf .on .draw{stroke-dashoffset:0}
.fx .tf .flash{transform-box:fill-box;transform-origin:center}
.fx .tf .on .flash{animation:tf-flash 2.6s ease-in-out .7s 2 both}
.fx .tf .bubble{transform-box:fill-box;transform-origin:50% 100%}
.fx .tf .on .bubble{animation:tf-talk 3.2s ease-in-out infinite}
.fx .tf .on .bubble+.bubble{animation-delay:1.6s}
.fx .tf .on .leaf{transform-box:fill-box;transform-origin:50% 100%;animation:tf-sway 4s ease-in-out infinite}
.fx .tf .on .sun{transform-box:fill-box;transform-origin:center;animation:tf-spin 24s linear infinite}
.fx .tf-progress i{background:rgba(61,84,73,.18)}
.fx .tf-progress i.on{background:#7A2E3B}
@keyframes tf-flash{0%,100%{opacity:0;transform:scale(.3)}18%{opacity:1;transform:scale(1.15)}40%{opacity:0;transform:scale(1.4)}}
@keyframes tf-talk{0%,55%,100%{transform:none}25%{transform:scale(1.1)}}
@keyframes tf-sway{0%,100%{transform:rotate(-3deg)}50%{transform:rotate(4deg)}}
@keyframes tf-spin{to{transform:rotate(360deg)}}

.train-journey .train-steps{position:relative;max-width:none}
.train-journey .train-steps li{align-content:center;transition:background-color .4s}
.train-journey .train-steps li::before{transition:color .4s,transform .5s cubic-bezier(.22,1,.36,1);transform-origin:left center}
.fx .train-journey .train-steps li{min-height:46vh;padding-left:20px;padding-right:16px}
.fx .train-journey .train-steps li:not(.is-now)::before{color:#7C9C90}
.fx .train-journey .train-steps li.is-now{background:rgba(122,46,59,.08)}
.fx .train-journey .train-steps li.is-now::before{transform:scale(1.4)}
.fx .train-journey .train-steps li.is-now strong{color:#7A2E3B}

@media (max-width:900px){
  .train-journey{display:block}
  .train-figure{z-index:5;top:72px;margin-bottom:8px;padding:10px 12px;border-radius:0 0 8px 8px;box-shadow:0 12px 18px -14px rgba(31,46,39,.5)}
  .train-figure svg{max-height:30vh;max-height:30svh}
  .tf-progress{margin-top:7px}
  .tf-caption{margin-top:7px;font-size:14px}
  .tf-caption b{font-size:24px}
  .fx .train-journey .train-steps li{min-height:30vh;padding-left:10px;padding-right:10px}
}
@media (max-width:680px){.train-figure{top:64px}}

/* Icone dei sei temi */
.train-topics .tt-icon{width:66px;height:66px;fill:none;stroke:#3D5449;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;margin-bottom:4px}
.train-topics .tt-icon .accent{stroke:#7A2E3B}
.fx .tt-icon>*{stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.5s ease calc(var(--i,0) * 90ms + .3s)}
.fx .tt-icon>*:nth-child(n+2){transition-delay:calc(var(--i,0) * 90ms + .7s)}
.fx .fx-in .tt-icon>*{stroke-dashoffset:0}

/* Entrate in sequenza */
.fx [data-fx]{opacity:0;translate:0 30px;transition:opacity .8s ease calc(var(--i,0) * 90ms),translate .9s cubic-bezier(.22,1,.36,1) calc(var(--i,0) * 90ms)}
.fx [data-fx="left"]{translate:-34px 0}
.fx [data-fx="right"]{translate:34px 0}
.fx [data-fx].fx-in{opacity:1;translate:0 0}
@media (max-width:900px){
  .fx [data-fx="left"],.fx [data-fx="right"]{translate:0 22px}
}

/* Apertura */
.fx .train-hero-cta,.fx .train-page .guide-lead{animation:tr-rise .9s cubic-bezier(.22,1,.36,1) .15s both}
.fx .train-hero-cta{animation-delay:.3s}
@keyframes tr-rise{from{transform:translateY(22px)}}
.fx .train-page>.guide-cover{clip-path:inset(0 var(--cover-inset,8%) round 10px)}

/* Le domande del manifesto si accendono una dopo l'altra */
.fx-q{color:rgba(246,244,239,.6);background-image:linear-gradient(#7A2E3B,#7A2E3B);background-repeat:no-repeat;background-position:0 50%;background-size:0 100%;-webkit-box-decoration-break:clone;box-decoration-break:clone;transition:color .45s,background-size .7s cubic-bezier(.22,1,.36,1)}
.fx-q.on{color:#fff;background-size:100% 100%}

/* Non è / È: i segni compaiono con la riga */
.fx .train-no li::before{scale:0;rotate:-90deg;transition:scale .5s ease calc(var(--i,0) * 90ms + .35s),rotate .5s ease calc(var(--i,0) * 90ms + .35s)}
.fx .train-no li.fx-in::before{scale:1;rotate:0deg}
.fx .train-yes li::before{scale:0;transition:scale .6s cubic-bezier(.3,1.7,.5,1) calc(var(--i,0) * 90ms + .4s)}
.fx .train-yes li.fx-in::before{scale:1}

@media (prefers-reduced-motion:no-preference){
  .train-cards li,.train-topics li{transition:background-color .3s,box-shadow .3s}
  .train-cards li:hover,.train-topics li:hover{background:#fff;box-shadow:0 14px 32px rgba(61,84,73,.12)}
  .train-page details[open]>div{animation:tr-open .45s cubic-bezier(.22,1,.36,1) both}
}
@keyframes tr-open{from{opacity:0;transform:translateY(-10px)}}

@media print{
  .fx [data-fx]{opacity:1;translate:none}
  .train-figure{position:static}
}

@media (min-width:901px){
  .train-topics{grid-template-columns:repeat(3,minmax(0,1fr))}
}
