.custom-timeline-container {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 0;
    font-family: inherit;
}

/* --- CERCHIO DI SEPARAZIONE PER ANNO --- */
.tl-year-divider {
    position: relative;
    width: 100%;
    text-align: center;
    margin: 35px 0;
    z-index: 5;
    clear: both;
}
.tl-year-divider span {
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 54px;
    background-color: #71828a;
    color: #fff;
    font-weight: bold;
    font-size: 1.1em;
    border-radius: 50%;
    border: 4px solid #c5a059;
    box-shadow: 0 0 0 4px #fff, 0 3px 8px rgba(0,0,0,0.15);
}

/* --- ANIMAZIONE ALLO SCROLL --- */
@keyframes tlibFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tl-item {
    position: relative;
    background: inherit;
    width: 50%;
    padding: 20px 30px;
    box-sizing: border-box;
    opacity: 0;
    animation: tlibFadeInUp 0.6s ease forwards;
    z-index: 2; /* I box stanno sopra la linea ma sotto l'icona */
}

.tl-item:nth-child(odd) { animation-delay: 0.1s; }
.tl-item:nth-child(even) { animation-delay: 0.2s; }

/* --- LAYOUT VERTICALE --- */
.timeline-vertical::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: #c5a059;
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
    z-index: 1; /* Linea centrale di fondo */
}
.timeline-vertical .tl-item.left {
    left: 0;
    text-align: right;
}
.timeline-vertical .tl-item.right {
    left: 50%;
    text-align: left;
}

/* PALLINO ICONA: FORZATURA TOTALE IN PRIMO PIANO SOPRA LA LINEA */
.timeline-vertical .tl-icon {
    width: 36px;
    height: 36px;
    right: -18px;
    background-color: #ffffff !important;
    border: 3px solid #c5a059;
    top: 25px;
    border-radius: 50%;
    z-index: 99999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c5a059;
    font-size: 14px;
    box-shadow: 0 0 0 3px #ffffff;
}
.timeline-vertical .tl-item.right .tl-icon {
    left: -18px;
    right: auto;
}

/* --- LAYOUT ORIZZONTALE --- */
.timeline-horizontal {
    display: flex;
    overflow-x: auto;
    max-width: 100%;
    padding: 40px 20px;
    gap: 30px;
    scroll-behavior: smooth;
}
.timeline-horizontal::after {
    display: none;
}
.timeline-horizontal .tl-item {
    min-width: 320px;
    max-width: 380px;
    width: auto;
    left: auto !important;
    padding: 0;
    text-align: left;
}
.timeline-horizontal .tl-icon {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    margin: 0 auto 15px auto;
    width: 40px;
    height: 40px;
    background-color: #ffffff !important;
    border: 3px solid #c5a059;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #c5a059;
    z-index: 99999;
}

/* --- STILE DEI BOX E IMMAGINE AFFIANCATA --- */
.tl-content {
    padding: 20px;
    background: #fdfdfd;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}
.tl-header {
    background-color: #c5a059;
    color: #fff;
    padding: 8px 15px;
    font-weight: bold;
    font-size: 1.05em;
    border-radius: 4px 4px 0 0;
    margin: -20px -20px 15px -20px;
}

/* TITOLO IN GRASSETTO CLICCABILE */
.tl-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.2em;
    color: #333;
    font-weight: bold;
}
.tl-title a:hover {
    color: #c5a059 !important;
}

/* IMMAGINE IN EVIDENZA AFFIANCATA A SINISTRA */
.tl-body-wrapper {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}
.tl-item.left .tl-body-wrapper {
    flex-direction: row-reverse;
}
.tl-featured-image {
    flex-shrink: 0;
    width: 100px;
}
.tl-featured-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 2px;
    background: #fff;
}
.tl-text-content {
    flex-grow: 1;
}
.tl-text-content p {
    margin-top: 0;
}

/* --- RESPONSIVE MOBILE --- */
@media screen and (max-width: 768px) {
    .timeline-vertical::after {
        left: 30px;
    }
    .timeline-vertical .tl-item {
        width: 100%;
        padding-left: 70px;
        padding-right: 25px;
        text-align: left !important;
    }
    .timeline-vertical .tl-item.right {
        left: 0;
    }
    .timeline-vertical .tl-icon {
        left: 12px !important;
        right: auto !important;
    }
    .tl-body-wrapper {
        flex-direction: column !important;
    }
    .tl-featured-image {
        width: 100%;
    }
}

/* FORCE COLOR ON UPLOADED PNG / SVG ICONS */
.tl-icon img {
    /* Trasforma il nero in un tono marroncino/oro dorato coordinato */
    filter: invert(68%) sepia(45%) saturate(450%) hue-rotate(5deg) brightness(90%) contrast(85%) !important;
    display: block;
    margin: 0 auto;
}

/* --- PALLINO FINALE DELLA TIMELINE --- */
.timeline-vertical {
    padding-bottom: 20px; /* Spazio per fare respirare il pallino finale */
}
.timeline-vertical::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #c5a059; /* Colore coordinato con la linea e i bordi */
    border-radius: 50%;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 0 0 3px #ffffff; /* Bordo bianco per staccarlo pulito dallo sfondo */
}