.timeline {
    display: grid;
    gap: 3rem;
    justify-content: center;
    grid-template-columns: 13rem;
}

.timeline>article {
    height: 17rem;
    background: #fff;
    border: 1px solid black;
    border-radius: 1rem;
    padding: 0.7rem;
    text-align: center;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;

    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}


.timeline article img {
    width: calc(100% / 1.678);
}

/* Titre (année) */
.timeline h3 {
    font-size: 1.4rem;
    color: var(--color-accent-secondary-dark);
    font-weight: bold;
}

.timeline figure {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    height: 11rem;
}

/* Texte (événement) */
.timeline figcaption {
    font-size: 0.95rem;
    line-height: 1.4;
    font-weight: 700;
    margin-top: 0.7rem;
}

@media screen and (min-width:64rem) {
    .timeline {
        grid-template-columns: repeat(3, 13rem);
        grid-auto-flow: dense;
        justify-content: center;
    }

    .timeline>article {
        position: relative;
    }

    /* Even rows (reverse order: 4 → 6, 10 → 12, …) */
    .timeline>:nth-child(6n+4) {
        grid-column: 3;
        justify-self: right;
    }

    /* 4, 10, 16, 22… */
    .timeline>:nth-child(6n+5) {
        grid-column: 2;
    }

    /* 5, 11, 17, 23… */
    .timeline>:nth-child(6n+6) {
        grid-column: 1;
    }

    .timeline>::after {
        position: absolute;
        font-size: 1.7rem;
        animation-duration: 3s;
        animation-timing-function: ease-in-out;
        animation-iteration-count: infinite;
    }

    .timeline .move-lr,
    .timeline .move-rl {
        width: calc(0.93*13rem);
    }

    .timeline .move-ud {
        height: calc(0.93*17rem);
    }

    .timeline .move-lr::after {
        --shift: 0.5rem;
        content: "→";
        right: -2.4rem;
        top: 50%;
        animation-name: wiggle-x;
        color:var(--black);
    }

    .timeline .move-ud::after {
        --shift: 0.5rem;
        content: "↓";
        right: 50%;
        bottom: -3rem;
        animation-name: wiggle-y;
    }

    .timeline .move-rl::after {
        --shift: -0.5rem;
        content: "←";
        top: 50%;
        left: -2.4rem;
        animation-name: wiggle-x;
    }

    @keyframes wiggle-x {

        0%,
        100% {
            transform: translateX(0);
        }

        50% {
            transform: translateX(var(--shift, .5rem));
        }
    }

    @keyframes wiggle-y {

        0%,
        100% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(var(--shift, .5rem));
        }
    }

}

/* OA Section */
.oa {
    background: var(--color-accent-primary-light);
    text-align: center;
    padding: 3rem 2rem;
    border-radius: 0.5rem;
    margin: 3rem 0;
}

.oa h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.oa p {
    margin: 1rem auto;
    max-width: 60ch;
    line-height: 1.6;
    color: var(--color-text);
}

.oa .cta {
    margin-top: 2rem;
}

.oa .btn {
    background: var(--color-accent-primary-dark);
    color: #fff;
    padding: 0.9rem 1.8rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 700;
    display: inline-block;
    transition: background 0.2s;
}

.oa .btn:hover {
    background: var(--color-accent-primary);
}



.flip-inner {
    position: relative;
}

.flip-front {
    position: absolute;
    inset: 0;
    z-index: 2;

    background: white;
    transition:
        transform .45s ease,
        opacity .35s ease;
}

/* ÉTAT OUVERT */
.timeline-item.is-flipped .flip-front {
    transform: translateX(-105%);
    opacity: 0;
    pointer-events: none;
}
.flip-back {
    position: relative;
    z-index: 1;
}



/* Focus clavier (toujours nécessaire sans button) */
.timeline-item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

/* Motion safety */
@media (prefers-reduced-motion: reduce) {
    .flip-front {
        transition: none;
        transform: none;
    }
}