.com-historicidad-container {
    width: 96%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.visually-hidden,
.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: #fff;
    z-index: 1000;
}

.timeline-header h1 {
    font-size: 1.8rem;
    margin: 0 0 0.5rem 0;
}

.timeline-subtitle {
    color: #666;
    margin: 0 0 1rem 0;
}

.timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e0e0e0;
}

.timeline-controls label {
    font-size: 0.85rem;
    color: #555;
}

.timeline-controls select {
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85rem;
}

.timeline-count {
    margin-left: auto;
    font-size: 0.85rem;
    color: #777;
}

.timeline-explorer {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.timeline-rail {
    flex: 1 1 auto;
    min-height: 400px;
    position: relative;
    overflow-y: auto;
    max-height: 70vh;
}

.timeline-event {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.15s;
}

.timeline-event:hover,
.timeline-event:focus {
    background: #f5f5f5;
}

.timeline-event-date {
    flex: 0 0 120px;
    font-size: 0.8rem;
    color: #888;
    font-variant-numeric: tabular-nums;
}

.timeline-event-content {
    flex: 1 1 auto;
}

.timeline-event-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
}

.timeline-event-category {
    font-size: 0.75rem;
    color: #999;
}

.timeline-event.selected {
    background: #e8f0fe;
    border-left: 3px solid #4285f4;
}

.timeline-evidence-panel {
    flex: 0 0 360px;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-y: auto;
    max-height: 70vh;
}

.timeline-evidence-panel[hidden] {
    display: none;
}

.evidence-close {
    float: right;
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    padding: 0;
    line-height: 1;
}

.evidence-event-title {
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.evidence-event-date {
    color: #888;
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0;
}

.evidence-event-text {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 1rem 0;
}

.evidence-sources h3,
.evidence-hashes h3,
.evidence-epistemic h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
    margin: 1rem 0 0.3rem 0;
}

.evidence-source-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.evidence-source-list li {
    margin: 0.2rem 0;
}

.evidence-source-list a {
    font-size: 0.85rem;
    word-break: break-all;
}

.evidence-hash-value {
    font-size: 0.75rem;
    word-break: break-all;
    display: block;
}

.evidence-epistemic-value {
    font-size: 0.85rem;
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    background: #e8e8e8;
}

.evidence-article-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #4285f4;
    color: #fff;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.85rem;
}

.evidence-article-link:hover {
    background: #3367d6;
}

.timeline-pagination {
    margin-top: 1rem;
    text-align: center;
    padding: 0.5rem 0;
}

.pagination-info {
    font-size: 0.85rem;
    color: #777;
}

@media (max-width: 768px) {
    .timeline-explorer {
        flex-direction: column;
    }

    .timeline-evidence-panel {
        flex: 1 1 auto;
        max-height: none;
    }

    .timeline-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .timeline-count {
        margin-left: 0;
    }

    .timeline-event-date {
        flex: 0 0 90px;
    }
}

/* ── Timelines list (cards grid) ──────────────────────── */
.com-historicidad-timelines {
    width: 96%;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
}

.timelines-header h1 {
    font-size: 1.8rem;
    margin: 0 0 0.5rem 0;
}

.timelines-subtitle {
    color: #666;
    margin: 0 0 1.5rem 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.timelines-empty {
    color: #999;
    font-size: 1rem;
    padding: 2rem 0;
    text-align: center;
}

.timelines-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.timeline-card {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.timeline-card:hover,
.timeline-card:focus {
    border-color: #4285f4;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.15);
    transform: translateY(-2px);
}

.timeline-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #1a1a1a;
}

.timeline-card-headline {
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-card-desc {
    font-size: 0.8rem;
    color: #777;
    line-height: 1.4;
    margin: 0 0 0.75rem 0;
    flex: 1 1 auto;
}

.timeline-card-meta {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.timeline-card-count {
    font-size: 0.8rem;
    color: #4285f4;
    font-weight: 600;
}

@media (max-width: 768px) {
    .timelines-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Presidential year axis + bands ──────────────────── */

.timeline-year-axis {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    border-bottom: 2px solid #e0e0e0;
    padding: 0.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.timeline-year-track {
    display: flex;
    gap: 0;
    min-width: max-content;
    padding: 0 0.5rem;
}

.timeline-year-tick {
    flex: 0 0 auto;
    min-width: 3rem;
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid #f0f0f0;
    padding: 0.15rem 0;
}

.timeline-year-tick:first-child {
    border-left: none;
}

.timeline-year-tick:hover {
    color: #4285f4;
    cursor: pointer;
}

.timeline-president-bands {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    border-bottom: 1px solid #e0e0e0;
    padding: 0;
    min-width: max-content;
}

.timeline-president-band {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.4rem 0.5rem;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--band-color, #ccc);
    color: #fff;
    min-width: 5rem;
    cursor: default;
    transition: opacity 0.2s;
    position: relative;
}

.timeline-president-band.is-empty {
    opacity: 0.35;
    background: repeating-linear-gradient(
        45deg,
        var(--band-color, #ccc),
        var(--band-color, #ccc) 4px,
        rgba(255, 255, 255, 0.15) 4px,
        rgba(255, 255, 255, 0.15) 8px
    );
}

.timeline-band-name {
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.timeline-band-years {
    font-size: 0.6rem;
    opacity: 0.85;
    font-variant-numeric: tabular-nums;
}

.timeline-band-party {
    font-size: 0.55rem;
    opacity: 0.7;
    text-align: center;
}

.timeline-band-count {
    position: absolute;
    top: 0.15rem;
    right: 0.15rem;
    font-size: 0.6rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.timeline-band-count:empty,
.timeline-president-band.is-empty .timeline-band-count {
    display: none;
}

/* ── Period headers (collapsible) ────────────────────── */

.timeline-period-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    background: linear-gradient(90deg, var(--band-color, #4285f4) 0%, var(--band-color, #4285f4) 4px, #f8f9fa 4px, #f8f9fa 100%);
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    role: button;
}

.timeline-period-header:hover {
    background: linear-gradient(90deg, var(--band-color, #4285f4) 0%, var(--band-color, #4285f4) 4px, #eef2f7 4px, #eef2f7 100%);
}

.timeline-period-dot {
    flex: 0 0 12px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.timeline-period-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
}

.timeline-period-years {
    font-size: 0.8rem;
    color: #666;
    font-variant-numeric: tabular-nums;
}

.timeline-period-party {
    font-size: 0.75rem;
    color: #888;
    margin-left: 0.25rem;
}

.timeline-period-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4285f4;
    background: #e8f0fe;
    border-radius: 10px;
    padding: 0.1rem 0.5rem;
}

.timeline-period-toggle {
    flex: 0 0 auto;
    font-size: 0.7rem;
    color: #999;
    transition: transform 0.2s;
}

.timeline-period-group {
    transition: max-height 0.3s ease, opacity 0.2s ease;
    overflow: hidden;
}

.timeline-period-group.is-collapsed {
    max-height: 0;
    opacity: 0;
    border-bottom: none;
}

.timeline-period-group.is-collapsed .timeline-event {
    border-bottom: none;
}

@media (max-width: 768px) {
    .timeline-year-tick {
        min-width: 2.5rem;
        font-size: 0.65rem;
    }

    .timeline-president-band {
        min-width: 4rem;
        padding: 0.3rem 0.35rem;
    }

    .timeline-band-name {
        font-size: 0.65rem;
    }

    .timeline-period-header {
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.5rem;
    }

    .timeline-period-name {
        font-size: 0.85rem;
    }
}
