:root {
    --bg-color: #050505;
    --main-color: #00f2ff;
    --accent-color: #bc13fe;
    --hot-pink: #ff00f2;
    --font-main: 'Courier New', Courier, monospace;
}

body {
    background: var(--bg-color);
    background-image: url('Dance\ Castle.png'); 
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #fff;
    font-family: var(--font-main);
    margin: 0; padding: 0;
    text-transform: uppercase;
    animation: background-soft-pulse 30s ease-in-out infinite alternate;
}

@keyframes background-soft-pulse {
    0% { filter: brightness(0.6) contrast(1.1); }
    100% { filter: brightness(0.85) contrast(1.2); }
}

/* --- Effetto Pioggia Verticale --- */
.rain {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1; pointer-events: none; opacity: 0.3;
}
.rain::after {
    content: "";
    position: absolute;
    top: -100%; left: 0; width: 100%; height: 200%;
    background-image: linear-gradient(to bottom, rgba(0, 242, 255, 0), rgba(0, 242, 255, 0.8) 50%, rgba(0, 242, 255, 0));
    background-size: 2px 250px;
    background-repeat: repeat;
    mask-image: repeating-linear-gradient(90deg, black, black 1px, transparent 1px, transparent 40px);
    animation: rain-fall 0.4s linear infinite;
}
@keyframes rain-fall { 
    0% { transform: translateY(0) skewX(-5deg); } 
    100% { transform: translateY(250px) skewX(-5deg); } 
}

.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%);
    background-size: 100% 4px;
    z-index: 100; pointer-events: none; opacity: 0.15;
}

/* --- Navigazione --- */
.back-nav { 
    padding: 20px; 
    position: sticky; 
    top: 0; 
    z-index: 110; 
    background: rgba(5,5,5,0.85); 
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 242, 255, 0.2);
}
.back-btn {
    color: var(--main-color);
    text-decoration: none;
    font-size: 0.8rem;
    border: 1px solid var(--main-color);
    padding: 8px 15px;
    transition: 0.3s;
}
.back-btn:hover { background: var(--main-color); color: #000; box-shadow: 0 0 15px var(--main-color); }

.projects-container { max-width: 700px; margin: 0 auto; padding: 20px; position: relative; z-index: 10; }

/* --- Header Glitch --- */
.page-header { text-align: left; margin: 40px 0 60px; border-left: 5px solid var(--main-color); padding-left: 20px; }
.glitch-neon {
    font-size: clamp(2.2rem, 9vw, 4.5rem);
    font-weight: 900;
    letter-spacing: 5px;
    color: #fff;
    animation: neon-flicker 3.5s infinite;
}
@keyframes neon-flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% { text-shadow: 0 0 10px #fff, 0 0 25px var(--main-color), 0 0 50px var(--accent-color); opacity: 1; }
    20%, 24%, 55% { text-shadow: none; opacity: 0.6; }
}

/* Sottotitolo con box per leggibilità */
.subtitle-wrapper { margin-top: 15px; }
.subtitle { 
    display: inline-block;
    background: rgba(0, 0, 0, 0.85);
    color: var(--hot-pink); 
    font-size: 0.8rem; 
    letter-spacing: 2px; 
    padding: 10px 20px;
    border: 1px solid var(--hot-pink);
    text-shadow: 0 0 10px var(--hot-pink);
    font-weight: bold;
    box-shadow: 0 0 15px rgba(255, 0, 242, 0.2);
}

/* --- PROGRESS BARS --- */
.loading-grid { 
    margin-top: 50px; 
    background: rgba(10, 10, 10, 0.9);
    padding: 40px;
    border: 1px solid rgba(0, 242, 255, 0.2);
    backdrop-filter: blur(5px);
}

.project-item { margin-bottom: 50px; }

.project-header { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 0.95rem; letter-spacing: 1px; }
.project-title { color: var(--main-color); font-weight: bold; text-shadow: 0 0 5px var(--main-color); }
.percentage { color: var(--hot-pink); text-shadow: 0 0 10px var(--hot-pink); font-weight: bold; }

.progress-bar {
    width: 100%;
    height: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(0, 242, 255, 0.3);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.fill {
    height: 100%;
    width: 0%; 
    background: linear-gradient(90deg, var(--accent-color), var(--hot-pink));
    box-shadow: 0 0 15px var(--hot-pink);
    transition: width 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-details {
    font-size: 0.8rem;
    color: #ccc;
    margin-top: 12px;
    text-transform: none;
    line-height: 1.6;
    opacity: 0.8;
}

.projects-footer { 
    text-align: center; 
    margin-top: 80px; 
    padding: 40px 0;
    font-size: 0.75rem; 
    color: rgba(255, 255, 255, 0.4); 
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
    .projects-container { padding: 15px; }
    .project-header { font-size: 0.75rem; }
    .loading-grid { padding: 25px 15px; }
    .glitch-neon { font-size: 2.2rem; }
}
/* --- MOBILE FIX FOR PROJECTS --- */
@media screen and (max-width: 768px) {
    .project-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .percentage {
        align-self: flex-end; /* Sposta la percentuale a destra */
        font-size: 0.9rem;
    }

    .project-title {
        font-size: 1.1rem;
    }
    
    .loading-grid {
        padding: 0 10px;
    }
     .page-header h1.glitch-neon {
        /* Qui serve un font più piccolo rispetto agli altri */
        font-size: 9.5vw; 
        letter-spacing: 1px; /* Riduciamo leggermente lo spacing originale che era 4px */
    }

    /* Se il titolo va su due righe, allinealo bene */
    .page-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 20px 10px;
    }

    .subtitle {
        font-size: 0.7rem;
        max-width: 100%;
    }
    /* Stile del Box Nero */
    .subtitle {
        background-color: #000000;       /* Sfondo Nero Assoluto */
        color: var(--hot-pink);          /* Testo Pink Neon */
        border: 1px solid var(--hot-pink); /* (Opzionale) Bordo sottile per definire il box */
        
        /* Dimensioni e Spaziatura */
        padding: 8px 15px;               /* Spazio interno confortevole */
        font-size: 0.8rem;               /* Testo leggibile ma compatto */
        font-weight: bold;
        letter-spacing: 1px;
        
        /* Gestione testo lungo */
        white-space: normal;             /* Permette al testo di andare a capo */
        line-height: 1.4;                /* Interlinea pulita */
        text-align: center;
        
        /* Larghezza dinamica */
        display: inline-block;
        max-width: 90%;                  /* Evita che tocchi i bordi dello schermo */
        
        /* Effetti Cyberpunk */
        box-shadow: 0 0 15px rgba(255, 0, 242, 0.15); /* Leggero alone pink dietro il box */
        text-shadow: none;               /* Rimuoviamo il glow del testo per massima leggibilità su nero */
    }
}