/* ==========================================================================
   Timeline Zoom Stacks
   When the view is zoomed out, close events gather in a column with a count
   badge. timeline-render.js (applyZoomStacks) builds the .timeline-stack button
   and sets inline `left`, `top` and the `--stack-count` custom property;
   timeline-interactions.js zooms to the stack when the button is activated.
   ========================================================================== */

/* -------------------------------------------------------------------------
   Stack Button
   ------------------------------------------------------------------------- */

/* The button is a fixed screen size at every zoom: the world scales it, so the
   transform divides that scale out (the live --timeline-zoom-scale, set by
   timeline-zoom.js). The box holds the dot column at the bottom and the count
   badge at the top, so it is moved up by half the badge row to centre the column
   on the spine. */
.timeline-stack {
    position: absolute;
    width: var(--space-xl);
    height: calc(var(--stack-count, 2) * var(--timeline-stack-spacing) + var(--space-lg));
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    z-index: var(--z-timeline-stack);
    transform:
        translate(-50%, -50%)
        scale(calc(1 / var(--timeline-zoom-scale, 1)))
        translateY(calc(-1 * var(--timeline-stack-offset)));
}

/* -------------------------------------------------------------------------
   Count Badge
   ------------------------------------------------------------------------- */

.timeline-stack__count {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    min-width: var(--timeline-stack-size);
    padding: 0 var(--space-xs);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: var(--text-2xs);
    font-weight: var(--font-weight-semibold);
    line-height: var(--timeline-stack-line-height);
    text-align: center;
}

/* -------------------------------------------------------------------------
   Stack States
   ------------------------------------------------------------------------- */

.timeline-stack:hover .timeline-stack__count {
    border-color: var(--accent);
}

.timeline-stack:focus-visible {
    outline: var(--focus-ring-width) solid var(--accent);
    outline-offset: var(--focus-ring-offset);
}

.timeline-stack.filtered-out {
    opacity: var(--opacity-faint);
    pointer-events: none;
}

/* -------------------------------------------------------------------------
   Stacked Dots and Labels
   ------------------------------------------------------------------------- */

/* For each event inside a stack, applyZoomStacks (timeline-render.js) sets
   timeline-dot--stacked on the dot and layoutHorizontalLabels sets
   label--stacked on its label. A stacked dot is not a target of its own; the
   stack button is. Its label is hidden; the count badge stands for it. */
.timeline-dot--stacked {
    pointer-events: none;
}

.timeline-label.label--stacked {
    display: none;
}
