/* ============================================================
   TIMELINE VIEW
   ============================================================ */
.tl-controls { padding: 12px 16px; }
.tl-legend {
    display: flex; flex-wrap: wrap; gap: 14px; padding: 6px 16px 10px;
    font-size: 0.82rem; color: var(--text-muted, #555);
}
.tl-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.tl-swatch {
    display: inline-block; width: 14px; height: 14px; border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.15);
}
.tl-sw-focus-outline { background: #fff; border: 2px solid #2a2a2a; }
.tl-sw-est    { background: repeating-linear-gradient(45deg, #aaa, #aaa 3px, #ddd 3px, #ddd 6px); }

.tl-container {
    margin: 0 16px 16px;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    overflow: auto;
    max-height: calc(100vh - 280px);
    position: relative;
}

.tl-canvas {
    position: relative;
    width: var(--tl-track-width, 2000px);
    background-image: linear-gradient(to right, rgba(0,0,0,0.06) 1px, transparent 1px);
    background-size: var(--tl-decade-px, 120px) 100%;
}
.tl-ruler {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--card-bg, #fff);
    border-bottom: 1px solid var(--border-color, #ddd);
    height: 28px;
    width: var(--tl-track-width, 2000px);
}
.tl-tick {
    position: absolute; top: 0; bottom: 0;
    border-left: 1px dashed rgba(0,0,0,0.18);
    font-size: 0.72rem; color: var(--text-muted, #777);
    padding: 4px 0 0 4px;
    white-space: nowrap;
}
.tl-lanes {
    position: relative;
    width: var(--tl-track-width, 2000px);
}

.tl-bar {
    position: absolute;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
    font-size: 0.7rem;
    line-height: 20px;
    padding: 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(0,0,0,0.18);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.tl-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    z-index: 5;
}
/* Each couple gets a pastel from the JS palette via inline background-color.
   Text stays dark so it reads on any pastel. */
.tl-bar { color: #2a2a2a; }
.tl-bar-focus-outline {
    box-shadow: 0 0 0 2px #2a2a2a, 0 1px 2px rgba(0,0,0,0.25);
    font-weight: 700;
}
.tl-bar.tl-est { background-image: repeating-linear-gradient(45deg, rgba(0,0,0,0.12) 0 4px, transparent 4px 8px); }

:root[data-theme="dark"] .tl-bar { color: #1a1a1a; }
:root[data-theme="dark"] .tl-bar-focus-outline {
    box-shadow: 0 0 0 2px #ffffff, 0 1px 2px rgba(0,0,0,0.4);
}

.tl-marker-focus-year {
    position: absolute; top: 32px; bottom: 0;
    border-left: 2px solid #f4c430;
    z-index: 1;
    pointer-events: none;
}

.tl-empty {
    padding: 32px; text-align: center; color: var(--text-muted, #777);
}

/* Dark theme tweaks */
:root[data-theme="dark"] .tl-track {
    background-image: linear-gradient(to right, rgba(255,255,255,0.06) 1px, transparent 1px);
}
:root[data-theme="dark"] .tl-track:hover { background-color: rgba(255,255,255,0.04); }
:root[data-theme="dark"] .tl-tick { color: #aaa; border-left-color: rgba(255,255,255,0.1); }

/* Phones: the desktop max-height assumes ~280px of chrome above, which leaves
   almost nothing on a 600px-tall screen. Use viewport-relative height instead. */
@media (max-width: 768px) {
    .tl-container { max-height: 65vh; margin: 0 12px 12px; }
    .tl-controls  { padding: 10px 12px; }
    .tl-legend    { padding: 4px 12px 8px; gap: 10px; }
}
