/* ============================================================
   COMBINED TIMELINE — Star Map + Vertical Descent
   ============================================================ */

/* ── Page background — warm Mars tones ───────────────────── */
body[data-page-id="timeline"],
body[data-page-id="agent-timeline"] {
    background: #1a0a08;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 40%,
            rgba(81, 34, 22, 0.5) 0%,
            rgba(60, 18, 10, 0.3) 40%,
            transparent 70%),
        radial-gradient(ellipse 50% 80% at 80% 60%,
            rgba(140, 45, 20, 0.15) 0%,
            transparent 60%);
    animation: tl-bg-pulse 8s ease-in-out infinite alternate;
}

@keyframes tl-bg-pulse {
    0%   { background-color: #1a0a08; }
    50%  { background-color: #1f0e0a; }
    100% { background-color: #1a0a08; }
}

/* ── Full page — prevent scroll for star view ────────────── */
body[data-page-id="timeline"],
body[data-page-id="agent-timeline"] {
    overflow-x: hidden;
}

/* ── Page header ─────────────────────────────────────────── */
.tl-page-header {
    position: relative;
    z-index: var(--z-ui, 10);
    text-align: center;
    padding: 0.6rem 1rem 0.15rem;
}

.tl-page-title {
    font-family: var(--font-mono, monospace);
    font-size: clamp(0.9rem, 2.5vw, 1.3rem);
    letter-spacing: 0.2em;
    color: rgba(255, 120, 70, 0.95);
    text-transform: uppercase;
    margin: 0 0 0.4rem;
}

.tl-page-subtitle {
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: rgba(200, 240, 200, 0.6);
    text-transform: uppercase;
    margin: 0;
}

/* ── View toggle buttons ─────────────────────────────────── */
.tl-view-toggle {
    position: relative;
    z-index: var(--z-ui, 10);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.25rem 1rem 0.25rem;
}

.tl-view-btn {
    background: rgba(81, 34, 22, 0.25);
    border: 1px solid rgba(255, 100, 50, 0.2);
    color: rgba(255, 120, 70, 0.5);
    font-family: var(--font-mono, monospace);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    text-transform: uppercase;
    border-radius: 3px;
}

.tl-view-btn:hover {
    background: rgba(81, 34, 22, 0.4);
    color: rgba(255, 120, 70, 0.8);
}

.tl-view-btn--active {
    background: rgba(255, 80, 40, 0.15);
    border-color: rgba(255, 100, 50, 0.5);
    color: #ff8040;
    box-shadow: 0 0 12px rgba(255, 80, 40, 0.1);
}

.tl-view-icon {
    margin-right: 0.3rem;
    font-size: 0.7rem;
}

/* ── View containers ─────────────────────────────────────── */
.tl-view {
    display: none;
}

.tl-view--active {
    display: block;
}


/* ============================================================
   STAR MAP VIEW
   ============================================================ */

.tl-star-wrapper {
    position: relative;
    z-index: var(--z-ui, 10);
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 0.5rem 0.25rem;
    box-sizing: border-box;
}

#tl-star-canvas {
    display: block;
    width: 100%;
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px);
    min-height: 300px;
    border-radius: 4px;
}

/* Detail panel — positioned near clicked star */
.tl-star-detail {
    display: none;
    position: absolute;
    width: 90%;
    max-width: 480px;
    background: rgba(30, 12, 8, 0.96);
    border: 1px solid rgba(255, 100, 50, 0.4);
    border-radius: 4px;
    overflow: hidden;
    z-index: 20;
    box-shadow:
        0 0 30px rgba(255, 60, 20, 0.15),
        0 4px 16px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.tl-star-detail--visible {
    display: block;
}

.tl-star-detail-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.85rem;
    background: rgba(200, 60, 20, 0.15);
    border-bottom: 1px solid rgba(255, 100, 50, 0.25);
}

.tl-star-detail-date {
    font-family: var(--font-mono, monospace);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: rgba(255, 120, 70, 0.8);
}

.tl-star-detail-title {
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: rgba(200, 245, 200, 0.95);
    text-transform: uppercase;
    flex: 1;
}

.tl-star-detail-close {
    background: none;
    border: 1px solid rgba(255, 100, 50, 0.35);
    color: rgba(255, 120, 70, 0.7);
    font-family: var(--font-mono, monospace);
    font-size: 0.55rem;
    padding: 0.2rem 0.5rem;
    cursor: pointer;
    letter-spacing: 0.1em;
    transition: all 0.2s;
}

.tl-star-detail-close:hover {
    background: rgba(255, 60, 20, 0.12);
    color: #ff7040;
}

.tl-star-detail-body {
    padding: 0.75rem 1rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.68rem;
    line-height: 1.7;
    color: rgba(200, 235, 200, 0.92);
    margin: 0;
}

.tl-star-error {
    color: rgba(255, 100, 60, 0.6);
    font-family: monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-align: center;
    margin: 3rem 0;
}


/* ============================================================
   VERTICAL DESCENT VIEW
   ============================================================ */

.tl-vert-wrapper {
    position: relative;
    z-index: var(--z-ui, 10);
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem 1.25rem 4rem;
}

/* Central spine */
.tl-vert-spine {
    position: absolute;
    left: 50%;
    top: 2rem;
    bottom: 4rem;
    width: 2px;
    background: linear-gradient(180deg,
        rgba(255, 100, 50, 0.6) 0%,
        rgba(255, 80, 40, 0.4) 50%,
        rgba(255, 60, 30, 0.2) 100%);
    transform-origin: top center;
    transform: scaleY(0);
}

.tl-vert-track {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Card */
.tl-vert-card {
    position: relative;
    width: 44%;
    opacity: 0;
}

.tl-vert-card--left {
    align-self: flex-start;
    margin-left: 2%;
}

.tl-vert-card--right {
    align-self: flex-end;
    margin-right: 2%;
}

/* Year dot on spine */
.tl-vert-dot {
    position: absolute;
    top: 1rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 100, 50, 0.7);
    border: 2px solid rgba(255, 120, 70, 0.8);
    box-shadow: 0 0 14px rgba(255, 80, 40, 0.4);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
}

.tl-vert-card--left .tl-vert-dot {
    right: -14%;
    transform-origin: center;
}

.tl-vert-card--right .tl-vert-dot {
    left: -14%;
    transform-origin: center;
}

.tl-vert-year {
    position: absolute;
    top: -1.6rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    color: rgba(255, 120, 70, 0.85);
    white-space: nowrap;
}

/* Panel */
.tl-vert-panel {
    position: relative;
    background: rgba(81, 34, 22, 0.35);
    border: 1px solid rgba(255, 100, 50, 0.3);
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 30px rgba(200, 50, 20, 0.1);
    overflow: hidden;
}

.tl-vert-card--left .tl-vert-panel {
    border-right: 3px solid rgba(255, 100, 50, 0.5);
}

.tl-vert-card--right .tl-vert-panel {
    border-left: 3px solid rgba(255, 100, 50, 0.5);
}

.tl-vert-date {
    font-family: var(--font-mono, monospace);
    font-size: 0.58rem;
    letter-spacing: 0.12em;
    color: rgba(255, 120, 70, 0.65);
    margin-bottom: 0.3rem;
}

.tl-vert-card-title {
    font-family: var(--font-mono, monospace);
    font-size: 0.78rem;
    letter-spacing: 0.15em;
    color: rgba(200, 245, 200, 0.95);
    text-transform: uppercase;
    margin: 0 0 0.6rem;
}

.tl-vert-body {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    line-height: 1.75;
    color: rgba(200, 235, 200, 0.85);
    margin: 0;
}

.tl-vert-error {
    color: rgba(255, 100, 60, 0.6);
    font-family: monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-align: center;
    margin: 3rem 0;
}

/* ── Mobile — vertical descent ───────────────────────────── */
@media (max-width: 700px) {
    .tl-vert-spine { left: 1.5rem; }

    .tl-vert-card,
    .tl-vert-card--left,
    .tl-vert-card--right {
        width: calc(100% - 3rem);
        margin-left: 3rem;
        margin-right: 0;
        align-self: flex-start;
    }

    .tl-vert-card--left .tl-vert-dot,
    .tl-vert-card--right .tl-vert-dot {
        left: -2.4rem;
        right: auto;
    }

    .tl-vert-card--left .tl-vert-panel,
    .tl-vert-card--right .tl-vert-panel {
        border-right: none;
        border-left: 3px solid rgba(255, 100, 50, 0.5);
    }

    .tl-vert-track { gap: 2rem; }
}

/* ── Mobile — star map ───────────────────────────────────── */
@media (max-width: 600px) {
    #tl-star-canvas {
        height: calc(100vh - 150px);
        height: calc(100dvh - 150px);
        min-height: 260px;
    }

    .tl-star-detail {
        width: 94%;
        max-width: none;
    }

    .tl-page-header { padding: 0.4rem 0.75rem 0.1rem; }
    .tl-page-title { font-size: 0.8rem; margin-bottom: 0.2rem; }
    .tl-page-subtitle { font-size: 0.55rem; }
    .tl-view-toggle { gap: 0.3rem; padding: 0.2rem 0.5rem 0.15rem; }
    .tl-view-btn { padding: 0.3rem 0.5rem; font-size: 0.5rem; }
}

@media (max-width: 480px) {
    .tl-vert-wrapper { padding: 1rem 0.75rem 3rem; }
    .tl-vert-panel { padding: 1rem; }
}
