/* ═════════════════════════════════════════════════════
   Astaria — Interactive Timeline Styles
   Vertical timeline with parchment event cards on a gold rail
   ═════════════════════════════════════════════════════ */

/* ── Container ── */
#astaria-timeline {
    position: relative;
    padding: 2rem 0;
    max-width: 800px;
    margin: 0 auto;
}

.timeline-loading,
.timeline-empty,
.timeline-error {
    text-align: center;
    padding: 3rem 1rem;
    font-family: 'Cinzel', serif;
    color: var(--parch-ink, #2c1810);
    font-size: 1.1rem;
}

/* ── Rail (the vertical line) ── */
.timeline-rail {
    position: relative;
    padding-left: 40px;
}

.timeline-rail::before {
    content: '';
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(
        to bottom,
        transparent,
        var(--parch-ink-faded, #6b5b48) 5%,
        var(--parch-ink-faded, #6b5b48) 95%,
        transparent
    );
    border-radius: 2px;
}

/* ── Era Sections ── */
.timeline-era {
    position: relative;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ── Era Node (dot on the rail) ── */
.timeline-node {
    position: absolute;
    left: -40px;
    top: 0.3rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid var(--parch-ink-faded, #6b5b48);
    background: var(--parch-bg, #f4e8c1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.timeline-node-inner {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

/* ── Era Header (collapsible toggle) ── */
.timeline-era-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: linear-gradient(
        135deg,
        rgba(107, 91, 72, 0.1),
        rgba(107, 91, 72, 0.04)
    );
    border: 1px solid var(--parch-border, rgba(107, 91, 72, 0.25));
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.timeline-era-header:hover {
    background: linear-gradient(
        135deg,
        rgba(107, 91, 72, 0.15),
        rgba(107, 91, 72, 0.06)
    );
    border-color: var(--era-color, var(--parch-ink-faded, #6b5b48));
}

.timeline-era-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--parch-ink, #2c1810);
    margin: 0;
}

.timeline-chevron {
    font-size: 0.8rem;
    color: var(--parch-ink-faded, #6b5b48);
    transition: transform 0.3s ease;
    opacity: 0.6;
}

.timeline-chevron.rotated {
    transform: rotate(-90deg);
}

/* ── Era Body (collapsible content) ── */
.timeline-era-body {
    overflow: hidden;
    max-height: 5000px;
    transition: max-height 0.5s ease, opacity 0.4s ease;
    opacity: 1;
    padding-top: 0.8rem;
}

.timeline-era-body.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
}

.timeline-era-desc p {
    color: var(--parch-ink-light, #4a3828);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 0.8rem;
}

.timeline-map-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    background: rgba(107, 91, 72, 0.08);
    border: 1px solid var(--parch-border, rgba(107, 91, 72, 0.25));
    color: var(--parch-ink-faded, #6b5b48);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

/* ── Event Cards ── */
.timeline-events {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-left: 0.5rem;
}

.timeline-event {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
    padding: 0.8rem 1rem;
    background: rgba(107, 91, 72, 0.03);
    border: 1px solid rgba(107, 91, 72, 0.1);
    border-radius: 5px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.timeline-event:hover {
    background: rgba(107, 91, 72, 0.07);
    border-color: rgba(107, 91, 72, 0.2);
}

.timeline-event-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.timeline-event-content {
    flex: 1;
    min-width: 0;
}

.timeline-event-title {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--parch-ink, #2c1810);
    margin: 0 0 0.3rem;
    line-height: 1.4;
}

.timeline-event-label {
    display: inline-block;
    font-family: 'Crimson Text', serif;
    font-size: 0.8rem;
    color: var(--parch-ink-faded, #6b5b48);
    background: rgba(107, 91, 72, 0.08);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.timeline-event-desc {
    color: var(--parch-ink-light, #4a3828);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 0.5rem;
}

.timeline-no-events {
    color: var(--parch-ink-faded, #6b5b48);
    font-style: italic;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* ── Event Action Links ── */
.timeline-event-actions {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.timeline-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Cinzel', serif;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.timeline-link-map {
    color: var(--parch-ink, #2c1810);
    border: 1px solid var(--parch-border, rgba(107, 91, 72, 0.25));
}

.timeline-link-map:hover {
    background: rgba(107, 91, 72, 0.1);
    color: var(--parch-ink, #2c1810);
}

.timeline-link-lore {
    color: var(--parch-ink-light, #4a3828);
    border: 1px solid rgba(107, 91, 72, 0.15);
}

.timeline-link-lore:hover {
    background: rgba(107, 91, 72, 0.08);
    color: var(--parch-ink, #2c1810);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .timeline-rail {
        padding-left: 30px;
    }

    .timeline-rail::before {
        left: 13px;
    }

    .timeline-node {
        left: -30px;
        width: 20px;
        height: 20px;
    }

    .timeline-node-inner {
        width: 8px;
        height: 8px;
    }

    .timeline-era-title {
        font-size: 1.1rem;
    }

    .timeline-event {
        padding: 0.6rem 0.8rem;
    }

    .timeline-event-title {
        font-size: 0.9rem;
    }
}
