:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden; /* Permette lo scroll verticale ma blocca l'orizzontale */
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background Animations */
.background-animation {
    position: fixed; /* Fixed per rimanere visibile durante lo scroll */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: -1; /* Messo in background reale */
}

.shape {
    position: absolute;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out;
}

.shape-1 {
    top: -10%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    background: var(--primary);
    border-radius: 50%;
    animation-delay: 0s;
}

.shape-2 {
    bottom: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    max-width: 700px;
    max-height: 700px;
    background: var(--secondary);
    border-radius: 50%;
    animation-delay: -5s;
}

.shape-3 {
    top: 40%;
    left: 40%;
    width: 40vw;
    height: 40vw;
    max-width: 500px;
    max-height: 500px;
    background: #8b5cf6;
    border-radius: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -50px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* Global Container */
.container {
    width: 100%;
    max-width: 1200px; /* Aumentato per schermi grandi */
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Navbar */
#navbar {
    width: 100%;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
}

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

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--text-main);
}

.nav-links a.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
}

.menu-toggle svg {
    width: 24px;
    height: 24px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Page Header */
.page-header {
    margin-top: 4rem;
    margin-bottom: 3rem;
    text-align: left;
    animation: slideUp 0.8s ease-out forwards;
}

.badge {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: 1px solid rgba(99, 102, 241, 0.3);
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -1px;
}

h1 span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr; /* Colonna principale più larga, laterale più stretta */
    gap: 2rem;
    margin-bottom: 4rem;
    opacity: 0;
    animation: slideUp 0.8s ease-out forwards 0.2s;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}

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

/* Profile Text */
.profile-text h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.profile-text p {
    color: var(--text-muted);
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.profile-text p:last-child {
    margin-bottom: 0;
}

/* Sidebar Column */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Achievement */
.achievement h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.achievement p {
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.achievement a {
    display: inline-block;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
    line-height: 1.4;
}

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

/* Contact Grid */
.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.contact-card img {
    width: 32px;
    height: 32px;
    filter: invert(100%);
    opacity: 0.8;
}

.contact-card h4 {
    color: var(--text-main);
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.contact-card span {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Footer */
footer {
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid var(--glass-border);
    padding: 2rem;
    margin-top: auto;
}

footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Utilities */
.text-center { text-align: center; }
.mb-3 { margin-bottom: 2rem; }
.mb-4 { margin-bottom: 4rem; }
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
    border: none;
    cursor: pointer;
    text-align: center;
    width: 100%;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    color: white;
}

/* Books and Projects Grid */
.books-grid, .projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.book-card {
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.book-cover {
    width: 100%;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    aspect-ratio: 3/4;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.05);
}

.book-content-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.book-info h3 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.book-subtitle {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.book-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.book-benefits h4 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.book-benefits ul {
    list-style-position: inside;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.book-benefits li::marker {
    color: var(--primary);
}

/* Benefits Grid (Why Choose) */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.benefit-item {
    text-align: center;
}

.benefit-item .icon-wrapper {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.benefit-item h3 {
    color: var(--text-main);
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.benefit-item p {
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 992px) {
    .layout-grid {
        grid-template-columns: 1fr; /* Una singola colonna su tablet e mobile */
    }
    
    .books-grid, .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    h1 {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .page-header {
        margin-top: 2rem;
    }

    h1 {
        font-size: 2.5rem;
    }
    
    .contact-grid {
        flex-direction: column;
    }
    
    .books-grid, .projects-grid {
        grid-template-columns: 1fr;
    }

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

    /* Stili responsive per Navbar */
    .menu-toggle {
        display: block;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        border-bottom: 1px solid var(--glass-border);
        padding: 1.5rem 2rem;
        gap: 1.5rem;
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-10px);
        transition: all 0.3s ease;
    }

    .nav-links.active {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
        transform: translateY(0);
    }
}
