/* ================= 1. VARIABILI E IMPOSTAZIONI GLOBALI ================= */
:root {
    --beige-light: #79705b;   /* Sfondo generale morbido */
    --beige-medium: #39342c;  /* Elementi secondari e bordi */
    --beige-dark: #c5b9a5;    /* Dettagli e stati hover */
    --charcoal: #1e2022;      /* Testo e intestazioni per forte contrasto */
    --white: #ffffff;
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--beige-dark) !important;
    color: var(--charcoal);
    overflow-x: hidden;
    width: 100%;
}

/* ================= 2. INTESTAZIONE (HEADER) ================= */
header {
    text-align: center;
    padding: 80px 20px;
    position: relative;
    box-sizing: border-box;
    background: linear-gradient(
        to right,
        #ffffff 10%,
        #c5b9a5 50%,
        #ffffff 90%
    ) !important;
    background-size: 200% 100% !important;
    animation: luceRettangoloGrande 5s linear infinite !important;
}

@keyframes luceRettangoloGrande {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

header h1, .titolo-animato {
    margin: 0 auto;
    font-size: 4rem !important;
    letter-spacing: 7px !important;
    text-transform: uppercase !important;
    font-family: 'Orbitron', sans-serif !important;
    font-weight: 700 !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box;
    padding: 10px 0;
    white-space: nowrap !important;
    word-wrap: normal !important;
    color: var(--charcoal) !important;
    -webkit-text-fill-color: var(--charcoal) !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    animation: none !important;
}

header p {
    margin: 15px 0 0 0;
    font-size: 1.1rem;
    color: var(--beige-medium);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ================= 3. CONTENUTO CENTRALE (MAIN) ================= */
main {
    max-width: 1000px;
    margin: 50px auto;
    padding: 40px;
    background-color: var(--white);
    border-radius: 12px;
    border: 1px solid var(--beige-medium) !important;
    box-shadow: 0 10px 40px rgba(30, 32, 34, 0.08) !important;
    animation: fadeInUp 0.8s ease-out;
    box-sizing: border-box;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= 4. TIPOGRAFIA E SEZIONI ================= */
.profile-header h3 {
    font-size: 1.5rem;
    color: var(--charcoal);
    margin-bottom: 35px;
    border-left: 4px solid var(--beige-dark);
    padding-left: 15px;
}

.bio-section h4 {
    font-size: 1.25rem;
    color: var(--charcoal);
    margin-top: 35px;
    margin-bottom: 12px;
    font-weight: 700;
}

.bio-section p {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #4a4a4a;
    margin-bottom: 20px;
    text-align: justify;
}

.software-list {
    list-style-type: none;
    padding-left: 0;
}

.software-list li {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 15px;
    padding-left: 25px;
    position: relative;
    transition: transform 0.2s ease;
}

.software-list li::before {
    content: "■";
    position: absolute;
    left: 0;
    color: var(--beige-dark);
    font-size: 0.8rem;
    top: 2px;
}

.software-list li:hover {
    transform: translateX(5px);
    color: var(--charcoal);
}

.software-list strong {
    color: var(--charcoal);
}

/* ================= 5. GRIGLIA PORTFOLIO E SCHEDE ================= */
.portfolio-section {
    margin-top: 60px;
    border-top: none;
    padding-top: 40px;
    padding-left: 40px;
    padding-right: 40px;
}

#blocco-portfolio {
    border-top: none;
    padding: 0 40px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.project-card {
    background-color: var(--white);
    border: 1px solid var(--beige-medium);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--beige-dark);
    box-shadow: 0 15px 35px rgba(197, 185, 165, 0.2);
}

.project-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    filter: grayscale(20%);
    transition: filter 0.4s ease, transform 0.4s ease;
} 

.project-card:hover img {
    filter: grayscale(0%);
    transform: scale(1.03);
}

.project-info {
    padding: 25px 20px !important;
    background-color: var(--white);
    text-align: left !important;
}

.project-info h5 {
    font-size: 18px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    color: var(--charcoal) !important;
    margin: 0 0 12px 0 !important;
    line-height: 1.2 !important;
}

.project-info p {
    font-size: 15px !important;
    font-weight: 400 !important;
    color: #333333 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

.scheda-nascosta {
    display: none !important;
}

.project-card.nascondi-cartella {
    display: none !important;
}

/* ================= 6. PULSANTI E NAVIGAZIONE ================= */
.btn-portfolio, .btn-back, .btn-write-here, .back-btn, .torna-home, a[href*="index"] {
    display: table !important;
    background-color: var(--charcoal) !important;
    color: var(--white) !important;
    padding: 14px 30px !important;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 2px solid var(--charcoal) !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;
    max-width: 100%;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
}

.btn-portfolio:hover, .btn-back:hover, .btn-write-here:hover {
    background-color: var(--beige-dark) !important;
    color: var(--charcoal) !important;
    border-color: var(--beige-dark) !important;
    transform: translateY(-2px) scale(1.02);
}

.tasto-ritorno-container {
    margin-bottom: 30px;
    padding: 0 40px;
    text-align: center;
}

.header-action-container, .btn-container, .back-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    text-align: center !important;
    box-sizing: border-box !important;
    margin-top: 25px;
    margin-bottom: 20px;
}

/* ================= 7. FORM E CONTATTI ================= */
form, .form-container {
    width: 100%;
    max-width: 1050px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

form input[type="text"],
form input[type="email"],
form input[type="tel"],
form input,
.form-group input {
    width: 100% !important;
    border: none !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 10px 12px !important;
    margin-top: 5px;
    margin-bottom: 20px;
    font-size: 16px !important;
    color: var(--charcoal) !important;
    box-sizing: border-box;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="tel"]:focus,
.form-group input:focus {
    border-bottom: 1px solid var(--charcoal) !important;
}

form textarea, .textarea-full-group textarea {
    width: 100% !important;
    min-height: 150px;
    border: none !important;
    background: transparent !important;
    padding: 10px 0 !important;
    font-size: 1.15rem !important;
    line-height: 1.6;
    resize: vertical;
    box-shadow: none !important;
    box-sizing: border-box;
}

form textarea:focus, .textarea-full-group textarea:focus {
    outline: none !important;
}

.bottom-action-bar {
    padding: 30px 40px;
    background-color: #faf8f5;
    border-top: 1px solid var(--beige-medium);
    box-sizing: border-box;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

form input[type="submit"],
form button,
.bottom-action-bar button,
.bottom-action-bar input[type="submit"] {
    display: block !important;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
}

/* ================= 8. LIGHTBOX MODAL & PUNTINI (SOLO LIGHTBOX) ================= */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(30, 32, 34, 0.95);
    justify-content: center;
    align-items: center;
    touch-action: none;
    overflow: hidden !important;
}

.lightbox-content {
    max-width: 85%;
    max-height: 85%;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.1s ease-out;
    display: block;
    transform-origin: center center;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #ffffff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 100002;
}

.lightbox-close:hover {
    color: #c5b9a5;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 45px;
    font-weight: bold;
    cursor: pointer;
    padding: 15px 25px;
    user-select: none;
    transition: all 0.2s ease;
    z-index: 100001;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.lightbox-arrow:hover {
    background-color: rgba(0, 0, 0, 0.5);
    color: #c5b9a5;
}

.arrow-left { left: 20px; }
.arrow-right { right: 20px; }

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Puntini visibili ESCLUSIVAMENTE all'interno del Lightbox */
#lightboxModal .dot-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    z-index: 1010;
}

#lightboxModal .dot {
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: inline-block;
    cursor: pointer;
    border: 1px solid #fff;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

#lightboxModal .dot.active {
    width: 14px;
    height: 14px;
    background-color: #ffffff;
    transform: scale(1.2);
}

/* ================= 9. LOGO AZIENDALE ================= */
.logo-container {    
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;            
    margin: 40px auto !important;      
    text-align: center !important;
    box-sizing: border-box;
}

.main-logo {
    width: 100% !important;            
    max-width: 100% !important;        
    height: auto !important;            
    display: block !important;
    transform: scale(1) !important;    
    opacity: 1 !important;              
}

/* ================= 10. FOOTER ================= */
footer {
    text-align: center;
    padding: 30px;
    background-color: var(--charcoal);
    color: var(--white);
    font-size: 0.85rem;
    letter-spacing: 1px;
    box-sizing: border-box;
}

.footer-link {
    color: var(--beige-dark);
    text-decoration: none;
}

/* ================= 11. MEDIA QUERIES (MOBILE) ================= */
@media screen and (max-width: 768px) {
    header h1, .titolo-animato {
        font-size: clamp(1.2rem, 5.8vw, 2.2rem) !important;
        letter-spacing: clamp(2px, 1.2vw, 5px) !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        word-wrap: normal !important;
        display: block !important;
        text-align: center !important;
    }

    header p {
        font-size: 0.95rem !important;
    }

    /* 1. RIPRISTINATO IL MAIN COME IN ORIGINE (Salva l'aspetto della Index) */
    main {
        width: 92% !important;        
        margin: 20px auto !important;
        padding: 20px !important;    
        box-sizing: border-box !important;
    }

    /* 2. RIPRISTINATA LA GRIGLIA E LE CARD COME IN ORIGINE */
    .projects-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }

    .project-card {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        border-radius: 0 !important;
        border-top: 1px solid #dcdcdc !important;
        border-bottom: 1px solid #dcdcdc !important;
        margin-bottom: 25px !important;
    }

    .project-card img {
        height: 240px !important;
        border-radius: 0 !important;
    }

    /* 3. MODIFICA SPECIFICA SOLO PER LA PAGINA PORTFOLIO */
    /* Allarga il blocco portfolio per toccare i bordi del riquadro bianco annullando il padding del main */
    #blocco-portfolio {
        margin-left: -20px !important;
        margin-right: -20px !important;
        width: calc(100% + 40px) !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* Modifica l'interno del portfolio senza intaccare le altre pagine */
    #blocco-portfolio .projects-grid {
        display: block !important; 
        padding: 0 !important;
        margin: 0 !important;
    }

    #blocco-portfolio .project-card {
        border-left: none !important;
        border-right: none !important;
        border-top: 1px solid var(--beige-medium) !important;
        border-bottom: 1px solid var(--beige-medium) !important;
    }

    .lightbox-arrow { display: none; }
    .lightbox-close { top: 20px; right: 25px; }

    .bio-section p {
        text-align: left !important;
        font-size: 0.95rem !important;
    }
}