/* --- BASE E COLORI --- */
body {
    background-color: rgba(198, 175, 166, 0.847);
}

body {
    /* Il padding deve essere uguale o leggermente superiore all'altezza della navbar */
    padding-top: 50px; 
}


@media (max-width: 991px) {
    /* 1. Forza la navbar a mantenere una posizione relativa per fare da ancora */
    .navbar .container-fluid {
        display: flex;
        align-items: center;
        min-height: 56px; /* Altezza standard della navbar */
    }

    /* 2. Blocca il logo esattamente al centro della barra superiore */
    .absolute-center-mobile {
        position: absolute;
        left: 50%;
        top: 30px; /* Metà dell'altezza della barra chiusa */
        transform: translate(-50%, -50%);
        z-index: 1100; /* Valore altissimo per stare sopra tutto */
        margin: 0 !important;
        padding: 0 !important;
        width: 250px;
        text-align: center;
    }

    /* 3. Evita che l'immagine si sposti quando la tendina si apre */
    .absolute-center-mobile img {
        width: 250px !important;
        height: auto !important;
        display: block;
        max-width: none !important 
    }

    /* 4. Spazio per il menu a tendina */
    .navbar-collapse {
        margin-top: 8px; /* Sposta il menu a tendina sotto l'area del logo */
    }
}

.dropdown-menu .dropdown-item:active {
    background-color: #2b2b2b; /* Un grigio ancora un po' più scuro per il click */
    color: #ffffff;
}

.navbar-nav .nav-link:focus, 
.dropdown-item:focus {
    box-shadow: none; 
}

.btn-secondary {
    background-color: rgb(87, 68, 61);
    border-color: rgb(87, 68, 61);
}


footer {
    width: auto;
    padding: 10px;
    margin-top: 90px;
    text-align: center;
    z-index: 1000;
    background-color: rgb(248, 249, 250, 1);
    color: black;
    opacity: 0.8;
}

.text-center {
    padding: 30px;
    margin-top: 10px;
}

html {
    scroll-behavior: smooth;
}

section {
    scroll-margin-top: 70px;
}

/* --- CARD GENERALI --- */
.card {
    transition: all 0.3s ease-in-out;
    border: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    background-color: #fff;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

/* --- TIMELINE --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 20px;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: #ddd;
    top: 0;
    height: calc(100% - 50px);
    left: 20px;
}

.timeline-item {
    padding: 20px 0 20px 50px;
    position: relative;
    width: 100%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 10px;
    background-color: white;
    border: 3px solid #8b5e3c;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    transition: background-color 0.3s ease;
}

.card-interattiva-timeline {
    transition: all 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
}

.timeline-item:hover::after {
    background-color: #57443d;
}

.img-timeline {
    height: 150px;
    object-fit: cover;
}

/* --- SEZIONE LIBRI --- */
#libri {
    margin-top: -1px;
    background-color: #f8f9fa;
    padding-bottom: 50px;
}

#libri .card-img-top {
    height: 350px;
    object-fit: cover;
}

#libri .card-title {
    color: #57443d;
    font-size: 1rem;
}

/* --- SEZIONE FILM --- */
#film .card-img-top {
    height: 300px;
    object-fit: cover;
    cursor: pointer;
    border-radius: 10px;
    overflow: hidden;
}

/* --- DIVIDERS (WAVE E TRIANGOLO) --- */
.wave-container {
    line-height: 0;
    width: 100%;
}

.wave-container svg {
    display: block;
    width: 100%;
    height: 80px;
}

#formazione {
    background-color: rgba(198, 175, 166, 0.85);
    margin-top: -1px;
    padding-top: 50px;
}

.custom-shape-divider-sinistra {
    width: 100%;
    overflow: hidden;
    line-height: 0;
    background-color: #f8f9fa;
}

.custom-shape-divider-sinistra svg {
    display: block;
    width: calc(100% + 1.3px);
    height: 80px;
    transform: scaleX(-1);
}

/* --- BOTTONE TORNA SU E CV --- */
.btn-back-to-top-fixed {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    line-height: 42px;
    background-color: #57443d;
    color: #ffffff;
    text-align: center;
    border-radius: 50%;
    z-index: 9999;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    display: none; /* Gestito da JS */
}

.btn-cv {
    padding: 12px 30px;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 0;
    transition: all 0.4s ease;
    border: 1px solid #57443d;
    color: #57443d;
    position: relative;
    z-index: 5;
}

.btn-cv:hover {
    background-color: #57443d !important; 
    color: #fdfaf7 !important;          
    border-color: #57443d !important;
    text-decoration: none;   /* Rimuove eventuali sottolineature di default */
}

.img-cv-profile {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #57443d;
}

/* --- GESTIONE BIANCO E NERO (MEDIA QUERIES) --- */

/* 1. COMPORTAMENTO PER DESKTOP (Computer) */
@media (min-width: 992px) {
    /* Stato iniziale: Bianco e nero per poster, timeline e profilo */
    .card-img-top, .img-timeline, .img-cv-profile {
        filter: grayscale(100%);
        transition: all 0.5s ease;
    }

    /* Ritorno al colore (Generale) */
    .card:hover .card-img-top, 
    .timeline-item:hover .img-timeline, 
    .img-cv-profile:hover {
        filter: grayscale(0%);
    }
    
    /* --- EFFETTO OBLIQUO SOLO PER I POSTER --- */
    #film a .card-img-top:hover {
        filter: grayscale(0%);
        transform: scale(1.1) rotate(5deg) !important;
        z-index: 10;
        position: relative; /* Serve per far funzionare lo z-index e stare sopra gli altri */
        box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    }

    /* --- PROTEZIONE BANNER --- */
    /* Specifichiamo che l'immagine nel banner deve restare ferma e a colori */
    #film .text-center img {
        filter: grayscale(0%) !important;
        transform: none !important;
        transition: none !important;
    }
}

/* 2. COMPORTAMENTO PER MOBILE (Telefono) */
@media (max-width: 991px) {
    .card-img-top, .img-timeline, .img-cv-profile, #film img {
        filter: grayscale(0%) !important; /* Sempre a colori */
    }
    
    .timeline::after { left: 31px; height: calc(100% - 150px); }
    .timeline-item { padding-left: 70px; }
    .timeline-item::after { left: 23px; }
}

@media (max-width: 768px) {
    #formazione {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
    
    .text-center {
        padding: 15px; /* Riduciamo il padding del titolo */
    }
}

