/* timeline.css — Vertical timeline page styles */

/* =============================================
   HERO
============================================= */
.timeline-hero {
    min-height: 320px;
    background:
        linear-gradient(rgba(10, 12, 25, 0.82), rgba(10, 12, 25, 0.97)),
        url('https://images.unsplash.com/photo-1519074069444-1ba4fff66d16?q=80&w=1470&auto=format&fit=crop')
        center/cover no-repeat scroll;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 3px solid var(--accent-gold);
    position: relative;
}

.timeline-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(251, 191, 36, 0.025) 0px,
        rgba(251, 191, 36, 0.025) 1px,
        transparent 1px,
        transparent 40px
    );
    pointer-events: none;
}

.timeline-hero-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
}

.timeline-hero-content {
    text-align: center;
    padding: 3rem 2rem;
    max-width: 700px;
    margin: 0 auto;
}

.timeline-hero-content h1 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    text-shadow: 0 2px 20px rgba(251, 191, 36, 0.3);
}

.timeline-hero-content p {
    font-size: 1.15rem;
    color: var(--text-muted);
}

/* =============================================
   MAIN CONTAINER
============================================= */
.timeline-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 4rem 2rem 6rem;
    position: relative;
}

/* =============================================
   ERA INDICATOR
   Sticky label that floats at the top of the viewport
   as the user scrolls, showing which era they're in.
   Updated by JS.
============================================= */
.timeline-era-indicator {
    position: sticky;
    top: 97px; /* below navbar */
    z-index: 100;
    text-align: center;
    margin-bottom: 3rem;
    pointer-events: none;
}

#eraLabel {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(251, 191, 36, 0.35);
    color: var(--accent-gold);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.5rem 1.4rem;
    border-radius: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s;
}

/* =============================================
   TIMELINE TRACK
   The vertical line runs down the center.
   Events alternate left and right of the line.
============================================= */
.timeline-track {
    position: relative;
}

/*
  The vertical gold line — a pseudo-element on the track.
  Gradient fades out at the bottom to suggest the story continues.
*/
.timeline-track::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(
        to bottom,
        transparent,
        var(--accent-gold) 5%,
        var(--accent-gold) 90%,
        transparent
    );
    opacity: 0.35;
}

/* =============================================
   TIMELINE EVENT
   Events alternate left/right using :nth-child.
   Each event starts invisible and animates in when
   it enters the viewport (handled by IntersectionObserver in JS).
============================================= */
.timeline-event {
    display: flex;
    justify-content: flex-end;
    padding-right: calc(50% + 2.5rem);
    margin-bottom: 4rem;
    position: relative;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Right-side events */
.timeline-event.right {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: calc(50% + 2.5rem);
    transform: translateX(40px);
}

/* Visible state — triggered by IntersectionObserver */
.timeline-event.visible {
    opacity: 1;
    transform: translateX(0);
}

/* =============================================
   NODE — the dot on the line
   Sits exactly on the vertical line.
   Pulses gently to draw attention.
============================================= */
.timeline-node {
    position: absolute;
    left: 50%;
    top: 1.5rem;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-gold);
    border: 3px solid var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
    z-index: 2;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-event:hover .timeline-node {
    transform: translateX(-50%) scale(1.4);
    box-shadow: 0 0 0 5px rgba(251, 191, 36, 0.25),
                0 0 15px rgba(251, 191, 36, 0.4);
}

/*
  Connector line from node to card.
  Left events point right, right events point left.
*/
.timeline-connector {
    position: absolute;
    top: calc(1.5rem + 5px); /* aligns with node center */
    height: 2px;
    background: linear-gradient(to right, rgba(251, 191, 36, 0.5), transparent);
    width: 2.5rem;
    right: calc(50% + 0.5rem);
    z-index: 1;
}

.timeline-event.right .timeline-connector {
    right: auto;
    left: calc(50% + 0.5rem);
    background: linear-gradient(to left, rgba(251, 191, 36, 0.5), transparent);
}

/* =============================================
   CARD
============================================= */
.timeline-card {
    background: linear-gradient(160deg, #1e2d45 0%, #0f172a 100%);
    border: 1px solid rgba(251, 191, 36, 0.12);
    border-radius: var(--border-radius);
    padding: 1.5rem 1.6rem;
    max-width: 380px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Colour accent top border — category colour set by JS */
.timeline-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--event-color, var(--accent-gold));
    opacity: 0.8;
}

.timeline-card:hover {
    transform: translateY(-5px);
    border-color: var(--event-color, var(--accent-gold));
    box-shadow:
        0 14px 28px rgba(0, 0, 0, 0.4),
        0 0 16px color-mix(in srgb, var(--event-color, #fbbf24) 12%, transparent);
}

/* =============================================
   CARD HEADER — year + category badge
============================================= */
.timeline-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.timeline-year {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    color: var(--event-color, var(--accent-gold));
    font-weight: 700;
    letter-spacing: 0.05em;
    text-shadow: 0 0 12px color-mix(in srgb, var(--event-color, #fbbf24) 40%, transparent);
}

.timeline-category-badge {
    font-size: 0.68rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    background: color-mix(in srgb, var(--event-color, #fbbf24) 15%, transparent);
    color: var(--event-color, var(--accent-gold));
    border: 1px solid color-mix(in srgb, var(--event-color, #fbbf24) 40%, transparent);
}

/* =============================================
   CARD TITLE & DESCRIPTION
============================================= */
.timeline-card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: 0.6rem;
    line-height: 1.35;
}

.timeline-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.65;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.timeline-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.timeline-details-btn {
    background: transparent;
    border: 1.5px solid var(--event-color, var(--accent-gold));
    color: var(--event-color, var(--accent-gold));
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timeline-details-btn:hover {
    background: var(--event-color, var(--accent-gold));
    color: var(--primary-dark);
}

/* =============================================
   ERA DIVIDER
   A full-width label that appears between eras.
   Breaks the timeline into named periods.
============================================= */
.timeline-era-divider {
    position: relative;
    text-align: center;
    margin: 3rem 0;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.timeline-era-divider.visible {
    opacity: 1;
}

.timeline-era-divider span {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-gold);
    background: var(--primary-dark);
    padding: 0.4rem 1.5rem;
    position: relative;
    z-index: 1;
}

.timeline-era-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right,
        transparent,
        rgba(251, 191, 36, 0.4) 20%,
        rgba(251, 191, 36, 0.4) 80%,
        transparent
    );
}

/* =============================================
   MODAL
============================================= */
.timeline-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 1001;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.timeline-modal-content {
    background: linear-gradient(160deg, #1e2d45 0%, #111827 100%);
    max-width: 680px;
    margin: 0 auto;
    border-radius: var(--border-radius);
    border: 1px solid rgba(251, 191, 36, 0.2);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

@keyframes modalSlideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to   { transform: translateY(0);     opacity: 1; }
}

.timeline-modal-content::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(to right, var(--accent-gold), var(--accent-purple), var(--accent-gold));
}

.timeline-modal-body {
    padding: 2rem;
}

.modal-event-year {
    font-family: 'Cinzel', serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.3rem;
}

.modal-event-title {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 1.2rem;
    line-height: 1.3;
}

.modal-event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid rgba(251, 191, 36, 0.1);
}

.modal-event-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-event-meta i {
    color: var(--accent-gold);
}

.modal-event-description {
    color: var(--text-muted);
    font-size: 0.97rem;
    line-height: 1.9;
}

.modal-event-description p {
    margin-bottom: 1.2rem;
}

.modal-event-description p:last-child {
    margin-bottom: 0;
}

/* Close button */
.close-timeline-modal {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: var(--text-light);
    font-size: 1.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 1100;
    line-height: 1;
}

.close-timeline-modal:hover {
    background: var(--accent-gold);
    color: var(--primary-dark);
}

/* =============================================
   END OF TIMELINE marker
============================================= */
.timeline-end {
    text-align: center;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.timeline-end.visible {
    opacity: 1;
}

.timeline-end i {
    display: block;
    font-size: 1.5rem;
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 768px) {
    .timeline-hero-content h1 { font-size: 2.2rem; }

    /*
      On mobile the timeline collapses to a single left-aligned column.
      All events sit to the right of the line which moves to the left edge.
    */
    .timeline-track::before {
        left: 1rem;
    }

    .timeline-event,
    .timeline-event.right {
        justify-content: flex-start;
        padding-left: 3.5rem;
        padding-right: 0;
        transform: translateX(20px);
    }

    .timeline-node {
        left: 1rem;
    }

    .timeline-connector,
    .timeline-event.right .timeline-connector {
        left: 1.8rem;
        right: auto;
        width: 1.5rem;
        background: linear-gradient(to right, rgba(251, 191, 36, 0.5), transparent);
    }

    .timeline-card {
        max-width: 100%;
    }

    .timeline-modal { padding: 0; }
    .timeline-modal-content { border-radius: 0; min-height: 100dvh; }
    .modal-event-year { font-size: 2rem; }
}