/* ============================================================
   TEKSTYLE.IT - Versione 2.8 (Desktop Compact & Mobile Fixed)
   ============================================================ */

:root {
    --primary-color: #003366;
    --accent-color: #00d2ff;
    --bg-color: #f1f5f9;
    --text-muted: #64748b;
    --white: #ffffff;
    --header-bg: #001A33;
}

* { box-sizing: border-box; }

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg-color); 
    margin: 0; 
    overflow-x: hidden; 
}
/* Miglioramento accessibilità: Focus visibile */
a:focus, button:focus {
    outline: 2px solid var(--accent-color) !important;
    outline-offset: 3px !important;
}
/* --- HEADER & STICKY CONFIG (Compact Desktop) --- */
.main-header {
    background: var(--header-bg);
    padding: 15px 20px;
    
    /* MODIFICA: Togliamo il bordo piatto e aggiungiamo l'effetto LIGHTING */
    border-bottom: 2px solid rgba(0, 210, 255, 0.4); /* Bordo semitrasparente */
    box-shadow: 
        0 15px 25px rgba(0, 210, 255, 0.15), /* Lieve bagliore sotto */
        0 4px 10px rgba(0, 51, 102, 0.3);      /* Ombra profonda per il contrasto */
        
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 35px; /* Leggermente più stretto */
}

/* --- LOGO & MOTTO --- */
.logo-container { max-width: 130px; flex-shrink: 0; } /* Logo leggermente più piccolo */
.logo-img { width: 100%; height: auto; display: block; border: none; }

.header-divider { 
    width: 1px; height: 50px; /* Ridotto da 70px a 50px */
    background: rgba(255,255,255,0.2); 
}

.motto-primary { 
    margin: 0; font-size: 1.3rem; font-weight: 800; color: var(--accent-color); 
    text-transform: uppercase; letter-spacing: 1.2px; line-height: 1.1; 
}

.motto-secondary { 
    margin: 5px 0 0 0; font-size: 0.9rem; font-weight: 300; color: var(--white); 
    opacity: 0.8; line-height: 1.3; 
}

/* --- MENU --- */
/* --- MENU DESKTOP CON ICONE E LINEA ANIMATA --- */
.menu-container { 
    display: flex;
    gap: 25px; /* Più respiro tra le voci */
}

.menu-container a { 
    position: relative; /* Necessario per posizionare la linea */
    color: rgba(255, 255, 255, 0.8); 
    text-decoration: none; 
    font-size: 0.9rem; 
    font-weight: 500; 
    text-transform: uppercase; 
    display: flex;
    align-items: center;
    gap: 8px; /* Spazio tra icona e testo */
    padding: 10px 0;
    transition: color 0.3s ease;
}

/* Fix per le icone nel menu */
.menu-container a .material-symbols-rounded {
    font-size: 20px !important; /* Piccole e discrete */
    background: transparent !important;
    color: inherit !important;
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
    margin: 0 !important;
}

/* Creazione della linea animata (nascosta di base) */
.menu-container a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 0 8px var(--accent-color); /* Bagliore sulla linea */
}

/* Effetto Hover */
.menu-container a:hover { 
    color: var(--accent-color);
}

.menu-container a:hover::after {
    width: 100%; /* La linea si espande */
}
/* ICONA BURGER - Fix dimensione */
.burger-icon { display: none; color: var(--white); cursor: pointer; }
.burger-icon .material-symbols-rounded {
    font-size: 32px !important;
    background: transparent !important;
    color: white !important;
    width: auto !important;
    height: auto !important;
    line-height: normal !important;
}

/* --- GRID INDEX (TESTO COMPLETO E BOX DINAMICI) --- */
.main-wrapper {
    max-width: 1200px; 
    margin: 0 auto;
    padding: 0 20px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
    margin-top: 30px; 
    margin-bottom: 60px; /* Spazio per staccare il footer */
}

.category-card {
    background: var(--white);
    padding: 25px 20px;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0, 26, 51, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Rimuoviamo min-height fisso per evitare il vuoto eccessivo */
    height: 100%; 
    transition: all 0.3s ease;
}

.category-card h3 {
    font-size: 1.05rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    font-weight: 800;
    line-height: 1.2;
}

.category-card p {
    font-size: 0.88rem;
    line-height: 1.6;
    color: #444;
    margin: 0;
    
    /* RESET TOTALE PER ELIMINARE I TRE PUNTINI */
    display: block !important; 
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: normal !important;
    -webkit-line-clamp: none !important; /* Questo elimina il limite delle righe */
    -webkit-box-orient: vertical;
}

/* Icone nei box */
.category-card .material-symbols-rounded {
    font-size: 32px;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.category-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .categories-grid { grid-template-columns: 1fr; }
}
/* ICONE NEI BOX */
.category-card .material-symbols-rounded {
    font-size: 26px; /* Icone leggermente più piccole */
    color: var(--primary-color);
    margin-bottom: 10px;
    background: #f8fafc;
    width: 50px;
    height: 50px;
    line-height: 50px;
    border-radius: 10px;
}

.category-card h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem; 
    color: var(--primary-color);
    font-weight: 800;
    text-transform: uppercase;
}

.category-card p {
    font-size: 0.75rem; 
    color: var(--text-muted);
    line-height: 1.3;
    margin: 0;
}

/* --- MOBILE OVERLAY --- */
.mobile-overlay {
    height: 100%; width: 0; position: fixed; z-index: 2000;
    top: 0; left: 0; background-color: var(--header-bg);
    overflow-x: hidden; transition: 0.5s;
}
.overlay-content { position: relative; top: 15%; width: 100%; text-align: center; }
.mobile-overlay a { padding: 15px; text-decoration: none; font-size: 1.2rem; color: var(--white); display: block; text-transform: uppercase; font-weight: 700; }
.mobile-overlay .closebtn { position: absolute; top: 20px; right: 35px; font-size: 35px; color: var(--white); text-decoration: none; }

/* --- RESPONSIVE LOGIC --- */

@media (max-width: 600px) {
    /* 1. L'header deve stare SOPRA a tutto il resto */
    .main-header { 
        position: fixed !important; 
        top: 0 !important;
        left: 0 !important;
        right: 0 !important; 
        width: 100% !important;
        height: 130px !important; 
        z-index: 99999 !important; /* Valore altissimo per vincere su altri elementi */
        background: var(--header-bg) !important;
        display: flex !important;
        align-items: center !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.5) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* 2. Il corpo della pagina deve scendere per forza */
    body { 
        padding-top:145px !important; 
        margin-top: 0 !important;
        overflow-x: hidden !important;
    }

    /* 3. Il container interno deve occupare tutto lo spazio */
    .header-container { 
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 0 15px !important;
        height: 100% !important;
    }

    /* 4. Forza la visibilità del Burger Menu */
    .burger-icon { 
        display: flex !important; 
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 100000 !important; /* Più alto dell'header stesso */
        cursor: pointer !important;
        color: #ffffff !important;
    }

    .burger-icon .material-symbols-rounded {
        font-size: 35px !important;
        color: #ffffff !important;
        display: block !important;
    }

    /* Nascondi i disturbi */
    .header-divider, .motto-secondary, .menu-container:not(.mobile-overlay) { 
        display: none !important; 
    }

    .logo-container { max-width: 140px !important; }
    .logo-img { height: 65px !important; width: auto !important; }
}

/* ============================================================
   TEKSTYLE.IT - FOOTER SECTION (COMPACT & ALIGNED)
   ============================================================ */

.main-footer {
    /* Sfumatura rapidissima: solo il primo 4% per fondere i colori senza rubare spazio */
    background: linear-gradient(to bottom, #f1f5f9 0%, #001A33 4%, #001A33 100%);
    color: white;
    padding: 30px 0 15px 0;
    margin-top: 30px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- RIGA 1: BRAND, NAV E SOCIAL (COMPATTA E ALLINEATA) --- */
.footer-top-row {
    display: flex !important;
    flex-direction: row !important;
    /* Cambiato da space-between a center per eliminare i vuoti laterali */
    justify-content: center; 
    align-items: center;
    /* Distanza bilanciata tra i tre macro-blocchi */
    gap: 50px; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 15px;
    margin-bottom: 15px;
    width: 100%;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.footer-logo { height: 30px; width: auto; }

.footer-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.footer-title span { color: var(--accent-color); }

/* Navigazione compatta */
.footer-nav {
    display: flex;
    gap: 20px;
    margin: 0;
}

.footer-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    padding: 4px 0;
    transition: 0.3s;
}

/* Linea animata sotto i link */
.footer-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}
.footer-nav a:hover::after { width: 100%; }
.footer-nav a:hover { color: var(--accent-color); }

/* Blocco Social e CTA integrato */
.footer-social-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

/* Icone e Linea Animata */
.footer-nav a .material-symbols-rounded { font-size: 18px !important; }

.footer-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
    box-shadow: 0 0 5px var(--accent-color);
}
.footer-nav a:hover::after { width: 100%; }
.footer-nav a:hover { color: var(--accent-color); }

/* RIGA 2: Copyright */
.footer-credits {
    text-align: center;
    margin: 0;
}
.footer-credits p {
    margin: 0;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* RIGA 3: Motto */
.footer-motto-row {
    text-align: center;
}
.footer-motto {
    margin: 0;
    font-size: 0.7rem;
    font-style: italic;
    opacity: 0.4;
    letter-spacing: 0.5px;
}

/* Responsive: si incolonna solo sotto i 768px */
@media (max-width: 768px) {
    .footer-top-row {
        flex-direction: column !important;
        gap: 15px;
        text-align: center;
    }
}
/* --- SOCIAL ICONS MINIMALI (Solo un accenno) --- */
.header-socials, .footer-socials {
    display: flex;
    gap: 12px; /* Un po' più vicini tra loro */
    align-items: center;
    margin-left: 30px; /* Più spazio dal menu per separarli nettamente */
    border-left: 1px solid rgba(255, 255, 255, 0.1); /* Una riga sottilissima di divisione */
    padding-left: 20px;
}

.header-socials a, .footer-socials a {
    color: rgba(255, 255, 255, 0.7); /* Molto trasparenti di base */
    font-size: 0.9rem; /* Rimpiccioliti (erano 1.1) */
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Effetto Hover: si accendono solo quando servono */
.header-socials a:hover, .footer-socials a:hover {
    color: var(--accent-color);
    transform: scale(1.1); /* Invece di saltare su, si ingrandiscono appena */
    opacity: 1;
}

/* --- FOOTER SOCIALS (Minimal Accenno) --- */
.footer-socials {
    display: flex;
    gap: 15px;
    align-items: center;
    border-left: 1px solid rgba(255, 255, 255, 0.1); /* Linea di separazione sottile */
    padding-left: 15px;
    margin-left: 10px;
}

.footer-socials a {
    color: rgba(255, 255, 255, 0.7); /* Opacità ridotta per non distrarre */
    font-size: 0.85rem; /* Piccole, come richiesto */
    transition: all 0.3s ease;
    text-decoration: none;
}

.footer-socials a:hover {
    color: var(--accent-color);
    opacity: 1;
    transform: scale(1.1); /* Solo un leggero ingrandimento */
}

/* Fix per allineamento responsive del footer con social */
@media (max-width: 900px) {
    .footer-top-row {
        flex-direction: column !important;
        gap: 20px;
    }
    .footer-socials {
        border-left: none;
        padding-left: 0;
        margin-left: 0;
    }
}
/* --- CTA SOCIAL FOOTER --- */
.footer-social-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

.cta-social {
    font-size: 0.65rem; /* Molto piccolo e discreto */
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    text-transform: uppercase;
}

.footer-socials {
    display: flex;
    gap: 12px;
}

.footer-socials a {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.footer-socials a:hover {
    color: var(--accent-color);
    opacity: 1;
}

/* Fix Mobile: togliamo il bordo e mettiamo la CTA sopra le icone */
@media (max-width: 900px) {
    .footer-social-wrapper {
        border-left: none;
        padding-left: 0;
        flex-direction: column;
        gap: 8px;
    }
}
/* --- FOOTER LEGAL & MODAL --- */
.footer-legal {
    text-align: center;
    margin: 5px 0;
}

.footer-legal a {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    transition: 0.3s;
}

.footer-legal a:hover { color: var(--accent-color); }

.legal-sep {
    color: rgba(255, 255, 255, 0.3); /* Un bianco trasparente o grigio leggero */
    margin: 0 5px;
    user-select: none; /* Evita che il separatore venga selezionato trascinando il mouse */
}

/* ============================================================
   TEKSTYLE.IT - MODALE LEGALE "DARK TECH"
   ============================================================ */

.legal-modal {
    display: none;
    position: fixed;
    z-index: 10001; /* Sopra a tutto, anche al banner cookie */
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(0, 15, 30, 0.96); /* Blu notte profondissimo Tekfriend */
    backdrop-filter: blur(10px); /* Effetto vetro sfocato premium */
    opacity: 0; /* Per animazione ingresso */
    transition: opacity 0.4s ease;
}

/* Quando la modale è aperta, mostrala con dissolvenza */
.legal-modal[style*="display: block"] {
    opacity: 1;
}

.modal-content {
    background: #ffffff; /* Manteniamo il fondo bianco per massima leggibilità del testo legale */
    color: #333333;
    margin: 5vh auto;
    padding: 0; /* Padding gestito internamente */
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    border-radius: 20px;
    position: relative;
    overflow: hidden; /* Importante per l'header sfumato */
    box-shadow: 0 25px 60px rgba(0, 210, 255, 0.3); /* Underglow blu Tekfriend */
    
    /* Animazione ingresso: balzo leggero dall'alto */
    transform: translateY(-50px);
    transition: transform 0.5s ease;
}

/* Quando la modale è aperta, anima il contenuto */
.legal-modal[style*="display: block"] .modal-content {
    transform: translateY(0);
}

/* --- HEADER DELLA MODALE: Il tocco di classe --- */
.modal-header {
    background: linear-gradient(135deg, #001A33 0%, #003366 100%); /* Sfumatura blu profonda */
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: white;
    margin: 0;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Aggiungiamo un'icona di lucchetto per la sicurezza legale */
.modal-header h2::before {
    content: '\e897'; /* Codice Material Icon per 'lock' */
    font-family: 'Material Symbols Rounded';
    font-size: 24px;
    color: var(--accent-color); /* Blu acceso Tekfriend */
}

.close-modal {
    font-size: 32px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: 0.3s;
    line-height: 1;
}
.close-modal:hover { color: var(--accent-color); transform: rotate(90deg); }

/* --- CORPO DELLA MODALE (Testo Legale) --- */
#modal-body {
    padding: 40px 35px;
    overflow-y: auto;
    max-height: calc(85vh - 80px); /* Sottraiamo l'altezza dell'header */
    line-height: 1.7;
    font-size: 0.95rem;
}

#modal-body h3 { color: #001A33; margin-top: 25px; margin-bottom: 10px; font-weight: 700; }
#modal-body p { margin-bottom: 15px; color: #555; }
#modal-body ul { margin-bottom: 20px; padding-left: 20px; color: #555; }
#modal-body li { margin-bottom: 8px; }

/* Loader stilizzato coerente */
#modal-loader {
    padding: 50px;
    text-align: center;
    color: #001A33;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .modal-content { margin: 2vh auto; width: 95%; max-height: 96vh; }
    .modal-header { padding: 15px 20px; }
    .modal-header h2 { font-size: 1.1rem; }
    #modal-body { padding: 25px 20px; }
}
/* STABILIZZATORE LAYOUT */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
}

.category-card {
    height: auto !important;
    min-height: 200px;
}

/* Fix per H2 che ha sostituito H3 */
.category-card h2 {
    font-size: 1rem;
    margin-top: 0;
}
/* FIX CONTRASTO BLOG & PORTFOLIO */
.blog-icon-box {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Questo forza l'icona a essere visibile su qualsiasi pastello */
.blog-icon-box span, 
.blog-icon-box .material-symbols-rounded {
    color: #003366 !important; 
    font-size: 28px !important;
}

/* Titolo H1 con parola evidenziata (es. BLOG) */
h1 span {
    color: #005bb5 !important; /* Un blu più scuro dell'azzurro originale */
}
.btn-primary, button[type="submit"] {
    background-color: #003366 !important;
    color: #ffffff !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 8px !important;
}
/* --- FIX ACCESSIBILITÀ: CONTRASTO --- */
/* Forza il colore scuro per le icone e i testi nei box pastello di Blog e Portfolio */
.blog-icon-box, .card-icon-box {
    color: #1e293b !important; /* Colore scuro ad alto contrasto */
}

.blog-card h3, .portfolio-card h3, .category-card h3 {
    color: #002244 !important; /* Un blu più profondo per i titoli */
}

.article-count, .card-desc {
    color: #334155 !important; /* Grigio scuro leggibile */
}
/* --- FIX ACCESSIBILITÀ: DIMENSIONI FONT --- */
.footer-bottom, .cookie-banner p, .motto-secondary {
    font-size: 0.9rem !important; /* Circa 14px, garantisce il 100% su Lighthouse */
}

.btn-accept, .btn-minimal, .legal-link {
    font-size: 0.85rem !important; /* Minimo sindacale per l'usabilità mobile */
}