/* Regulation timelines: key dates on a drawn time axis (js/timeline.js).
   The linework follows the schematic robot (components.css) and the How to
   start figures (steps.css): 2px round strokes, hairline leaders, Space
   Mono dates, square corners, chalk used only for the next date and today.
   Colours come only from tokens.css; inside .section-light the same
   variables remap to the paper inks.
   Two views of the same dates, exactly one shown at a time:
   .tl-h  horizontal axis with tooltips (700px and up)
   .tl-v  vertical list with every text inline (phones and print).
   Without JS nothing is armed, and with reduced motion everything renders
   fully drawn. */

.tl { margin: var(--s5) 0 0; position: relative; }
.tl-cap {
    font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--s4);
}
/* The regulation page lets its key dates figure use the full column. */
.reg-block.reg-block-tl { max-width: none; }

/* Lists are reset at .tl specificity: .reg-block ol styles numbered lists. */
.tl .tl-h { display: none; }
@media (min-width: 700px) {
    .tl .tl-h { display: block; }
    .tl .tl-v { display: none; }
}

/* ===== Horizontal axis ===== */
.tl-stage { position: relative; height: 96px; --tl-axis-y: 48px; --tl-today-x: 0px; }
.tl .tl-items { display: block; list-style: none; margin: 0; padding: 0; }

.tl-axis { position: absolute; left: 0; right: 0; top: calc(var(--tl-axis-y) - 1px); height: 2px; }
.tl-axis-past, .tl-axis-future { position: absolute; top: 0; height: 2px; }
.tl-axis-past { left: 0; width: var(--tl-today-x); background: var(--draft-dim); }
.tl-axis-future { left: var(--tl-today-x); right: 6px; background: var(--draft); }
/* Start tick and arrowhead: time runs on to the right */
.tl-axis::before { content: ""; position: absolute; left: 0; top: -6px; width: 2px; height: 14px; background: var(--draft-dim); }
.tl-axis::after {
    content: ""; position: absolute; right: 0; top: -5px; width: 12px; height: 12px;
    background: var(--draft); clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* Time scale: faint ticks and years (or months) below the dates */
.tl-ruler { position: absolute; left: 0; right: 18px; top: var(--tl-ruler-y, 80px); height: 18px; border-top: 1px dashed var(--draft-faint); }
.tl-ruler-tick { position: absolute; top: -4px; height: 12px; border-left: 1px solid var(--draft-dim); }
.tl-ruler-label {
    position: absolute; top: 4px; font-family: var(--font-mono); font-size: 0.6875rem; line-height: 14px;
    letter-spacing: 0.04em; color: var(--text-muted); white-space: nowrap;
}
.tl-stage[data-today-edge="start"] .tl-axis::before { display: none; }

/* Leaders: hairlines from the axis to each date label */
.tl-leader { position: absolute; width: 0; border-left: 1px solid var(--draft-dim); margin-left: -0.5px; pointer-events: none; }
.tl-item.is-past .tl-leader { border-left-color: var(--draft-faint); }

/* Dots: a 30px button, the drawn mark inside. Past: filled and dimmed.
   Upcoming: open ring. Next: chalk bullseye. Proposed: dashed ring. */
.tl-dot {
    position: absolute; left: var(--x, 0); top: var(--tl-axis-y);
    width: 30px; height: 30px; margin: -15px 0 0 -15px; padding: 0;
    border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; z-index: 2;
}
.tl-dot::before {
    content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
    transform: translate(-50%, -50%); border-radius: 50%;
    border: 2px solid var(--draft); background: var(--field);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tl-item.is-past .tl-dot::before { width: 12px; height: 12px; border-color: var(--draft-dim); background: var(--draft-dim); }
.tl-item.is-next .tl-dot::before {
    width: 18px; height: 18px; border-color: var(--chalk);
    background: radial-gradient(circle, var(--chalk) 0 3.5px, var(--field) 4px);
    box-shadow: 0 0 0 4px var(--chalk-tint);
}
.tl-item.is-proposed .tl-dot::before { border-style: dashed; }
.tl-dot:hover::before, .tl-item.is-open .tl-dot::before { transform: translate(-50%, -50%) scale(1.18); }
.tl-item.is-open .tl-dot::before { border-color: var(--chalk); }
.tl-dot:focus-visible { outline: 2px solid var(--glow); outline-offset: 0; }

/* Date labels: the date on the axis side, a tag (Next, Proposed) beyond it */
.tl-label {
    position: absolute; left: 0; top: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    white-space: nowrap; line-height: 1.25; cursor: pointer;
}
.tl-label[data-side="above"] { flex-direction: column-reverse; }
.tl-label[data-align="start"] { align-items: flex-start; }
.tl-label[data-align="end"] { align-items: flex-end; }
.tl-date { font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 700; color: var(--draft); }
.tl-item.is-past .tl-date { font-weight: 400; color: var(--text-muted); }
.tl-item.is-next .tl-date { color: var(--chalk); }
.tl-item:hover .tl-date, .tl-item.is-open .tl-date { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tl-tags { display: inline-flex; align-items: center; gap: var(--s1); }
.tl-tag {
    font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--chalk);
}
.tl-label .badge, .tl-v-head .badge { font-size: 0.625rem; padding: 1px 5px; }

/* Today: a chalk cut through the axis, a dashed leader to its label */
.tl-today { pointer-events: none; }
.tl-today .tl-leader { border-left: 1px dashed var(--chalk); }
.tl-today .tl-label { cursor: default; }
.tl-today-mark {
    position: absolute; left: var(--tl-today-x); top: var(--tl-axis-y);
    width: 2px; height: 20px; margin: -10px 0 0 -1px; background: var(--chalk);
}

/* Tooltip: a drafted callout with a caret pointing at its dot */
.tl-tip {
    position: absolute; z-index: 30; width: min(320px, calc(100vw - 32px));
    background: var(--field-raised); color: var(--text);
    border: 1px solid var(--draft); border-radius: var(--r-card);
    padding: var(--s3) var(--s4); text-align: left; white-space: normal;
    font-size: 0.9375rem; line-height: 1.5;
}
.tl-tip[hidden] { display: none; }
.tl-tip::before {
    content: ""; position: absolute; left: var(--caret, 50%); width: 10px; height: 10px; margin-left: -5px;
    background: var(--field-raised); border: solid var(--draft); border-width: 1px 0 0 1px;
}
.tl-tip[data-side="below"]::before { top: -6px; transform: rotate(45deg); }
.tl-tip[data-side="above"]::before { bottom: -6px; transform: rotate(225deg); }
.tl-tip-head {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s3); margin-bottom: var(--s2);
    font-family: var(--font-mono); font-size: 0.75rem;
}
.tl-tip-date { font-weight: 700; color: var(--draft); }
.tl-tip-status { color: var(--text-muted); }
.tl-item.is-next .tl-tip-status { color: var(--chalk); }

/* Entry text, shared by the tooltip and the vertical list */
.tl-entry + .tl-entry { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px dashed var(--draft-faint); }
.tl-text { font-weight: 600; color: var(--text); }
.tl-text .badge { margin-left: var(--s1); vertical-align: 1px; }
.tl-affects { font-size: 0.875rem; color: var(--text-muted); margin-top: var(--s1); }
.tl-link { display: inline-block; margin-top: var(--s2); font-size: 0.875rem; font-weight: 700; }

.tl-hint { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); margin-top: var(--s4); }

/* ===== Vertical list (phones) ===== */
.tl .tl-v { list-style: none; margin: 0; padding: 0; gap: 0; }
.tl-v-row { position: relative; padding: 0 0 var(--s5) 36px; }
.tl-v-row:last-child { padding-bottom: 0; }
/* Segment from this mark down to the next one */
.tl-v-row::before {
    content: ""; position: absolute; left: 10px; top: 12px; bottom: -12px; width: 2px;
    background: var(--draft);
}
.tl-v-row.is-past::before { background: var(--draft-dim); }
.tl-v-row:last-child::before { display: none; }
.tl-v-mark {
    position: absolute; left: 4px; top: 5px; width: 14px; height: 14px; z-index: 1;
    border-radius: 50%; border: 2px solid var(--draft); background: var(--field);
}
.tl-v-row.is-past .tl-v-mark { border-color: var(--draft-dim); background: var(--draft-dim); }
.tl-v-row.is-next .tl-v-mark {
    left: 2px; top: 3px; width: 18px; height: 18px; border-color: var(--chalk);
    background: radial-gradient(circle, var(--chalk) 0 3.5px, var(--field) 4px);
    box-shadow: 0 0 0 4px var(--chalk-tint);
}
.tl-v-row.is-proposed .tl-v-mark { border-style: dashed; }
.tl-v-today .tl-v-mark { left: 0; top: 11px; width: 22px; height: 2px; border: 0; border-radius: 0; background: var(--chalk); }
.tl-v-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s2); min-height: 24px; }
.tl-v-row.is-past .tl-date { font-weight: 400; color: var(--text-muted); }
.tl-v-row.is-next .tl-date { color: var(--chalk); }
.tl-v-row.is-past .tl-text { font-weight: 500; }
.tl-v .tl-entry { margin-top: 2px; }
/* Compact overview (the deadlines page lists the full details below it) */
.tl-compact .tl-v-row { padding-bottom: var(--s4); }
.tl-compact .tl-v .tl-text { font-size: 0.9375rem; line-height: 1.45; }
.tl-overview .tl { margin-top: 0; }
.tl-v .tl-entry + .tl-entry { margin-top: var(--s2); padding-top: var(--s2); }

/* ===== Drawing on scroll (js/timeline.js arms, then draws) ===== */
.tl.is-armed .tl-axis { clip-path: inset(-8px 100% -8px 0); }
.tl.is-drawn .tl-axis { animation: tlWipe 1s ease-in-out 0.1s forwards; }
.tl.is-armed :is(.tl-dot, .tl-label, .tl-leader, .tl-today-mark) { opacity: 0; }
.tl.is-armed .tl-ruler { opacity: 0; }
.tl.is-drawn .tl-ruler { animation: tlPop 0.6s ease 0.9s forwards; }
.tl.is-drawn :is(.tl-dot, .tl-label, .tl-leader, .tl-today-mark) { animation: tlPop 0.35s ease var(--d, 0s) forwards; }
.tl.is-armed .tl-v-row::before { transform: scaleY(0); transform-origin: top; }
.tl.is-drawn .tl-v-row::before { animation: tlGrowY 0.28s linear calc(var(--i, 0) * 0.24s + 0.14s) forwards; }
.tl.is-armed .tl-v-mark { opacity: 0; }
.tl.is-drawn .tl-v-mark { animation: tlPop 0.3s ease calc(var(--i, 0) * 0.24s) forwards; }
@keyframes tlWipe { to { clip-path: inset(-8px -8px -8px 0); } }
@keyframes tlPop { to { opacity: 1; } }
@keyframes tlGrowY { to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
    .tl .tl-axis { animation: none !important; clip-path: none !important; }
    .tl :is(.tl-dot, .tl-label, .tl-leader, .tl-today-mark, .tl-v-mark, .tl-ruler) { animation: none !important; opacity: 1 !important; }
    .tl .tl-v-row::before { animation: none !important; transform: none !important; }
    .tl-dot::before { transition: none; }
}

/* ===== Print: a plain list ===== */
@media print {
    .tl-h, .tl-v-today, .tl-v-mark, .tl-v-row::before { display: none !important; }
    .tl .tl-v { display: block !important; }
    .tl-v-row { padding: 0 0 var(--s2) 130px; break-inside: avoid; }
    .tl-v-head { position: absolute; left: 0; top: 3px; min-height: 0; line-height: 1.5; }
    .tl-v .tl-entry { margin-top: 0; }
    /* The deadlines page prints its full grouped list instead */
    .tl-overview { display: none !important; }
}

/* Deadlines page on phones: the grouped list below already shows every
   date with its full text, so the overview timeline would repeat it. */
@media (max-width: 699px) { .tl-overview { display: none; } }

/* A dot reached by keyboard is visible at once, even mid-drawing (QA review 8 Oct 2026). */
.tl .tl-dot:focus-visible { opacity: 1 !important; animation: none; }
