/* Apertura in 3D: il portatile che si smonta */
.opera { position: relative; background: var(--bg-deep); color: #fff; }
.opera.con3d { height: 700vh; }
.palco { position: relative; overflow: hidden; background: radial-gradient(60% 62% at 70% 50%, #1d2735 0%, #11151d 46%, var(--bg-deep) 100%); }
.con3d .palco { position: sticky; top: 0; height: 100vh; height: 100svh; }
.palco canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 0.5s ease; touch-action: pan-y pinch-zoom; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.pronto3d .palco canvas { opacity: 1; }
.opera:not(.con3d) .palco canvas, .opera:not(.con3d) .nome, .opera:not(.con3d) .punti3d, .opera:not(.con3d) .salta3d, .opera:not(.con3d) .tutto3d { display: none; }

.testo3d { text-shadow: 0 2px 22px rgba(10, 10, 15, 0.75); }
.con3d .testo3d { position: absolute; left: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))); top: 50%; width: min(40vw, 620px); transform: translateY(calc(-50% + var(--su, 0px))); }
.con3d .passo, .con3d .tutto3d, .con3d .fine3d { opacity: 0; visibility: hidden; }
.con3d .fine3d { width: min(36vw, 520px); }
.opera .hero-title { font-size: clamp(2.3rem, 4.9vw, 5.2rem); max-width: 12ch; margin: 0; }
.opera .hero-cresta { width: min(420px, 80%); margin: 1rem 0 1.6rem; }
.opera .hero-subtitle { max-width: 34ch; margin-bottom: 1.8rem; }
.opera .hero-buttons { justify-content: flex-start; }
.titolo3d { font-size: clamp(2.1rem, 4.2vw, 4.2rem); line-height: 1.04; letter-spacing: -0.03em; font-weight: 800; text-wrap: balance; }
.frase3d { margin-top: 1rem; font-size: clamp(1.05rem, 1.35vw, 1.28rem); line-height: 1.6; color: #d4d8dd; max-width: 32ch; }
.num3d { display: block; margin-bottom: 0.9rem; color: var(--accent); font-weight: 700; font-size: 1rem; }
.fine3d .hero-buttons { margin-top: 1.6rem; }

.nome { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; opacity: 0; visibility: hidden; cursor: pointer; }
.nome span { position: absolute; right: 12px; top: -34px; display: block; padding: 8px 16px; min-height: 40px; border: 1px solid rgba(0, 212, 255, 0.55); border-radius: 999px; background: rgba(10, 12, 17, 0.86); color: #fff; font: 600 0.95rem var(--font-body); white-space: nowrap; transition: background 0.2s ease, color 0.2s ease; }
.nome::before { content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(0, 212, 255, 0.22); }
.nome.destra span { right: auto; left: 14px; }
/* area di tocco più grande della pastiglia, per il dito */
.nome span::after { content: ""; position: absolute; inset: -6px -4px; }
.nome:focus-visible span { background: var(--accent); color: #0a0a0f; }
@media (hover: hover) { .nome:hover span { background: var(--accent); color: #0a0a0f; } }
.nome:active span { background: var(--accent); color: #0a0a0f; }

.punti3d { position: absolute; right: calc(var(--gutter) * 0.5); top: 50%; transform: translateY(-50%); display: grid; gap: 0; }
.punti3d button { width: 44px; height: 44px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
.punti3d button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); transition: transform 0.25s ease, background 0.25s ease; }
.punti3d button[aria-current="step"]::before { background: var(--accent); transform: scale(1.5); }
.salta3d { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; font-size: 0.95rem; color: #d4d8dd; text-decoration: underline; text-underline-offset: 4px; }

/* prima che il 3D sia pronto, oppure quando non c'è: immagini ferme */
.fermo3d { display: block; width: 100%; height: auto; }
.con3d .fermo3d.smontato { display: none; }
.con3d .fermo3d.chiuso { position: absolute; right: 2%; top: 50%; width: 55%; transform: translateY(-50%); transition: opacity 0.4s ease; }
.pronto3d .fermo3d.chiuso { opacity: 0; pointer-events: none; }
.opera:not(.con3d) .palco { padding: calc(var(--nav-h) + 32px) var(--gutter) 64px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 40px clamp(24px, 5vw, 72px); align-items: center; max-width: none; }
.opera:not(.con3d) .fermo3d.smontato { grid-column: 2; grid-row: 2 / span 5; }
.opera:not(.con3d) .passo { grid-column: 1; }
.opera:not(.con3d) .passo .titolo3d { font-size: clamp(1.5rem, 2.4vw, 2rem); }
.opera:not(.con3d) .fine3d { grid-column: 1 / -1; }

/* striscia con la foto della valle */
.valle { position: relative; height: clamp(280px, 48vw, 620px); overflow: hidden; background: var(--bg-deep); }
.valle img { width: 100%; height: 100%; object-fit: cover; object-position: center 42%; }
.valle::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 17, 21, 0.5), rgba(15, 17, 21, 0) 30%, rgba(15, 17, 21, 0) 60%, var(--bg) 100%); }

/* telefoni e tablet in verticale: testo in basso, portatile sopra (lo spazio del portatile lo calcola avvio.js dai testi) */
@media (max-width: 599px), (max-aspect-ratio: 105/100) {
  .palco { background: radial-gradient(95% 46% at 50% 36%, #1d2735 0%, #11151d 55%, var(--bg-deep) 100%); }
  .con3d .testo3d, .con3d .fine3d { left: var(--gutter); right: var(--gutter); width: auto; top: auto; bottom: 108px; transform: translateY(var(--su, 0px)); }
  .opera .hero-title { font-size: clamp(1.9rem, 8.4vw, 3rem); max-width: none; }
  .opera .hero-cresta { height: 28px; margin: 0.5rem 0 0.8rem; }
  .opera .hero-subtitle { font-size: 1.02rem; line-height: 1.5; margin-bottom: 1rem; max-width: 46ch; }
  .opera .testo3d .eyebrow { display: none; }
  .opera .hero-buttons { flex-direction: row; gap: 10px; }
  .opera .hero-buttons .btn { width: auto; flex: 1 1 0; min-height: 48px; padding: 13px 12px; font-size: 0.95rem; }
  .titolo3d { font-size: clamp(1.8rem, 8vw, 2.6rem); }
  .frase3d { font-size: 1.08rem; max-width: 42ch; }
  /* immagine ferma nello stesso spazio del 3D: fra il menu e il titolo (--cima la scrive la pagina) */
  .con3d .fermo3d.chiuso { left: 50%; right: auto; width: auto; max-width: 92%; max-height: max(90px, calc(var(--cima, 62%) - var(--nav-h) - 20px)); top: calc((var(--nav-h) + var(--cima, 62%) - 4px) / 2); transform: translate(-50%, -50%); }
  .punti3d { left: calc(var(--gutter) - 17px); right: auto; top: auto; bottom: 58px; transform: none; display: flex; }
  .nome span { padding: 6px 12px; font-size: 0.86rem; min-height: 34px; }
  .salta3d { left: var(--gutter); bottom: 12px; transform: none; padding-left: 0; }
  .opera:not(.con3d) .palco { grid-template-columns: minmax(0, 1fr); }
  .opera:not(.con3d) .fermo3d.smontato, .opera:not(.con3d) .passo { grid-column: 1; grid-row: auto; }
}
/* telefoni piccoli in verticale: testi più compatti, così resta spazio al portatile */
@media (max-height: 600px) and (max-width: 599px), (max-height: 600px) and (max-aspect-ratio: 105/100) {
  .opera .hero-cresta { display: none; }
  .opera .hero-title { font-size: 1.75rem; margin-bottom: 0.7rem; }
  .opera .hero-subtitle { font-size: 0.95rem; }
  .titolo3d { font-size: 1.65rem; }
  .frase3d { font-size: 1rem; margin-top: 0.6rem; }
  .num3d { margin-bottom: 0.5rem; }
}
/* finestre basse e larghe, come il telefono girato: testo a sinistra, portatile a destra */
@media (max-height: 560px) and (min-width: 600px) and (min-aspect-ratio: 105/100) {
  .con3d .testo3d { top: calc(var(--nav-h) + (100% - var(--nav-h) - 52px) / 2); width: min(44vw, 440px); }
  .con3d .fermo3d.chiuso { right: auto; left: 67%; top: calc((var(--nav-h) + 6px + 92%) / 2); width: auto; max-width: 50%; max-height: calc(92% - var(--nav-h) - 6px); transform: translate(-50%, -50%); }
  .con3d .fine3d { width: min(40vw, 420px); }
  .opera .testo3d .eyebrow { display: none; }
  .opera .hero-cresta { display: none; }
  .opera .hero-title { font-size: clamp(1.6rem, 3.6vw, 2.2rem); max-width: none; margin-bottom: 0.6rem; }
  .opera .hero-subtitle { font-size: 0.95rem; line-height: 1.45; max-width: 40ch; margin-bottom: 0.9rem; }
  .opera .hero-buttons { flex-direction: row; gap: 10px; }
  .opera .hero-buttons .btn { width: auto; min-height: 44px; padding: 11px 20px; font-size: 0.92rem; }
  .fine3d .hero-buttons { margin-top: 1rem; }
  .titolo3d { font-size: clamp(1.5rem, 3.4vw, 2rem); }
  .frase3d { font-size: 0.98rem; line-height: 1.5; margin-top: 0.6rem; max-width: 36ch; }
  .num3d { margin-bottom: 0.4rem; }
  .punti3d { top: calc(var(--nav-h) + (100% - var(--nav-h) - 84px) / 2); }
  .punti3d button { width: 36px; height: 36px; }
  .salta3d { left: var(--gutter); bottom: 4px; transform: none; padding-left: 0; }
}
@media (max-height: 480px) { .opera .nome { display: none; } }
@media (min-width: 600px) and (min-aspect-ratio: 105/100) { .opera:not(.con3d) .fermo3d.chiuso { order: 1; } .opera:not(.con3d) .testo3d:first-of-type { order: 0; } .opera:not(.con3d) .testo3d:not(:first-of-type), .opera:not(.con3d) .fermo3d.smontato { order: 2; } }
