/* ========================= timeline canvas page ========================= */

.tl-root {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: var(--bg);
}
.tl-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: grab;
    touch-action: none;
}
.tl-canvas.dragging { cursor: grabbing; }
.tl-canvas.pointing { cursor: pointer; }

.tl-head {
    position: absolute;
    top: calc(env(safe-area-inset-top, 0) + 0.75rem);
    left: 0;
    right: 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 1rem;
    pointer-events: none;
    z-index: 5;
}
.tl-back {
    pointer-events: auto;
    font-family: var(--font-label);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--gold);
    text-decoration: none;
    padding: 0.45rem 0.8rem;
    border: 1px solid rgba(200,155,58,0.4);
    border-radius: 2px;
    background: rgba(10,7,4,0.55);
    backdrop-filter: blur(4px);
}
.tl-back:hover { color: var(--gold-bright); border-color: var(--gold-bright); }
.tl-title { text-align: center; }
.tl-kicker {
    margin: 0;
    font-family: var(--font-label);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.42em;
    font-size: 0.62rem;
    color: var(--gold);
    padding-left: 0.42em;
}
.tl-title h1 {
    margin: 0.2rem 0 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 3.4vw, 2.1rem);
    line-height: 1;
    color: var(--ink);
    text-shadow: 0 1px 0 rgba(0,0,0,0.4), 0 0 26px rgba(200,155,58,0.18);
}
.tl-hint {
    font-family: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.62rem;
    color: var(--muted);
    padding: 0.5rem 0;
    text-align: right;
    max-width: 11rem;
    line-height: 1.7;
}

.tl-legend {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: calc(env(safe-area-inset-bottom, 0) + 0.7rem);
    display: flex;
    gap: 1.1rem;
    padding: 0.45rem 1rem;
    background: rgba(10,7,4,0.6);
    border: 1px solid rgba(200,155,58,0.25);
    border-radius: 2px;
    backdrop-filter: blur(4px);
    font-family: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.6rem;
    color: var(--muted);
    z-index: 5;
    pointer-events: none;
}
.tl-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.tl-legend i {
    display: inline-block;
    width: 1.2rem;
    height: 0;
    border-top: 2px solid var(--c);
}
.tl-legend i.dash { border-top-style: dashed; }
.tl-legend i.dot { border-top-style: dotted; }

.tl-reset {
    position: absolute;
    right: 1rem;
    bottom: calc(env(safe-area-inset-bottom, 0) + 0.7rem);
    z-index: 5;
    width: 2.4rem;
    height: 2.4rem;
    display: grid;
    place-items: center;
    background: rgba(10,7,4,0.6);
    border: 1px solid rgba(200,155,58,0.4);
    border-radius: 2px;
    color: var(--gold);
    font-size: 1.05rem;
    cursor: pointer;
    backdrop-filter: blur(4px);
}
.tl-reset:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

.tl-tip {
    position: absolute;
    z-index: 6;
    max-width: 20rem;
    padding: 0.55rem 0.8rem;
    background: rgba(14,10,6,0.92);
    border: 1px solid rgba(200,155,58,0.45);
    border-radius: 2px;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.45;
    pointer-events: none;
    box-shadow: 0 8px 22px rgba(0,0,0,0.55);
}
.tl-tip .tip-kind {
    display: block;
    font-family: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.58rem;
    color: var(--gold);
    margin-bottom: 0.2rem;
}

/* ------------------------------ card modal ------------------------------ */

.tl-modal { position: fixed; inset: 0; z-index: 20; }
.tl-modal-scrim {
    position: absolute;
    inset: 0;
    background: rgba(8,5,3,0.78);
    backdrop-filter: blur(6px);
}
.tl-modal-body {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1.25rem, 4vw, 3.5rem);
    padding: 1rem;
    pointer-events: none;
}
.tl-modal-card, .tl-modal-meta { pointer-events: auto; }

.tl-modal-card { perspective: 1400px; }
.tl-flip {
    width: min(58vw, calc((100dvh - 9rem) * 2 / 3), 340px);
    aspect-ratio: 2 / 3;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(.2,.8,.2,1);
    cursor: pointer;
}
.tl-flip.is-flipped { transform: rotateY(180deg); }
.tl-flip .face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    backface-visibility: hidden;
    border-radius: 8px;
    box-shadow: 0 14px 40px rgba(0,0,0,0.65);
}
.tl-flip .back { transform: rotateY(180deg); }
.tl-flip-cue {
    margin: 0.7rem 0 0;
    text-align: center;
    font-family: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.6rem;
    color: var(--muted);
}

.tl-modal-meta { max-width: 20rem; }
.tl-modal-kicker {
    margin: 0;
    font-family: var(--font-label);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-size: 0.66rem;
    color: var(--gold);
}
.tl-modal-meta h2 {
    margin: 0.3rem 0 0.2rem;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 4.5vw, 2.4rem);
    line-height: 1.02;
    color: var(--ink);
    text-shadow: 0 0 22px rgba(200,155,58,0.16);
}
.tl-modal-years {
    margin: 0;
    font-family: var(--font-label);
    letter-spacing: 0.24em;
    font-size: 0.85rem;
    color: var(--muted);
}
.tl-modal-hook {
    margin: 0.7rem 0 0;
    font-style: italic;
    color: var(--muted);
    line-height: 1.5;
}
.tl-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 1.4rem;
}
.tl-act {
    display: block;
    text-align: center;
    font-family: var(--font-label);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--gold);
    text-decoration: none;
    padding: 0.6rem 1rem;
    border: 1px solid rgba(200,155,58,0.5);
    border-radius: 2px;
    background: rgba(10,7,4,0.55);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tl-act:hover { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.tl-act-primary { color: var(--bg); background: var(--gold); border-color: var(--gold); }
.tl-act-primary:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.tl-act-ghost { border-color: rgba(200,155,58,0.25); color: var(--muted); font-family: var(--font-label); }
.tl-act-ghost:hover { color: var(--ink); background: rgba(200,155,58,0.12); }

@media (max-width: 720px) {
    .tl-modal-body { flex-direction: column; overflow-y: auto; justify-content: flex-start; padding-top: 3.5rem; }
    .tl-flip { width: min(70vw, 250px); }
    .tl-modal-meta { text-align: center; padding-bottom: 2rem; }
    .tl-legend { display: none; }
    .tl-hint { display: none; }
}
