/* TRANSIZIONI E ANIMAZIONI */

.full-viewport-section {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: opacity, transform;
}

.full-viewport-section.section-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Animazioni specifiche per ogni sezione */
#main-navbar.section-visible {
    animation: FadeInDown 1s ease-out 0.6 both;
}
#intro.section-visible .lettering {
    animation: fadeInScale 1s ease-out 0.3s both;
}

#intro.section-visible .data,
#intro.section-visible .titolo {
    animation: fadeInUp 1s ease-out 0.6s both;
}

#open-call.section-visible .open-call-text {
    animation: fadeInScale 1.2s ease-out 0.4s both;
}

/* Keyframes per le animazioni */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(calc(var(--navbar-height)/2));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* SEZIONI */
.full-viewport-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out,         
                transform 0.8s ease-out;
}

/* Container principale */
.hero-section {
  position: relative;
  width: 100%;
  height: 100vh; /* Occupa tutta l'altezza della viewport */
  overflow: hidden;
  justify-content: center
}
/* Contenitore video */
.video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
.video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}
.video-container video.video-loaded {
    opacity: 1;
}
/* Video di sfondo */
.background-video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Fondamentale per riempire lo spazio */
}
/* Stati di caricamento */
.video-ready .video-overlay {
  opacity: 0.3;
  transition: opacity 0.5s ease;
}
/* Fallback per video non disponibile */
.video-fallback {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(45deg, #000, #333);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

/* NUOVA IDENTITA' VISIVA */
.hero-section {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
.lettering {
  font-family: var(--font-family-special);
  position: relative;
  z-index: 2;
  text-align: center;
}
.lettering .row-1,
.lettering .row-2 {
    color: white;
    font-family: var(--font-family-special);
    z-index: var(--font-size-base);
}
.lettering .row-1 {
  /* Le dimensioni del font sono gestite dal CSS per .row-1 */
  font-size: var(--font-size-xxl);
  line-height: clamp(0.7, 0.8, 0.9);
}
/* Le dimensioni del font .row-2 sono gestite in text-scaler.js */

.details-container {
    display: flex;
    justify-content: space-between;
    width: calc(100% - (var(--margin-x)*2));
    bottom: var(--margin-x);
    position: absolute;
    z-index: 2;
}
.data {
    font-size: var(--font-size-h1);
    font-weight: 500;
    color: white;
    pointer-events: none;
    opacity: 1;
    text-shadow: 0px 0px 40px rgba(0, 0, 0, 0.1);
}      
.titolo {
    font-size: var(--font-size-h1);
    color: white;
    pointer-events: none;
    font-weight: 400;
    text-shadow: 0px 0px 40px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

/* OPEN CALL E PREMI */
#open-call {
    background-color: black;
    min-height: 50vh;
    display: none;
}
.content-section {
    background-color: black;
    color: white;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.open-call-text {
    font-family: var(--font-family-special);
    font-size: clamp(8em, 10vw, 12em);
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    line-height: 0.85;
    margin: 0;
    padding: 0;
}
.call-buttons {
    position: relative;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    display: none;
}
.apply-button {
    position: relative;
    flex: 1;
    background-color: white;
    color: black;
    text-decoration: none;
    font-size: var(--font-size-h1);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid black;
    border-top: none;
    overflow: hidden;
    transition: all var(--animation-speed) var(--animation-timing-function);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    hyphens: manual;
    overflow-wrap: break-word;
}
.apply-button::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background-color: black;
    transition: height var(--animation-speed) var(--animation-timing-function);
    z-index: -1;
}
.apply-button:hover {
    color: white;
    border-color: none;
    border-top: 1px solid white;
}
.apply-button:hover::before {
    height: 100%;
}

/* DAILY PROGRAM */
#daily-program{
    min-height: max-content;
    padding-block: calc(var(--navbar-height)/2);
}
.program-section {
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
}
.boxes-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    -ms-overflow-style: none; /* Rimuovere le scrollbar per IE e Edge vecchie versioni */
    scrollbar-width: none; /* Rimuovere le scrollbar per Firefox */
}
.boxes-wrapper::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}
.boxes-wrapper.grabbing {
    cursor: grabbing;
}
.boxes-container {
    display: flex;
    width: 100%;
    height: auto;
    gap: var(--margin-x);
    padding: var(--margin-x);
}
/* Aggiunge uno spazio vuoto alla fine del contenitore */
.boxes-container::after {
    content: ''; /* Obbligatorio per i pseudo-elementi */
    min-width: 1px;/* Imposta la larghezza dello spazio */
    height: 1px; /* Obbligatorio, può essere un valore minimo */
    flex-shrink: 0; /* Assicura che lo spaziatore non si riduca */
}
.date-box {
    width: 20vw;
    aspect-ratio: 0.8;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-family-special);
    transition: all var(--animation-speed) var(--animation-timing-function);
    transform-origin: center;
    will-change: transform;
    position: relative;
    cursor: pointer;
}
.date-box:hover {
    transform: scale(1.05);
    z-index: var(--z-index-base);
}
.date-box:active {
    transform: scale(1);
}
.date-box::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border-radius: 12px;
    opacity: 0;
    transition: opacity var(--animation-speed) var(--animation-timing-function);
    z-index: -1;
}
.date-box:hover::before {
    opacity: 1;
}
.date-box a {
    text-decoration: none;
    color: inherit;
    font-size: clamp(6em, 10vw, 8em);
    line-height: clamp(0.9, 1.1, 1.2);
    transition: transform var(--animation-speed) var(--animation-timing-function);
    display: block;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    overflow: hidden;
    hyphens: manual;
    overflow-wrap: break-word;
}
.date-box:hover a {
    transform: translateZ(0);
}
.date-box:nth-child(1) { background-color: #ec1c4e; color: #cce5ff; }
.date-box:nth-child(2) { background-color: #fe6fb4; color: #f8d317; }
.date-box:nth-child(3) { background-color: #3ed3aa; color: #183090; }
.date-box:nth-child(4) { background-color: #fa6919; color: #66e5ff; }
.date-box:nth-child(5) { background-color: #f8d317; color: #ec1c4e; }
.date-box:nth-child(6) { background-color: #66e5ff; color: #9c8cff; }
.date-box:nth-child(7) { background-color: #556eff; color: #fe6fb4; }

/* TESTO INTRODUTTIVO */
#about{
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background-color: var(--color-grigio);
    align-items: center;
    min-height: calc(100vh - var(--navbar-height));
    padding-block: var(--navbar-height);
}
.text-section p{
    text-align: left;
    width: var(--paragraph-vw);
    margin: 0 auto; /* centra il container */
    max-width: 1200px;
}
/* BOX CONTAINER */
#explore-sections {
    padding: 0;
    position: relative;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    min-height: max-content;
    margin-bottom: calc(var(--navbar-height)/2);
    margin-top: var(--navbar-height);
}
.box-container {
    /* La larghezza del box-container ora occupa lo spazio specificato */
    width: calc(100vw - var(--margin-x) * 2);
    display: flex;
    gap: 1em;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    height: auto;
    text-align: center;
    /* max-width rimosso per permettere al contenitore di occupare la larghezza totale */
}
.box {
    /* flex-basis viene ricalcolato per adattarsi al contenitore, mantenendo il gap */
    flex: 1 1 calc(25% - 1em);
    min-width: 200px;
    max-width: 540px;
    /* Impostazione dell'aspect-ratio con un valore scalabile (1.25) */
    aspect-ratio: 540 / 675;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    /* Stili iniziali per l'animazione */
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.25, 1, 0.5, 1), transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    container-type: inline-size;
    container-name: box;
}
/* Stili iniziali: invisibili e leggermente spostati */
#explore-sections .box {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
/* Stili finali che si attivano con la classe 'animate' */
#explore-sections.active .box {
    opacity: 1;
    transform: translateY(0);
    width: 100%;
}
#explore-sections.active .box a {
    text-decoration: none;
    color: inherit;
    line-height: 0.9; /* Fisso per testo grande uppercase */
    text-transform: uppercase;
    font-family: var(--font-family-special);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow-wrap: break-word; 
    /* DISATTIVAZIONE COMPLETA SILLABAZIONE */
    hyphens: none;
    -webkit-hyphens: none;
    -moz-hyphens: none;
    -ms-hyphens: none;    
    /* Padding variabile */
    padding: clamp(0.8rem, 3vw, 1.5rem) clamp(1rem, 4vw, 2rem);
    margin: clamp(0.5rem, 2vw, 1rem);
    position: relative;
    font-size: clamp(3.5rem, 5vw, 4rem);
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    /* Previene il testo troppo stretto */
    min-width: min-content;
}

/* Ritardo per animare ogni box in sequenza */
#explore-sections.active .box-1 { transition-delay: 0.2s; }
#explore-sections.active .box-2 { transition-delay: 0.3s; }
#explore-sections.active .box-3 { transition-delay: 0.4s; }
#explore-sections.active .box-4 { transition-delay: 0.5s; }

.box-1 { background-color: var(--color-giallo); }
.box-2 { background-color: var(--color-arancione); }
.box-3 { background-color: var(--color-viola-urbano); }
.box-4 { background-color: var(--color-azzurro); }

.box {
    position: relative; /* Fondamentale per posizionare assolutamente il contenuto sopra l'immagine */
    overflow: hidden; /* Nasconde qualsiasi parte dell'immagine che fuoriesca dal box */
    /* Rimuovi o commenta lo sfondo colorato se lo avevi prima */
    /* background-color: #your-color; */
}
.box img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* L'immagine copre tutto lo spazio del box, ritagliandosi se necessario */
    display: block; /* Rimuove lo spazio sotto l'immagine */
    transition: all 0.3s ease; /* Opzionale: per un effetto hover */
    opacity: 80%;
}
.box:hover img {
    transform: scale(1.05); /* Opzionale: leggero zoom al passaggio del mouse */
    opacity: 10%;
}
.box-content {
    position: absolute; /* Posiziona il contenuto sopra l'immagine */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}
.availability-note {
  font-size: var(--font-size-base);
  color: #666;
  text-align: left;
  margin-top: calc(var(--navbar-height)/2);
}
/* Applica margin-top a tutti tranne al primo */
.availability-note.first-note {
  margin-top: 0;
}
.availability-note p {
  margin: 0; /* Rimuove il margine predefinito del paragrafo */
}

/* MAPPA */
.map-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: black;
}
.map-section h1 {
    margin-top: 0;
}
.map-container {
    width: calc(100% - var(--margin-x) * 2);
    height: calc(70vh - var(--navbar-height) / 2);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    border: 1px solid black; 
}
.map-container iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* SOSTIENICI */
#sostienici {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - (var(--navbar-height)*2));
    padding-inline: var(--margin-x);
    box-sizing: border-box;
    background-color: var(--color-grigio);
}
.content-container {
    display: block;
    font-size: var(--font-size-base);
    width: 100%;
    gap: var(--margin-x);
}
.text-block {
    flex: 1;
}
.bank-details {
    width: fit-content;
    margin:0 auto;
    margin-top: calc(var(--navbar-height)/2);
}

/* RESPONSIVE PER MOBILE */
@media (max-width: 768px) {                
    /* NUOVA IDENTITA' VISIVA RESPONSIVE */
    .lettering {
        margin-top: calc(var(--navbar-height)*1.5);
        transform: translateY(0%);
    }
    .details-container {
        position: static;
        display: flex;
        flex-direction: column;
        justify-content: center; 
        align-items: center; 
        width: 100%;
        margin-top: calc(var(--navbar-height)*1.5);
        margin-bottom: 0;
    }
    .data, .titolo{
        font-size: var(--font-size-h2);
    }
    .titolo{
        order: 1;
    }
    .data{
        order: 2;
    }
    
    /* OPEN CALL E PREMI */
    #open-call {
        min-height: 50vh;
    }
    .call-buttons {
        /* Elemento da posizionare in basso */
        width: 100%;
        /*display: flex;*/
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: calc(var(--navbar-height)*2);
        border-left-style: none;
        border-right-style: none;
    }
    .apply-button {
        font-size: var(--font-size-h2);
        padding: auto;
        width: 100%;
        margin: 0;
        height: var(--navbar-height);
    }
    
    /* DAILY PROGRAM RESPONSIVE */
    #daily-program{
        padding-block: calc(var(--navbar-height)/1.5);
    }
    .date-box {
        width: calc(360px * 0.8);
        cursor: default;
    }
    .date-box a {
        transition: none;
    }
        
    /* TESTO DESCRITTIVO */
    #about {
        height: auto;
        padding-inline: var(--margin-x);
    }
    .text-section p{
        width: 100%;
        max-width: 1200px;
    }
    /* BOX CONTAINER RESPONSIVE */
    #explore-sections {
        height: auto;
        margin-block: calc(var(--navbar-height)/2);
    }
    .box-container {
        gap: calc(var(--navbar-height)/3);
        flex-direction: column;
    }
    .box {
        flex: 1 1 auto;
        width: 100%;
        max-width: 100%;
        min-height: 200px;
        opacity: 1;
        transform: none;
        animation: none;
    }
    
    /* MAPPA RESPONSIVE */
    .map-section{
        height: fit-content;
    }
    .map-container {
        height: calc(100vh - (var(--navbar-height)*3));
        margin-top:auto;
        margin-bottom: var(--navbar-height);
    }
    .map-section h1 {
        margin-top: calc(var(--navbar-height) / 2)
    }
    
    /* SOSTIENICI RESPONSIVE */
    #sostienici {
        justify-content: center;
        padding-bottom: var(--navbar-height);
    }
    .content-container {
        flex-direction: column;
        gap: calc(var(--navbar-height)/2);
    }   
}