:root {
    /* Variabili globali per la palette colori */
    --blue-primary: #4582c5;
    --blue-light: #618bb5;
    --blue-dark: #30455c;
    --gray-light: #bec1c3;
    --gray-mid: #86929f;
    --gray-dark: #526b7e;
    --black-blue: #121d29;
}

/* Reset di base per il box model */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth; /* Scroll fluido per anchor link */
}

body {
    margin: 0;
    background: var(--black-blue);
    color: var(--gray-light);
    font-family: 'Inter', sans-serif;
}

/* Titoli con font dedicato */
h1, h2, h3, h4 {
    font-family: 'Exo 2', sans-serif;
    margin-top: 0;
}

/* Testo introduttivo sezioni */
.section-intro {
    max-width: 700px;
    margin: 10px auto 40px;
    color: var(--gray-mid);
    font-size: 0.98rem;
}

/* ===========================
   NAVBAR
=========================== */

.navbar {
    position: fixed; /* Fissa in alto */
    top: 0;
    width: 100%;
    background: rgba(18, 29, 41, 0.9); /* Semi-trasparente */
    backdrop-filter: blur(8px); /* Effetto vetro */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 40px;
    z-index: 100;
}

.logo img {
    height: 42px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    color: var(--gray-light);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.25s ease;
}

.nav-links a:hover {
    color: var(--blue-primary);
}

/* CTA evidenziata nella navbar */
.cta-nav {
    padding: 8px 16px;
    border-radius: 6px;
    background: var(--blue-primary);
    color: #fff !important;
    transition: background 0.25s ease;
}

.cta-nav:hover {
    background: var(--blue-light);
}

/* Bottone hamburger per mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 4px 0;
    background: var(--gray-light);
    border-radius: 999px;
    transition: transform 0.25s ease, opacity 0.25s ease, background 0.25s ease;
}

/* ===========================
   HERO
=========================== */

.hero {
    height: 100vh;
    background-image:
        /* Overlay scuro per leggibilità testo */
        linear-gradient(to bottom, rgba(18,29,41,0.7), rgba(18,29,41,1)),
        url('img/_LGP5489.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    padding: 0 8%;
}

.hero-content {
    max-width: 650px;
    animation: fadeIn 1.2s ease forwards; /* Animazione ingresso */
    margin-top: 60px; /* Compensa navbar fissa */
}

.hero h1 {
    font-size: 3.1rem;
    margin-bottom: 16px;
}

.hero p {
    font-size: 1.05rem;
    margin-bottom: 28px;
    color: var(--gray-mid);
    line-height: 1.6;
}

.cta-link {
    text-decoration: none;
}

/* Pulsante principale (CTA) */
.cta {
    background: var(--blue-primary);
    color: #fff;
    padding: 14px 32px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.cta:hover {
    background: var(--blue-light);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(69,130,197,0.35);
}

/* ===========================
   FEATURES
=========================== */

.features {
    padding: 120px 8%;
    text-align: center;
}

.features h2 {
    margin-bottom: 10px;
}

.features-grid {
    margin-top: 40px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Griglia responsive */
    gap: 30px;
}

/* Card caratteristiche */
.card {
    background: var(--blue-dark);
    padding: 28px;
    border-radius: 10px;
    text-align: left;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card h3 {
    margin-bottom: 10px;
}

.card p {
    font-size: 0.95rem;
    color: var(--gray-light);
    line-height: 1.6;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 25px rgba(69,130,197,0.25);
}

/* ===========================
   GALLERY (Masonry)
=========================== */

.gallery {
    padding: 120px 8%;
    text-align: center;
}

.gallery h2 {
    margin-bottom: 10px;
}

/* Layout masonry con column-count */
.gallery-grid {
    column-count: 3;
    column-gap: 20px;
}

.gallery-grid img {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 10px;
    display: block;
    break-inside: avoid; /* Evita spezzature tra colonne */
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
    filter: saturate(1.05);
    cursor: pointer;
}

.gallery-grid img:hover {
    transform: scale(1.04);
    box-shadow: 0 10px 25px rgba(69,130,197,0.25);
    filter: saturate(1.2);
}

/* ===========================
   VIDEO SECTION
=========================== */

.videos {
    padding: 120px 8%;
    text-align: center;
}

.videos h2 {
    margin-bottom: 10px;
}

.video-block {
    max-width: 900px;
    margin: 0 auto 70px;
    text-align: left;
}

.video-block h3 {
    margin-bottom: 8px;
}

.video-block p {
    font-size: 0.95rem;
    color: var(--gray-mid);
    margin-bottom: 18px;
    line-height: 1.6;
}

/* Wrapper per mantenere proporzione 16:9 */
.video-wrapper,
.video-thumb {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
}

.video-wrapper iframe,
.video-thumb iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 10px;
    border: none;
}

/* Leggera differenza di raggio per i thumb */
.video-thumb iframe {
    border-radius: 8px;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.video-item {
    text-align: left;
    background: #182433;
    padding: 20px;
    border-radius: 10px;
}

.video-item h4 {
    margin-bottom: 6px;
}

.video-item p {
    font-size: 0.9rem;
    color: var(--gray-mid);
    margin-bottom: 12px;
    line-height: 1.5;
}

/* ===========================
   SIMULATOR CTA SECTION
=========================== */

.simulator {
    background: url('img/_LGP5486.JPG');
    background-size: cover;
    background-position: center;
    padding: 150px 8%;
    position: relative;
    margin-top: 40px;
}

/* Overlay scuro sopra l’immagine */
.simulator::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(18,29,41,0.88);
}

.sim-content {
    position: relative; /* Sopra l’overlay */
    max-width: 650px;
    color: var(--gray-light);
}

.sim-content h2 {
    margin-bottom: 14px;
}

.sim-content p {
    font-size: 0.98rem;
    line-height: 1.7;
    margin-bottom: 14px;
}

/* ===========================
   FOOTER
=========================== */

footer {
    text-align: center;
    padding: 40px 8%;
    background: var(--black-blue);
    color: var(--gray-mid);
    font-size: 0.9rem;
    border-top: 1px solid #1d2936;
}

/* ===========================
   ANIMAZIONI
=========================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Classe generica per animazione in ingresso */
.fade-up {
    opacity: 0;
    transform: translateY(25px);
    animation: fadeUp 1s ease forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================
   LIGHTBOX
=========================== */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none; /* Disabilita click quando nascosta */
    transition: opacity 0.35s ease;
    z-index: 9999;
}

.lightbox.show {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90%;
    max-height: 85%;
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(0,0,0,0.6);
    animation: zoomIn 0.35s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Pulsante chiusura lightbox */
.close-btn {
    position: absolute;
    top: 25px;
    right: 35px;
    font-size: 3rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.close-btn:hover {
    opacity: 0.6;
}

/* Frecce navigazione lightbox */
.arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    font-size: 4rem;
    color: #fff;
    cursor: pointer;
    user-select: none;
    padding: 10px 15px;
    transition: opacity 0.2s ease;
    z-index: 10000;
}

.arrow:hover {
    opacity: 0.6;
}

.left-arrow {
    left: 30px;
}

.right-arrow {
    right: 30px;
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width: 900px) {
    .gallery-grid {
        column-count: 2; /* Riduce colonne gallery */
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 10px 18px;
    }

    .nav-toggle {
        display: block; /* Mostra hamburger */
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(18, 29, 41, 0.95);
        flex-direction: column;
        align-items: center;
        padding: 18px 0 22px;
        gap: 14px;
        display: none; /* Mostrato solo con .nav-open */
    }

    /* CTA nella navbar su mobile: stile link normale */
    .nav-links .cta-nav {
        background: none;
        padding: 0;
        color: var(--gray-light) !important;
    }

    .navbar.nav-open .nav-links {
        display: flex;
    }

    /* Animazione hamburger → X */
    .navbar.nav-open .nav-toggle span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    .navbar.nav-open .nav-toggle span:nth-child(2) {
        opacity: 0;
    }
    .navbar.nav-open .nav-toggle span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }

    .nav-links a {
        font-size: 0.95rem;
    }

    .nav-links .cta-nav {
        margin-top: 4px;
    }

    .hero {
        padding: 0 6%;
        text-align: center;
    }

    .hero h1 {
        font-size: 2.4rem;
    }

    .hero-content {
        margin-top: 80px;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        column-count: 1; /* Una colonna sola */
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .arrow {
        font-size: 3rem;
        padding: 5px 10px;
    }

    .left-arrow {
        left: 12px;
    }

    .right-arrow {
        right: 12px;
    }

    .close-btn {
        font-size: 2.4rem;
        right: 20px;
        top: 15px;
    }

    .lightbox img {
        max-width: 95%;
        max-height: 80%;
    }
}

/* ===========================
   PAGINA CONTATTI
=========================== */

.contatti-section {
    position: relative;
    padding: 150px 8% 120px;
    text-align: center;
    background-image:
        linear-gradient(to bottom, rgba(18,29,41,0.75), rgba(18,29,41,0.95)),
        url('img/_LGP5484.JPG');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.contatti-section h2 {
    margin-bottom: 10px;
}

.contatti-section .section-intro {
    color: var(--gray-light);
}

/* Card “vetro” nella pagina contatti */
.contatti-section .features-grid .card {
    background: rgba(48, 69, 92, 0.85);
    backdrop-filter: blur(4px);
}