/* =========================================================
   TIMELINE — EDITORIAL V6
   Three-column dossier layout:
   metadata | axis | card
========================================================= */

.timeline-filters {
    width: min(100%, 1120px);
    margin: 30px auto 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 12px;
}

.timeline-filter {
    appearance: none;
    min-height: 38px;
    padding: 8px 16px;
    border: 1px solid #dce1e5;
    border-radius: 999px;
    background: #fff;
    color: #59636d;
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(27,34,40,.055);
    transition: transform .18s ease, box-shadow .18s ease,
        border-color .18s ease, background-color .18s ease, color .18s ease;
}

.timeline-filter:hover {
    transform: translateY(-1px);
    border-color: #cbd2d7;
    box-shadow: 0 6px 15px rgba(27,34,40,.085);
}

.timeline-filter.active,
.timeline-filter[aria-pressed='true'] {
    border-color: #2d3338;
    background: #2d3338;
    color: #fff;
    box-shadow: 0 7px 17px rgba(27,33,38,.18);
}

.timeline-filter:focus-visible {
    outline: 3px solid rgba(216,173,47,.28);
    outline-offset: 2px;
}

.timeline-filter:disabled {
    cursor: wait;
    opacity: .55;
    transform: none;
}

.timeline-status {
    width: min(100%, 1120px);
    min-height: 20px;
    margin: 14px auto 28px;
    color: #7a848d;
    font-size: .82rem;
    text-align: center;
}

.vertical-timeline-container {
    position: relative;
    width: min(100%, 1040px);
    margin: 0 auto 58px;
    --timeline-meta-width: 175px;
    --timeline-axis-width: 42px;
    --timeline-progress-stop: 0%;
}

/* Continuous vertical axis. Its center is after the metadata column. */
.vertical-timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--timeline-meta-width) + (var(--timeline-axis-width) / 2));
    width: 2px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: linear-gradient(
        to bottom,
        #d9ad2f 0%,
        #d9ad2f var(--timeline-progress-stop),
        #e5e9ec var(--timeline-progress-stop),
        #e5e9ec 100%
    );
    z-index: 0;
}

.timeline-block {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns:
        var(--timeline-meta-width)
        var(--timeline-axis-width)
        minmax(0, 1fr);
    align-items: start;
    margin: 0 0 44px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .48s ease, transform .48s ease;
}

.timeline-block.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-date-column {
    grid-column: 1;
    padding: 19px 14px 0 0;
    text-align: right;
}

.timeline-date-column .timeline-date {
    display: block;
    margin: 0 0 8px;
    color: #283039;
    font-size: .86rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: .035em;
    text-transform: uppercase;
}

.timeline-time {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    margin: 0 0 12px;
    color: #68737c;
    font-size: .88rem;
    font-weight: 600;
}

.timeline-time i {
    font-size: .86rem;
}

.timeline-side-metadata {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.timeline-side-badge {
    display: inline-flex;
    max-width: 100%;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.timeline-side-badge-jurisdiction {
    border-color: #e8dbad;
    background: #f8f2df;
    color: #735d18;
}

.timeline-side-badge-category {
    border-color: #dce5eb;
    background: #edf3f6;
    color: #425d6c;
}

.timeline-axis-column {
    position: relative;
    grid-column: 2;
    min-height: 100%;
}

.timeline-marker {
    position: absolute;
    top: 23px;
    left: 50%;
    z-index: 3;
    width: 13px;
    height: 13px;
    box-sizing: border-box;
    transform: translateX(-50%);
    border: 3px solid #d9ad2f;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 4px #f7f8f9;
    transition: transform .2s ease, background-color .2s ease;
}

.timeline-block.completed .timeline-marker,
.timeline-block.timeline-importance-1 .timeline-marker {
    background: #d9ad2f;
}

.timeline-block:hover .timeline-marker {
    transform: translateX(-50%) scale(1.08);
}

.timeline-card {
    position: relative;
    grid-column: 3;
    box-sizing: border-box;
    min-width: 0;
    padding: 29px 31px 30px;
    border: 1px solid #e2e6e9;
    border-left: 3px solid #d9ad2f;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(27,34,40,.06);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.timeline-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 17px 38px rgba(27,34,40,.085);
}

/* White connector pointing from the card to the axis. */
.timeline-card::before {
    content: '';
    position: absolute;
    top: 25px;
    left: -12px;
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 12px solid #fff;
    filter: drop-shadow(-1px 0 0 #e2e6e9);
}

/* Editorial label above the title. */
.timeline-card-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 9px;
    color: #7a6520;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: .095em;
    text-transform: uppercase;
}

.timeline-card-kicker::before {
    content: '';
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #d9ad2f;
}

.timeline-block.timeline-importance-1 .timeline-card-kicker {
    color: #8a3f34;
}

.timeline-card h4 {
    margin: 0 0 12px;
    color: #252b31;
    font-size: 1.32rem;
    line-height: 1.28;
    letter-spacing: -.025em;
}

.timeline-card p {
    margin: 0;
    color: #505b65;
    font-size: .94rem;
    line-height: 1.7;
    white-space: pre-line;
}

.timeline-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 13px;
}

.timeline-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 4px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .67rem;
    font-weight: 750;
    line-height: 1.2;
    white-space: nowrap;
}

.timeline-badge-category {
    border-color: #d9e5ec;
    background: #edf3f7;
    color: #415d6d;
}

.timeline-badge-jurisdiction {
    border-color: #eadfb9;
    background: #f8f3e4;
    color: #6e5b1e;
}

.timeline-badge-source {
    border-color: #e4d9ee;
    background: #f3eef8;
    color: #624775;
}

.timeline-source {
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid #edf0f2;
}

.timeline-source a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6a590b;
    font-size: .8rem;
    font-weight: 750;
    text-decoration: none;
}

.timeline-source a::after {
    content: '↗';
}

.timeline-block.timeline-importance-1 .timeline-card h4 {
    font-size: 1.36rem;
}

.timeline-category-judicial .timeline-card { border-top-color: #a6afb8; }
.timeline-category-comunicacion .timeline-card { border-top-color: #9bb9aa; }
.timeline-category-medico .timeline-card { border-top-color: #94b5ca; }
.timeline-category-familiar .timeline-card { border-top-color: #c7aeb6; }
.timeline-category-penal .timeline-card { border-top-color: #b99f9f; }
.timeline-category-institucional .timeline-card { border-top-color: #aaa38f; }

.timeline-loading,
.timeline-empty,
.timeline-error {
    position: relative;
    z-index: 3;
    box-sizing: border-box;
    width: 100%;
    margin: 16px 0;
    padding: 28px 22px;
    border: 1px solid #e5e8ea;
    border-radius: 13px;
    background: #fff;
    color: #6d7780;
    text-align: center;
    box-shadow: 0 8px 24px rgba(27,34,40,.055);
}

.timeline-loading::before {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 11px;
    border: 3px solid #e4e8ea;
    border-top-color: #d7ad34;
    border-radius: 50%;
    animation: timeline-spin .8s linear infinite;
}

.timeline-error {
    border-color: #ead6d6;
    background: #fffafa;
    color: #7b5151;
}

.timeline-error button {
    margin-left: 8px;
    padding: 7px 11px;
    border: 1px solid #c39898;
    border-radius: 7px;
    background: #fff;
    color: #704747;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

@keyframes timeline-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
    .vertical-timeline-container {
        --timeline-meta-width: 150px;
        --timeline-axis-width: 38px;
    }

    .timeline-date-column {
        padding-right: 16px;
    }
}

@media (max-width: 700px) {
    .timeline-filters {
        justify-content: flex-start;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 2px 0 9px;
        scrollbar-width: thin;
    }

    .timeline-filter {
        flex: 0 0 auto;
    }

    .timeline-status {
        text-align: left;
    }

    .vertical-timeline-container {
        width: 100%;
        --timeline-meta-width: 0px;
        --timeline-axis-width: 34px;
    }

    .vertical-timeline-container::before {
        left: 9px;
    }

    .timeline-block {
        grid-template-columns: 34px minmax(0,1fr);
        margin-bottom: 24px;
    }

    .timeline-date-column {
        grid-column: 2;
        grid-row: 1;
        padding: 0 0 11px;
        text-align: left;
    }

    .timeline-date-column .timeline-date {
        display: inline;
        margin-right: 8px;
        font-size: .82rem;
    }

    .timeline-time {
        margin: 0;
        font-size: .78rem;
    }

    .timeline-side-metadata {
        display: none;
    }

    .timeline-axis-column {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .timeline-marker {
        top: 5px;
        left: 9px;
        transform: translateX(-50%);
    }

    .timeline-block:hover .timeline-marker {
        transform: translateX(-50%);
    }

    .timeline-card {
        grid-column: 2;
        grid-row: 2;
        padding: 21px;
    }

    .timeline-card::before {
        top: 18px;
    }

    .timeline-card-kicker {
        margin-bottom: 7px;
        font-size: .64rem;
    }

    .timeline-card h4 {
        font-size: 1.12rem;
    }

    .timeline-card p {
        font-size: .9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .timeline-block,
    .timeline-card,
    .timeline-marker,
    .timeline-filter {
        transition: none;
    }

    .timeline-block {
        opacity: 1;
        transform: none;
    }

    .timeline-loading::before {
        animation: none;
    }
}
