/* ==========================================================================
   DIGGG PREMIUM STYLESHEET - Calibrated & Stable Architecture
   ========================================================================== */

/* IMPORTAZIONE FONT GOOGLE PREMIUM */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-blue: #364495;       /* Blu ufficiale DIGGG */
    --navy-dark: #0f172a;          /* Blu notte profondo */
    --gold-accent: #c5a880;        /* Oro antico */
    --bg-light: #f8fafc;           
    --white: #ffffff;
    --text-dark: #1e293b;          
    --text-muted: #57657a;         
    --border-color: #e2e8f0;       
    --transition-smooth: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* RESET E IMPOSTAZIONI DI BASE */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-dark);
    background-color: var(--white);
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ANIMAZIONI DI INGRESSO */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-in { animation: fadeIn 1s var(--transition-smooth) forwards; }
.animate-slide-up { animation: fadeInUp 1s var(--transition-smooth) forwards; }

/* HEADER CON EFFETTO GLASSMORPHISM E TOGGLE MOBILE IN CSS */
header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo img {
    max-height: 75px;
    width: auto;
    display: block;
}

/* Checkbox nascosto per controllare lo stato del menu */
.menu-toggle-checkbox {
    display: none;
}

/* Hamburger Icon in CSS Puro */
.menu-icon {
    display: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1100;
}

.menu-icon .navicon {
    background: var(--navy-dark);
    display: block;
    height: 2px;
    position: relative;
    transition: var(--transition-smooth);
    width: 24px;
}

.menu-icon .navicon::before,
.menu-icon .navicon::after {
    background: var(--navy-dark);
    content: '';
    display: block;
    height: 100%;
    position: absolute;
    transition: var(--transition-smooth);
    width: 100%;
}

.menu-icon .navicon::before { top: 7px; }
.menu-icon .navicon::after { top: -7px; }

/* Menu Navigazione Desktop */
nav ul {
    list-style: none;
    display: flex;
    gap: 32px;
    align-items: center;
}

nav ul li a {
    text-decoration: none;
    color: var(--navy-dark);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.82rem;
    transition: var(--transition-smooth);
    position: relative;
    padding: 6px 0;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1.5px;
    background-color: var(--primary-blue);
    transition: var(--transition-smooth);
}

nav ul li a:hover::after { width: 100%; }
nav ul li a:hover { color: var(--primary-blue); }

.nav-cta {
    background-color: var(--primary-blue);
    color: var(--white) !important;
    padding: 11px 24px;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid var(--primary-blue);
    box-shadow: 0 4px 12px rgba(54, 68, 149, 0.15);
}

.nav-cta::after { display: none !important; }
.nav-cta:hover {
    background-color: var(--white) !important;
    color: var(--primary-blue) !important;
    box-shadow: 0 4px 20px rgba(54, 68, 149, 0.25);
    transform: translateY(-1px);
}

/* HERO SECTION */
.hero {
    background: radial-gradient(circle at top right, rgba(54, 68, 149, 0.08) 0%, rgba(255, 255, 255, 0) 60%), var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    padding: 95px 24px;
    text-align: center;
}

.hero-content {
    max-width: 950px;
    margin: 0 auto;
}

.hero h1 {
    font-family: 'Playfair Display', serif;
    font-size: 3.4rem;
    color: var(--navy-dark);
    margin-bottom: 24px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.28rem;
    color: var(--text-muted);
    margin-bottom: 30px;
    font-weight: 400;
}

/* TITOLI SEZIONI */
.section-title-wrapper {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: var(--navy-dark);
    font-weight: 700;
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background-color: var(--gold-accent);
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.12rem;
    max-width: 750px;
    margin: 15px auto 0;
    font-weight: 400;
}

.section-wrapper {
    padding: 65px 24px;
    max-width: 1280px;
    margin: 0 auto;
}

/* GRIGLIE */
.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 35px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
    gap: 50px;
    align-items: center;
}

.card {
    background: var(--white);
    padding: 40px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 35px rgba(15, 23, 42, 0.05);
    border-color: rgba(54, 68, 149, 0.15);
}

.card h3 {
    font-family: 'Playfair Display', serif;
    color: var(--navy-dark);
    margin-bottom: 16px;
    font-size: 1.4rem;
}

.card p {
    color: var(--text-muted);
    font-size: 1.02rem;
    flex-grow: 1;
}

.featured-event-box {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.03);
    overflow: hidden;
    transition: var(--transition-smooth);
}

.featured-event-box:hover {
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
}

.event-badge {
    background-color: var(--navy-dark);
    color: var(--gold-accent);
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-radius: 3px;
    display: inline-block;
    margin-bottom: 24px;
}

.image-container {
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.img-fluid {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition-smooth);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 30px;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    height: 280px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.02);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.4) 0%, rgba(15, 23, 42, 0) 60%);
    opacity: 0;
    transition: var(--transition-smooth);
}

.gallery-item:hover img { transform: scale(1.04); }
.gallery-item:hover::after { opacity: 1; }

.cta-banner {
    background: linear-gradient(135deg, var(--navy-dark) 0%, #1a2544 100%);
    color: var(--white);
    padding: 70px 40px;
    text-align: center;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.cta-banner h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2.3rem;
    margin-bottom: 20px;
}

.cta-banner p { font-size: 1.15rem; }

/* TIMELINE ED ELEMENTO MAPPA 3D (VERSIONE STABILE E SICURA) */
.timeline-section {
    position: relative;
    background-color: #0f172a;
    color: var(--white);
    padding: 100px 24px; /* Ripristinato padding corretto per evitare sfasamenti */
    overflow: hidden;
}

/* Spostamento sicuro verso il basso e inclinazione senza sforare i limiti della pagina */
.map-bg-container {
    position: absolute;
    top: 62%; /* Abbassata delicatamente per fare da pavimento sotto le card */
    left: 50%;
    transform: translate(-50%, -35%) rotateX(65deg) rotateZ(-22deg) scale(1.35); /* Scala ridotta a 1.35 per stabilità totale */
    transform-style: preserve-3d;
    width: 100%;
    max-width: 800px;
    opacity: 0.35; /* Opacità aumentata per renderla chiaramente visibile */
    pointer-events: none;
    z-index: 1;
}

.map-3d {
    width: 100%;
    height: auto;
    display: block;
}

.timeline-viewport {
    position: relative;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
}

/* CONTENITORE DI SCROLL */
.timeline-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 35px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 30px 10px;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
    cursor: grab;
    position: relative;
    z-index: 20;
    width: 100%;
}

.timeline-scroll-container::-webkit-scrollbar {
    display: none;
}

/* PULSANTI DI CONTROLLO TIMELINE (FRECCE) */
.timeline-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    position: relative;
    z-index: 30;
}

.ctrl-btn {
    background: transparent;
    border: 1px solid var(--gold-accent);
    color: var(--gold-accent);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: var(--transition-smooth);
}

.ctrl-btn:hover {
    background: var(--gold-accent);
    color: var(--navy-dark);
    box-shadow: 0 4px 15px rgba(197, 168, 128, 0.3);
}

.scroll-indicator {
    text-align: center;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 15px;
}

.timeline-card {
    flex: 0 0 380px;
    scroll-snap-align: start;
    background: rgba(30, 41, 59, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 24px;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    user-select: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5); /* Ombra pulita e stabile */
}

.timeline-card:hover {
    transform: translateY(-8px);
    background: rgba(30, 41, 59, 0.95);
    border-color: var(--gold-accent);
    box-shadow: 0 20px 40px rgba(0,0,0,0.6);
}

.timeline-card .card-year {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--gold-accent);
    margin-bottom: 5px;
}

.timeline-card .card-date {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--white);
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: block;
}

.timeline-card .card-img-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 20px;
}

.timeline-card .card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.timeline-card h4 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--white);
    margin-bottom: 10px;
}

.timeline-card p {
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.6;
}

/* FOOTER */
footer {
    background-color: var(--navy-dark);
    color: #94a3b8;
    padding: 80px 24px 40px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.92rem;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 50px;
    margin-bottom: 40px;
}

.footer-col { flex: 1; min-width: 250px; }
.footer-col h4 {
    color: var(--white);
    font-size: 0.92rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
}

.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: var(--transition-smooth);
}
.footer-col ul li a:hover { color: var(--white); padding-left: 4px; }

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    color: #64748b;
}

.footer-bottom a {
    color: #64748b;
    text-decoration: none;
    transition: var(--transition-smooth);
}

/* ==========================================================================
   STRUTTURA RESPONSIVE - COMPORTAMENTO MOBILE E HAMBURGER
   ========================================================================== */

@media (max-width: 992px) {
    .grid-2 { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 768px) {
    .hero h1 { font-size: 2.2rem; }
    
    .footer-container { flex-direction: column; gap: 30px; }
    .footer-bottom { flex-direction: column; gap: 15px; text-align: center; }

    /* Mostra il tasto hamburger su mobile */
    .menu-icon {
        display: block;
    }

    /* Trasforma il menu in una barra laterale a scorrimento */
    nav {
        position: fixed;
        top: 0;
        right: -100%; /* Nasconde il menu fuori dallo schermo a destra */
        width: 80%;
        max-width: 320px;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: -10px 0 40px rgba(15, 23, 42, 0.15);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        transition: var(--transition-smooth);
        padding: 100px 30px;
        z-index: 1050;
    }

    nav ul {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 25px;
        width: 100%;
    }

    nav ul li { width: 100%; }
    nav ul li a {
        font-size: 1.05rem;
        display: block;
        width: 100%;
        padding: 8px 0;
    }

    .nav-cta {
        display: inline-block;
        text-align: center;
        margin-top: 15px;
    }

    /* Quando l'input nascosto è selezionato, fai slittare il menu all'interno dello schermo */
    .menu-toggle-checkbox:checked ~ nav {
        right: 0;
    }

    /* Animazione Hamburger in "X" */
    .menu-toggle-checkbox:checked ~ .menu-icon .navicon {
        background: transparent;
    }

    .menu-toggle-checkbox:checked ~ .menu-icon .navicon::before {
        transform: rotate(-45deg);
        top: 0;
    }

    .menu-toggle-checkbox:checked ~ .menu-icon .navicon::after {
        transform: rotate(45deg);
        top: 0;
    }
}

@media (max-width: 576px) {
    .timeline-card {
        flex: 0 0 295px; /* Adatta le dimensioni su schermi molto stretti */
    }
}