/* ==========================================================================
   CINEMATIC CONTAINER CON FUSIONE INVISIBILE (iOS 26 RADICAL)
   ========================================================================== */
.cinematic-scroll-container {
    position: relative;
    width: 100%;
    height: 500vh; /* Respiro ottimale per rendere l'emersione fluida */
    box-sizing: border-box;
    background: transparent; /* Fa trasparire lo sfondo/arcobaleno del sito */
}

.cinematic-sticky-viewport {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    background: transparent;
}

/* ==========================================================================
   FUSIONE RESPONSIVA CON MASCHERA DI TRASPARENZA AVANZATA
   ========================================================================== */
.cinematic-video-layer {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    opacity: 0;
    transform: scale(1.02); /* Leggero zoom di profondità d'ingresso */
    transition: opacity 1.4s cubic-bezier(0.25, 1, 0.5, 1), transform 1.8s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;

    /* Maschera hardware: cancella i bordi del video sfumandoli nel vuoto */
    -webkit-mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 1) 15%,
        rgba(0, 0, 0, 1) 85%,
        rgba(0, 0, 0, 0) 100
    );
    mask-image: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 1) 15%,
        rgba(0, 0, 0, 1) 85%,
        rgba(0, 0, 0, 0) 100%
    );
}

/* Stato attivo dei video gestito dal JS */
.cinematic-video-layer.visible {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.cinematic-video-layer video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Oscuramento mirato centrale per proteggere la lettura del testo */
.cinematic-blend-overlay {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%; 
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0) 0%,
        rgba(0, 0, 0, 0.35) 20%,
        rgba(0, 0, 0, 0.55) 50%, /* Contrasto massimo al centro */
        rgba(0, 0, 0, 0.35) 80%,
        rgba(0, 0, 0, 0) 100%
    );
    backdrop-filter: blur(3px) saturate(135%);
    -webkit-backdrop-filter: blur(3px) saturate(135%);
    z-index: 3;
    pointer-events: none;
}

/* ==========================================================================
   STRUTTURA TESTI CRISTALLINA (SENZA MOVIMENTI SPAZIALI)
   ========================================================================== */
.cinematic-caption-wrapper {
    position: relative;
    width: 100%;
    max-width: 1000px;
    padding: 0 40px;
    text-align: center;
    z-index: 4;
}

.cinematic-phrase {
    position: absolute;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%); /* Perfettamente fisse e sovrapposte al centro */
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.9s cubic-bezier(0.25, 1, 0.5, 1), visibility 0.9s step-end;
}

/* Quando la scritta compare, resta centrata sul posto senza alterare i posizionamenti */
.cinematic-phrase.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.9s cubic-bezier(0.25, 1, 0.5, 1), visibility 0s;
}

.cinematic-phrase h2 {
    font-family: "Josefin Sans", sans-serif;
    font-size: clamp(24px, 4.5vw, 42px);
    line-height: 1.4;
    font-weight: 400;
    color: #ffffff;
    text-transform: none;
    letter-spacing: 0.3px;
    text-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
    margin: 0;
}

/* ==========================================================================
   DISTRIBUZIONE TRIGGER DI SCORRIMENTO (Senza pallini a destra)
   ========================================================================== */
.scroll-trigger-anchor {
    position: absolute;
    width: 100%;
    height: 55vh;
    pointer-events: none;
    z-index: 1;
}
.scroll-trigger-anchor:nth-child(1) { top: 0vh; }
.scroll-trigger-anchor:nth-child(2) { top: 60vh; }
.scroll-trigger-anchor:nth-child(3) { top: 120vh; }
.scroll-trigger-anchor:nth-child(4) { top: 180vh; }
.scroll-trigger-anchor:nth-child(5) { top: 240vh; }
.scroll-trigger-anchor:nth-child(6) { top: 300vh; }
.scroll-trigger-anchor:nth-child(7) { top: 360vh; }
.scroll-trigger-anchor:nth-child(8) { top: 420vh; }
.scroll-trigger-anchor:nth-child(9) { top: 460vh; }