/* ==========================================================================
   CLASS S.R.L.S. – Pagina Fotovoltaico
   Si appoggia a style.css (variabili, header, footer, pulsanti, form) e a
   componenti.css (countdown, contatori, simulatore, FAQ, passi, CTA, nota
   legale, pulsante fisso, modalità presentazione).
   Qui restano solo l'accento caldo (ambra) e le parti esclusive della pagina.
   Animazioni: solo transform, opacity e stroke-dashoffset.
   ========================================================================== */

.pv-page {
  --c-sun: #f2a516;
  --c-sun-deep: #c97d05;
  --c-sun-soft: #fff3d6;
  --c-anth: #1c1f27;
  --c-anth-2: #262a35;
  --c-on-anth-muted: rgba(255, 255, 255, 0.72);
  --cut: clamp(2rem, 5vw, 4.5rem);
  /* Accento dei componenti condivisi: ambra */
  --acc: var(--c-sun);
  --acc-deep: var(--c-sun-deep);
  --acc-soft: var(--c-sun-soft);
  --acc-ink: var(--c-anth);
  --acc-link: #ffd37a;
  --acc-rgb: 242, 165, 22;
}

/* Dicitura dell'entità nell'header: antracite per il contrasto, filetto ambra */
.pv-page .hd-entity { color: var(--c-anth); }
.pv-page .hd-home:hover { color: var(--c-anth); }

.btn-sun { background: var(--c-sun); color: var(--c-anth); box-shadow: var(--sh-sm); }
.btn-sun:hover { background: #ffb62a; color: var(--c-anth); box-shadow: var(--sh-md); }
.pv-dark .btn-sun, .pv-dark .btn-sun:hover { color: var(--c-anth); }

/* ---------- 1. Hero ---------- */
.pv-hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: calc(100vh - var(--header-h)); min-height: calc(100svh - var(--header-h));
  display: grid; align-items: center;
  background: linear-gradient(135deg, #fff9ec 0%, #ffe6ad 48%, #ffc266 100%);
  color: var(--c-anth);
}
.pv-hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.pv-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.75; }
.pv-blob-1 { width: 60vmax; height: 60vmax; right: -22vmax; top: -28vmax; background: #ffb13d; }
.pv-blob-2 { width: 36vmax; height: 36vmax; left: -14vmax; bottom: -18vmax; background: #ffdca3; }
.pv-halo {
  position: absolute; left: 68%; top: 42%; width: 80vmin; height: 80vmin; margin: -40vmin 0 0 -40vmin;
  border-radius: 50%; will-change: transform;
  background: radial-gradient(circle, rgba(255, 216, 102, 0.95) 0%, rgba(255, 190, 70, 0.45) 30%, rgba(255, 190, 70, 0) 68%);
}
.pv-hero-ring { position: absolute; right: -6vmin; bottom: -14vmin; width: 52vmin; height: 52vmin; color: rgba(28, 31, 39, 0.22); }
.pv-hero-content { position: relative; padding-top: var(--s-8); padding-bottom: var(--s-9); }
.pv-hero .eyebrow { color: var(--c-sun-deep); }
.pv-hero h1 {
  font-size: clamp(2.6rem, 1.4rem + 5.6vw, 6rem); letter-spacing: -0.025em; line-height: 1.02;
  color: var(--c-anth); margin-bottom: var(--s-5); max-width: 14ch;
}
.pv-h1-fixed { display: block; }
.pv-h1-swap { display: block; color: var(--c-sun-deep); min-height: 1.02em; }
.pv-hero-sub { font-size: clamp(1.125rem, 1rem + 0.9vw, 1.5rem); max-width: 34ch; color: #3b3a36; margin-bottom: var(--s-6); font-weight: 500; }
.pv-hero-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-4); }
.pv-link-arrow { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 700; color: var(--c-anth); padding: var(--s-2) 0; }
.pv-link-arrow svg { width: 22px; height: 22px; fill: currentColor; transition: transform var(--t-base) var(--ease); }
.pv-link-arrow:hover { text-decoration: none; }
.pv-link-arrow:hover svg { transform: translateY(3px); }
@media (min-width: 600px) { .pv-hero-actions { flex-direction: row; align-items: center; gap: var(--s-6); } }

/* ---------- 3. Una giornata di sole ---------- */
.pv-day { background: #0b1020; color: #fff; position: relative; }
.pv-day { --ctl-bg: rgba(255, 255, 255, 0.08); --ctl-fg: #fff; --ctl-track: rgba(255, 255, 255, 0.22); --ctl-dot: rgba(255, 255, 255, 0.35); }
.pv-day-pin {
  height: 100vh; height: 100svh; display: flex; align-items: stretch;
  padding-top: var(--header-h); padding-bottom: 84px; /* spazio per il pulsante fisso su mobile */
  box-sizing: border-box;
}
.pv-day-grid {
  display: grid; grid-template-rows: auto 1fr; gap: var(--s-4); height: 100%;
  padding-block: var(--s-4) var(--s-5); align-content: start;
}
.pv-day-text { position: relative; display: grid; grid-template-rows: auto auto 1fr auto auto; align-content: stretch; min-height: 0; }
.pv-day-extra {
  display: flex; gap: var(--s-3); align-items: flex-start; margin: var(--s-4) 0 0;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: rgba(242,165,22,0.12); border: 1px solid rgba(242,165,22,0.35);
  font-size: 0.8rem; line-height: 1.4; color: rgba(255,255,255,0.85);
}
@media (min-width: 900px) { .pv-day-extra { font-size: var(--fs-sm); line-height: 1.45; } }
.pv-day-extra svg { width: 22px; height: 22px; flex: none; fill: var(--c-sun); margin-top: 1px; }
.pv-day-extra strong { color: #fff; }
.pv-day-title { color: #fff; font-size: 1.125rem; margin-bottom: var(--s-3); opacity: 0.8; }
.pv-day .eyebrow { color: var(--c-sun); margin-bottom: var(--s-1); }
.pv-captions { position: relative; font-size: clamp(1.35rem, 0.9rem + 2.2vw, 2.4rem); line-height: 1.18; min-height: 4.8em; }
.pv-caption {
  position: absolute; inset: 0; margin: 0; opacity: 0; will-change: transform, opacity;
  display: flex; align-items: center;
  font-family: var(--f-head); font-weight: 700; line-height: inherit; letter-spacing: -0.015em;
  font-size: inherit; text-wrap: balance; color: #fff;
}
.pv-scroll-hint { display: none; margin: 0; font-size: var(--fs-sm); color: rgba(255,255,255,0.55); }
.pv-scene { display: grid; align-content: center; min-height: 0; }
.pv-scene-svg {
  width: 100%; height: auto; max-height: calc(100svh - var(--header-h) - 15rem);
  aspect-ratio: 1000 / 620; border-radius: var(--r-lg); box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  margin-inline: auto;
}

/* Ordine su mobile: scena sopra, testi sotto */
.pv-day-grid .pv-scene { order: -1; }

@media (min-width: 1024px) { .pv-day-pin { padding-bottom: 0; } }
@media (min-width: 900px) {
  .pv-day-grid { grid-template-columns: 0.9fr 1.5fr; grid-template-rows: none; align-items: center; align-content: center; gap: var(--s-7); }
  .pv-day-grid .pv-scene { order: 0; }
  .pv-day-text { align-self: stretch; }
  .pv-captions { min-height: 6em; }
  .pv-scroll-hint { display: block; margin: var(--s-4) 0 0; align-self: end; }
  .pv-scene-svg { max-height: calc(100svh - var(--header-h) - 7rem); }
}

/* Flussi di energia */
.pv-scene-svg .flow-dash { stroke: #ffcf4d; stroke-width: 4; stroke-dasharray: 8 14; stroke-linecap: round; animation: pv-flow 0.9s linear infinite; }
.pv-scene-svg .flow-dot { stroke: #fff8dc; stroke-width: 7; stroke-dasharray: 0.1 21.9; stroke-linecap: round; animation: pv-flow 0.9s linear infinite; }
.pv-scene-svg .flow-dash.is-grid { stroke: #9fb3e8; stroke-width: 3; }
.pv-scene-svg .flow-dot.is-grid { stroke: #e3ecff; stroke-width: 5; }
@keyframes pv-flow { to { stroke-dashoffset: -22; } }

/* Versione statica: 4 riquadri */
.pv-day-static { padding-block: var(--section-y); display: grid; gap: var(--s-5); }
.pv-day-static .pv-day-head { grid-column: 1 / -1; }
.pv-day-static .pv-day-title { font-size: var(--fs-h2); opacity: 1; }
.pv-day-static figure { margin: 0; display: grid; gap: var(--s-3); }
.pv-day-static .pv-scene-svg { max-height: none; box-shadow: var(--sh-md); }
.pv-day-static .pv-day-extra-static { grid-column: 1 / -1; max-width: 70ch; }
.pv-day-static figcaption { font-family: var(--f-head); font-weight: 700; font-size: 1.125rem; line-height: 1.3; color: #fff; }
@media (min-width: 640px) { .pv-day-static { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .pv-day-static { grid-template-columns: repeat(4, 1fr); } }

/* ---------- 6. Con o senza batteria ---------- */
.pv-battery { position: relative; z-index: 2; }
.pv-battery .section-head { max-width: none; }
.pv-battery .lead { max-width: none; }
.pv-bars { display: grid; gap: var(--s-6); max-width: 900px; }
.pv-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-3); }
.pv-bar-head span { font-weight: 700; font-size: 1.125rem; }
.pv-bar-head b { font-family: var(--f-head); font-size: clamp(1.75rem, 1.2rem + 2vw, 2.75rem); color: var(--c-sun); line-height: 1; }
.pv-bar-track { position: relative; height: 26px; border-radius: 999px; background: var(--c-anth-2); overflow: hidden; }
.pv-bar-fill, .pv-bar-range { position: absolute; top: 0; bottom: 0; left: 0; width: var(--w); transform: scaleX(0); transform-origin: left center; }
.pv-bar-fill { background: #8fa4d6; border-radius: 999px 0 0 999px; }
.pv-bar-fill.is-sun { background: var(--c-sun); }
.pv-bar-range { left: var(--from); border-radius: 0 999px 999px 0; background: repeating-linear-gradient(135deg, rgba(143,164,214,0.9) 0 6px, rgba(143,164,214,0.45) 6px 12px); }
.pv-bar-range.is-sun { background: repeating-linear-gradient(135deg, rgba(242,165,22,0.9) 0 6px, rgba(242,165,22,0.45) 6px 12px); }
.pv-bars-text { margin: var(--s-6) 0 0; max-width: 62ch; color: var(--c-on-anth-muted); }

/* ---------- 9. Il Veneto ci crede ---------- */
.pv-big { display: grid; gap: var(--s-6); }
.pv-big > div { display: grid; gap: var(--s-3); }
.pv-big span { color: var(--c-on-anth-muted); max-width: 32ch; }
@media (min-width: 768px) { .pv-big { grid-template-columns: 1fr 1fr; gap: var(--s-8); } }

/* ---------- Scena con cursore (touch / schermi stretti) ----------
   La sezione non è fissata: titolo, scena, poi didascalia e cursore nello stesso riquadro, nota in fondo. */
.pv-manual .pv-day-pin { height: auto; padding: 0; display: block; }
.pv-manual .pv-day-grid {
  height: auto; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
  gap: var(--s-4); padding-block: var(--section-y); align-content: start; align-items: start;
}
.pv-manual .pv-day-text { display: contents; }
.pv-manual .pv-day-text > .eyebrow { order: 1; margin-bottom: 0; }
.pv-manual .pv-day-title { order: 2; margin-bottom: 0; }
.pv-manual .pv-day-grid > .pv-scene { order: 3; }
.pv-manual .pv-captions { order: 4; font-size: clamp(1.1rem, 1rem + 0.6vw, 1.45rem); min-height: calc(4.8em + var(--s-4)); }
.pv-manual .pv-day-grid > .pv-scene-ctl { order: 5; }
.pv-manual .pv-day-extra { order: 6; margin: 0; }
.pv-manual .pv-scroll-hint { display: none; }
.pv-manual .pv-caption { inset: var(--s-4) var(--s-4) 0; align-items: flex-start; }
.pv-manual .pv-scene-svg { max-height: none; }
@media (min-width: 900px) {
  /* Tablet in orizzontale: testo, didascalia e cursore a sinistra, scena a destra */
  .pv-manual .pv-day-grid { grid-template-columns: 0.9fr 1.5fr; column-gap: var(--s-7); row-gap: 0; align-items: center; }
  .pv-manual .pv-day-text { display: grid; grid-template-rows: none; gap: var(--s-4); align-content: end; grid-column: 1; grid-row: 1; }
  .pv-manual .pv-captions { margin-bottom: 0; }
  .pv-manual .pv-day-extra { margin-top: var(--s-4); }
  .pv-manual .pv-day-grid > .pv-scene-ctl { grid-column: 1; grid-row: 2; align-self: start; }
  .pv-manual .pv-day-grid > .pv-scene { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .pv-manual .pv-captions { min-height: calc(5.5em + var(--s-4)); }
}

/* ---------- Modalità presentazione: parti della scena ---------- */
.is-presenting .pv-day-pin { padding-top: 0; padding-bottom: 0; }

/* ---------- Versione statica (reduced-motion o senza GSAP) ---------- */
.pv-static .pv-bar-fill, .pv-static .pv-bar-range { transform: none; }
.pv-static .pv-caption { position: static; opacity: 1; display: block; }
.pv-static .pv-scroll-hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  .pv-halo { display: none; }
  .pv-scene-svg .flow-dash, .pv-scene-svg .flow-dot { animation: none; }
}

@media print {
  .pv-day-pin { height: auto; }
}
