/* ==========================================================================
   Component: Timeline
   Description: Vertical timeline with connected nodes and card slots.
   Used for participation history and experience preview journeys.
   ========================================================================== */

/* --- Container --- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding: var(--space-1) 0;
}

/* --- Individual timeline entry --- */
.timeline__item {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: var(--space-3);
  position: relative;
  min-height: 48px;
}

/* --- Node (circle marker) --- */
.timeline__node {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: var(--space-0-5);
  position: relative;
  z-index: 1;
}

.timeline__dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-default);
  background-color: var(--surface-base);
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

/* --- Connector line (between nodes) --- */
.timeline__item:not(:last-child) .timeline__node::after {
  content: '';
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  bottom: -2px;
  background-color: var(--border-subtle);
}

/* --- Card (content slot) --- */
.timeline__card {
  padding-bottom: var(--space-4);
}

.timeline__card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.timeline__card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1-5);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.timeline__card-meta .badge {
  font-size: 10px;
  padding: 1px var(--space-1-5);
}

.timeline__card-detail {
  margin-top: var(--space-1-5);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Separator dot in meta --- */
.timeline__card-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: var(--radius-full);
  background-color: var(--text-disabled);
  flex-shrink: 0;
}

/* --- Status variants — dot color --- */
.timeline__item--completed .timeline__dot {
  border-color: var(--status-success);
  background-color: var(--status-success);
}

.timeline__item--completed .timeline__node::after {
  background-color: var(--status-success);
}

.timeline__item--active .timeline__dot {
  border-color: var(--accent-primary);
  background-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.timeline__item--active .timeline__node::after {
  background-color: var(--border-subtle);
}

.timeline__item--pending .timeline__dot {
  border-color: var(--border-default);
  background-color: var(--surface-base);
}

.timeline__item--expired .timeline__dot {
  border-color: var(--status-error);
  background-color: var(--status-error);
}

.timeline__item--expired .timeline__node::after {
  background-color: var(--status-error);
}

.timeline__item--paused .timeline__dot {
  border-color: var(--status-warning);
  background-color: var(--status-warning);
}

/* --- Clickable card variant --- */
.timeline__card--interactive {
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-2) 0;
  transition: background-color var(--duration-fast) var(--ease-out);
}

/* Card-as-link — clickable WITHOUT changing the card's box metrics, so a linked
   row stays exactly as tight as a plain one and links + non-links align under
   their nodes. Clickability is signalled by the title turning accent on hover
   (no padding/margin, hence no layout shift). */
a.timeline__card {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

a.timeline__card:hover .timeline__card-title {
  color: var(--accent-primary);
}

.timeline__card--interactive:hover {
  background-color: var(--surface-hover);
}

.timeline__card--interactive.timeline__card--selected {
  background-color: var(--surface-selected);
}

/* --- Compact variant (for aside panels / narrow contexts) --- */
.timeline--compact .timeline__item {
  grid-template-columns: 16px 1fr;
  gap: var(--space-2);
}

.timeline--compact .timeline__dot {
  width: 8px;
  height: 8px;
}

.timeline--compact .timeline__item:not(:last-child) .timeline__node::after {
  top: 14px;
}

.timeline--compact .timeline__card {
  padding-bottom: var(--space-3);
}

.timeline--compact .timeline__card-title {
  font-size: var(--text-xs);
}

/* --- Header (experience-level summary above timeline) --- */
.timeline__header {
  margin-bottom: var(--space-4);
}

.timeline__header-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.timeline__header-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1-5);
  margin-top: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Variation: Events & To-dos (agenda)
   Added 2026-06-04 — approved by user via Visual Companion (Option C "pushed").
   Purely additive: the base dot-journey timeline above is untouched. Gives the
   Calendar/To-do surfaces a type cue (checkbox = to-do, calendar = event) and a
   status cue (dot/glyph colour), and treats the list as a dated agenda rather
   than a progress sequence (neutral connector). Consumed by the shared
   participations/elements/_timeline_item row.
   -------------------------------------------------------------------------- */

/* Glyph marker — replaces .timeline__dot in the node for type-bearing rows.
   Default neutral; status colour comes from the .timeline__item--* modifier. */
.timeline__marker {
  font-size: 18px;
  line-height: 1;
  color: var(--border-default);
  flex-shrink: 0;
}

.timeline__item--completed .timeline__marker { color: var(--status-success); }
.timeline__item--pending   .timeline__marker { color: var(--border-default); }
.timeline__item--expired   .timeline__marker { color: var(--status-error); }

/* Event marker — accent-coloured (e.g. the `event` calendar glyph). */
.timeline__marker--event { color: var(--accent-primary); }

/* Agenda modifier — retunes the connector to meet the larger glyph (vs the 12px
   dot) and keeps it neutral: an agenda is a dated list, not a progress sequence,
   so the connector carries no green/red flow colour. */
.timeline--agenda .timeline__item:not(:last-child) .timeline__node::after {
  top: 24px;
  background-color: var(--border-subtle);
}

/* Completed to-do reads "done": muted + struck title. */
.timeline--agenda .timeline__item--completed.timeline__item--task .timeline__card-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
  text-decoration-color: var(--text-disabled);
}

/* --- DM channel badge (inline with meta) --- */
.timeline__dm-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px var(--space-1);
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background-color: var(--surface-sunken);
  color: var(--text-secondary);
}

.timeline__dm-badge .material-symbols-rounded {
  font-size: 12px;
}

/* Card shape follows the soul (kept after --interactive so it wins, as before). */
.timeline__card { border-radius: var(--soul-radius-control, 10px); }

/* ── To-do list — the status tabs above the shared timeline ────────────────
   This class belongs to a MULTI-USE partial (participations/elements/_todo_filter),
   rendered on the participation shell (/p) AND the member shell (/d, /d/todos).
   It lived in TWO page bundles — pages/participation/todo_list.css (never loaded
   on the member shell) and an identical copy in pages/dashboards/dashboard.css
   (never loaded on the participation shell) — so deleting either one silently
   killed the spacing on the other shell. A shared partial's layout lives in
   components/, which every bundle loads. (2026-07-14) */
.todo-list__filter {
  margin-bottom: var(--space-4);
}
