/**
 * YCMC Timeline
 * Timeline verticale, responsive, avec marqueurs colorés et animation au scroll.
 */

.ycmc-timeline {
    width: 100%;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    --ycmc-tl-color: #1e4c8a;
}

.ycmc-timeline__heading {
    text-align: center;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    margin: 0 0 40px;
    color: #1e4c8a;
}

.ycmc-timeline__track {
    position: relative;
    padding-left: 90px;
}

/* Ligne verticale centrale (la colonne des marqueurs) */
.ycmc-timeline__track::before {
    content: "";
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 35px;
    width: 2px;
    background: linear-gradient(
        to bottom,
        rgba(30, 76, 138, 0) 0%,
        rgba(30, 76, 138, 0.4) 8%,
        rgba(30, 76, 138, 0.4) 92%,
        rgba(30, 76, 138, 0) 100%
    );
}

/* Dot voyageur : scroll-driven. Position + couleur mises à jour par JS
   via --ycmc-tl-dot-top et --ycmc-tl-dot-color (voir maybe_render_js). */
.ycmc-timeline__track::after {
    content: "";
    position: absolute;
    top: var(--ycmc-tl-dot-top, 40px);
    left: 36px;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ycmc-tl-dot-color, #1e4c8a);
    box-shadow: 0 0 0 6px rgba(30, 76, 138, 0.22);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--ycmc-tl-dot-color, #1e4c8a) 25%, transparent);
    z-index: 1;
    transition: top 0.85s cubic-bezier(.5, 0, .3, 1),
                background 0.5s ease,
                box-shadow 0.5s ease;
}

/* ============================================================
   Item
   ============================================================ */
.ycmc-timeline__item {
    position: relative;
    z-index: 2; /* passe au-dessus du dot voyageur (::after du track, z-index 1) */
    margin-bottom: 48px;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.ycmc-timeline__item:last-child {
    margin-bottom: 0;
}

.ycmc-timeline__item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Fallback : si JS désactivé / pas d'IntersectionObserver, on affiche tout */
.no-js .ycmc-timeline__item,
.ycmc-timeline__item.no-anim {
    opacity: 1;
    transform: none;
}

/* ============================================================
   Marqueur (cercle + icône)
   ============================================================ */
.ycmc-timeline__marker {
    position: absolute;
    top: 0;
    left: -90px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ancien dot statique par item : désactivé (remplacé par le voyageur du track) */
.ycmc-timeline__dot {
    display: none;
}

/* Cercle principal avec icône */
.ycmc-timeline__icon {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--ycmc-tl-color);
    color: var(--ycmc-tl-color);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.ycmc-timeline__icon svg,
.ycmc-timeline__icon img {
    width: 100%;
    height: 100%;
    display: block;
}

.ycmc-timeline__icon img {
    object-fit: contain;
}

.ycmc-timeline__item:hover .ycmc-timeline__icon {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   Contenu
   ============================================================ */
.ycmc-timeline__content {
    background: #fff;
    padding: 22px 28px;
    box-shadow: 0 4px 20px rgba(30, 76, 138, 0.08);
    border-left: 4px solid var(--ycmc-tl-color);
    position: relative;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.ycmc-timeline__item:hover .ycmc-timeline__content {
    box-shadow: 0 8px 28px rgba(30, 76, 138, 0.14);
    transform: translateY(-2px);
}

/* Flèche pointant vers le marqueur */
.ycmc-timeline__content::before {
    content: "";
    position: absolute;
    top: 24px;
    left: -10px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid var(--ycmc-tl-color);
}

.ycmc-timeline__year {
    font-family: "Helvetica", Arial, sans-serif;
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    font-weight: 700;
    color: var(--ycmc-tl-color);
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.ycmc-timeline__title {
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    font-weight: 600;
    color: #666;
    margin: 0 0 12px;
    line-height: 1.35;
}

.ycmc-timeline__body {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
}

.ycmc-timeline__body p {
    margin: 0 0 10px;
}

.ycmc-timeline__body p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media screen and (max-width: 680px) {
    .ycmc-timeline__track {
        padding-left: 70px;
    }
    .ycmc-timeline__track::before {
        left: 27px;
    }
    .ycmc-timeline__marker {
        left: -70px;
        width: 54px;
        height: 54px;
    }
    .ycmc-timeline__icon {
        width: 48px;
        height: 48px;
    }
    .ycmc-timeline__icon svg,
    .ycmc-timeline__icon img {
        width: 22px;
        height: 22px;
    }
    .ycmc-timeline__dot {
        width: 16px;
        height: 16px;
        top: -4px;
        left: -4px;
    }
    .ycmc-timeline__content {
        padding: 18px 20px;
    }
    .ycmc-timeline__content::before {
        top: 18px;
        border-top-width: 6px;
        border-bottom-width: 6px;
        border-right-width: 8px;
        left: -8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ycmc-timeline__item {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .ycmc-timeline__icon,
    .ycmc-timeline__content {
        transition: none;
    }
    .ycmc-timeline__track::after {
        animation: none;
        display: none;
    }
}
