/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Layout base */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #333;
    color: white;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Layout dell'Header */
.header-flex {
    display: flex;
    justify-content: space-between; /* Spinge i due blocchi ai lati opposti */
    align-items: center; /* Allinea tutto verticalmente al centro */
    padding: 10px 0;
}

header {
    background: #0a0a0a;
    border-bottom: 2px solid #00ff00;
    padding: 15px 0;
}

/* Stile del Logo/Nome */
.logo h1 {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.8rem;
    color: #ffffff;
    margin: 0;
}

.logo .glitch {
    color: #00ff00;
}

.subtitle {
    color: #888;
    font-size: 0.85rem;
    letter-spacing: 1px;
    margin-top: 2px;
    font-family: 'Courier New', monospace;
}

/* Stile dei bottoni lingua (a destra) */
.language-buttons {
    display: flex;
    gap: 10px; /* Spazio tra i bottoni */
}

.lang-btn {
    background: transparent;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.lang-btn:hover {
    border-color: #00ff00;
    color: #00ff00;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.3);
}

/* MAIN */
main {
    flex: 1;
}

/* ABOUT: Foto a sinistra, Testo a destra su PC */
.about {
    padding: 60px 0;
    background: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), url('img/about.png') center/cover no-repeat;
    border-bottom: 1px solid #444;
}

.about-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}

.about-image img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid #4CAF50;
    object-fit: cover;
    flex-shrink: 0;
}

.about-text h2 {
    color: #4CAF50;
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.about-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ddd;
}

/* CARDS: 4 colonne su PC */
.cards-section {
    padding: 78px 0;
    background-color: #44444a;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 35px;
}

.card {
    position: relative;
    height: 300px; /* Altezza ridotta per le card su PC */
    background-color: #222;
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid #555;
    transition: all 0.4s ease;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-10px);
    border-color: #4CAF50;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: 0.3s;
}

.card:hover .card-image {
    opacity: 1;
}

.card h2 {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 20px 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    text-align: center;
    font-size: 1.2rem;
    color: white;
}

/* FOOTER PROFESSIONALE */
footer {
    background-color: #121212; /* Nero profondo per contrasto */
    padding: 50px 0 30px;
    border-top: 3px solid #4CAF50; /* Linea distintiva */
    margin-top: auto;
    color: #bbb;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr; /* Tre colonne: Brand, Contact, Social */
    gap: 50px;
    align-items: start;
}

footer h3, footer h4 {
    color: #4CAF50;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

footer h3 { font-size: 1.4rem; }
footer h4 { font-size: 1rem; }

/* Stile contatti */
.footer-contact a {
    display: block;
    color: #ddd;
    text-decoration: none;
    margin-bottom: 10px;
    font-size: 0.95rem;
    transition: 0.3s;
}

.footer-contact a i {
    margin-right: 10px;
    color: #4CAF50;
    width: 20px;
}

.footer-contact a:hover {
    color: #4CAF50;
    transform: translateX(5px);
}

/* Stile Social */
.social-icons-wrapper {
    display: flex;
    gap: 20px;
}

.social-icon {
    font-size: 1.8rem;
    color: #4CAF50;
    transition: all 0.3s ease;
}

.social-icon:hover {
    color: white;
    transform: translateY(-5px);
}

.footer-brand p {
    font-size: 0.85rem;
    margin-top: 10px;
}

/* Il tastino fluttuante */
#game-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1a1a1a;
    color: #4CAF50;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
    z-index: 999;
}

/* L'overlay del terminale */
#terminal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.terminal-window {
    width: 80%;
    max-width: 500px;
    background: #0d0d0d;
    border: 1px solid #4CAF50;
    font-family: 'Courier New', monospace;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

.terminal-header {
    background: #4CAF50;
    color: black;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
}

.terminal-body {
    padding: 20px;
    height: 200px;
    overflow-y: auto;
    color: #00ff41;
}

.terminal-input-area {
    padding: 10px 20px;
    display: flex;
    border-top: 1px solid #222;
}

#terminal-input {
    background: transparent;
    border: none;
    color: #00ff41;
    outline: none;
    flex: 1;
    margin-left: 10px;
    font-family: inherit;
}

/* RESPONSIVE FOOTER */
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr; /* Una colonna su tablet/mobile */
        text-align: center;
        gap: 30px;
    }
    
    .social-icons-wrapper {
        justify-content: center;
    }

    .footer-contact a:hover {
        transform: none;
    }
}

/* --- MEDIA QUERIES --- */

/* Tablet: 2 Card per riga */
@media (max-width: 1024px) {
    .about-content {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-flex {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    .contact-info a {
        display: block;
        margin: 5px 0;
    }
}

/* Smartphone: 1 Card per riga */
@media (max-width: 600px) {
    header {
        padding: 20px 0;
    }
    .header-flex {
        flex-direction: column;
        gap: 15px;
    }
    .cards {
        grid-template-columns: 1fr;
    }
    .about-text h2 {
        font-size: 2rem;
    }
    .about-text p {
        font-size: 1rem;
    }
}


/* Stile del tasto CONNECT nell'header della Home */
.contact-link-header {
    color: #27c93f !important; /* Verde Signal */
    text-decoration: none;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.85rem;
    border: 1px solid rgba(39, 201, 63, 0.4);
    padding: 6px 15px;
    border-radius: 4px;
    transition: 0.3s all ease;
}

.contact-link-header:hover {
    background: rgba(39, 201, 63, 0.1);
    box-shadow: 0 0 10px rgba(39, 201, 63, 0.3);
    border-color: #27c93f;
    transform: translateY(-1px);
}

.blink-terminal {
    animation: blink-animation 1s step-end infinite;
    margin-right: 5px;
}

@keyframes blink-animation {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Assicurati che l'header gestisca bene il nuovo elemento */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-and-lang {
    display: flex;
    align-items: center;
    gap: 20px;
}