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

@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&display=swap');

body {
    background-color: #F5F5F5;
    font-family: 'Open Sans', sans-serif;
    line-height: 1.8;
    color: #333;
    font-size: 1.4rem;
}

.top-nav {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    padding: 2rem 2rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    border-bottom: 1px solid rgba(0, 102, 204, 0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    align-items: center;
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: #333;
    margin: 5px 0;
    transition: 0.3s ease;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.nav-menu {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.top-nav a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.8rem 1.2rem;
    letter-spacing: 0.5px;
    border-radius: 5px;
}

.top-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: #1a1a1a;
    transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-radius: 2px;
}

.top-nav a:hover {
    color: #0066cc;
    transform: translateY(-2px);
}

.top-nav a:hover::after {
    width: 100%;
}

.cv-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.2rem !important;
    color: #333 !important;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.cv-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.cv-link:hover {
    color: #0066cc;
    transform: translateY(-2px);
}

.cv-link:hover::after {
    width: 100%;
}

main {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.home-container {
    display: flex;
    align-items: center;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-image {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #0066cc;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.home-text {
    flex: 1;
    min-width: 300px;
}

section {
    margin: 6rem 0;
    padding: 2.5rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    opacity: 0.3;
    transition: opacity 0.6s ease-out, transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

section:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 102, 204, 0.25);
}

section.in-view {
    opacity: 1;
}

section h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 2.8rem;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
}

.greeting {
    font-size: 4.5rem;
    color: #333;
    margin-bottom: 1.5rem;
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
}

.education {
    font-size: 1.5rem;
    color: #666;
    font-weight: bold;
    margin-bottom: 1rem;
}

.education-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.polito-logo {
    width: 180px;
    height: 180px;
    object-fit: contain;
}

.cert-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.cert-badge {
    width: 180px;
    height: 180px;
    object-fit: contain;
    background-color: #141d2b;
    padding: 15px;
    border-radius: 10px;
}

.cert-item a {
    color: #0066cc;
    text-decoration: none;
}

.cert-item a:hover {
    text-decoration: underline;
}

.experience-item {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.experience-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

.cert-validation {
    text-align: center;
    margin-top: 2rem;
}

.validation-btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: linear-gradient(135deg, #0066cc, #004499);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 102, 204, 0.3);
    border: 2px solid transparent;
}

.validation-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 102, 204, 0.5);
    background: linear-gradient(135deg, #004499, #003366);
    text-decoration: none;
}

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

.project-logo {
    width: 100%;
    max-width: 400px;
    height: auto;
    object-fit: contain;
    margin: 1rem 0;
    display: block;
}

.project-content {
    width: 100%;
}

.project-title {
    font-size: 2.4rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-family: 'Open Sans', sans-serif;
}

.project-date {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-style: italic;
}

.project-description {
    line-height: 1.8;
    margin-bottom: 1rem;
    text-align: justify;
}

.github-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
    padding: 0.5rem 1rem;
    border: 2px solid #0066cc;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.github-link:hover {
    background-color: #0066cc;
    color: white;
    text-decoration: none;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.contact-item {
    font-size: 1.2rem;
}

.contact-item a {
    color: #0066cc;
    text-decoration: none;
}

.contact-item a:hover {
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.social-link:hover {
    color: #0066cc;
}

.social-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

/* RESPONSIVE DESIGN */

/* Tablets (768px and below) */
@media (max-width: 768px) {
    body {
        font-size: 1.1rem;
    }

    .top-nav {
        gap: 1rem;
        padding: 1rem;
        justify-content: space-between;
    }

    .hamburger {
        display: none;
    }

    .nav-menu {
        gap: 1rem;
        justify-content: space-between;
    }

    .top-nav a {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .cv-link {
        padding: 0.6rem 0.8rem !important;
    }

    .cv-icon {
        width: 16px;
        height: 16px;
    }

    main {
        padding: 0 0.5rem;
        margin: 1rem auto;
    }

    section {
        margin: 3rem 0;
        padding: 1.5rem;
    }

    section h2 {
        font-size: 2rem;
    }

    .greeting {
        font-size: 2.8rem;
    }

    .education {
        font-size: 1.2rem;
    }

    .home-container {
        gap: 1.5rem;
    }

    .profile-image {
        width: 180px;
        height: 180px;
    }

    .home-text {
        min-width: 250px;
        flex: 0 1 100%;
        text-align: center;
    }

    .education-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    .polito-logo {
        width: 120px;
        height: 120px;
    }

    .cert-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .cert-badge {
        width: 120px;
        height: 120px;
    }

    .experience-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .experience-logo {
        width: 80px;
        height: 80px;
    }

    .project-logo {
        max-width: 100%;
    }

    .project-title {
        font-size: 1.8rem;
    }

    .social-links {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .social-link {
        font-size: 1rem;
    }

    .social-icon {
        width: 24px;
        height: 24px;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    body {
        font-size: 0.95rem;
    }

    .top-nav {
        flex-direction: row;
        gap: 0.5rem;
        padding: 0.75rem;
        align-items: center;
        justify-content: space-between;
    }

    .hamburger {
        display: flex;
        order: -1;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        flex-direction: column;
        gap: 0;
        padding: 0;
        border-bottom: 1px solid rgba(0, 102, 204, 0.15);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        align-items: stretch;
    }

    .nav-menu.active {
        max-height: 500px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    }

    .nav-menu a {
        padding: 1rem;
        text-align: center;
        border-bottom: 1px solid #eee;
        width: 100%;
        display: block;
    }

    .nav-menu a:last-child {
        border-bottom: none;
    }

    .nav-menu .cv-link {
        justify-content: center;
        border-bottom: none;
    }

    .top-nav a {
        padding: 0.5rem;
        font-size: 0.85rem;
        text-align: center;
        flex: 1;
    }

    .cv-link {
        padding: 0.5rem !important;
        justify-content: center;
    }

    .cv-icon {
        width: 14px;
        height: 14px;
    }

    main {
        padding: 0;
        margin: 0.5rem auto;
        max-width: 100%;
    }

    section {
        margin: 2rem 0;
        padding: 1rem;
        border-radius: 0;
    }

    section h2 {
        font-size: 1.6rem;
        margin-bottom: 1rem;
    }

    .greeting {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }

    .education {
        font-size: 0.95rem;
    }

    .home-container {
        gap: 1rem;
    }

    .profile-image {
        width: 150px;
        height: 150px;
    }

    .home-text {
        min-width: 100%;
        text-align: center;
    }

    .education-item {
        gap: 0.75rem;
    }

    .polito-logo {
        width: 100px;
        height: 100px;
    }

    .cert-item {
        margin-bottom: 1.5rem;
    }

    .cert-badge {
        width: 100px;
        height: 100px;
    }

    .experience-item {
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .experience-logo {
        width: 70px;
        height: 70px;
    }

    .project-title {
        font-size: 1.4rem;
    }

    .project-date {
        font-size: 0.9rem;
    }

    .project-description {
        text-align: left;
        font-size: 0.95rem;
    }

    .github-link {
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .validation-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .contact-item {
        font-size: 0.95rem;
    }

    .social-links {
        flex-direction: column;
        gap: 0.75rem;
    }

    .social-link {
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
        padding: 0.5rem;
    }

    .social-icon {
        width: 20px;
        height: 20px;
    }
}
