/* EL Timeline Widget ─ widget.css */

.elt-widget {
    width: 100%;
    box-sizing: border-box;
}

/* ── Title ─────────────────────────────────────────────────── */
.elt-title {
    text-align: center;
    margin-bottom: 60px;
}

/* ── Snake container ───────────────────────────────────────── */
.elt-snake {
    position: relative;
    box-sizing: border-box;
}

/* ── SVG connector overlay ─────────────────────────────────── */
.elt-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    z-index: 1;
}

/* ── Row ───────────────────────────────────────────────────── */
.elt-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 60px;
}
.elt-row:last-child {
    margin-bottom: 0;
}

/* Horizontal dashed line: vertically centered on dot (--elt-line-top = dot centre Y) */
.elt-row::before {
    content: '';
    position: absolute;
    top: var(--elt-line-top, 8px);
    left: 0;
    width: 0;
    height: 2px;
    transform: translateY(-50%);
    background: repeating-linear-gradient(
        90deg,
        var(--elt-line-color, #ccc) 0 6px,
        transparent 6px 12px
    );
    z-index: 0;
    transition: width 1s ease;
}
.elt-rtl::before {
    left: auto;
    right: 0;
}
.elt-row.elt-animate::before {
    width: 100%;
}

/* ── Item ──────────────────────────────────────────────────── */
.elt-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    position: relative;
    z-index: 2;
    box-sizing: border-box;
}
.elt-item.elt-show {
    opacity: 1;
    transform: translateY(0);
}

/* ── Dot ───────────────────────────────────────────────────── */
.elt-dot {
    width: 16px;
    height: 16px;
    background: #e22222;
    border-radius: 50%;
    flex-shrink: 0;
    margin-bottom: 10px;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

/* ── Year label ────────────────────────────────────────────── */
.elt-year {
    font-size: 15px;
    font-weight: 700;
    color: #222;
    margin-bottom: 8px;
    text-align: center;
    width: 100%;
    line-height: 1.35;
    min-height: 1.35em;
}

/* ── Caption under image ─────────────────────────────────── */
.elt-item-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: #222;
    text-align: center;
    width: 100%;
    padding: 0 6px;
    box-sizing: border-box;
}

/* ── Image ─────────────────────────────────────────────────── */
.elt-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.14);
    display: block;
    max-width: 100%;
}

.elt-img + .elt-desc {
    margin-top: 14px;
}

/* ── Description ───────────────────────────────────────────── */
.elt-desc {
    font-size: 13px;
    line-height: 1.65;
    color: #555;
    text-align: center;
    padding: 0 8px;
}

/* ── Tablet: tighten desktop rhythm ────────────────────────── */
@media (max-width: 1024px) {
    .elt-title {
        margin-bottom: 40px;
    }
    .elt-row {
        margin-bottom: 48px;
    }
}

/* ── Mobile + small tablet portrait ────────────────────────── */
@media (max-width: 767px) {
    .elt-widget {
        padding-inline: max(16px, env(safe-area-inset-left, 0px))
            max(16px, env(safe-area-inset-right, 0px));
    }

    .elt-title {
        margin-bottom: 28px;
        padding-inline: 4px;
    }

    .elt-snake {
        --elt-m-pad: 42px;
        padding-inline-start: var(--elt-m-pad);
        padding-inline-end: 12px;
    }

    /* Vertical dashed axis: pad + half track − half stroke (~11px centres on dot column) */
    .elt-snake::before {
        content: '';
        position: absolute;
        top: 12px;
        bottom: 12px;
        left: calc(var(--elt-m-pad) + 11px - 1px);
        width: 2px;
        background: repeating-linear-gradient(
            180deg,
            var(--elt-line-color, #ccc) 0 8px,
            transparent 8px 14px
        );
        pointer-events: none;
        z-index: 0;
    }

    .elt-row::before {
        display: none;
    }

    .elt-svg {
        display: none;
    }

    .elt-row {
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 28px;
        margin-bottom: 36px;
    }

    .elt-row:last-child {
        margin-bottom: 0;
    }

    /*
     * Timeline card: dot + line sit in a narrow track; content column right.
     * grid-row 1 / -1 keeps the dot vertically centred on the whole card.
     */
    .elt-item {
        display: grid;
        grid-template-columns: 22px minmax(0, 1fr);
        column-gap: 16px;
        row-gap: 10px;
        align-items: start;
        width: 100%;
        max-width: 100%;
        flex: none;
        opacity: 1;
        transform: none;
        transition: none;
        margin-inline-start: 0;
        min-width: 0;
    }

    .elt-dot {
        grid-column: 1;
        grid-row: 1 / -1;
        justify-self: center;
        align-self: center;
        margin: 0;
        flex-shrink: 0;
        position: relative;
        z-index: 2;
    }

    .elt-year {
        grid-column: 2;
        grid-row: auto;
        text-align: left;
        margin-bottom: 0;
        font-size: 16px;
        line-height: 1.35;
        min-height: auto;
        width: auto;
        max-width: 100%;
        word-break: break-word;
    }

    .elt-img {
        grid-column: 2;
        justify-self: start;
        width: clamp(88px, 26vw, 120px);
        height: auto;
        aspect-ratio: 1 / 1;
        margin-inline-start: 0;
    }

    .elt-item-title {
        grid-column: 2;
        text-align: left;
        font-size: 15px;
        padding-inline: 0;
    }

    .elt-desc {
        grid-column: 2;
        text-align: left;
        font-size: 15px;
        line-height: 1.6;
        padding-inline: 0;
        hyphens: auto;
        -webkit-hyphens: auto;
    }

    .elt-img + .elt-desc {
        margin-top: 10px;
    }

    html[dir="rtl"] .elt-snake {
        padding-inline-start: 12px;
        padding-inline-end: var(--elt-m-pad);
    }

    html[dir="rtl"] .elt-snake::before {
        left: auto;
        right: calc(var(--elt-m-pad) + 11px - 1px);
    }

    html[dir="rtl"] .elt-snake .elt-desc,
    html[dir="rtl"] .elt-snake .elt-item-title,
    html[dir="rtl"] .elt-snake .elt-year {
        text-align: right;
    }

    html[dir="rtl"] .elt-snake .elt-img {
        justify-self: end;
    }
}

@media (max-width: 480px) {
    .elt-snake {
        --elt-m-pad: 36px;
        padding-inline-end: 10px;
    }

    .elt-snake::before {
        left: calc(var(--elt-m-pad) + 11px - 1px);
    }

    html[dir="rtl"] .elt-snake::before {
        left: auto;
        right: calc(var(--elt-m-pad) + 11px - 1px);
    }

    .elt-row {
        gap: 22px;
        margin-bottom: 28px;
    }

    .elt-item {
        grid-template-columns: 20px minmax(0, 1fr);
        column-gap: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .elt-row::before {
        transition: none;
    }

    .elt-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .elt-svg path {
        transition: none !important;
    }
}
