/* =========================================================
   TJG Fase 6/5 fixes — loghi, marquee, hero mobile
   (colori «Vai a» solo in tjg-anchors.css)
   ========================================================= */

:root{
  --tjg-logo-gap:64px;
  --tjg-logo-gap-half:32px;
}
@media (max-width:600px){
  :root{
    --tjg-logo-gap:32px;
    --tjg-logo-gap-half:16px;
  }
}

/* C) Loghi a colori — gap uniforme run↔run e dentro i run */
.lg-ph,
.logos .lg-mask .lg-ph,
.lg-mask .lg-ph,
.marquee .lg-ph{
  flex:none;
  display:grid;
  place-items:center;
  box-sizing:border-box;
  width:168px;
  height:72px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,.14);
  background:#fff;
  padding:10px 14px;
  overflow:hidden;
}
.lg-ph img,
.logos .lg-mask .lg-ph img,
.lg-mask .lg-ph img,
.marquee .lg-ph img,
.sci-logos .lg-item img,
.lg-grid .lg-item img{
  display:block;
  max-width:100%;
  max-height:40px;
  width:auto;
  height:auto;
  object-fit:contain;
  object-position:center;
  filter:none!important;
  opacity:1!important;
}

.lg-run,
.lg-dup,
.marquee-track .lg-run,
.marquee-track .lg-dup,
.marquee-dup{
  display:flex!important;
  flex:none;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:center;
  gap:var(--tjg-logo-gap)!important;
  width:max-content;
}
.lg-track,
.logos .lg-track{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:center;
  gap:var(--tjg-logo-gap)!important;
  width:max-content!important;
  animation:tjg-lgscroll 42s linear infinite;
}
.marquee-track{
  display:flex!important;
  flex-direction:row!important;
  flex-wrap:nowrap!important;
  align-items:center;
  gap:var(--tjg-logo-gap)!important;
  width:max-content!important;
  animation:tjg-marquee 55s linear infinite;
}
@keyframes tjg-lgscroll{to{transform:translateX(calc(-50% - var(--tjg-logo-gap-half)))}}
@keyframes tjg-marquee{to{transform:translateX(calc(-50% - var(--tjg-logo-gap-half)))}}

.lg-mask,
.logos .lg-mask,
.marquee{
  overflow:hidden!important;
}
.lg-mask:hover .lg-track,
.marquee:hover .marquee-track{animation-play-state:paused}
.marquee{
  -webkit-mask-image:linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent);
  mask-image:linear-gradient(90deg,transparent,#000 12%,#000 88%,transparent);
}

@media (max-width:600px){
  .lg-ph,
  .logos .lg-mask .lg-ph,
  .lg-mask .lg-ph,
  .marquee .lg-ph{
    width:132px!important;
    height:56px!important;
    border-radius:12px;
    padding:8px 10px;
  }
  .lg-ph img,
  .logos .lg-mask .lg-ph img,
  .lg-mask .lg-ph img,
  .marquee .lg-ph img,
  .sci-logos .lg-item img,
  .lg-grid .lg-item img{
    max-height:30px!important;
    max-width:100%!important;
  }
}

@media (prefers-reduced-motion:reduce){
  .lg-track,
  .marquee-track{
    animation:none!important;
    transform:none!important;
    flex-wrap:wrap!important;
    justify-content:center;
    width:auto!important;
    max-width:100%;
  }
  .lg-dup,
  .marquee-dup{display:none!important}
  .lg-mask,
  .marquee{
    overflow:visible!important;
    -webkit-mask-image:none;
    mask-image:none;
  }
}

/* grid sci-logos */
.sci-logos .lg-item img,
.lg-grid .lg-item img{
  max-height:44px;
}
.lg-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px 16px;
  align-items:center;
}
@media (max-width:600px){
  .lg-grid{grid-template-columns:repeat(2,minmax(0,1fr));}
  .sci-logos .lg-item img,
  .lg-grid .lg-item img{max-height:30px!important}
}

/* 4) Hero mobile: recupera spazio CTA in prima schermata (testo a capo) */
@media (max-width:600px){
  .hero .hero-main,
  section.hero .hero-main,
  .hero-main{
    /* header fixed ~73px + 12px; non scendere sotto (evita overlap Vai a) */
    padding-top:85px!important;
  }
  .hero .hero-ctas .btn.lg{
    padding-top:12px!important;
    padding-bottom:12px!important;
  }
}


/* =========================================================
   Fix regressioni Claude (hero overflow + logo stretch)
   ========================================================= */

/* 1) Home mobile: griglia hero non deve forzare min-content del «Vai a» */
.hero-copy,
.hero .hero-copy,
.hero-main > *,
.hero .hero-main > *{
  min-width:0;
}
.tjg-anchors,
.hero .tjg-anchors,
.hero-copy .tjg-anchors{
  max-width:100%;
  box-sizing:border-box;
}

/* 2) Logo nav/footer: non stirare (HTML width/height = aspect ratio) */
.nav-logo img,
.foot img,
footer.foot img,
.logo img{
  width:auto!important;
  height:auto;
  max-height:40px;
  object-fit:contain;
}
.foot img,
footer.foot img{
  max-height:34px;
}
.nav-logo img{
  max-height:40px;
}


/* a11y: link distinguibili nel testo (ricerca) senza cambiare colori */
.prose a[href^="http"],
.content a[href^="http"],
.wrap a[href^="https://doi.org"],
.wrap a[href^="https://journals."],
.wrap a[href^="https://wlu.ca"],
main a[href^="http"]{
  text-decoration: underline;
  text-underline-offset:2px;
}


/* a11y heading-order: titoli tile come gli h3 precedenti (Fase4a #1d1d1f) */
.tile h2.tile-title,
h2.tile-title{
  font-size:24px;
  font-weight:700;
  letter-spacing:-.02em;
  line-height:1.2;
  margin:0;
  color:#1d1d1f;
}
.tile.black h2.tile-title,
.dark .tile h2.tile-title,
.night .tile h2.tile-title{
  color:#fff;
}

/* =========================================================
   Fase6 fix3: LCP — niente opacity:0 above-the-fold (.rv)
   ========================================================= */
.sec.center > .wrap > .rv,
.sec.center > .wrap .btns.rv,
.hero .rv,
header.hero .rv,
.photo-hero + .sec .wrap > .rv:nth-child(-n+4){
  opacity:1!important;
  transform:none!important;
  transition:none!important;
}


/* LAYOUT_RICCARDO_V1 */
/* Loghi marquee: meno aria verticale */
.logos{
  margin: clamp(20px, 3vw, 36px) 0 clamp(16px, 2.5vw, 28px) !important;
}
.logos .lg-mask,
.lg-mask{
  max-height: 88px;
}
.lg-track{
  animation: tjg-lgscroll 42s linear infinite !important;
}

/* Griglia sci-logos compatta */
.sci-logos .lg-grid{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}
.sci-logos > .lg-item{ display: none !important; }
@media (max-width: 600px){
  .sci-logos .lg-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Perché credere + video bilanciati */
.why-block{
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  margin-top: clamp(48px, 7vw, 88px);
  align-items: start;
}
.why-block .why-h{ margin-top: 0 !important; }
.why-block .why-h .h3{ max-width: 34ch !important; }
.why-media{
  display: flex;
  flex-direction: column;
  align-items: center;
}
.why-block .video{
  width: min(100%, 380px) !important;
  max-width: 380px !important;
  margin: 0 auto 10px !important;
  border-radius: 22px !important;
}
.why-block .vcap{
  margin: 0 !important;
  text-align: center;
}
@media (min-width: 900px){
  .why-block{
    grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
    gap: clamp(36px, 5vw, 64px);
    align-items: start;
  }
  .why-media{ align-items: stretch; }
  .why-block .video{
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 10px !important;
  }
  .why-block .vcap{ text-align: left; padding: 0; }
}

/* Bridge/formula integrata */
.diff .bridge{
  margin: 0 0 22px !important;
  padding: 16px 14px !important;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
}

/* CTA night full-bleed + footer padding */
section.sec.night#incontro{
  padding-top: clamp(72px, 9vw, 110px) !important;
  padding-bottom: clamp(72px, 9vw, 110px) !important;
  margin-bottom: 0 !important;
}
section.sec.night#incontro .wrap{
  max-width: 720px;
}
footer.foot{
  padding-top: 56px !important;
  padding-bottom: 48px !important;
  border-top: 1px solid var(--line, #d2d2d7);
}

/* Form prenota: banda full-bleed, non card stretta su bianco */
.c-column:has(#rs-prenota),
.c-column:has(#_builder-form),
.c-column:has(.fcard-hd){
  padding: clamp(28px, 4vw, 48px) clamp(20px, 3vw, 40px) !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
  background: #f5f5f7 !important;
}
@media (min-width: 900px){
  .c-row:has(#rs-prenota),
  .c-row:has(.fcard-hd){
    background: #0f1230;
  }
  .c-column:has(#rs-prenota),
  .c-column:has(.fcard-hd){
    background: transparent !important;
  }
  .c-column:has(#rs-prenota) .fcard-hd h3,
  .c-column:has(.fcard-hd) .fcard-hd h3{ color: #fff !important; }
  .c-column:has(#rs-prenota) .fcard-hd > p:not(.fcard-kicker),
  .c-column:has(.fcard-hd) .fcard-hd > p:not(.fcard-kicker){ color: rgba(255,255,255,.78) !important; }
  .c-column:has(#rs-prenota) .fcard-kicker,
  .c-column:has(.fcard-hd) .fcard-kicker{ color: #C3BBFF !important; }
}

/* Percorsi: card di bilanciamento */
.split-balance-card{
  border-radius: var(--r, 28px);
  padding: 28px 24px !important;
}


/* LAYOUT_RICCARDO_V2 */
/* Spazio loghi → sezione successiva */
.logos{
  margin-bottom: clamp(8px, 1.5vw, 16px) !important;
}
#risultato.sec,
section#risultato{
  padding-top: clamp(40px, 5vw, 64px) !important;
}
/* Sezione che contiene i loghi: meno padding sotto */
.sec:has(.logos),
.sec.white:has(.logos){
  padding-bottom: clamp(28px, 4vw, 48px) !important;
}

/* Dark / CTA: full-bleed fuori dal padding builder */
section.sec.dark,
section.dark.grain,
section.dark.cta-sec,
.cta-sec.dark{
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  box-sizing: border-box !important;
  border-radius: 0 !important;
}
.custom-code-container:has(section.sec.dark),
.custom-code-container:has(section.dark),
.custom-code-container:has(.cta-sec){
  padding: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  overflow: visible !important;
}
.c-column:has(section.sec.dark),
.c-column:has(section.dark),
.c-column:has(.cta-sec),
.c-row:has(section.sec.dark),
.c-row:has(.cta-sec),
.c-section:has(section.sec.dark),
.c-section:has(.cta-sec){
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: none !important;
  width: 100% !important;
}

/* Why-block: niente doppio margine enorme */
.why-block .why-h{
  margin-top: 0 !important;
}
.why-block{
  margin-top: clamp(36px, 5vw, 64px) !important;
}

/* Bridge/formula: pezzo della card, non sticker */
.dcard-kicker{
  margin: 0 0 12px !important;
  font: 700 12px/1.2 var(--f-body, system-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--lilac, #C3BBFF);
}
.diff .bridge{
  margin: 18px 0 0 !important;
  padding: 14px 12px !important;
  border-radius: 18px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
}
.diff .bridge .bn{
  min-height: 72px;
}

/* Form prenota: banda continua, zero inset bianco */
.c-column:has(#rs-prenota),
.c-column:has(#_builder-form),
.c-column:has(.fcard-hd){
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 48px) !important;
  background: #0f1230 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.c-row:has(#rs-prenota),
.c-row:has(#_builder-form),
.c-row:has(.fcard-hd),
.c-section:has(#rs-prenota),
.c-section:has(.fcard-hd){
  background: #0f1230 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin: 0 !important;
  max-width: none !important;
  width: 100% !important;
}
.c-column:has(#rs-prenota) .fcard-hd h3,
.c-column:has(.fcard-hd) .fcard-hd h3{ color:#fff !important; }
.c-column:has(#rs-prenota) .fcard-hd > p:not(.fcard-kicker),
.c-column:has(.fcard-hd) .fcard-hd > p:not(.fcard-kicker){ color:rgba(255,255,255,.78)!important; }
.c-column:has(#rs-prenota) .fcard-kicker,
.c-column:has(.fcard-hd) .fcard-kicker{ color:#C3BBFF !important; }

/* Footer home: aria dal blu sopra */
footer.foot{
  padding-top: 64px !important;
  padding-bottom: 56px !important;
  margin-top: 0 !important;
}
.c-section:has(footer.foot),
.custom-code-container:has(footer.foot){
  padding-top: 0 !important;
  margin-top: 0 !important;
}

/* Percorsi: CTA night + footer non attaccati */
section.sec.night#incontro{
  padding-top: clamp(80px, 10vw, 120px) !important;
  padding-bottom: clamp(80px, 10vw, 120px) !important;
}
section.sec.night#incontro + footer.foot,
main#contenuto-principale + footer.foot{
  margin-top: 0 !important;
  padding-top: 56px !important;
}
.split-balance-card{
  margin-top: 16px;
}


/* LAYOUT_RICCARDO_V3 */
footer.foot{
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  box-sizing: border-box !important;
}
footer.foot .container,
footer.foot .foot-in{
  max-width: var(--wide, 1120px);
  margin-left: auto;
  margin-right: auto;
  padding-left: 22px;
  padding-right: 22px;
}
/* Percorsi: aria tra CTA night e footer */
section.sec.night#incontro{
  padding-bottom: clamp(88px, 11vw, 132px) !important;
}
section.sec.night#incontro .wrap{
  padding-bottom: 0 !important;
}
/* Balance card a sinistra, non stretta */
.prose .split-balance-card{
  max-width: 100%;
}
