/* ═══════════════════════════════════════════════════════════
   timeline_origin_revised_v2.css

   Requires: troqc-base.css loaded first (provides :root vars).

   Changes from timeline_origin.css (currently live):
   - Removed :root block (now in troqc-base.css)
   - All hardcoded brand colors → var() references
   - .timeline-orientation → defined in troqc-base.css (shared)
   - Removed Start Here banner styles
   - Added: episode counter, jump-to-latest, progress bar,
     clickable cards, editorial notes, latest-episode highlight,
     cast portrait row

   Location: wp-content/themes/troqc/css/timeline_origin_revised_v2.css
   ═══════════════════════════════════════════════════════════ */

/* ─── Hide WP defaults ─── */
.page .entry-content { display: none; }

/* ─── Page wrapper ─── */

.timeline-page-wrapper {
    min-height: 100vh;
}

.timeline-origin-page {
    display: block;
}

/* ─── Timeline Hero ─── */

.timeline-hero {
    text-align: center;
    max-width: 1100px;
    margin: 50px auto;
    padding: 40px 40px;
    background: var(--surface-card);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    border-top: 4px solid var(--brand-teal);
}

.timeline-hero-illustration {
    width: 120px;
    height: auto;
    display: block;
    margin: 0 auto 0.5rem;
    opacity: 0.85;
}

.timeline-title {
    font-family: var(--font-display);
    font-size: 3.25rem;
    margin-bottom: 20px;
    color: var(--text-heading);
}

.timeline-subtitle {
    font-family: var(--font-handwritten);
    font-size: 2rem;
    color: #666;
    margin-bottom: 20px;
}

/* Orientation crosslink spacing (shared styles in troqc-base.css) */
.timeline-orientation {
    margin-bottom: 24px;
}

.timeline-description {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    color: #555;
    max-width: 600px;
    margin: 0 auto;
}

.cast-divider {
    margin: 40px 0 20px;
    font-size: 1.875rem;
    color: var(--brand-teal);
    opacity: 0.35;
}

.cast-list {
    font-family: var(--font-body);
    font-size: 1rem;
    color: #999;
    margin-bottom: 16px;
}

/* ─── Cast Portrait Row (adds color to hero) ─── */

.cast-portraits-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 4px;
}

a.cast-portrait-item {
    text-decoration: none;
    color: inherit;
}

.cast-portrait-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.cast-portrait-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--surface-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.cast-portrait-img:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(63, 109, 125, 0.2);
    border-color: var(--brand-teal);
}

.cast-portrait-name {
    font-family: var(--font-handwritten);
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ─── Chapter Heading (teal accents) ─── */

.chapter-heading {
    text-align: center;
    margin: 80px 0 60px;
}

.chapter-stars {
    font-size: 1.5rem;
    color: var(--brand-teal);
    opacity: 0.5;
    letter-spacing: 0.5em;
    margin-bottom: 16px;
}

.chapter-title {
    font-family: var(--font-handwritten);
    font-size: 2.625rem;
    color: var(--brand-teal);
}

.chapter-subtitle {
    font-family: var(--font-handwritten);
    font-size: 1.25rem;
    color: #999;
    margin-top: 5px;
}

.chapter-meta {
    margin-top: 16px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.episode-count {
    background: var(--surface-border);
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.chapter-meta-divider {
    color: #ccc;
}

/* ─── Timeline Container & Line ─── */

.timeline-container {
    position: relative;
    padding: 40px 0;
}

.timeline-container::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 150px;
    width: 3px;
    background: linear-gradient(to bottom, #ddd 0%, #ddd 50%, transparent 50%, transparent 100%);
    background-size: 100% 20px;
    transform: translateX(-50%);
    z-index: 1;
}

/* ─── Timeline Panels (5-column CSS Grid — markers on spine) ─── */

.timeline-panel {
    position: relative;
    margin-bottom: -70px;
    display: grid;
    grid-template-columns: 1fr 20px 65px 20px 1fr;
    align-items: center;
    padding: 0 20px;
}

.timeline-panel:last-child {
    margin-bottom: 80px;
}

/* ODD panels: card on LEFT side */
.timeline-panel:nth-child(odd) {
    text-align: left;
}

.timeline-panel:nth-child(odd) .story-card-timeline {
    grid-column: 1;
    grid-row: 1;
}

.timeline-panel:nth-child(odd) .timeline-connector {
    grid-column: 2;
    grid-row: 1;
}

.timeline-panel:nth-child(odd) .timeline-marker {
    grid-column: 3;
    grid-row: 1;
}

/* EVEN panels: card on RIGHT side */
.timeline-panel:nth-child(even) {
    text-align: right;
}

.timeline-panel:nth-child(even) .timeline-marker {
    grid-column: 3;
    grid-row: 1;
}

.timeline-panel:nth-child(even) .timeline-connector {
    grid-column: 4;
    grid-row: 1;
}

.timeline-panel:nth-child(even) .story-card-timeline {
    grid-column: 5;
    grid-row: 1;
}

/* ─── Timeline Markers ─── */

.timeline-marker {
    width: 65px;
    height: 65px;
    background: var(--surface-card);
    border: 3px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    justify-self: center;
}

.timeline-icon-svg {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

/* ─── Timeline Connectors ─── */

.timeline-connector {
    width: calc(100% + 20px);
    height: 2px;
    background: #ddd;
    align-self: center;
}

.timeline-panel:nth-child(odd) .timeline-connector {
    margin-left: -20px;
}

.timeline-panel:nth-child(even) .timeline-connector {
    margin-right: -20px;
    justify-self: end;
}

/* ─── Story Cards (fully clickable) ─── */

.story-card-timeline {
    background: var(--surface-card);
    padding: 30px;
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 10;
    max-width: 380px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: block;
}

.timeline-panel:nth-child(odd) .story-card-timeline {
    justify-self: end;
}

.timeline-panel:nth-child(even) .story-card-timeline {
    justify-self: start;
}

.story-card-clickable {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.story-card-timeline:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.story-card-clickable:hover {
    outline: 2px solid var(--brand-wine);
    outline-offset: -2px;
}

.story-card-timeline::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid #333;
    opacity: 0.1;
    pointer-events: none;
}

.episode-number {
    font-family: var(--font-body);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #999;
    margin-bottom: 10px;
}

.episode-of {
    color: #bbb;
    font-weight: 400;
}

.story-card-timeline .story-title {
    font-family: var(--font-handwritten);
    font-size: 1.75rem;
    line-height: 1.2;
    margin-bottom: 10px;
    color: var(--text-heading);
}

.story-date {
    font-family: var(--font-body);
    font-size: 1rem;
    color: #999;
    margin-bottom: 15px;
}

.story-blurb {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    color: #666;
    margin-bottom: 15px;
}

.read-story-link {
    font-family: var(--font-handwritten);
    font-size: 1.25rem;
    color: var(--brand-teal);
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s;
}

.story-card-clickable:hover .read-story-link {
    color: var(--brand-wine);
}

/* ─── Editorial Notes (outside upper corner of each card) ─── */

.editorial-note {
    font-family: var(--font-handwritten);
    font-size: 1.625rem;
    color: #999;
    pointer-events: none;
    z-index: 15;
    grid-row: 1;
    align-self: start;
    margin-top: -50px;
}

.timeline-panel:nth-child(odd) .editorial-note {
    grid-column: 1;
    justify-self: start;
    margin-left: -20px;
    transform: rotate(-6deg);
}

.timeline-panel:nth-child(even) .editorial-note {
    grid-column: 5;
    justify-self: end;
    margin-right: -20px;
    transform: rotate(6deg);
}

/* ─── Timeline Footer ─── */

.timeline-footer {
    text-align: center;
    padding: 60px 20px 40px;
    max-width: 600px;
    margin: -120px auto 0;
}

.tbc-text {
    font-family: var(--font-handwritten);
    font-size: 2.625rem;
    color: var(--brand-teal);
    margin-bottom: 15px;
}

.tbc-subtext {
    font-family: var(--font-body);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    line-height: 1.6;
}

.tbc-subtext a {
    color: var(--brand-teal);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--brand-teal);
}

.tbc-subtext a:hover {
    color: var(--brand-wine);
    border-bottom-color: var(--brand-wine);
}

.timeline-footer-btn {
    margin-top: 24px;
}

.tbc-follow {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e0dbd3;
}

.tbc-follow-label {
    font-family: var(--font-handwritten);
    font-size: 2rem;
    color: rgba(0, 0, 0, 0.35);
    display: block;
    margin-bottom: 12px;
}

.tbc-follow-links {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.tbc-follow-link {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 6px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s ease;
}

.tbc-youtube {
    background: var(--brand-wine);
    color: #fff;
}

.tbc-youtube:hover {
    background: var(--brand-wine-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(72, 16, 55, 0.3);
}

.tbc-rss {
    background: var(--brand-teal);
    color: #fff;
    border: 1px solid var(--brand-teal);
}

.tbc-rss:hover {
    background: var(--brand-teal);
    color: #fff;
    transform: translateY(-1px);
}

/* ─── Progress Bar ─── */

.timeline-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.timeline-progress-bar.visible {
    opacity: 1;
}

.timeline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand-teal), var(--brand-wine));
    width: 0%;
    transition: width 0.1s ease-out;
    border-radius: 0 2px 2px 0;
}

/* ─── Responsive ─── */

@media (max-width: 900px) {
    .timeline-origin-page {
        padding: 0 20px 30px;
        border-width: 12px;
    }

    .timeline-hero {
        margin: 20px 0;
        padding: 40px 20px;
    }

    .timeline-title {
        font-size: 2.25rem;
    }

    .timeline-subtitle {
        font-size: 1.625rem;
    }

    .chapter-title {
        font-size: 2rem;
    }

    .tbc-text {
        font-size: 2rem;
    }

    .cast-portraits-row {
        gap: 12px;
    }

    .cast-portrait-img {
        width: 44px;
        height: 44px;
    }

    .cast-portrait-name {
        font-size: 1rem;
    }

    .chapter-heading {
        margin: 50px 0 40px;
    }

    .chapter-meta {
        flex-direction: column;
        gap: 6px;
    }

    .chapter-meta-divider {
        display: none;
    }

    /* Timeline — collapse to single column */
    .timeline-container::before {
        left: 30px;
    }

    .timeline-panel,
    .timeline-panel:nth-child(odd),
    .timeline-panel:nth-child(even) {
        display: block;
        text-align: left;
        padding-left: 80px;
        margin-bottom: 40px;
        position: relative;
    }

    .timeline-panel:last-child {
        margin-bottom: 40px;
    }

    .timeline-marker,
    .timeline-panel:nth-child(odd) .timeline-marker,
    .timeline-panel:nth-child(even) .timeline-marker {
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 50px;
        height: 50px;
    }

    .timeline-icon-svg {
        width: 28px;
        height: 28px;
    }

    .timeline-connector {
        display: none;
    }

    .story-card-timeline {
        width: 100%;
        max-width: 100%;
        padding: 20px;
        margin: 0;
    }

    .story-card-timeline .story-title {
        font-size: 1.375rem;
    }

    .editorial-note,
    .timeline-panel:nth-child(odd) .editorial-note,
    .timeline-panel:nth-child(even) .editorial-note {
        display: none;
    }
}

@media (max-width: 768px) {
    .timeline-page-wrapper {
        padding: 10px;
    }

    .timeline-origin-page {
        padding: 0 15px 30px;
        border-width: 12px;
    }

    .timeline-hero {
        margin: 20px 0;
        padding: 60px 20px 40px;
    }

    .timeline-title {
        font-size: 2rem;
    }

    .chapter-heading {
        margin: 40px 0 30px;
    }
}

@media (max-width: 480px) {
    .timeline-origin-page {
        border-width: 8px;
        padding: 0 10px 20px;
    }

    .timeline-hero {
        padding: 60px 15px 30px;
        margin: 10px 0;
    }

    .tbc-follow-links {
        flex-direction: column;
        align-items: center;
    }

    .tbc-follow-link {
        width: 200px;
        text-align: center;
    }
}
