/* =========================
   RESET E VARIABILI CSS
   ========================= */

/* Layout principale - CRITICO per footer fisso */
*,
*::before,
*::after {
    box-sizing: border-box;
}



body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
}

/* VARIABILI TEMA */
:root {
    --color-bg: #f8fafc;
    --color-surface: rgba(255, 255, 255, 0.8);
    --color-surface-solid: #ffffff;
    --color-border: rgba(203, 213, 225, 0.6);
    --color-text: #0f172a;
    --color-text-muted: #64748b;
    --color-primary: #2563eb;
    --color-primary-soft: #eff6ff;
    --color-accent: #059669;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 24px 38px 3px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 20px 25px -5px rgba(0, 0, 0, 0.02), 0 0 0 1px rgba(37, 99, 235, 0.1);
    --transition-snappy: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}


body.theme-dark {
    --color-bg: #09090b;
    --color-surface: rgba(24, 24, 27, 0.65);
    --color-surface-solid: #18181b;
    --color-border: rgba(63, 63, 70, 0.5);
    --color-text: #f8fafc;
    --color-text-muted: #a1a1aa;
    --color-primary: #3b82f6;
    --color-primary-soft: rgba(37, 99, 235, 0.15);
    --color-accent: #10b981;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
}


body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

main {
    flex: 1 0 auto;
    /* CRESCITA per spingere footer in fondo */
}

/* =========================
   CONTAINER E LAYOUT
   ========================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-footer {
    flex-shrink: 0;
    /* NON SI COMPRIME */
    margin-top: auto;
    /* SEMPRE IN FONDO */
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    background-color: var(--color-surface);
}

/* =========================
   HEADER STICKY (Glassmorphism)
   ========================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--color-border);
    transition: background-color 0.4s ease, border-color 0.4s ease;
}

body.theme-dark .site-header {
    background: rgba(11, 15, 25, 0.75);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 2rem;
}

.logo-area {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.logo-dot {
    color: var(--color-primary);
}

.logo-tagline {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* NAVBAR */
.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-link {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-snappy);
}

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

.nav-link-active {
    color: var(--color-text) !important;
    border-bottom-color: var(--color-primary) !important;
}

/* CONTROLLI HEADER */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-switch {
    font-size: 0.9rem;
    font-weight: 500;
}

.lang-link {
    color: var(--color-text-muted);
    text-decoration: none;
}

.lang-active {
    color: var(--color-text);
}

.lang-separator {
    margin: 0 0.5rem;
    color: var(--color-text-muted);
}

.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background: var(--color-surface-solid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: all var(--transition-snappy);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-text);
    left: 3px;
    transition: all var(--transition-snappy);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

body.theme-dark .theme-toggle::before {
    transform: translateX(30px);
    background: var(--color-primary);
}

.theme-icon {
    font-size: 0.85rem;
    z-index: 2;
    transition: color var(--transition-snappy);
}

.theme-icon-light {
    color: #f59e0b;
}

body.theme-light .theme-icon-light {
    color: var(--color-surface-solid);
}

.theme-icon-dark {
    color: var(--color-text-muted);
}

body.theme-dark .theme-icon-dark {
    color: #ffffff;
}

/* =========================
   HERO SECTION
   ========================= */

.hero {
    padding: 7rem 0 5rem;
    background: radial-gradient(circle at top right, var(--color-primary-soft) 0%, transparent 60%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    position: relative;
    overflow: hidden;
}

body.theme-dark .hero {
    background: radial-gradient(circle at top right, rgba(96, 165, 250, 0.15) 0%, transparent 60%),
        radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--color-primary), transparent);
    opacity: 0.2;
}

.hero-inner {
    display: grid;
    grid-template-columns: 2fr 1.2fr;
    gap: 4rem;
    align-items: center;
}

.hero-side {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.profile-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 6px solid var(--color-surface-solid);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 10;
    margin-bottom: -4rem; /* Overlap with the card */
    position: relative;
    transition: transform var(--transition-smooth);
}

.profile-img:hover {
    transform: scale(1.05);
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 1rem;
}

.highlight {
    color: var(--color-primary);
}

.hero-eyebrow {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
    max-width: 32rem;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-snappy);
    font-size: 0.95rem;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    background: color-mix(in srgb, var(--color-primary) 85%, black);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: var(--color-primary) !important;
    color: #ffffff !important;
    border-color: var(--color-primary) !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

/* HERO CARD */
.hero-card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: 5rem 2rem 2rem; /* Added top padding for the overlapping image */
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-soft);
    width: 100%;
}

.hero-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem;
}

.hero-list li {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* =========================
   SEZIONI E CARDS
   ========================= */

.section {
    padding: 4rem 0;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
    color: var(--color-text);
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    max-width: 36rem;
    margin: 0 auto;
}

/* GRID */
.grid {
    display: grid;
    gap: 2.5rem;
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* CARDS */
.card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: 2.25rem;
    border: 1px solid var(--color-border);
    transition: all var(--transition-snappy);
    box-shadow: var(--shadow-soft);
    height: 100%;
}

.card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-border);
}

.card h2,
.card h3 {
    margin-top: 0;
    color: var(--color-text);
}

.card-meta {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.link-inline {
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.link-inline:hover {
    color: var(--color-accent);
    transform: translateX(4px);
}

/* CARD CLICCABILI */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

/* =========================
   FOOTER
   ========================= */

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copy {
    margin: 0;
    color: var(--color-text-muted);
}

.footer-links a {
    color: var(--color-text-muted);
    margin-left: 1.5rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-primary);
}

/* =========================
   FORM CONTACT
   ========================= */

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

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

.form-group input,
.form-group textarea {
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 10%, transparent);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1024px) {
    .hero-inner {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .header-inner {
        gap: 1rem;
    }

    .main-nav ul {
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        height: auto;
        padding: 1rem 0;
    }

    .profile-img {
        width: 130px;
        height: 130px;
    }

    .main-nav ul {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .hero {
        padding: 3rem 0;
    }

    .section {
        padding: 2.5rem 0;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .profile-img {
        width: 110px;
        height: 110px;
    }
}

/* FIX TEMA - Background e testi per tutti gli elementi */
body.theme-light {
    background-color: var(--color-bg);
    color: var(--color-text);
}

body.theme-dark {
    --color-bg: #09090b;
    --color-surface: rgba(24, 24, 27, 0.65);
    --color-surface-solid: #18181b;
    --color-border: rgba(63, 63, 70, 0.5);
    --color-text: #f8fafc;
    --color-text-muted: #a1a1aa;
    --color-primary: #3b82f6;
    --color-primary-soft: rgba(37, 99, 235, 0.15);
    --color-accent: #10b981;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 24px 38px 3px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.05);
}


/* Header backdrop-filter per dark mode */
body.theme-dark .site-header {
    background: rgba(15, 23, 42, 0.95);
}

/* Hero gradient per dark mode */
body.theme-dark .hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 100%);
}

/* Cards e surface in dark mode */
body.theme-dark .card,
body.theme-dark .hero-card,
body.theme-dark .contact-form input,
body.theme-dark .contact-form textarea {
    background-color: var(--color-surface) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

/* Footer dark mode */
body.theme-dark .site-footer {
    background-color: var(--color-surface);
}

/* Link e testi secondari */
body.theme-dark .hero-list,
body.theme-dark .card-meta,
body.theme-dark .lang-link,
body.theme-dark .footer-copy,
body.theme-dark .footer-links a {
    color: var(--color-text-muted) !important;
}

/* =========================
   FIX: Animazione hover SOLO su card cliccabili
   ========================= */

/* Card NORMALI - SENZA animazione hover */
.card:not(.card-link) {
    transition: none !important;
    /* Nessuna animazione */
}

.card:not(.card-link):hover {
    transform: none !important;
    /* Nessun movimento */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05) !important;
    /* Ombra originale */
    border-color: var(--color-border) !important;
    /* Bordo originale */
}

/* Card CLICCABILI - MANTENGONO animazione */
.card-link {
    transition: all var(--transition-snappy);
}

.card-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary-soft);
}

/* Hero card (index.html) - SENZA animazione */
.hero-card {
    transition: none !important;
}

.hero-card:hover {
    transform: none !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1) !important;
}

/* =========================
   ANIMAZIONI FADE-UP (Observer JS)
   ========================= */

.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   TABELLE PROGETTI JOBS
   ========================= */
/*
.job-section {
    margin-bottom: 5rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

.job-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.job-intro {
    max-width: 42rem;
    margin: 0 auto 3rem;
    font-size: 1.1rem;
    line-height: 1.7;
}

.table-container {
    overflow-x: auto;
    border-radius: 1rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.projects-table th {
    background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
    color: var(--color-text);
    font-weight: 600;
    padding: 1.25rem 1rem;
    text-align: left;
    border-bottom: 2px solid var(--color-border);
}

.projects-table td {
    padding: 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border) 50%, transparent);
    vertical-align: top;
}

.projects-table tbody tr:hover {
    background: color-mix(in srgb, var(--color-primary-soft) 10%, var(--color-surface));
}

.projects-table tbody tr:last-child td {
    border-bottom: none;
}
*/
/* Responsive table */
/*
@media (max-width: 768px) {
    .projects-table {
        font-size: 0.85rem;
    }
    
    .projects-table th,
    .projects-table td {
        padding: 0.75rem 0.5rem;
    }
}
*/
/* =========================
   TABELLE JOBS MIGLIORATE (3 colonne)
   ========================= */

.job-intro {
    max-width: 48rem;
    margin: 0 auto 3.5rem;
    font-size: 1.125rem;
    line-height: 1.7;
}

.job-responsibilities {
    background: color-mix(in srgb, var(--color-primary-soft) 15%, transparent);
    padding: 1.5rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--color-primary);
    margin-top: 1.5rem;
    font-weight: 500;
}

.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.projects-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 800px;
    /* Larghezza minima per 3 colonne */
}

.projects-table th {
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--color-primary) 15%, var(--color-surface)) 0%,
            color-mix(in srgb, var(--color-primary) 5%, var(--color-surface)) 100%);
    color: var(--color-text);
    font-weight: 600;
    padding: 1.25rem 1rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--color-border);
}

.projects-table th:first-child {
    width: 20%;
}

.projects-table th:nth-child(2) {
    width: 25%;
}

.projects-table th:nth-child(3) {
    width: 55%;
}

.projects-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border) 30%, transparent);
    vertical-align: top;
}

.projects-table tbody tr {
    transition: background-color 0.2s ease;
}

.projects-table tbody tr:hover {
    background: color-mix(in srgb, var(--color-primary-soft) 8%, var(--color-surface));
}

.projects-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile table */
@media (max-width: 900px) {
    .projects-table {
        font-size: 0.875rem;
        min-width: 600px;
    }

    .projects-table th,
    .projects-table td {
        padding: 1rem 0.75rem;
    }
}

@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .projects-table {
        min-width: 700px;
    }
}

/* =========================
   TABELLE SKILLS (2 colonne)
   ========================= */

.skills-category {
    margin-bottom: 4rem;
}

.skills-category:last-child {
    margin-bottom: 0;
}

.skills-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    min-width: 500px;
}

.skills-table th {
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--color-accent) 15%, var(--color-surface)) 0%,
            color-mix(in srgb, var(--color-accent) 5%, var(--color-surface)) 100%);
    color: var(--color-text);
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 3px solid var(--color-accent);
    position: sticky;
    top: 0;
    z-index: 10;
}

.skills-table th:first-child {
    width: 65%;
}

.skills-table th:last-child {
    width: 35%;
    text-align: center;
}

.skills-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid color-mix(in srgb, var(--color-border) 40%, transparent);
}

.skills-table tbody tr:hover {
    background: color-mix(in srgb, var(--color-accent) 5%, var(--color-surface));
}

.skills-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile */
@media (max-width: 768px) {
    .skills-table {
        font-size: 0.875rem;
        min-width: 450px;
    }

    .skills-table th,
    .skills-table td {
        padding: 1rem 1rem;
    }
}

/* =========================
   CONTACT - LAYOUT E SOCIAL
   ========================= */

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 3rem;
}

.contact-card {
    background: var(--color-surface);
    border-radius: 1.5rem;
    padding: 2.5rem;
    border: 1px solid var(--color-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
}

.contact-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--color-text);
    margin-bottom: 2rem;
}

.social-card {
    display: flex;
    flex-direction: column;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    border-radius: 1rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    transition: all var(--transition-snappy);
    border: 2px solid transparent;
}

/* LINK BASE */
.contact-link:hover {
    transform: translateX(4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--color-primary-soft);
}

/* EMAIL - Verde */
.email-link {
    color: var(--color-accent);
}

.email-link:hover {
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    border-color: var(--color-accent);
}

/* TELEFONO - Blu */
.phone-link {
    color: var(--color-primary);
}

.phone-link:hover {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
    border-color: var(--color-primary);
}

/* LINKEDIN - ADATTIVO tema chiaro/scuro */
.linkedin-link {
    color: #0a66c2 !important;
    /* Blu LinkedIn ufficiale */
    /* border-color: color-mix(in srgb, #0a66c2 20%, transparent) !important; */
}

body.theme-dark .linkedin-link {
    color: #31a8ff !important;
    /* Blu più luminoso per dark */
    border-color: color-mix(in srgb, #31a8ff 30%, transparent) !important;
}

.linkedin-link:hover {
    background: linear-gradient(135deg,
            color-mix(in srgb, #0a66c2 10%, transparent),
            color-mix(in srgb, #0a66c2 5%, transparent)) !important;
    transform: translateX(4px) !important;
}

/* GITHUB - ADATTIVO */
.github-link {
    color: #333 !important;
}

body.theme-dark .github-link {
    color: #8b949e !important;
    /* Grigio GitHub dark */
}

.github-link:hover {
    background: color-mix(in srgb, #333 10%, transparent) !important;
}

body.theme-dark .github-link:hover {
    background: color-mix(in srgb, #8b949e 15%, transparent) !important;
}

.contact-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    flex-shrink: 0;
}

.contact-icon-linkedin,
.contact-icon-github {
    font-size: 1.5rem;
}

/* FORM MIGLIORATO */
.form-card .form-group {
    margin-bottom: 1.5rem;
}

.form-card label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.btn-full {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

/* AVAILABILITY CARD */
.availability-card {
    margin-top: 5rem;
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--color-primary-soft) 0%, var(--color-accent-soft) 100%);
    border-radius: 1.5rem;
    text-align: center;
}

body.theme-dark .availability-card {
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-primary) 20%, transparent) 0%,
            color-mix(in srgb, var(--color-accent) 20%, transparent) 100%);
}

.availability-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.availability-text {
    font-size: 1.125rem;
    max-width: 36rem;
    margin: 0 auto;
    color: var(--color-text-muted);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .contact-card {
        padding: 2rem;
    }

    .contact-link {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* =========================
   TABLER ICONS GLOBALI
   ========================= */

.ti {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* CONTACT - ICONE MIGLIORATE */
.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    border-radius: 1rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
}

/* NO BORDO social */
.linkedin-link,
.github-link {
    border: none !important;
}

.contact-link:hover {
    transform: translateX(8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
}

.contact-link i {
    width: 28px;
    height: 28px;
    font-size: 1.2em;
    font-variation-settings: "wght" 300;
}

/* EMAIL */
.email-link i {
    color: var(--color-accent);
}

.email-link:hover {
    background: color-mix(in srgb, var(--color-accent) 10%, transparent);
    border-color: var(--color-accent);
}

/* PHONE */
.phone-link i {
    color: var(--color-primary);
}

.phone-link:hover {
    background: color-mix(in srgb, var(--color-primary) 10%, transparent);
    border-color: var(--color-primary);
}

/* LINKEDIN - Brand colors */
.linkedin-link i {
    color: #0a66c2;
}

body.theme-dark .linkedin-link i {
    color: #31a8ff;
}

.linkedin-link:hover i {
    color: #ffffff;
}

.linkedin-link:hover {
    background: linear-gradient(135deg, #0a66c2, #1d4ed8);
    box-shadow: 0 12px 35px rgba(10, 102, 194, 0.4);
}

/* GITHUB - Brand colors */
.github-link i {
    color: #181818;
}

body.theme-dark .github-link i {
    color: #79c0ff;
}

.github-link:hover i {
    color: #ffffff;
}

.github-link:hover {
    background: linear-gradient(135deg, #181818, #333333);
    box-shadow: 0 12px 35px rgba(24, 24, 24, 0.4);
}

body.theme-dark .github-link:hover {
    background: linear-gradient(135deg, #79c0ff, #60a5fa);
    box-shadow: 0 12px 35px rgba(121, 192, 255, 0.4);
}

/* FORM ICONS */
.form-group label i {
    margin-right: 0.5rem;
    opacity: 0.7;
    width: 18px;
    height: 18px;
}

.btn-primary i {
    margin-right: 0.5rem;
    width: 20px;
    height: 20px;
}

/* Grid 7 card Activities */
@media (min-width: 1200px) {
    .grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

/* =========================
   PROGETTI CON CAROUSEL
   ========================= */

.project-item {
    margin-bottom: 5rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

.project-item:last-child {
    border-bottom: none;
}

.project-header {
    margin-bottom: 2rem;
}

.project-header h3 {
    font-size: 1.75rem;
    margin: 0 0 1rem;
}

.project-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.project-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.project-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    align-items: start;
}

.project-text p {
    font-size: 1.125rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.project-tech {
    background: color-mix(in srgb, var(--color-primary-soft) 20%, transparent);
    padding: 1.25rem;
    border-radius: 0.75rem;
    border-left: 4px solid var(--color-primary);
    font-size: 0.95rem;
    font-weight: 500;
}

/* CAROUSEL */
.project-carousel {
    position: relative;
}

.carousel-container {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.carousel-track {
    display: flex;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
    display: none;
    min-width: 100%;
}

.carousel-slide.active {
    display: block;
}

.carousel-slide img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-snappy);
    z-index: 20;
}

body.theme-dark .carousel-btn {
    background: rgba(15, 23, 42, 0.9);
}

.carousel-btn:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.prev {
    left: 1rem;
}

.next {
    right: 1rem;
}

.carousel-indicators {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
}

.indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all var(--transition-snappy);
}

.indicator.active {
    background: white;
    transform: scale(1.2);
}

body.theme-dark .indicator {
    background: rgba(15, 23, 42, 0.7);
}

body.theme-dark .indicator.active {
    background: #60a5fa;
}

/* CODE BLOCK */
.project-code {
    margin-top: 2rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    overflow: hidden;
}

.project-code pre {
    margin: 0;
    padding: 1.5rem;
    background: #0f172a;
    color: #f8fafc;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    overflow-x: auto;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .project-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .carousel-slide img {
        height: 250px;
    }
}

/* =========================
   CONTACT PAGE STYLES
   ========================= */

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-link:hover {
    transform: translateX(5px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    color: var(--color-primary);
}

.contact-link i {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

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

.form-group label {
    font-weight: 500;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.availability-card {
    margin-top: 4rem;
    text-align: center;
    background: var(--color-surface);
    border: 1px dashed var(--color-border);
    border-radius: 16px;
    padding: 2rem;
}

.availability-card h3 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}



/* =========================
   RICH FOOTER
   ========================= */

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--color-border);
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-tagline {
    color: var(--color-text-muted);
    line-height: 1.6;
    max-width: 320px;
    font-size: 0.95rem;
}

.footer-socials {
    display: flex;
    gap: 1rem;
}

.footer-socials a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-bg);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    transition: all var(--transition-snappy);
    text-decoration: none;
}

.footer-socials a:hover {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-hover);
}

.footer-links-group h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.footer-links-group ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-links-group a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
    font-size: 0.95rem;
}

.footer-links-group a:hover {
    color: var(--color-primary);
    transform: translateX(5px);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copy,
.footer-made-with {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin: 0;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* =========================
   ANIMATIONS (AOS)
   ========================= */
.fade-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s var(--transition-snappy), transform 0.8s var(--transition-snappy);
}

.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}



/* =========================
   SKILLS PAGE EXTRA
   ========================= */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.skills-card {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    padding: 2.25rem;
    border: 1px solid var(--color-border);
    transition: all var(--transition-snappy);
    box-shadow: var(--shadow-sm);
}

.skills-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-border);
}

.skills-card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--color-text);
}

.skills-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.skill-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.skill-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.skill-years {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--color-border);
}

.skill-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
}

.skill-progress {
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.4);
    transform-origin: left;
    animation: barFill 1.5s var(--transition-snappy) forwards;
}

@keyframes barFill {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

/* =========================
   PREMIUM TABLES
   ========================= */

.table-container {
    background: var(--color-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 2.5rem;
    transition: all var(--transition-snappy);
}

.table-container:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
    border-color: var(--color-primary-soft);
}

.premium-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.premium-table th {
    background: rgba(0, 0, 0, 0.02);
    padding: 1.25rem 1.5rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-primary);
    font-weight: 700;
    border-bottom: 1px solid var(--color-border);
}

body.theme-dark .premium-table th {
    background: rgba(255, 255, 255, 0.02);
}

.premium-table td {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.95rem;
    font-weight: 500;
}

.premium-table tr:last-child td {
    border-bottom: none;
}

.premium-table tbody tr {
    transition: background-color var(--transition-snappy);
}

.premium-table tbody tr:hover {
    background-color: var(--color-primary-soft);
}

/* =========================
   ABOUT PAGE SENIOR LAYOUT
   ========================= */
.about-bio {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-text-muted);
}

.about-bio strong {
    color: var(--color-text);
}

.blockquote-premium {
    border-left: 4px solid var(--color-primary);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--color-text);
    background: var(--color-primary-soft);
    padding: 1.5rem;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.personal-data-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.personal-data-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border);
}

.personal-data-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.personal-data-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* =========================
   ABOUT GRID RESPONSIVE
   ========================= */
.about-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 4rem;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
}