/* ==========================================================================
   1. STRUTTURA GENERALE E FONTS
   ========================================================================== */
body {
    margin: 0; 
    padding: 0; 
    background-color: #000; 
    color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    overflow: hidden; 
    display: grid; 
    grid-template-columns: repeat(12, 1fr);
}    

canvas { 
    position: fixed; 
    top: 0; 
    left: 0; 
    z-index: -1; 
}

/* ==========================================================================
   2. SCHERMATA INIZIALE (PAGE-0)
   ========================================================================== */
#page-0 { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh; 
    background: rgba(0, 0, 0, 0.15); 
    backdrop-filter: blur(2px);
    z-index: 200; 
    transition: opacity 0.8s ease;
    padding: 40px; 
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
}

#page-0.hidden { 
    opacity: 0; 
    pointer-events: none; 
}

#page-0:not(.hidden) ~ #ui-layer .bottom-left-controls,
#page-0:not(.hidden) ~ .bottom-left-controls {
    display: none !important;
}

.p0-title-container { 
    grid-column: 1 / 13;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.p0-title { 
    font-weight: 900; 
    font-size: 84px; 
    margin: 0; 
    letter-spacing: 2px; 
    line-height: 1; 
    color: white; 
}

.p0-content { 
    margin-top: 40px; 
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    width: 100%;
}

.p0-desc { 
    grid-column: 1 / 4; 
    font-size: 18px; 
    line-height: 1.6; 
    margin: 0; 
    color: white; 
}

.explore-btn { 
    grid-column: 1;
    justify-self: start;
    margin-top: 40px; 
    padding: 15px; 
    font-size: 13px; 
    border: 0.5px solid white; 
    color: white; 
    background: transparent; 
    text-transform: none; 
    cursor: pointer; 
    transition: 0.3s; 
    min-width: 150px;
    box-sizing: border-box;
    text-align: left;
}

.explore-btn:hover { 
    background: white; 
    color: black; 
}

/* ==========================================================================
   3. INTERFACCIA UTENTE PRINCIPALE (UI-LAYER)
   ========================================================================== */
#ui-layer { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh; 
    pointer-events: none; 
    z-index: 10; 
    display: none; 
}

#ui-layer.active { 
    display: block; 
}

.clickable-title { 
    position: absolute; 
    top: 40px; 
    left: 40px; 
    cursor: pointer; 
    pointer-events: auto; 
    z-index: 50; 
}

/* Navigazione Laterale Principale */
.side-nav { 
    position: absolute; 
    left: 40px; 
    top: 50%; 
    transform: translateY(calc(-30% - 20px)); 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
}

.nav-item { 
    position: relative; 
    display: flex; 
    align-items: center; 
    pointer-events: auto; 
}

.nav-btn { 
    padding: 15px; 
    border: 0.5px solid white; 
    color: white; 
    background: rgba(0,0,0,0.5); 
    cursor: pointer; 
    transition: 0.3s; 
    font-size: 13px; 
    letter-spacing: 1px; 
    text-align: left; 
    min-width: 150px; 
    box-sizing: border-box;
}

.nav-btn:hover, .nav-btn.active { 
    background: white; 
    color: black; 
    border: 0.5px solid white; 
}

/* Hover Preview Tecnica */
.tech-preview {
    position: absolute; 
    left: 160px; 
    top: 0; 
    width: 220px;
    background: rgba(0, 0, 0, 0.85); 
    backdrop-filter: blur(10px);
    padding: 20px; 
    border: 0.5px solid white; 
    opacity: 0; 
    visibility: hidden; 
    transition: 0.3s ease;
    pointer-events: none;
    box-sizing: border-box;
    text-align: left;
}

.tech-preview b {
    color: white;
    text-transform: none;
    font-size: 9px;
    display: block;
    margin-top: 14px;
    letter-spacing: 1px;
    opacity: 0.6;
}

.tech-preview b:first-of-type {
    margin-top: 0 !important;
}

.tech-preview span {
    display: block;
    font-size: 13px;
    color: white;
    margin-top: 6px;
    margin-bottom: 4px;
    text-transform: none;
    line-height: 1.4;
}

.nav-item:hover .tech-preview { 
    opacity: 1; 
    visibility: visible; 
    transform: translateX(10px); 
}

/* Controlli in basso a sinistra (About / Sources) */
.bottom-left-controls {
    position: absolute;
    bottom: 40px;
    left: 40px;
    display: flex;
    flex-direction: column;        
    align-items: flex-start;       
    gap: 10px;                     
    z-index: 600;
    pointer-events: auto;
}

.info-square {
    min-width: 150px; 
    padding: 12px 15px; 
    border: 0.5px solid #888; 
    background: rgba(0,0,0,0.5);
    color: #888; 
    display: flex; 
    justify-content: flex-start; 
    align-items: center;
    cursor: pointer; 
    transition: 0.3s; 
    font-family: inherit; 
    font-size: 13px; 
    text-transform: none; 
    letter-spacing: 0.5px; 
    opacity: 1;
    box-sizing: border-box;
}

.info-square:hover { 
    opacity: 1; 
    background: white; 
    color: black; 
    border: 0.5px solid white; 
}

/* ==========================================================================
   4. PAGINA DELLE FONTI (SOURCES) E POP-UP ABOUT
   ========================================================================== */
#about-page {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh; 
    background: #000; 
    z-index: 400; 
    display: none;
    box-sizing: border-box; 
    padding: 120px 40px 40px 40px; 
    overflow-y: auto;
}

#about-page.active {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 20px;
    align-items: start;
}

#about-page.active ~ #ui-layer .bottom-left-controls,
#about-page.active ~ .bottom-left-controls {
    display: none !important;
}

#sources-page {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh;
    background: #000; 
    z-index: 400; 
    display: none;
    box-sizing: border-box; 
    padding: 120px 40px 40px 40px;
    overflow-y: auto;
}

#sources-page.active { 
    display: grid; 
    grid-template-columns: repeat(12, 1fr); 
    gap: 20px; 
    align-items: start; 
}

#sources-page.active ~ #ui-layer .bottom-left-controls,
#sources-page.active ~ .bottom-left-controls,
#sources-page.active + .bottom-left-controls {
    display: none !important;
}

.sources-content { 
    grid-column: 3 / 13; 
    text-align: left; 
    max-width: 520px;
    width: 100%;
}

.sources-content h1 { 
    font-size: 48px; 
    margin: 0; 
    text-transform: none; 
    letter-spacing: -1px; 
    color: white; 
}

.source-group { 
    margin-bottom: 30px; 
    opacity: 0.8; 
}

#about-page .source-group {
    opacity: 1;
}

.source-group b { 
    display: block; 
    margin-bottom: 5px; 
    color: white; 
    text-transform: none; 
    font-size: 12px; 
    letter-spacing: 1px; 
    opacity: 0.6; 
}

.source-link { 
    color: white; 
    text-decoration: none; 
    display: block; 
    font-size: 14px; 
    margin-bottom: 5px; 
    line-height: 1.5; 
    word-break: break-all; 
}

.source-link:hover { 
    text-decoration: underline; 
}

/* ==========================================================================
   5. SCHEDA DI DETTAGLIO SATELLITI
   ========================================================================== */
#detail-page { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100vh; 
    background: #000; 
    z-index: 300; 
    display: none; 
    box-sizing: border-box; 
    padding: 120px 40px 40px 40px; 
    overflow-y: auto;
}

#detail-page.active { 
    display: grid; 
    grid-template-columns: repeat(12, 1fr); 
    gap: 20px; 
    align-items: start; 
}

/* Menu Capitoli a Sinistra nel Dettaglio */
.detail-chapters { 
    position: absolute; 
    left: 40px; 
    top: 50%; 
    transform: translateY(calc(-30% - 20px)); 
    display: flex; 
    flex-direction: column; 
    gap: 20px; 
    z-index: 510;
}

.chapter-item {
    position: relative;
    display: flex;
    align-items: center;
    pointer-events: auto;
}

.chapter-btn { 
    padding: 15px; 
    border: 0.5px solid white; 
    color: white; 
    background: rgba(0,0,0,0.5); 
    cursor: pointer; 
    transition: 0.3s; 
    font-size: 13px; 
    letter-spacing: 1px; 
    text-align: left; 
    min-width: 150px; 
    box-sizing: border-box;
}

.chapter-btn:hover, .chapter-btn.active { 
    background: white; 
    color: black; 
    border: 0.5px solid white; 
}

/* Layout del blocco di testo e dei dati */
.detail-text { 
    grid-column: 3 / 13; 
    font-size: 14px; 
    line-height: 1.8; 
    text-align: left; 
    padding-right: 15px; 
    color: white;
    display: flex;
    flex-direction: column;
    margin-top: -20px;
    opacity: 1 !important; /* Riporta l'intero contenitore a opacità 1 per sbloccare il bianco pieno del titolo e dei bottoni */
}

.detail-text p {
    opacity: 0.8; /* Applica l'opacità solo al testo descrittivo della missione */
}

#detail-title-block {
    min-height: 120px;
    margin-bottom: 20px;
    display: block;
}

#detail-title {
    color: #ffffff !important;
    opacity: 1 !important;
}

.detail-text h1 { 
    font-size: 48px; 
    margin: 0; 
    letter-spacing: 1px; 
    color: white; 
    max-width: 700px; 
    white-space: pre-wrap; 
    line-height: 1.2; 
}

.detail-text h3 { 
    font-size: 14px; 
    text-transform: none; 
    letter-spacing: 2px; 
    color: white; 
    opacity: 0.5; 
    margin-bottom: 30px; 
}

.sub-page-tabs {
    display: flex; 
    gap: 15px; 
    margin-bottom: 30px;
    height: 40px;
    align-items: center;
}

/* ==========================================================================
   COLORI IDENTICI PER BOTTONI SATELLITI E TAB (DATA/MISSION)
   ========================================================================== */
.tab-toggle-btn {
    padding: 15px;
    background: rgba(0, 0, 0, 0.5) !important;
    color: #ffffff !important;
    border: 0.5px solid white !important; 
    cursor: pointer;
    font-size: 13px;
    letter-spacing: 1px;
    transition: 0.3s;
    min-width: 150px;
    box-sizing: border-box;
    text-align: left;
    opacity: 1 !important;
}

.tab-toggle-btn:hover,
.tab-toggle-btn.active {
    background: #ffffff !important;
    color: #000000 !important;
    border: 0.5px solid white !important;
    opacity: 1 !important;
}

#detail-content {
    min-height: 380px; 
}

/* Allineamento Griglia Dati con l'inizio del testo di Mission */
.data-row {
    margin-bottom: 12px;
}

.tech-info-block b { 
    color: white; 
    text-transform: none; 
    font-size: 9px; 
    display: block; 
    letter-spacing: 1px; 
    opacity: 0.6; 
}

.tech-info-block span { 
    display: block; 
    font-size: 14px; 
    color: white; 
    margin-bottom: 4px; 
    text-transform: none; 
}

/* Componenti Multimediali nel Dettaglio (Immagini e Iframe
.detail-side-img { 
    width: 100%; 
    height: 350px; 
    object-fit: cover; 
    background: transparent; 
    border: none !important; 
    outline: none !important; 
}

.expand-hint { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    font-size: 10px; 
    background: rgba(0,0,0,0.8); 
    color: white; 
    padding: 5px 10px; 
    pointer-events: none; 
    text-transform: uppercase; 
    opacity: 1; 
    z-index: 20; 
    border: none !important; 
}

/* Modello 3D di Supporto (Se presente) */
#detail-3d-container { 
    grid-column: 10 / 13; 
    height: 75vh; 
    position: sticky; 
    top: 120px;
    display: flex; 
    flex-direction: column; 
    gap: 20px;
}

#detail-3d-container canvas { 
    position: relative !important; 
    top: 0 !important; 
    left: 0 !important; 
    z-index: 1 !important; 
}

/* Pulseria di Sistema (Back e Successivo) */
.back-btn { 
    position: fixed; 
    top: 40px; 
    left: 40px; 
    background: transparent; 
    border: 0.5px solid white; 
    color: white; 
    padding: 12px 20px; 
    cursor: pointer; 
    font-size: 13px; 
    z-index: 500; 
    transition: 0.3s; 
    min-width: 150px; 
    text-align: left; 
    box-sizing: border-box; 
}

.back-btn:hover { 
    background: white; 
    color: black; 
}

#btn-successivo { 
    position: fixed; 
    bottom: 40px; 
    left: 40px; 
    background: transparent; 
    border: 0.5px solid white; 
    color: white; 
    padding: 12px 20px; 
    cursor: pointer; 
    font-size: 13px; 
    z-index: 500; 
    transition: 0.3s; 
    min-width: 150px; 
    text-align: left; 
    box-sizing: border-box; 
}

#btn-successivo:hover { 
    background: white; 
    color: black; 
}