/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-section: #1a1a1a;
    --text-primary: #e8e8e8; /* Migliorato contrasto per WCAG AA */
    --text-secondary: #b0b0b0; /* Migliorato contrasto per WCAG AA */
    --accent-color: #FAF0E6;
    --accent-hover: #FFF8F0;
    --border-color: #2a2a2a;
    --java-orange: #f89820;
    --spring-green: #6db33f;
    --focus-outline: #FAF0E6; /* Colore per focus visible */
}

html {
    scroll-behavior: smooth;
    /* Nascondi scrollbar ma mantieni lo scroll verticale */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE e Edge */
    /* Blocca completamente lo scroll orizzontale */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

html::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(-45deg, #000000, #050505, #000000, #0a0a0a);
    background-size: 400% 400%;
    background-attachment: fixed;
    animation: gradientShift 20s ease infinite;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    /* Nascondi scrollbar ma mantieni lo scroll verticale */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE e Edge */
    /* Blocca completamente lo scroll orizzontale */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
}

body::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0.1rem 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.nav-logo a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-logo a:hover {
    color: var(--accent-hover);
}

.nav-logo-img {
    height: 5rem;
    width: auto;
    filter: brightness(0) invert(1);
    transition: opacity 0.3s ease;
}

.nav-logo a:hover .nav-logo-img {
    opacity: 0.8;
}

.nav-menu {
    font-family: 'Poiret One', cursive;
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s ease;
    position: relative;
}

.nav-menu a:hover {
    color: var(--accent-color);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after,
.nav-menu a:focus-visible::after {
    width: 100%;
}

.nav-menu a:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 2px;
}

/* Hamburger Menu Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 5px;
    z-index: 1001;
    position: relative;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.nav-toggle:hover span,
.nav-toggle:focus-visible span {
    background-color: var(--accent-color);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 4px;
    border-radius: 4px;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Language Selector */
.language-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.lang-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: 'Poiret One', cursive;
    min-width: 40px;
}

.lang-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(250, 240, 230, 0.1);
}

.lang-btn.active {
    background: var(--accent-color);
    color: var(--bg-primary);
    border-color: var(--accent-color);
    font-weight: 600;
}

.lang-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
    padding: 8rem 0;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.3s forwards;
}

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

.header-name {
    font-family: 'Megrim', cursive;
    font-size: 5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: #E8E8E8;
    letter-spacing: 2px;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.5s forwards;
}

.header-role {
    font-family: 'Grandiflora One', serif;
    font-size: 2rem;
    font-weight: 400;
    color: #E8E8E8;
    margin-bottom: 3rem;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.7s forwards;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.download-btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.download-btn:hover {
    background: linear-gradient(135deg, #050505 0%, #0a0a0a 50%, #050505 100%);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.25), 0 4px 20px rgba(250, 240, 230, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.download-btn:hover svg {
    transform: translateY(2px);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
    border-radius: 8px;
}

.header-contacts {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    opacity: 0;
    animation: fadeInUp 1s ease-out 0.9s forwards;
}

.contact-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 0 2px 8px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.contact-icon svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.contact-icon:hover {
    color: var(--accent-color);
    background: linear-gradient(135deg, #050505 0%, #0a0a0a 50%, #050505 100%);
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.25), 0 4px 20px rgba(250, 240, 230, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.contact-icon:hover svg,
.contact-icon:focus-visible svg {
    transform: scale(1.1);
}

.contact-icon:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
    border-radius: 50%;
}

/* Sections */
.section {
    padding: 4rem 0;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section.animate {
    opacity: 1;
    transform: translateY(0);
}

.section:last-of-type {
    border-bottom: none;
}

.section-title {
    font-family: 'Grandiflora One', serif;
    font-size: 2rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out 0.2s, transform 0.8s ease-out 0.2s;
}

.section.animate .section-title {
    opacity: 1;
    transform: translateY(0);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--accent-color);
}

.section-content {
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out 0.4s, transform 0.8s ease-out 0.4s;
}

.section.animate .section-content {
    opacity: 1;
    transform: translateY(0);
}

/* About Section */
#about p {
    font-family: 'Grandiflora One', serif;
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 800px;
}

/* Education Section */
.education-item {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section.animate .education-item {
    opacity: 1;
    transform: translateY(0);
}

.section.animate .education-item:nth-child(1) {
    transition-delay: 0.1s;
}

.section.animate .education-item:nth-child(2) {
    transition-delay: 0.3s;
}

.education-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.education-header {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}

.education-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.education-logo:hover {
    opacity: 1;
}

.education-info {
    flex: 1;
}

.education-degree {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.education-institution {
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.3rem;
}

.education-period {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.education-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.project-card {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(250, 240, 230, 0.1), transparent);
    transition: left 0.5s ease;
}

.project-card:hover::before {
    left: 100%;
}

.section.animate .project-card {
    opacity: 1;
    transform: translateY(0);
}

.section.animate .project-card:nth-child(1) { transition-delay: 0.1s; }
.section.animate .project-card:nth-child(2) { transition-delay: 0.2s; }
.section.animate .project-card:nth-child(3) { transition-delay: 0.3s; }
.section.animate .project-card:nth-child(4) { transition-delay: 0.4s; }
.section.animate .project-card:nth-child(5) { transition-delay: 0.5s; }
.section.animate .project-card:nth-child(6) { transition-delay: 0.6s; }

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 30px rgba(250, 240, 230, 0.2);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.project-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.project-name a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.project-name a:hover,
.project-name a:focus-visible {
    color: var(--accent-color);
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 2px;
}

.project-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.project-stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.project-stat svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
    min-height: 3em;
}

.project-languages {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.language-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.language-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.project-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.project-updated {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.project-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.3s ease;
}

.project-link:hover,
.project-link:focus-visible {
    color: var(--accent-hover);
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 2px;
}

.project-link svg {
    width: 16px;
    height: 16px;
}

.projects-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    grid-column: 1 / -1;
}

.projects-error {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    grid-column: 1 / -1;
    background: rgba(250, 240, 230, 0.1);
    border: 1px solid rgba(250, 240, 230, 0.3);
    border-radius: 8px;
    margin: 1rem 0;
}

.projects-error p {
    margin: 0.5rem 0;
}

.projects-error a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.projects-error a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.error-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.projects-warning {
    text-align: center;
    color: #fbbf24;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
}

.projects-warning p {
    margin: 0.25rem 0;
}

.warning-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .project-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .project-stats {
        align-self: flex-start;
    }
}

/* Terminal Section */
.terminal-container {
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out 0.4s, transform 0.8s ease-out 0.4s;
}

.section.animate .terminal-container {
    opacity: 1;
    transform: translateY(0);
}

.terminal {
    background: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(0, 255, 0, 0.1),
                0 20px 60px rgba(45, 45, 45, 0.4),
                0 30px 80px rgba(45, 45, 45, 0.3);
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.terminal-header {
    background: #2d2d2d;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #000;
}

.terminal-buttons {
    display: flex;
    gap: 0.5rem;
}

.terminal-btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.terminal-btn:hover {
    opacity: 0.8;
}

.terminal-btn-close {
    background: #ff5f57;
}

.terminal-btn-minimize {
    background: #ffbd2e;
}

.terminal-btn-maximize {
    background: #28c840;
}

.terminal-title {
    color: #a0a0a0;
    font-size: 0.85rem;
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.terminal-body {
    background: #000;
    color: #00ff00;
    padding: 1.5rem;
    height: 400px;
    font-size: 0.9rem;
    line-height: 1.8;
    overflow-x: auto;
    overflow-y: auto;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Courier New', monospace;
}

/* Miglioramento contrasto per terminale */
.terminal-output {
    color: #b0b0b0; /* Migliorato da #a0a0a0 per migliore leggibilità */
}

/* Scrollbar styling per terminale */
.terminal-body::-webkit-scrollbar {
    width: 8px;
}

.terminal-body::-webkit-scrollbar-track {
    background: #0a0a0a;
}

.terminal-body::-webkit-scrollbar-thumb {
    background: #FAF0E6;
    border-radius: 4px;
}

.terminal-body::-webkit-scrollbar-thumb:hover {
    background: #FFF8F0;
}

/* Git log colorazione */
.git-pipe {
    color: #ff0000;
}

.git-commit {
    color: #ffff00;
}

.git-tag {
    color: #00ffff;
}

.git-head {
    color: #ff00ff;
}

.terminal-line {
    margin-bottom: 0.8rem;
    opacity: 0;
    animation: fadeInTerminal 0.3s ease-in forwards;
}

.terminal-line.visible {
    opacity: 1;
}

.terminal-prompt {
    color: #00ff00;
    font-weight: 500;
}

.terminal-command {
    color: #ffffff;
}

.terminal-output {
    color: #a0a0a0;
    margin-left: 0;
    white-space: pre-wrap;
    margin-top: 0.5rem;
    display: block;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background: #00ff00;
    animation: blink 1s infinite;
    margin-left: 2px;
    vertical-align: middle;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

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

/* Footer */
.footer {
    background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
    padding: 1rem 0 1rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer .section-title {
    margin-top: 0;
    margin-bottom: 0;
    padding-bottom: 0;
}

.footer-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    position: relative;
    padding-bottom: 1rem;
}

.footer-logo {
    height: 10rem;
    width: auto;
    filter: brightness(0) invert(1);
    display: block;
    margin: 0;
}

.footer-contacts {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.footer-contacts .contact-icon {
    width: 44px;
    height: 44px;
}

.footer-info {
    margin: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.8;
}

.footer-info p {
    margin-bottom: 0.5rem;
}

.footer-info strong {
    color: var(--text-primary);
}

.footer-copyright {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Animazioni più fluide - Miglioramenti generali */
.section {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-title {
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s, 
                transform 1s cubic-bezier(0.4, 0, 0.2, 1) 0.2s;
}

.section-content {
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1) 0.4s, 
                transform 1s cubic-bezier(0.4, 0, 0.2, 1) 0.4s;
}

/* Animazioni fluide per le card dei progetti */
.project-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animazioni fluide per i contatti */
.contact-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.contact-icon:hover {
    transform: translateY(-5px) scale(1.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animazione fluida per il pulsante download */
.download-btn {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.download-btn:hover {
    transform: translateY(-3px) scale(1.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animazione fluida per il terminale */
.terminal-line {
    animation: fadeInTerminal 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

/* Animazione fluida per il header */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth scroll migliorato */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Animazione per il menu di navigazione */
.nav-menu a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-menu a::after {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animazione per le education items */
.education-item {
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Effetto parallax leggero per le sezioni */
@media (prefers-reduced-motion: no-preference) {
    .section {
        will-change: transform, opacity;
    }
    
    .project-card {
        will-change: transform;
    }
}

/* Prefers Reduced Motion - Accessibilità */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .scroll-progress {
        animation: none !important;
    }

    .particle {
        animation: none !important;
    }

    .contact-icon {
        animation: none !important;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-name {
        font-size: 2rem;
    }

    .header-role {
        font-size: 1.2rem;
    }

    /* Hamburger Menu */
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: linear-gradient(135deg, #000000 0%, #050505 50%, #000000 100%);
        flex-direction: column;
        padding: 5rem 2rem 2rem;
        gap: 1.5rem;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-menu.active {
        right: 0;
    }

    /* Overlay per menu mobile */
    .nav-menu.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
        font-size: 1rem;
    }
    
    .language-selector {
        gap: 0.3rem;
        margin-top: auto;
        padding-top: 2rem;
    }
    
    .lang-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
        min-width: 35px;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .experience-role,
    .education-degree {
        font-size: 1.1rem;
    }

    .experience-period {
        display: block;
        margin-left: 0;
        margin-top: 0.3rem;
    }

}

@media (max-width: 480px) {
    .nav-menu {
        width: 100%;
        right: -100%;
    }

    .header {
        padding: 2rem 0;
    }

    .section {
        padding: 2.5rem 0;
    }
}

/* PDF Styles */
@media print {
    .navbar,
    .download-btn,
    .terminal-container,
    .projects-grid {
        display: none !important;
    }
    
    body {
        background: #fff;
        color: #000;
    }
    
    .section {
        page-break-inside: avoid;
        padding: 1.5rem 0;
    }
}

.pdf-mode {
    background: #fff !important;
    color: #000 !important;
}

.pdf-mode .navbar,
.pdf-mode .download-btn {
    display: none !important;
}

.pdf-mode .header {
    padding: 2rem 0;
}

.pdf-mode .section {
    padding: 1.5rem 0;
    border-bottom: 1px solid #ddd;
}

.pdf-mode .terminal-container {
    display: none !important;
}

.pdf-mode .projects-grid {
    display: none !important;
}

/* ============================================
   ANIMAZIONI AVANZATE
   ============================================ */

/* Scroll Progress Bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover), var(--accent-color));
    background-size: 200% 100%;
    z-index: 10000;
    transition: width 0.1s ease-out;
    box-shadow: 0 0 10px rgba(250, 240, 230, 0.5);
    animation: progressShimmer 2s infinite;
}

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

/* Particelle Animate nello Sfondo */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(250, 240, 230, 0.4);
    border-radius: 50%;
    animation: float 8s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% { 
        transform: translate(30px, -30px) scale(1.5);
        opacity: 0.6;
    }
    50% { 
        transform: translate(-20px, -60px) scale(1.2);
        opacity: 0.8;
    }
    75% { 
        transform: translate(-30px, 20px) scale(1.3);
        opacity: 0.5;
    }
}

/* Animated Gradient Background - Keyframes */
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Pulse Effect per Icone Contatti */
.contact-icon {
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), 
                    0 2px 8px rgba(255, 255, 255, 0.1), 
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    50% { 
        box-shadow: 0 0 30px rgba(250, 240, 230, 0.3), 
                    0 4px 20px rgba(250, 240, 230, 0.2), 
                    inset 0 1px 0 rgba(255, 255, 255, 0.15);
    }
}

.contact-icon:hover {
    animation: none;
}

/* Skeleton Loading per Progetti */
.project-skeleton {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    opacity: 0;
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.project-skeleton.visible {
    opacity: 1;
}

@keyframes skeleton-pulse {
    0%, 100% { 
        opacity: 0.6;
        background: var(--bg-section);
    }
    50% { 
        opacity: 0.3;
        background: rgba(255, 255, 255, 0.05);
    }
}

.skeleton-line {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 1rem;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-line:first-child {
    width: 60%;
}

.skeleton-line:nth-child(2) {
    width: 100%;
}

.skeleton-line:nth-child(3) {
    width: 80%;
}

@keyframes skeleton-shimmer {
    0% { opacity: 0.3; }
    50% { opacity: 0.7; }
    100% { opacity: 0.3; }
}

/* Parallax Effect per Header */
.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(250, 240, 230, 0.08) 0%, transparent 70%);
    animation: rotate-slow 25s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.header > .container {
    position: relative;
    z-index: 1;
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Magnetic Effect Base */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glitch Effect per Nome Header (opzionale, attivabile via hover) */
.header-name {
    position: relative;
}

@keyframes glitch-subtle {
    0%, 100% { transform: translate(0); }
    10% { transform: translate(-1px, 1px); }
    20% { transform: translate(1px, -1px); }
    30% { transform: translate(-1px, 0); }
    40% { transform: translate(1px, 1px); }
    50% { transform: translate(-1px, -1px); }
    60% { transform: translate(0, 1px); }
    70% { transform: translate(1px, 0); }
    80% { transform: translate(-1px, -1px); }
    90% { transform: translate(1px, 1px); }
}

/* Text Reveal Animato */
.section-title {
    position: relative;
}

/* Fade in più fluido per elementi in scroll */
@keyframes fadeInSmooth {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Animazione per navbar quando scroll down/up */
.navbar.scrolled {
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

/* Miglioramento hover per project cards con effetto ripple */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(250, 240, 230, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: 0;
}

.project-card:hover::after {
    width: 300px;
    height: 300px;
}

.project-card > * {
    position: relative;
    z-index: 1;
}

/* Skills Network Graph */
.skills-network-container {
    position: relative;
    width: 100%;
    max-width: 1800px;
    height: 100vh;
    max-height: 1200px;
    min-height: 1000px;
    margin: 0.5rem auto;
    background: transparent;
    padding: 2rem;
    overflow: hidden;
}

/* Il titolo rimane con max-width standard, solo il contenuto è più largo */
#skills > .container:first-of-type {
    max-width: 900px;
    padding: 0 20px;
}

/* Riduci margini tra titolo e componente skills */
#skills.section {
    padding-top: 1rem;
    padding-bottom: 0;
}

#skills > .container:last-of-type {
    max-width: 1800px;
    padding: 0 20px;
}

#skills .section-title {
    margin-bottom: 2rem;
    padding-bottom: 0 !important;
}

#skills .section-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

#skills .skills-network-container {
    margin-top: -2rem !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Riduci il padding interno dell'SVG */
#skills-network-2d {
    margin-top: -50px;
}

#skills-network-2d {
    width: 100%;
    height: 100%;
    display: block;
}

#skills-network-2d .skill-node {
    cursor: pointer;
}

#skills-network-2d .skill-node circle {
    transition: all 0.3s ease;
}

#skills-network-2d .skill-node:hover circle {
    filter: drop-shadow(0 0 8px rgba(250, 240, 230, 0.6));
}

#skills-network-2d .skill-link {
    transition: stroke-opacity 0.3s ease;
}

/* Nodi del grafo */
.skill-node {
    cursor: pointer;
    transition: all 0.3s ease;
}

.skill-node circle {
    fill: var(--bg-primary);
    stroke: var(--accent-color);
    stroke-width: 2px;
    transition: all 0.3s ease;
}

.skill-node:hover circle {
    stroke-width: 3px;
    filter: drop-shadow(0 0 8px rgba(250, 240, 230, 0.6));
}

.skill-node text {
    fill: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    text-anchor: middle;
    dominant-baseline: middle;
}

.skill-node.center circle {
    fill: var(--accent-color);
    stroke: var(--accent-hover);
    stroke-width: 3px;
    r: 60;
}

.skill-node.center text {
    fill: var(--bg-primary);
    font-size: 16px;
    font-weight: 600;
}

.skill-node.category circle {
    fill: var(--accent-color);
    stroke: var(--accent-hover);
    stroke-width: 3px;
    r: 50;
}

.skill-node.category text {
    fill: var(--bg-primary);
    font-size: 14px;
    font-weight: 600;
}

/* Collegamenti */
.skill-link {
    stroke: var(--border-color);
    stroke-width: 2px;
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
}

.skill-node:hover ~ .skill-link,
.skill-link:hover {
    stroke: var(--accent-color);
    stroke-opacity: 1;
    stroke-width: 3px;
}

/* Pannello dettagli */
.skill-details-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 700px;
    max-width: 90vw;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.skill-details-panel.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    pointer-events: none;
}

.skill-details-panel:not(.hidden) {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

.close-panel {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.close-panel:hover,
.close-panel:focus-visible {
    background: var(--bg-section);
    color: var(--text-primary);
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-icon {
    width: 32px;
    height: 32px;
    filter: brightness(0) invert(1);
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.panel-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.panel-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: none;
}

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

.meta-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.meta-value {
    color: var(--text-primary);
    font-weight: 400;
    font-size: 0.85rem;
}

/* Lista items categoria */
.panel-items-list {
    display: none;
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
}

.category-item {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    transition: all 0.2s ease;
}

.category-item:hover {
    background: rgba(250, 240, 230, 0.03);
}

.category-item-icon {
    flex-shrink: 0;
}

.category-item-content {
    flex: 1;
}

.category-item-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.category-item-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0 0 0.25rem 0;
    line-height: 1.4;
}

.category-item-experience {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

/* Scrollbar per il pannello */
.skill-details-panel::-webkit-scrollbar {
    width: 6px;
}

.skill-details-panel::-webkit-scrollbar-track {
    background: var(--bg-section);
}

.skill-details-panel::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 3px;
}

/* Lista mobile delle skills - nascosta su desktop */
.skills-mobile-list {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .skills-network-container {
        display: none; /* Nascondi il container del grafo su mobile */
    }
    
    /* Container per la lista mobile delle skills */
    .skills-mobile-list {
        display: block;
        padding: 1rem 0;
    }
    
    .mobile-skill-category {
        margin-bottom: 2rem;
    }
    
    .mobile-category-title {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 2px solid var(--accent-color);
    }
    
    .mobile-skill-item {
        display: flex;
        align-items: flex-start;
        padding: 1rem;
        margin-bottom: 0.75rem;
        background: rgba(250, 240, 230, 0.03);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .mobile-skill-item:hover {
        background: rgba(250, 240, 230, 0.05);
        border-color: var(--accent-color);
    }
    
    .mobile-skill-icon {
        width: 32px;
        height: 32px;
        margin-right: 0.75rem;
        flex-shrink: 0;
        filter: brightness(0) invert(1);
    }
    
    .mobile-skill-content {
        flex: 1;
    }
    
    .mobile-skill-name {
        font-size: 1rem;
        font-weight: 500;
        color: var(--text-primary);
        margin: 0 0 0.25rem 0;
    }
    
    .mobile-skill-description {
        font-size: 0.875rem;
        color: var(--text-secondary);
        margin: 0 0 0.5rem 0;
        line-height: 1.5;
    }
    
    .mobile-skill-experience {
        display: inline-block;
        font-size: 0.8rem;
        color: var(--accent-color);
        background: rgba(250, 240, 230, 0.1);
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
    }
    
    .skill-details-panel {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.9);
        width: 90%;
        max-width: 400px;
        right: auto;
    }
    
    .skill-details-panel.hidden {
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
    }
    
    .skill-details-panel:not(.hidden) {
        transform: translate(-50%, -50%) scale(1);
    }
}

