/* ============================================================
   GENS – Presentazione filmato
   File CSS: stile visuale (colori, layout, animazioni)
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #000;
    color: #fff;
    overflow: hidden;
}

/* Contenitore principale a schermo intero */
.gens-presentation {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 480px;
    overflow: hidden;
    background: #000;
}

/* ---------- Sfondi (immagini e video) ---------- */

.bg-container {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.bg-layer {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    /* ⭐ Niente zoom lento e niente "will-change": su computer datati (e con il filmato
       che gira) lo zoom tremolava. Ora le immagini si sfumano e basta. */
    transition: opacity 1.4s ease-in-out;
    z-index: 0;
}

.bg-layer.active {
    opacity: 1;
}

/* Layer speciale per il logo: sfondo nero */
.bg-layer.logo-bg {
    background-color: #000;
    background-size: contain;
    background-repeat: no-repeat;
    transition: opacity 1.2s ease;
}

.bg-layer.logo-bg.active {
    opacity: 1;
}

/* Video a pieno schermo (slide della perdita) */
.bg-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.2s ease;
    z-index: 0;
    pointer-events: none;
}

.bg-video.active {
    opacity: 1;
}

/* Velatura scura per far risaltare il testo */
.bg-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.45) 0%,
        rgba(0, 0, 0, 0.25) 40%,
        rgba(0, 0, 0, 0.55) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* Sulla slide logo overlay più soft */
.bg-overlay.logo-mode {
    background: radial-gradient(
        circle at center,
        rgba(0, 0, 0, 0.15) 0%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

/* ---------- Testi delle slide ---------- */

.content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 24px 20px 90px;
    max-width: 820px;
    margin: 0 auto;
}

.slide-text {
    position: absolute;
    left: 16px;
    right: 16px;
    /* Ancorato in alto: il testo cresce verso il basso senza “scatti” */
    top: 22%;
    transform: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.55s ease, visibility 0.55s;
    pointer-events: none;
}

.slide-text.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.slide-text.leaving {
    opacity: 0;
}

/* Piccola etichetta sopra il titolo (es. "L'origine") */
.slide-kicker {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #ffd700;
    margin-bottom: 12px;
    opacity: 0.95;
    min-height: 1.2em;
}

/* Titolo grande, stile scritto a mano (font Caveat)
   min-height riserva spazio per 2 righe → niente salto durante typewriter */
.slide-title {
    margin: 0 0 18px 0;
    font-family: 'Caveat', cursive;
    font-size: clamp(2.4rem, 7.5vw, 4.2rem);
    font-weight: 700;
    line-height: 1.15;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.55);
    min-height: 2.4em;
    letter-spacing: 0.01em;
}

/* Corpo del testo: spazio riservato per ~5 righe */
.slide-body {
    margin: 0 auto;
    max-width: 540px;
    font-family: 'Inter', sans-serif;
    font-size: clamp(1.05rem, 2.5vw, 1.25rem);
    line-height: 1.55;
    opacity: 0.94;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45);
    min-height: 7.8em;
}

/* Cursore che lampeggia durante l'effetto typewriter */
.tw-cursor {
    display: inline-block;
    width: 3px;
    height: 0.95em;
    background: #ffd700;
    margin-left: 3px;
    vertical-align: text-bottom;
    animation: blink 0.9s step-end infinite;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* Pulsanti finali (Entra come ospite / Registrati) */
.final-cta {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.9s ease 0.2s, transform 0.9s ease 0.2s;
}

.slide-text.active .final-cta.show {
    opacity: 1;
    transform: translateY(0);
}

.cta-btn {
    display: inline-block;
    padding: 12px 22px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
    border: none;
}

.cta-primary {
    background: #ffd700;
    color: #1a1a1a;
}

.cta-primary:hover {
    background: #ffe44d;
    transform: translateY(-2px);
}

.cta-secondary {
    background: transparent;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.cta-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

/* ---------- Controlli e indicatori ---------- */

.progress-dots {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    display: flex;
    gap: 10px;
    align-items: center;
}

.dot {
    position: relative;
    width: 10px;
    height: 10px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: background 0.4s, transform 0.4s;
    cursor: pointer;
}

/* area invisibile più grande, per cliccare/toccare facilmente */
.dot::after {
    content: '';
    position: absolute;
    inset: -9px -4px;
}

.dot.active {
    background: #ffd700;
    transform: scale(1.3);
}

.controls {
    position: absolute;
    bottom: 22px;
    right: 18px;
    z-index: 3;
    display: flex;
    gap: 8px;
}

.ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    backdrop-filter: blur(4px);
}

.ctrl-btn:hover {
    background: rgba(0, 0, 0, 0.65);
    border-color: rgba(255, 255, 255, 0.65);
}

.ctrl-btn.music-on {
    border-color: #ffd700;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
}

/* Selettore lingue a tendina (compatto, non copre il logo) */
.lang-switch {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 20;
}

.lang-toggle {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffd700;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 0.04em;
}

.lang-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 72px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 6px;
    flex-direction: column;
    gap: 2px;
}

.lang-switch.open .lang-menu {
    display: flex;
}

.lang-menu button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s, background 0.2s;
}

.lang-menu button.active,
.lang-menu button:hover {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.12);
}

/* Suggerimento per la musica */
.music-hint {
    position: fixed;
    bottom: 70px;
    right: 18px;
    z-index: 4;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 10px;
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s;
}

.music-hint.show {
    opacity: 1;
}

/* ---------- Responsive (mobile) ---------- */

/* Rispetta "riduci animazioni" del sistema operativo */
@media (prefers-reduced-motion: reduce) {
    .bg-layer,
    .slide-text,
    .final-cta,
    .bg-video {
        transition: none !important;
    }
    .tw-cursor { animation: none; }
}


/* ============================================================
   AGGIORNAMENTI
   ============================================================ */

/* ---------- Ultima slide (PC): logo piccolo in alto, testo sotto ---------- */
.bg-layer.logo-bg.finale {
    transform: translateY(-22%) scale(0.4);
    /* sfuma i bordi della foto, così non si vede il "rettangolo" quando si rimpicciolisce */
    -webkit-mask-image: radial-gradient(ellipse 52% 52% at center, #000 55%, transparent 100%);
    mask-image: radial-gradient(ellipse 52% 52% at center, #000 55%, transparent 100%);
}

.bg-layer.logo-bg.finale.active {
    transform: translateY(-24%) scale(0.58);
    transition: opacity 1.2s ease, transform 2.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-text.finale { top: 47%; }

.slide-text.finale .slide-title {
    font-size: clamp(2rem, 4.6vw, 3.3rem);
    min-height: 2.3em;
    margin-bottom: 12px;
}

.slide-text.finale .slide-body { min-height: 4.6em; }
.slide-text.finale .final-cta  { margin-top: 18px; }

/* ---------- Schermata iniziale ("Inizia") ---------- */
.start-screen {
    position: absolute;
    inset: 0;
    z-index: 15;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease, visibility 0.8s;
}

.start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.start-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: none;
    border: none;
    color: #ffd700;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.start-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    padding-left: 6px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.25);
    animation: respiro 2.4s ease-in-out infinite;
}

.start-label {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.start-btn:hover .start-icon,
.start-btn:focus-visible .start-icon {
    background: rgba(255, 215, 0, 0.14);
}

@keyframes respiro {
    50% { transform: scale(1.07); box-shadow: 0 0 60px rgba(255, 215, 0, 0.4); }
}

/* Tasto "tab" (tastiera): contorno ben visibile */
.ctrl-btn:focus-visible, .dot:focus-visible, .lang-toggle:focus-visible,
.cta-btn:focus-visible, .start-btn:focus-visible {
    outline: 3px solid #ffd700;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .start-icon { animation: none; }
}

/* ---------- Telefono (messo in fondo, così ha la precedenza) ---------- */
@media (max-width: 767px) {
    .content { padding: 20px 14px 130px; }
    .slide-title { font-size: clamp(2rem, 9vw, 2.8rem); min-height: 2.3em; }
    .slide-text { top: 18%; }
    .slide-body { font-size: 1.05rem; }
    /* puntini sopra, pulsanti sotto: così non si coprono */
    .progress-dots { bottom: 74px; }
    .controls { bottom: 14px; right: 0; left: 0; justify-content: center; gap: 10px; }
    .ctrl-btn { width: 46px; height: 46px; font-size: 1.15rem; }
    .lang-switch { top: 10px; right: 10px; }
    .music-hint { bottom: 130px; right: 50%; transform: translateX(50%); }

    /* ultima slide: il logo si rimpicciolisce in alto, il testo sta sotto */
    .bg-layer.logo-bg.finale.active { transform: translateY(-29%) scale(0.45); }
    .slide-text.finale { top: 43%; }
    .slide-text.finale .slide-title { font-size: clamp(1.8rem, 8vw, 2.4rem); min-height: 2.3em; margin-bottom: 10px; }
    .slide-text.finale .slide-body { min-height: 5.5em; font-size: 1rem; }
    .slide-text.finale .final-cta { margin-top: 14px; }
    .cta-btn { padding: 12px 20px; }
}
