/* ==========================================================================
   CLASS – Home "portale" (index.html)
   Presenta il claim comune e smista verso le due pagine: Serramenti (blu
   "vetro") e Fotovoltaico (ambra). Si appoggia a style.css e componenti.css.
   Split screen da 900 px in su: le due metà sono sovrapposte a tutta
   larghezza e la destra si sposta in orizzontale; così l'allargamento 60/40
   usa solo transform (niente ricalcolo del layout). Sotto i 900 px le metà
   diventano due blocchi impilati.
   Animazioni: solo transform, opacity e stroke-dashoffset.
   ========================================================================== */

.pt-page {
  --sx: #1273b3; --sx-deep: #0b5587; --sx-light: #5cb3ec;
  --fv: #f2a516; --fv-deep: #c97d05; --fv-light: #f5b83d;
  --sx-bg: linear-gradient(160deg, #eef7fd 0%, #d6ecf9 55%, #bfe0f5 100%);
  --fv-bg: linear-gradient(200deg, #fff8ea 0%, #ffe7b3 55%, #ffd27a 100%);
  --sx-bg-sat: linear-gradient(160deg, #dcefff 0%, #a9d6f6 60%, #7cc0ef 100%);
  --fv-bg-sat: linear-gradient(200deg, #fff1cc 0%, #ffd27a 55%, #ffb63a 100%);
  --split-ease: cubic-bezier(0.22, 0.8, 0.25, 1);
  --acc: var(--sx); --acc-deep: var(--sx-deep); --acc-soft: #e4f1fa; --acc-rgb: 18, 115, 179;
  background: var(--c-bg-alt);
}
.pt-page :focus-visible { outline-color: var(--c-anth); }

/* ---------- Animazione d'apertura ---------- */
.pt-intro { display: none; }
.pt-intro-on .pt-intro {
  display: block; position: fixed; inset: 0; z-index: 3000; cursor: pointer; overflow: hidden;
  /* Sicurezza: se lo script non parte, l'apertura sparisce comunque */
  animation: pt-intro-off 0.3s 2.4s both;
}
.pt-intro-half { position: absolute; top: 0; bottom: 0; width: 50.5%; background: var(--c-anth); will-change: transform; }
.pt-intro-l { left: 0; }
.pt-intro-r { right: 0; }
.pt-intro-line { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: linear-gradient(180deg, var(--sx-light), var(--fv-light)); transform: scaleY(0); }
.pt-intro-logo { position: absolute; left: 50%; top: 50%; width: min(360px, 62vw); height: auto; margin: 0; opacity: 0; transform: translate(-50%, -50%); }
@keyframes pt-intro-off { to { opacity: 0; visibility: hidden; } }

/* ---------- Claim ---------- */
.pt-claim {
  position: relative; z-index: 6; text-align: center; color: #fff;
  background: var(--c-anth); border-radius: var(--r-lg); padding: var(--s-5) var(--s-5);
  box-shadow: 0 24px 60px rgba(14, 18, 28, 0.28);
}
.pt-claim h1 { color: #fff; font-size: clamp(1.9rem, 1rem + 2.6vw, 3.3rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 var(--s-2); text-wrap: balance; }
.pt-claim p { margin: 0; font-size: clamp(1rem, 0.9rem + 0.45vw, 1.25rem); color: rgba(255, 255, 255, 0.82); font-weight: 600; }
/* "futuro": gradiente dal blu vetro all'ambra sole; l'animazione è una dissolvenza
   tra due gradienti con il passaggio di colore in punti diversi (solo opacity),
   così il confine blu/ambra scorre avanti e indietro lungo la parola */
.pt-fut { position: relative; display: inline-block; }
.pt-fut-a, .pt-fut-b { -webkit-background-clip: text; background-clip: text; color: transparent; }
.pt-fut-a { background-image: linear-gradient(90deg, var(--sx-light) 0%, var(--sx-light) 30%, var(--fv-light) 85%); }
.pt-fut-b { position: absolute; inset: 0; background-image: linear-gradient(90deg, var(--sx-light) 0%, var(--fv-light) 45%, var(--fv-light) 100%); animation: pt-fut 3.2s ease-in-out infinite alternate; }
@keyframes pt-fut { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Le due metà (mobile prima: blocchi impilati) ---------- */
.pt-split { position: relative; background: var(--c-bg-alt); padding-bottom: var(--s-2); }
.pt-top { display: flex; justify-content: center; padding: var(--s-4) var(--gutter) var(--s-3); }
.pt-logo img { height: 58px; width: auto; }
.pt-split > .pt-claim { margin: 0 var(--gutter) var(--s-4); }

.pt-half {
  position: relative; display: block; overflow: hidden; isolation: isolate;
  color: var(--c-anth); text-decoration: none; background: var(--sx-bg);
  margin: 0 var(--gutter) var(--s-4); border-radius: var(--r-lg);
}
.pt-fv { background: var(--fv-bg); }
.pt-half:hover { text-decoration: none; }
.pt-half:focus-visible { outline: 4px solid var(--c-anth); outline-offset: -4px; }
.pt-sat { position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity 0.6s var(--split-ease); background: var(--sx-bg-sat); }
.pt-fv .pt-sat { background: var(--fv-bg-sat); }
.pt-content { display: flex; flex-direction: column; align-items: flex-start; padding: var(--s-4) var(--s-5) var(--s-5); transition: transform 0.7s var(--split-ease), opacity 0.5s var(--ease); }
.pt-art { display: flex; width: 100%; justify-content: center; margin-bottom: var(--s-3); }
.pt-svg { width: 100%; height: auto; max-height: 30vh; max-height: 30svh; aspect-ratio: 520 / 440; }
.pt-verb {
  font-family: var(--f-head); font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  font-size: clamp(0.85rem, 0.7rem + 0.8vw, 1.25rem); color: var(--sx-deep); margin-bottom: var(--s-1);
}
.pt-fv .pt-verb { color: var(--fv-deep); }
.pt-name { font-size: clamp(2rem, 1.3rem + 3vw, 3.6rem); line-height: 1; letter-spacing: -0.025em; margin: 0 0 var(--s-2); color: var(--c-anth); display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.pt-badge { font-size: 0.75rem; margin-left: 0; }
/* Badge "Bonus": ambra per il fotovoltaico (stile di base), blu vetro per i serramenti */
.nav-badge-sx { background: var(--sx); color: #fff; }
.pt-sub { font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem); font-weight: 600; color: #3b4652; max-width: 34ch; margin-bottom: var(--s-4); }
.pt-fv .pt-sub { color: #4a4031; }
.pt-enter {
  display: inline-flex; align-items: center; gap: var(--s-2); min-height: 52px; padding: 0.8rem 1.5rem;
  border-radius: var(--r-pill); font-weight: 800; background: var(--sx); color: #fff; box-shadow: var(--sh-md);
  transition: transform var(--t-base) var(--ease), background var(--t-base) var(--ease);
}
.pt-fv .pt-enter { background: var(--c-anth); color: #fff; }
.pt-enter svg { width: 20px; height: 20px; fill: currentColor; transition: transform var(--t-base) var(--ease); }
.pt-half:hover .pt-enter svg, .pt-half:focus-visible .pt-enter svg { transform: translateX(4px); }
.pt-divider, .pt-halo, .pt-down { display: none; }

/* ---------- Tablet: le due metà affiancate, senza allargamento ---------- */
@media (min-width: 600px) and (max-width: 899px) {
  .pt-split { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-4); padding-inline: var(--gutter); }
  .pt-top, .pt-split > .pt-claim { grid-column: 1 / -1; }
  .pt-split > .pt-claim { margin-inline: 0; }
  .pt-half { margin: 0 0 var(--s-4); display: flex; }
  .pt-content { width: 100%; }
  .pt-sub { flex: 1 0 auto; }
}

/* ---------- Desktop: split screen a tutta altezza ---------- */
@media (min-width: 900px) and (min-height: 560px) {
  .pt-split { height: 100vh; height: 100svh; min-height: 600px; overflow: hidden; padding: 0; background: #e9e2d6; }
  .pt-top { position: absolute; z-index: 7; top: clamp(16px, 3vh, 32px); left: clamp(16px, 2.2vw, 40px); padding: 0; }
  /* Logo grande ma sempre a sinistra del box del claim */
  .pt-logo img { height: clamp(44px, calc(6.4vw - 12px), 84px); max-width: none; }
  .pt-split > .pt-claim {
    position: absolute; top: clamp(16px, 4.5vh, 52px); left: 50%; margin: 0; width: min(680px, 50vw);
    transform: translateX(-50%); padding: clamp(14px, 2.4vh, 26px) clamp(20px, 2.6vw, 40px);
  }
  .pt-half { position: absolute; inset: 0; margin: 0; border-radius: 0; }
  /* La metà destra copre la sinistra: la sua posizione è la linea di divisione */
  .pt-fv { transform: translateX(50%); transition: transform 0.7s var(--split-ease); will-change: transform; box-shadow: -18px 0 40px rgba(14, 18, 28, 0.10); }
  .pt-content {
    position: absolute; top: 0; bottom: 0; left: 0; width: 40%; justify-content: flex-end;
    padding: calc(clamp(16px, 4.5vh, 52px) + clamp(170px, 24vh, 220px)) clamp(16px, 2.2vw, 36px) clamp(24px, 6vh, 64px);
    transform: translateX(12.5%); will-change: transform;
  }
  .pt-art { flex: 1 1 auto; min-height: 0; align-items: center; margin-bottom: clamp(8px, 2vh, 24px); }
  .pt-svg { height: 100%; max-height: 46vh; width: auto; max-width: 100%; }
  .pt-divider {
    display: block; position: absolute; left: -1px; top: 0; bottom: 0; width: 2px; z-index: 2;
    background: rgba(255, 255, 255, 0.9); box-shadow: 0 0 0 1px rgba(28, 31, 39, 0.06);
  }
  /* Stato attivo (mouse o tastiera): 60/40, colore più saturo, l'altra metà si attenua */
  .pt-split.is-sx .pt-fv { transform: translateX(60%); }
  .pt-split.is-fv .pt-fv { transform: translateX(40%); }
  .pt-split.is-sx .pt-sx .pt-content { transform: translateX(25%); }
  .pt-split.is-fv .pt-sx .pt-content { transform: translateX(0); opacity: 0.55; }
  .pt-split.is-sx .pt-fv .pt-content { transform: translateX(0); opacity: 0.55; }
  .pt-split.is-fv .pt-fv .pt-content { transform: translateX(25%); }
  .pt-split.is-sx .pt-sx .pt-sat, .pt-split.is-fv .pt-fv .pt-sat { opacity: 1; }
  .pt-split.is-sx .pt-sx .pt-enter, .pt-split.is-fv .pt-fv .pt-enter { transform: scale(1.05); }
  .pt-halo {
    display: block; position: absolute; left: 0; top: 0; z-index: 5; width: 220px; height: 220px; border-radius: 50%;
    pointer-events: none; opacity: 0; transition: opacity 0.25s var(--ease); will-change: transform, opacity;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.35) 30%, rgba(255, 255, 255, 0) 68%);
  }
  .pt-halo.is-on { opacity: 1; }
  .pt-down {
    display: grid; place-items: center; position: absolute; z-index: 6; left: 50%; bottom: clamp(12px, 2.4vh, 24px);
    width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; background: var(--c-anth); color: #fff;
    box-shadow: var(--sh-md); transition: transform var(--t-base) var(--ease);
  }
  .pt-down:hover { transform: translateY(3px); }
  .pt-down svg { width: 24px; height: 24px; fill: currentColor; }
}

/* ---------- Transizione verso la pagina scelta ---------- */
.pt-wipe { position: fixed; left: 0; top: 0; width: 100vw; height: 100vh; z-index: 2500; transform-origin: 0 0; pointer-events: none; will-change: transform; }
.pt-wipe-serramenti { background: var(--sx-bg); }
.pt-wipe-fotovoltaico { background: var(--fv-bg); }

/* ---------- Sotto lo split ---------- */
.pt-countdown { border-top: 0; border-image: none; position: relative; }
.pt-countdown::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--sx), var(--fv)); }
.pt-countdown .pv-timer b { color: #fff; }
.pt-cd-note { margin: var(--s-3) 0 0; font-size: var(--fs-sm); color: var(--c-on-anth-muted); max-width: 60ch; }
.pt-more-inner { padding-block: var(--s-7) var(--s-8); }
.pt-more-title { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); margin-bottom: var(--s-5); }
.pt-cards { display: grid; gap: var(--s-4); }
.pt-card {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--s-3) var(--s-4);
  padding: var(--s-5); border-radius: var(--r-lg); color: var(--c-anth); text-decoration: none;
  background: #fff; border: 1px solid var(--c-line); box-shadow: var(--sh-sm); position: relative; overflow: hidden;
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.pt-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--sx); }
.pt-card-fv::before { background: var(--fv); }
.pt-card:hover { text-decoration: none; transform: translateY(-4px); box-shadow: var(--sh-md); }
.pt-card-icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-md); background: #e4f1fa; color: var(--sx-deep); }
.pt-card-fv .pt-card-icon { background: #fff3d6; color: var(--fv-deep); }
.pt-card-icon svg { width: 28px; height: 28px; fill: currentColor; }
.pt-card-body { display: grid; gap: 2px; }
.pt-card-body strong { font-family: var(--f-head); font-size: 1.35rem; }
.pt-card-body > span { color: var(--c-text-muted); }
.pt-card-go { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 800; color: var(--sx-deep); }
.pt-card-fv .pt-card-go { color: var(--c-anth); }
.pt-card-go svg { width: 18px; height: 18px; fill: currentColor; transition: transform var(--t-base) var(--ease); }
.pt-card:hover .pt-card-go svg { transform: translateX(4px); }
.pt-cred { margin: var(--s-6) 0 0; font-family: var(--f-head); font-weight: 700; font-size: clamp(1.15rem, 1rem + 0.6vw, 1.5rem); color: var(--c-anth); text-align: center; }
@media (min-width: 768px) {
  .pt-cards { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
  .pt-card { grid-template-columns: auto 1fr auto; padding: var(--s-6); }
  .pt-card-go { grid-column: auto; }
}

/* ---------- Footer ---------- */
.pt-footer { padding-top: var(--s-7); }
@media (min-width: 1024px) { .pt-footer .footer-grid { grid-template-columns: 1.2fr 0.8fr 1.4fr 0.8fr; } }

/* ---------- Modalità presentazione ---------- */
.pt-page .pv-present { left: auto; right: var(--s-4); }
.is-presenting .pt-down { display: none; }

/* ---------- Movimento ridotto ---------- */
@media (prefers-reduced-motion: reduce) {
  .pt-intro { display: none !important; }
  .pt-fut-b { animation: none; opacity: 0; }
  .pt-fv, .pt-content, .pt-sat { transition: none; }
}
