/* ==========================================================================
   1. VARIABILI E RESET GLOBALE
   ========================================================================== */
:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-color: #f0f0f0;
    --text-muted: #a0a0a0;
    --primary-red: #d32f2f;
    --border-color: #333333;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* ==========================================================================
   2. HEADER E NAVIGAZIONE FISSA
   ========================================================================== */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #000000;
    border-bottom: 2px solid var(--primary-red);
    padding: 1rem 1.5rem;
    z-index: 9999;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    flex-wrap: wrap; /* Evita sovrapposizioni visive se lo schermo si stringe */
    gap: 0.8rem;
}

.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.nav-brand span {
    color: var(--primary-red);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-red);
}

/* ==========================================================================
   3. LAYOUT STRUTTURALE (MAIN E FOOTER)
   ========================================================================== */
main {
    max-width: 1100px;
    margin: 0 auto 2rem auto;
    padding: 130px 1.5rem 0 1.5rem; /* Margine superiore ampio per pulire l'header */
    min-height: 70vh;
    position: relative;
    z-index: 1;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

footer {
    text-align: center;
    padding: 2rem;
    background-color: #000000;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
}

/* ==========================================================================
   4. ADATTAMENTO PER SCHERMI MEDI E MOBILI (RESPONSIVE)
   ========================================================================== */
@media (max-width: 850px) {
    nav {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-links {
        gap: 0.8rem 1rem;
    }

    main {
        padding-top: 160px; /* Aumenta lo spazio superiore su schermi più piccoli */
    }

    .agenda-year,
    .books-section {
        scroll-margin-top: 170px;
    }
}

/* ==========================================================================
   5. INDICI E COMPENSAZIONE ANCORE (AGENDA / LIBRI)
   ========================================================================== */
.year-nav,
.books-nav {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.year-nav span,
.books-nav span {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    font-weight: 600;
}

.year-links,
.books-nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.year-links a,
.books-nav-links a {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.year-links a:hover,
.books-nav-links a:hover {
    background-color: var(--primary-red);
    color: #ffffff;
    border-color: var(--primary-red);
}

.agenda-year,
.books-section {
    scroll-margin-top: 140px;
}

/* ==========================================================================
   6. SEZIONI SPECIFICHE (BIOGRAFIA E LIBRI)
   ========================================================================== */
.bio-container,
.books-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1.5rem;
}

.bio-section h2,
.books-section h2 {
    font-size: 1.4rem;
    color: var(--primary-red);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.3rem;
}

.bio-section p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-color);
}

.bio-section a {
    color: var(--primary-red);
    text-decoration: underline;
}

.bio-section a:hover {
    color: #ffffff;
}

.books-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.books-list li {
    background-color: var(--card-bg);
    border-left: 3px solid var(--primary-red);
    padding: 0.8rem 1.2rem;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.book-year {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    min-width: 55px;
    text-align: center;
}

.book-details {
    font-size: 0.95rem;
    line-height: 1.4;
}

.book-badge {
    display: inline-block;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    background-color: rgba(204, 0, 0, 0.2);
    color: #ff6b6b;
    border: 1px solid var(--primary-red);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.translations-box {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    line-height: 1.5;
}

.translations-box p strong {
    color: var(--primary-red);
}

/* ==========================================================================
   7. GALLERIA
   ========================================================================== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.gallery-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: border-color 0.2s ease;
}

.gallery-card:hover {
    border-color: var(--primary-red);
}

.card-img-wrap {
    width: 100%;
    height: 250px;
    min-height: 250px;
    max-height: 250px;
    background-color: #000000;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

@media (hover: hover) and (pointer: fine) {
    .card-img-wrap img {
        transition: transform 0.4s ease;
    }

    .gallery-card:hover .card-img-wrap img {
        transform: scale(1.12);
    }
}

/* ==========================================================================
   8. FORM CONTATTI E PRIVACY
   ========================================================================== */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-width: 600px;
    margin-top: 1.5rem;
}

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

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

.form-group input,
.form-group textarea {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
}

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

button[type="submit"] {
    background-color: var(--primary-red);
    color: #ffffff;
    border: none;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button[type="submit"]:hover {
    background-color: #b71c1c;
}

.checkbox-group {
    margin: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--primary-red);
}

.form-disclaimer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.8rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.8rem;
}

/* ==========================================================================
   9. UTILITY (TORNA SU / IN COSTRUZIONE)
   ========================================================================== */
.construction {
    text-align: center;
    padding: 4rem 1rem;
    background-color: var(--card-bg);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    margin-top: 2rem;
}

.construction h2 {
    color: var(--primary-red);
    margin-bottom: 0.5rem;
}

.back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 45px;
    height: 45px;
    background-color: var(--primary-red);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.back-to-top:hover {
    background-color: #b30000;
    transform: translateY(-3px);
}
