/* --- 1. CONFIGURATION GLOBALE --- */
:root {
    --bg-color: #0b0205;
    --accent-color: #811e1e;
    --accent-hover: #ff5e5e;
    --text-color: #d13a3a;
    --font-pixel: 'VT323', monospace;
}

* {
    box-sizing: border-box;
    border-radius: 0 !important;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    font-family: var(--font-pixel);
}

/* --- 2. ÉCRAN DE CHARGEMENT (PRELOADER) --- */
#loading-screen {
    position: fixed;
    top: 0; left: 0; 
    width: 100vw; height: 100vh;
    background: url('./images/background.jpg') no-repeat center center;
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s;
}

#loading-container {
    width: 320px;
    background: rgba(11, 2, 5, 0.9);
    border: 4px solid var(--accent-color);
    padding: 30px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 1);
    text-align: center;
}

.loading-text {
    color: var(--accent-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.loading-bar-border {
    width: 100%;
    height: 14px;
    border: 2px solid var(--accent-color);
    padding: 2px;
    background: #000;
}

#loading-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--accent-hover);
    box-shadow: 0 0 10px var(--accent-color);
    transition: width 0.3s ease;
}

/* --- 3. CONTENU PRINCIPAL (Masqué par défaut) --- */
#main-content {
    opacity: 0;
    visibility: hidden;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(rgba(11, 2, 5, 0.4), rgba(11, 2, 5, 0.4)), 
        url('./images/background.gif') no-repeat center center fixed;
    background-size: cover;
    transition: opacity 1s ease;
}

/* États une fois chargé */
body.loaded #loading-screen {
    opacity: 0;
    visibility: hidden;
}

body.loaded #main-content {
    opacity: 1;
    visibility: visible;
}

/* --- 4. EFFET SCANLINES (CRT) --- */
body::before {
    content: " ";
    display: block;
    position: fixed;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.15) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    z-index: 10000; /* Priorité absolue sur le rendu */
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
}

/* --- 5. LAYOUT & AVATAR --- */
.landing-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Garde tout en bas */
    overflow: hidden; /* Évite les scrolls parasites sur mobile */
}

.interface-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end; /* Pousse tout vers le bas */
    width: 100%;
    height: 100vh; /* Utilise toute la hauteur pour le calcul */
    padding-bottom: 20px;
}

#avatar-container-full {
    flex: 1; /* Prend tout l'espace disponible au-dessus de la boîte */
    width: 100%;
    max-width: 650px;
    display: flex;
    align-items: flex-end; /* Force l'avatar à toucher le bas de son conteneur */
    justify-content: center;
    min-height: 0; /* Important pour permettre le rétrécissement en Flexbox */
    margin-bottom: -30px; /* Chevauchement pour l'effet RPG */
}

#avatar-container-full canvas {
    max-height: 100%; /* Empêche le canvas de déborder */
    width: auto !important; 
    object-fit: contain;
}

/* --- 6. INTERFACE RPG & NAVIGATION --- */
.dialogue-container {
    width: 90%; 
    max-width: 1100px;
    z-index: 20;
}

.dialogue-box {
    width: 100%;
    background-color: var(--bg-color); 
    border: 4px solid var(--accent-color);
    padding: 30px;
    box-shadow: 0 0 0 4px var(--bg-color), 0 0 0 8px var(--accent-color);
    animation: border-flicker 4s infinite;
}

@keyframes border-flicker {
    0%, 100% { 
        border-color: var(--accent-color); 
    }
    50% { 
        border-color: #5a1414; /* Intensité basse */
    }
}

.dialogue-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px 40px;
}

.diag-link {
    position: relative;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.8rem;
    transition: all 0.2s;
    display: inline-block;
}

.diag-link:hover::before {
    content: ">";
    position: absolute;
    left: -20px;
    color: var(--accent-hover);
}

.diag-link:hover {
    color: #fff;
    transform: scale(1.05);
}

.diag-link:hover::after {
    content: attr(data-text);
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg-color);
    animation: glitch-anim 0.3s infinite linear alternate-reverse;
    z-index: -1;
}

@keyframes glitch-anim {
    0% { transform: translate(2px, -1px); text-shadow: -2px 0 red; clip-path: inset(10% 0 30% 0); }
    50% { transform: translate(-1px, 1px); text-shadow: 2px 0 blue; clip-path: inset(40% 0 10% 0); }
    100% { transform: translate(0); text-shadow: none; clip-path: inset(0); }
}

/* --- 7. FOOTER --- */
.landing-footer {
    color: var(--accent-color);
    font-size: 1.1rem;
    padding: 15px;
    text-align: center;
    width: 100%;
}

@media (max-width: 768px) {
    .dialogue-container {
        width: 95%;
        margin-bottom: 10px;
    }

    .dialogue-box {
        padding: 15px; /* Réduit l'encombrement interne */
    }

    .diag-link {
        font-size: 1.1rem; /* Plus petit pour éviter les retours à la ligne excessifs */
    }
}

/* --- RESPONSIVE NAVBAR --- */

/* Bouton Hamburger */
.menu-toggle {
    display: none; /* Caché sur desktop */
    flex-direction: column;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    justify-self: end;
}

.menu-toggle .bar {
    width: 30px;
    height: 4px;
    background-color: var(--accent-color);
    transition: 0.3s;
}

@media (max-width: 900px) {
    .nav-container {
        grid-template-columns: 1fr 1fr; /* Logo à gauche, Bouton à droite */
        padding: 10px 20px;
    }

    .nav-spacer { display: none; }

    .menu-toggle {
        display: flex;
        z-index: 1001;
    }

    .nav-links {
        position: fixed;
        top: 80px; /* Hauteur de la navbar */
        right: -100%; /* Caché par défaut */
        flex-direction: column;
        background: var(--nav-bg);
        width: 100%;
        height: calc(100vh - 80px);
        text-align: center;
        padding-top: 50px;
        transition: 0.4s ease-in-out;
        border-top: 4px solid var(--accent-color);
        gap: 40px;
    }

    /* Classe activée par JS */
    .nav-links.active {
        right: 0;
    }

    /* Animation du hamburger en "X" */
    .menu-toggle.active .bar:nth-child(1) { transform: translateY(10px) rotate(45deg); }
    .menu-toggle.active .bar:nth-child(2) { opacity: 0; }
    .menu-toggle.active .bar:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }
}