/* --- DESIGN TOKENS (Your "Design System") --- */
:root {
    --bg-color: #ffffff;
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --accent: #0066ff; /* Change this to your brand color */
    --card-bg: #f5f5f7;
    --gap: 2rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
}

/* --- LAYOUT --- */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

section { padding: 45px 0; }

/* --- NAVIGATION --- */
nav {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid #eee;
}

/* Theme toggle button */
#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.3s;
    position: relative;
}

#theme-toggle:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

#theme-toggle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.05);
    transition: opacity 0.3s;
}

#theme-toggle:hover::before {
    opacity: 1;
}

/* Dark mode styles */
.dark-mode {
    --bg-color: #1a1a1a;
    --text-main: #f0f0f0;
    --text-muted: #aaa;
    --card-bg: #2d2d2d;
    --accent: #4d94ff;
}

.dark-mode nav {
    background: rgba(25, 25, 25, 0.9);
    border-bottom: 1px solid #333;
}

.dark-mode .project-card {
    background: var(--card-bg);
}

.dark-mode footer {
    border-top: 1px solid #333;
    color: var(--text-muted);
}

/* Theme toggle icon visibility */
.sun-icon {
    display: inline;
}

.moon-icon {
    display: none;
}

.dark-mode .sun-icon {
    display: none;
}

.dark-mode .moon-icon {
    display: inline;
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo { font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--text-main); }
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}
.nav-links a:hover { color: var(--accent); }

/* --- HERO SECTION --- */
.hero {
    height:75 svh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.hero h1 {
    font-size: 3.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.5rem;
    color: var(--text-muted);
    max-width: 800px;
}

/* --- PROJECT GRID --- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: var(--gap);
}

.project-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.project-card:hover { transform: translateY(-5px); }

.project-img {
    width: 100%;
    height: 300px;
    background: #ddd; /* Placeholder color */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #999;
}

.project-info { padding: 1.5rem; }
.project-info h3 { margin-bottom: 0.5rem; font-size: 1.5rem; }
.tag {
    display: inline-block;
    background: #e0e0e0;
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

/* Dark mode tag background */
.dark-mode .tag {
    background: #555;
}

/* --- ABOUT & CONTACT --- */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
    padding-right: 12px;
}

/* Contact links - highly visible in both modes */
.contacts-title, .compliance-title {
    margin-top: 0;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.contacts-mail, .compliance-vat, .compliance-address, .compliance-pec {
    color: var(--text-main);
}

/* Make contact links highly visible */
a[href^="mailto:"], a[href^="https://linkedin.com"] {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    transition: all 0.2s ease;
}

a[href^="mailto:"], a[href^="https://linkedin.com"]:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
    filter: brightness(1.1);
}

footer {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid #eee;
    color: var(--text-muted);
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .grid { grid-template-columns: 1fr; }
    .about-content { grid-template-columns: 1fr; }
}

/* Responsive navbar adjustments */
@media (max-width: 540px) {

    nav .container {
        flex-direction: column;
        height: auto;
        padding: 0.5rem 0;
    }

    .logo {
        margin-bottom: 0.5rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .nav-links a {
        font-size: 0.9rem;
        padding: 0.3rem 0.5rem;
    }

    #theme-toggle {
        margin-left: 0;
        margin-top: 0.2rem;
    }
}

/* --- SECTION TITLE PADDING --- */
.section-title {
    padding-bottom: 16px;
}

/* --- SCALABLE ICON --- */
.scalable-icon {
    height: 1.5em;
    width: 1.5em;
    vertical-align: middle;
    margin-right: 0.5em;
}

/* Theme-dependent icon styling */
.dark-mode .scalable-icon {
    filter: brightness(0) invert(1);
}

/* Make all links highly visible in both modes */
a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
    filter: brightness(1.1);
}

/* Remove underline specifically from contact link in navbar */
.nav-links a[href^="mailto:"] {
    text-decoration: none;
}

.nav-links a[href^="mailto:"]:hover {
    text-decoration: none;
    filter: brightness(1.1);
}

.legal-footer {
    font-size: 12px; /* Piccolo ma leggibile */
    color: #888888;  /* Grigio discreto */
    text-align: center;
    padding: 20px 0;
    line-height: 1.5;
}

.legal-footer span {
    margin: 0 10px; /* Spazio tra i vari dati */
}

/* --- CTA BUTTON --- */
.cta-button {
    display: inline-block;
    margin-top: 2rem;
    padding: 16px 32px;
    background-color: var(--accent);
    color: #ffffff !important; /* Forces white text even in dark mode */
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 102, 255, 0.3); /* Subtle glow using accent color */
}

.cta-button:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.cta-button:active {
    transform: translateY(0);
}

/* Ensure the button doesn't look like a standard link in dark mode */
.dark-mode .cta-button {
    box-shadow: 0 4px 20px rgba(77, 148, 255, 0.4);
}

/* --- CONTACT FORM --- */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-group input, 
.form-group textarea {
    padding: 12px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    background: var(--bg-color);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.dark-mode .form-group input, 
.dark-mode .form-group textarea {
    border-color: rgba(255,255,255,0.1);
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.privacy-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.privacy-note a {
    font-weight: 400;
}
/* Contenitore generale */
.social-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* Spazio tra i quadratini */
    margin-top: 1.5rem;
}

/* La box 40x40 */
.social-box {
    display: inline-flex;    /* "inline-flex" permette alla box di stringersi sul contenuto */
    align-items: center;
    justify-content: flex-start; /* Allinea il contenuto a sinistra */
    width: auto;             /* Rimuove i 120px fissi per adattarsi al contenuto */
    min-width: 40px;         /* Mantiene almeno la forma quadrata se c'è solo l'icona */
    height: 40px;
    padding: 0 12px;         /* Aggiunge spazio interno ai lati */
    background-color: var(--card-bg);
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
    gap: 8px;                /* Spazio tra icona e testo (se decidi di aggiungerlo) */
}

.social-box p {
    margin: 0; /* Rimuove spazi bianchi extra */
    color: var(--text-main);
}

/* L'icona dentro la box */
.social-icon {
    width: 50%; /* Dimensione dell'icona dentro il quadrato */
    height: 50%;
    transition: transform 0.2s ease;
}

/* Effetti Hover */
.social-box:hover {
    background-color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.2);
}

/* Dark Mode Adjustments */
.dark-mode .social-box {
    border-color: rgba(255, 255, 255, 0.1);
}