/*
 * timeline.css - Timeline View Styles
 *
 * All styles for the interactive timeline view.
 * Isolated from main style.css to keep timeline code separate.
 */

/* ==================== TOTALS BAR ==================== */

.tl-totals-bar {
    position: -webkit-sticky;
    position: sticky;
    top: 48px;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 12px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.tl-current-date {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    white-space: nowrap;
    margin-right: 8px;
    min-width: 60px;
}

.tl-totals-group {
    display: flex;
    gap: 4px;
}

.tl-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 10px;
    border-radius: 4px;
    min-width: 60px;
}

.tl-total-citizens { background: rgba(45, 106, 45, 0.08); }
.tl-total-observers { background: rgba(9, 105, 218, 0.08); }
.tl-total-immigrants { background: rgba(130, 80, 223, 0.08); }
.tl-total-schools { background: rgba(188, 76, 0, 0.08); }

.tl-count {
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-sans);
    line-height: 1;
}

.tl-total-citizens .tl-count { color: #2d6a2d; }
.tl-total-observers .tl-count { color: var(--type-observers); }
.tl-total-immigrants .tl-count { color: var(--type-immigrants); }
.tl-total-schools .tl-count { color: var(--type-schools); }

.tl-total-label {
    font-size: 0.6rem;
    font-family: var(--font-sans);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-top: 1px;
}

.tl-totals-note {
    font-size: 0.72rem;
    font-family: var(--font-sans);
    color: var(--color-text-muted);
    text-align: center;
    width: 100%;
    margin-top: 2px;
}


.tl-count-pop {
    animation: tl-pop 0.3s ease-out;
}

@keyframes tl-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ==================== CONTENT AREA ==================== */

.tl-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 16px 40px 0;
    position: relative;
}

.tl-content::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #c0c0c0;
}

/* ==================== YEAR HEADERS ==================== */

.tl-year {
    position: relative;
    padding: 20px 0 10px 0;
    z-index: 1;
}

.tl-year::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: var(--color-bg);
    z-index: -1;
}

.tl-year span {
    display: inline-block;
    background: var(--color-bg);
    padding: 2px 16px 2px 14px;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 1;
}

/* ==================== MONTH SECTIONS ==================== */

.tl-month {
    padding: 4px 0;
}

.tl-month-label {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 10px 0 4px 14px;
    margin: 0;
    letter-spacing: 0.01em;
    position: relative;
    z-index: 1;
}

.tl-month-label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: var(--color-bg);
    z-index: -1;
}

/* ==================== NARRATIVE MOMENTS ==================== */

.tl-moment {
    position: relative;
    padding: 10px 0 10px 14px;
    margin: 10px 0;
    background: var(--color-bg);
    z-index: 1;
    scroll-margin-top: var(--tl-scroll-clearance, 200px);
}

.tl-moment-line {
    display: none;
}

.tl-moment-content {
    background: var(--color-surface);
    border: none;
    border-left: 4px solid #7a9dbd;
    border-radius: 0;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden; /* clear float from image */
}

.tl-moment-clickable {
    cursor: pointer;
}

.tl-moment-clickable:hover .tl-moment-content {
    border-left-color: #5a8aad;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.tl-moment-date {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.tl-moment-title {
    font-family: var(--font-serif);
    font-size: 1.32rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.tl-moment-desc {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--color-text-secondary);
    margin: 0;
}

.tl-inline-link {
    color: #5a7a9e;
    font-weight: 600;
    text-decoration: none;
}

.tl-inline-link:hover {
    color: #3d6a94;
}

.tl-moment-source {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5a7a9e;
    text-decoration: none;
    margin-top: 10px;
}

.tl-moment-source:hover {
    color: #3d6a94;
}

.tl-moment-img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 6px;
    margin: 4px 0 10px 0;
}

/* ==================== DAY CLUSTERS ==================== */

.tl-day {
    position: relative;
    padding: 4px 0 4px 32px;
    scroll-margin-top: var(--tl-scroll-clearance, 200px);
}

.tl-day-marker {
    position: absolute;
    left: 15px;
    top: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #c0c0c0;
    border: 2px solid var(--color-surface);
    transform: translateX(-50%);
    z-index: 2;
}

.tl-day-body {
    padding: 4px 0;
}

.tl-day-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 4px;
}

.tl-day-date {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--color-text);
}

.tl-day-count {
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

.tl-day-titles {
    padding-left: 0;
}

.tl-day-incident {
    font-size: 0.84rem;
    font-weight: 500;
    color: #4a7a9e;
    padding: 3px 0;
    cursor: pointer;
    line-height: 1.35;
}

.tl-day-incident:hover {
    color: #3d6a94;
}

.tl-cat-tag {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    color: var(--color-text-muted);
}

.tl-day-incidents {
    padding: 0 0 4px 32px;
}

.tl-day-hidden {
    display: none;
}

.tl-day-expanded .tl-day-hidden {
    display: block;
}

.tl-day-expanded .tl-day-more {
    display: none;
}

.tl-day-more {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a7a9e;
    padding: 4px 10px;
    margin-top: 4px;
    cursor: pointer;
    border: 1px solid rgba(90, 122, 158, 0.3);
    border-radius: 12px;
    background: rgba(90, 122, 158, 0.06);
}

.tl-day-more:hover {
    background: rgba(90, 122, 158, 0.12);
    border-color: rgba(90, 122, 158, 0.5);
}

/* ==================== DESKTOP LAYOUT ==================== */

@media (min-width: 768px) {
    .tl-totals-bar {
        gap: 10px;
        padding: 8px 20px;
    }

    .tl-total {
        padding: 5px 16px;
        min-width: 80px;
    }

    .tl-count {
        font-size: 1.3rem;
    }

    .tl-total-label {
        font-size: 0.65rem;
    }

    .tl-current-date {
        font-size: 1.1rem;
        min-width: 80px;
    }

    .tl-totals-note {
        font-size: 0.78rem;
    }

    .tl-content {
        max-width: 800px;
        padding: 0 24px 80px 0;
    }

    .tl-month-label {
        font-size: 1.2rem;
    }

    .tl-moment-content {
        padding: 20px 24px;
    }

    .tl-moment-title {
        font-size: 1.5rem;
    }

    .tl-moment-desc {
        font-size: 0.95rem;
    }

    .tl-moment-img {
        float: right;
        max-width: min(40%, 300px);
        border-radius: 6px;
        margin: 4px 0 10px 14px;
    }

    /* Changed mind, back to float right for all
    .tl-moment-alt .tl-moment-img {
        float: left;
        margin: 4px 14px 10px 0;
    } */

    .tl-day-incident {
        font-size: 0.89rem;
    }
}

/* ==================== LARGE DESKTOP ==================== */

@media (min-width: 1200px) {
    .tl-content {
        max-width: 900px;
    }

    .tl-count {
        font-size: 2rem;
    }

    .tl-moment-img {
        max-height: 340px;
    }
}

/* ==================== NARROW MOBILE ==================== */

@media (max-width: 480px) {
    .tl-totals-bar {
        gap: 2px;
        padding: 8px 8px;
    }

    .tl-total {
        padding: 4px 8px;
        min-width: 60px;
    }

    .tl-count {
        font-size: 1.2rem;
    }

    .tl-total-label {
        font-size: 0.58rem;
    }

    .tl-content::before {
        left: 10px;
    }

    .tl-month-label {
        padding-left: 10px;
    }

    .tl-month-label::before {
        width: 24px;
    }

    .tl-year::before {
        width: 24px;
    }

    .tl-moment {
        padding-left: 10px;
    }

    .tl-moment-content {
        padding: 12px 14px;
    }

    .tl-moment-title {
        font-size: 1.15rem;
    }

    .tl-moment-desc {
        font-size: 0.85rem;
    }

    .tl-day {
        padding-left: 26px;
    }

    .tl-day-incidents {
        padding-left: 26px;
    }

    .tl-day-marker {
        left: 11px;
    }
}
