/* --- 1. VARIABILI & PALETTE "INDUSTRIAL PREMIUM" --- */
:root {
    /* Colori */
    --bg-color: #050B14;       /* Deep Void */
    --surface-color: #0F172A;  /* Swiss Navy */
    --accent-color: #00F0FF;   /* Electric Teal */
    --accent-glow: rgba(0, 240, 255, 0.15); 
    
    --text-primary: #F1F5F9;   /* Signal White */
    --text-secondary: #94A3B8; /* Steel Grey */
    
    /* Tipografia */
    --font-main: 'Inter', sans-serif;         
    --font-tech: 'JetBrains Mono', monospace; 
    
    --container-width: 1200px;
}

/* --- 2. RESET & BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.7;
    font-weight: 300;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
ul { list-style: none; }

/* --- 3. TYPOGRAPHY SYSTEM --- */
h1, h2, h3, h4 { 
    font-family: var(--font-tech); 
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.04em;
}

h1 { font-size: 4rem; line-height: 1.1; margin-bottom: 1.5rem; }
h2 { font-size: 2.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; margin-bottom: 1rem; }

p { color: var(--text-secondary); margin-bottom: 1rem; }

.tech-accent { color: var(--accent-color); text-shadow: 0 0 15px var(--accent-glow); }

.section-subtitle { 
    color: var(--accent-color); 
    font-size: 0.85rem; 
    letter-spacing: 3px; 
    text-transform: uppercase; 
    margin-bottom: 1.5rem; 
    display: block; 
    font-family: var(--font-tech); 
    opacity: 0.8;
}

/* --- 4. LAYOUT UTILITIES --- */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}
section { padding: 8rem 0; }

/* --- 5. MODERN HEADER & NAVIGATION --- */
header.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    height: 80px;
    background: rgba(5, 11, 20, 0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: 0.3s ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    /* FIX MOBILE: Assicuriamo che resti in riga anche su schermi piccoli */
    flex-direction: row !important; 
}

/* LEFT: Language */
.nav-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.lang-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    font-family: var(--font-tech);
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    border-radius: 4px;
}

.lang-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* CENTER: Logo */
.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
    text-align: center;
}

/* Stile Logo "Tech Block" */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-tech);
    text-transform: uppercase;
}

.logo-box {
    background: rgba(0, 240, 255, 0.1); /* Sfondo ciano molto leggero */
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 2px 8px;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    border-radius: 2px; /* Angoli leggermente smussati ma tecnici */
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 2px; /* Spaziatura ampia per eleganza */
    color: var(--text-primary);
}

/* RIGHT: Menu */
.nav-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.desktop-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-weight: 500;
    position: relative;
}

.nav-link:hover { color: var(--text-primary); }

/* Linea decorativa sull'hover */
.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s;
}

.nav-link:hover::after { width: 100%; }

/* Bottone piccolo nel menu */
.btn-small {
    border: 1px solid var(--accent-color);
    padding: 0.4rem 1.2rem;
    color: var(--accent-color);
    font-family: var(--font-tech);
    font-size: 0.8rem;
    border-radius: 0;
}
.btn-small:hover {
    background: var(--accent-glow);
    color: var(--text-primary);
}
.btn-small::after { display: none !important; } /* FIX: Rimuove forzatamente la linea sotto il bottone */

/* --- MOBILE HAMBURGER & OVERLAY --- */
.mobile-trigger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    z-index: 1001;
}

.bar {
    width: 25px; /* Leggermente più piccolo per eleganza */
    height: 2px;
    background-color: var(--text-primary);
    transition: 0.3s;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
}

.mobile-overlay.active { transform: translateY(0); }

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.mobile-nav-links a {
    font-family: var(--font-tech);
    font-size: 2rem;
    color: var(--text-primary);
    text-transform: uppercase;
}

.mobile-nav-links a:hover {
    color: var(--accent-color);
    letter-spacing: 2px;
}

.mobile-trigger.open .bar-1 { transform: rotate(45deg) translate(5px, 6px); background-color: var(--accent-color); }
.mobile-trigger.open .bar-2 { transform: rotate(-45deg) translate(5px, -6px); background-color: var(--accent-color); }

/* --- 6. HERO SECTION --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 850px;
}

.hero-desc { 
    font-size: 1.25rem; 
    max-width: 650px; 
    margin-bottom: 3rem; 
    font-weight: 300;
}

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-family: var(--font-tech);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 10px var(--accent-glow);
}

.btn:hover { 
    background: var(--accent-glow);
    box-shadow: 0 0 25px var(--accent-glow);
    transform: translateY(-2px);
}

/* --- 7. ABOUT SECTION --- */
#about { background-color: var(--surface-color); border-top: 1px solid rgba(255,255,255,0.03); }

.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 5rem;
    align-items: center;
}

/* Container principale */
.about-img {
    width: 100%;
    height: 450px;
    background: #080c14; 
    border: 1px solid rgba(255,255,255,0.1);
    position: relative; /* Fondamentale per posizionare i figli */
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    overflow: hidden; /* Assicura che nulla esca dai bordi */
    
    /* Flexbox serve per centrare il testo overlay */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Assicuriamo che il canvas stia sullo sfondo */
#network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Lo stile della scritta centrale "HiEngineering" */
.about-overlay-text {
    position: relative;
    z-index: 10; /* Sopra il canvas */
    font-family: var(--font-tech), monospace; /* Usa il font tecnico */
    font-size: 3rem; /* Bello grande */
    font-weight: 700;
    color: #fff;
    letter-spacing: -1px;
    pointer-events: none; /* Il mouse passa attraverso (non blocca interazioni) */
    text-shadow: 0 10px 30px rgba(0,0,0,0.8); /* Ombra per staccarlo dallo sfondo */
    opacity: 0.9; /* Leggera trasparenza per fonderlo meglio */
}

/* Modifichiamo il pseudo-elemento per spostarlo nell'angolo (più elegante) */
.about-img::after {
    /* PRIMA ERA: content: "/// ENGINEERING_TASK_FORCE"; */
    
    /* ORA (Opzione consigliata): */
    content: "/// HI_ENGINEERING";
    
    position: absolute;
    bottom: 20px;
    right: 20px;
    z-index: 10;
    
    font-family: var(--font-tech);
    color: var(--text-secondary);
    font-size: 0.7rem;
    letter-spacing: 2px;
    opacity: 0.6;
}

/* Il bordo decorativo nell'angolo in alto a destra */
.about-img::before {
    content: "";
    position: absolute;
    top: -2px; right: -2px; /* Aggiustato per coprire il bordo */
    width: 60px; height: 60px; /* Un po' più piccolo è più elegante */
    border-top: 3px solid var(--accent-color); /* Un po' più spesso */
    border-right: 3px solid var(--accent-color);
    z-index: 10;
}

/* --- 8. SERVICES SECTION --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.service-card {
    background: rgba(15, 23, 42, 0.4); 
    padding: 2.5rem;
    border: 1px solid rgba(255,255,255,0.05);
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.service-card:hover {
    background: var(--surface-color);
    border-color: var(--accent-color);
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.service-icon { 
    font-size: 2rem; 
    color: var(--accent-color); 
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.service-card:hover .service-icon {
    opacity: 1;
    text-shadow: 0 0 15px var(--accent-glow);
}

/* --- 9. METHOD SECTION --- */
#method { 
    border-top: 1px solid rgba(255,255,255,0.05); 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    background-image: radial-gradient(circle at center, rgba(15, 23, 42, 0.5) 0%, rgba(5, 11, 20, 1) 70%);
}

.method-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 4rem;
    flex-wrap: wrap;
    gap: 2rem;
    position: relative;
}

.method-steps::before {
    content: "";
    position: absolute;
    top: 40px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.3;
    z-index: 0;
}

.step { 
    flex: 1; 
    min-width: 200px; 
    position: relative; 
    z-index: 1;
    background: var(--bg-color); 
    padding-right: 1rem;
}

.step-number { 
    font-family: var(--font-tech); 
    color: var(--accent-color); 
    font-size: 3.5rem; 
    line-height: 1;
    opacity: 0.2; 
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.step:hover .step-number { opacity: 0.8; transition: 0.3s; text-shadow: 0 0 20px var(--accent-glow); }

/* --- 10. FOOTER & CONTACT --- */
footer { 
    padding: 6rem 0; 
    background: #020408; 
    text-align: center; 
    border-top: 1px solid rgba(255,255,255,0.05);
}

.contact-box h2 { font-size: 2rem; margin-bottom: 2.5rem; }

.contact-btn {
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 1.2rem 3rem;
    font-family: var(--font-tech);
    font-weight: 700;
    display: inline-block;
    margin-bottom: 3rem;
    border: none;
    cursor: pointer;
}
.contact-btn:hover {
    background: var(--accent-color);
    box-shadow: 0 0 30px var(--accent-glow);
}

.contact-info p { 
    color: var(--text-secondary); 
    margin-bottom: 0.5rem; 
    font-family: var(--font-tech); 
    font-size: 0.9rem;
}

/* --- UTILITIES PER LINGUA (FIX DEFINITIVO LAYOUT) --- */

/* 1. Default: Nascondi tutti gli elementi in Inglese */
[data-lang="en"] { display: none; }

/* 2. Se siamo in modalità Inglese (body.lang-en): */

/* A. Nascondi tutto l'Italiano */
body.lang-en [data-lang="it"] { display: none; }

/* B. Mostra l'Inglese... MA con intelligenza: */

/* Se è un blocco generico (Titoli h1-h4, Paragrafi p, Div), mostralo come BLOCCO.
   Questo risolve il problema del <br> che non va a capo. */
body.lang-en h1[data-lang="en"],
body.lang-en h2[data-lang="en"],
body.lang-en h3[data-lang="en"],
body.lang-en h4[data-lang="en"],
body.lang-en p[data-lang="en"],
body.lang-en div[data-lang="en"] { 
    display: block; 
}

/* Se invece è uno SPAN (es. il testo dentro i bottoni o menu), mostralo come INLINE.
   Questo risolve il problema dei "rettangoli" o pulsanti rotti. */
body.lang-en span[data-lang="en"] { 
    display: inline; 
}

/* --- RESPONSIVE ADJUSTMENTS (FIX MOBILE) --- */
@media (max-width: 900px) {
    /* Manteniamo la navbar in riga, non in colonna! */
    .nav-container { 
        height: auto; 
        padding: 1rem; 
    }

    .desktop-menu { display: none; }
    .mobile-trigger { display: flex; }
    
    /* Ridimensiona il logo su mobile se troppo grande */
    .logo { font-size: 1.2rem; }
    
    h1 { font-size: 2.5rem; }
    .about-grid { grid-template-columns: 1fr; }
    .method-steps::before { display: none; } 
    section { padding: 4rem 0; }
}
/* Aggiungi nel tuo file CSS */

#about-canvas-container {
    position: relative;
    width: 100%;
    height: 400px; /* Altezza fissa per desktop, su mobile si adatterà */
    background: rgba(10, 15, 30, 0.6); /* Uno sfondo scuro semitrasparente */
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.1); /* Un sottile bordo ciano */
}

#network-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Adattamento per mobile */
@media (max-width: 768px) {
    #about-canvas-container {
        height: 300px; /* Un po' più basso su mobile */
        margin-top: 2rem;
    }
}