:root {
    --color-start: #7cb342;
    --color-mid: #26a69a;
    --color-end: #0277bd;
    --color-text: #2d3e50;
    --color-text-light: #5a6c7d;
    --line-width: 45px;
    --dot-size: 40px;
    --dot-size-large: 40px;
    --connector-width: 40px;

    /* Couleurs par item (gradient vert → bleu) */
    --c1: #7cb342;
    --c2: #6ab83f;
    --c3: #4db86a;
    --c4: #3ab580;
    --c5: #2aaf8f;
    --c6: #26a69a;
    --c7: #1f9a8e;
    --c8: #198e94;
    --c9: #1389a5;
    --c10: #0c85b5;
    --c11: #0580c5;
    --c12: #0277bd;
    /* --c13: #0069a7; */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container:has(.timeline) {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 20px 100px;
}

h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 2.4rem;
    color: var(--color-text);
    margin-bottom: 40px;
    font-weight: 700;
}

.timeline {
    position: relative;
    padding: 0;
}

/* ─── Ligne centrale ─── */
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: var(--line-width);
    height: 100%;
    z-index: 1;
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(180deg,
        var(--c1) 0%,
        var(--c3) 18%,
        var(--c5) 36%,
        var(--c7) 50%,
        var(--c9) 68%,
        var(--c11) 85%,
        var(--c12) 100%); /* changer en --c13 si un nouveau bloc apparaît */
}

.timeline-line-progress {
    width: 100%;
    height: 0%;
    background: rgba(255, 255, 255, 0.233);
    border-radius: 3px;
    transition: height 0.1s linear;
    border-radius: 0 0 20px 20px;
}

/* ─── Items ─── */
.timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: calc(50% + 60px);
    margin-bottom: 70px;
    z-index: 2;
    transform: translateY(-15px);
}

.timeline-item:nth-child(odd) {
    justify-content: flex-end;
    padding-right: calc(50% + 60px);
    padding-left: 0;
}

.timeline-item:nth-child(even) {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: calc(50% + 60px);
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* ─── Point sur la ligne ─── */
.timeline-dot {
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%) scale(0);
    width: var(--dot-size);
    height: var(--dot-size);
    border-radius: 50%;
    background: #fff;
    border: 4px solid currentColor;
    z-index: 3;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
        border-color 0.3s ease;
    box-shadow: 0 0 0 5px white;
}

.timeline-dot.large {
    width: var(--dot-size-large);
    height: var(--dot-size-large);
    top: 4px;
    background: currentColor;
    border: 4px solid currentColor;
}

.timeline-item.is-visible .timeline-dot {
    transform: translateX(-50%) scale(1);
}

/* ─── Couleurs par item ─── */
.timeline-item:nth-child(2)  { color: var(--c1); }
.timeline-item:nth-child(3)  { color: var(--c2); }
.timeline-item:nth-child(4)  { color: var(--c3); }
.timeline-item:nth-child(5)  { color: var(--c4); }
.timeline-item:nth-child(6)  { color: var(--c5); }
.timeline-item:nth-child(7)  { color: var(--c6); }
.timeline-item:nth-child(8)  { color: var(--c7); }
.timeline-item:nth-child(9)  { color: var(--c8); }
.timeline-item:nth-child(10) { color: var(--c9); }
.timeline-item:nth-child(11) { color: var(--c10); }
.timeline-item:nth-child(12) { color: var(--c11); }
.timeline-item:nth-child(13) { color: var(--c12); }
.timeline-item:nth-child(14) { color: var(--c13); }

/* ─── Ligne connecteur (dot → contenu) ─── */
.timeline-connector {
    position: absolute;
    top: calc(8px + var(--dot-size) / 2 - 1px);
    height: 2px;
    width: var(--connector-width);
    background: currentColor;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.4s ease 0.2s;
}

.timeline-item .timeline-dot.large ~ .timeline-connector {
    top: calc(4px + var(--dot-size-large) / 2 - 1px);
}

/* Connecteur côté impair (contenu à gauche → connecteur à droite du contenu) */
.timeline-item:nth-child(odd) .timeline-connector {
    left: calc(50% + 10px);
}

/* Connecteur côté pair (contenu à droite → connecteur à gauche du contenu) */
.timeline-item:nth-child(even) .timeline-connector {
    right: calc(50% + 10px);
}

.timeline-item.is-visible .timeline-connector {
    opacity: 1;
}

/* ─── Contenu ─── */
.timeline-content {
    max-width: 400px;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item:nth-child(even) .timeline-content {
    transform: translateX(-30px);
}

.timeline-item.is-visible .timeline-content {
    opacity: 1;
    transform: translateX(0);
}

.timeline-item:nth-child(odd) .timeline-content {
    text-align: right;
}

.timeline-item:nth-child(even) .timeline-content {
    text-align: left;
}

/* ─── Année ─── */
.timeline-year {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 4rem;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 6px;
    color: currentColor;
    display: flex;
    align-items: center;
    position: relative;
}

.timeline-year::before{
    top: 0;
    left: -50px;
    width: 100px;
    height: 6px;
    background: currentColor;
    position: relative;
    content: '';
    display: inline-block;
}

.timeline-year::after{
    top: 50%;
    left: 45px;
    height: 10px;
    width: 10px;
    background: currentColor;
    position: absolute;
    content: '';
    transform: translateY(-50%);
    border-radius: 50%;
}

.timeline-item:nth-child(odd) .timeline-year{
    flex-direction: row-reverse;
}

.timeline-item:nth-child(odd) .timeline-year::before{
    right: -50px;
    left: inherit;
}

.timeline-item:nth-child(odd) .timeline-year::after{
    right: 45px;
    left: inherit;
}

/* ─── Texte descriptif ─── */
.timeline-text {
    font-size: 2rem;
    line-height: 1.2;
    color: var(--color-text-light);
}

/* ─── Pulse sur le dernier point ─── */
.timeline-item:last-child .timeline-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(2, 119, 189, 1);
    animation: pulse 2s ease-out infinite;
    animation-play-state: paused;
}

.timeline-item:last-child.is-visible .timeline-dot::before {
    animation-play-state: running;
}

@keyframes pulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.5);
        opacity: 0;
    }
}

/* ─── Responsive ─── */
@media (max-width: 700px) {
    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        padding-right: 0;
        padding-left: 65px;
        justify-content: flex-start;
    }

    .timeline-line {
        left: -6.5px;
        transform: none;
    }

    .timeline-dot {
        left: 16px;
    }

    .timeline-connector {
        display: none;
    }

    .timeline-item:nth-child(odd) .timeline-content,
    .timeline-item:nth-child(even) .timeline-content {
        text-align: left;
        transform: translateX(-20px);
    }

    .timeline-item.is-visible .timeline-content {
        transform: translateX(0);
    }

    .timeline-content {
        max-width: 100%;
    }

    .timeline-year::before{
        right: inherit !important;
        left: -50px !important;
    }

    .timeline-year::after{
        left: 45px !important;
        right: inherit !important;
    }

    .timeline-item .timeline-year{
        flex-direction: row !important;
    }
}