/* The activity timeline (approved artifact "PrepDesk Activity Timeline"; decision 71). Used by the reading
   receipt on Home and in Getting started. Tokens and materials only: the card around it stays glass; each
   row is a flat panel (never blurred); the rail and nodes carry state; a finished row fills with the ok
   tint, a sheen passes once and a check draws in. Rows that are already settled when first shown
   (.settled) arrive still: only changes seen while watching animate. Motion stops under
   prefers-reduced-motion; every state still shows. */
.tl-head-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 120px; }
.tl-count { font-size: 22px; line-height: 26px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tl-count small { font-size: 13px; color: var(--muted); font-weight: 400; }
.tl-meter { width: 120px; }
.tl-meter > span { transition: width 0.5s cubic-bezier(.22, 1, .36, 1); }

.tl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tl-row { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 12px; }
.tl-row.in { animation: tl-in 0.42s cubic-bezier(.22, 1, .36, 1) both; }

/* The rail: a quiet line from node to node; it fills (data colour) as each row finishes. */
.tl-rail { position: relative; }
.tl-rail::before, .tl-rail::after { content: ""; position: absolute; left: 50%; width: 2px; margin-left: -1px; top: 0; bottom: -8px; border-radius: 2px; }
.tl-rail::before { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.tl-rail::after { background: linear-gradient(180deg, var(--ok), color-mix(in srgb, var(--ok) 60%, var(--data))); transform: scaleY(0); transform-origin: top; transition: transform 0.55s cubic-bezier(.22, 1, .36, 1) 0.15s; }
.tl-row:first-child .tl-rail::before, .tl-row:first-child .tl-rail::after { top: 22px; }
.tl-row:last-child .tl-rail::before, .tl-row:last-child .tl-rail::after { bottom: calc(100% - 22px); }
.tl-row.is-done .tl-rail::after { transform: scaleY(1); }

/* Nodes */
.tl-node { position: relative; z-index: 1; margin: 11px auto 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
  background: var(--panel-bg); box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 1px 2px color-mix(in srgb, var(--ink) 8%, transparent);
  transition: background-color 0.3s ease-out, box-shadow 0.3s ease-out, color 0.3s ease-out, transform 0.3s cubic-bezier(.34, 1.56, .64, 1); }
.tl-node svg { width: 12px; height: 12px; }
.tl-node .ck { stroke-dasharray: 14; stroke-dashoffset: 14; }
.tl-row.is-active .tl-node { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--action) 25%, transparent); color: var(--action); }
.tl-row.is-active .tl-node::before { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--action); border-right-color: color-mix(in srgb, var(--action) 35%, transparent); animation: tl-spin 0.9s linear infinite; }
.tl-row.is-done .tl-node { background: var(--ok); color: var(--on-action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 16%, transparent), 0 2px 6px color-mix(in srgb, var(--ok) 35%, transparent); transform: scale(1.08); }
.tl-row.is-done .tl-node .ck { animation: tl-draw 0.34s ease-out 0.22s forwards; }
.tl-row.is-done .tl-node::after { content: ""; position: absolute; inset: 0; border-radius: 50%; animation: tl-ring 0.7s ease-out 0.1s both; }
.tl-row.is-bad .tl-node { background: var(--danger); color: var(--on-action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent); }
.tl-row.is-unsure .tl-node { background: var(--review); color: var(--on-action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--review) 16%, transparent); }
.tl-row.is-event .tl-node { background: var(--action); color: var(--on-action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action) 12%, transparent); }
.tl-row.is-event.is-done .tl-node { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 16%, transparent), 0 2px 6px color-mix(in srgb, var(--ok) 35%, transparent); }
.tl-row.is-event .tl-node svg[viewBox="0 0 48 48"] { width: 12px; height: 12px; }

/* Row cards: flat panels. ::before is the liquid fill; ::after is the sheen that passes once when it fills. */
.tl-card { position: relative; overflow: hidden; isolation: isolate; border-radius: 14px; background: var(--panel-bg); box-shadow: var(--shadow-panel);
  padding: 11px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; min-height: 44px; }
.tl-card::before { content: ""; position: absolute; inset: 0; z-index: -1; transform-origin: left center; transform: scaleX(var(--p, 0));
  background: color-mix(in srgb, var(--data) 9%, var(--panel-bg)); transition: transform 0.6s cubic-bezier(.22, 1, .36, 1), background-color 0.35s ease-out; }
.tl-card::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  background: linear-gradient(105deg, transparent 35%, color-mix(in srgb, var(--surface-solid) 85%, transparent) 50%, transparent 65%); transform: translateX(-100%); }
.tl-row.is-done .tl-card::before { --p: 1; background: linear-gradient(90deg, color-mix(in srgb, var(--ok-soft) 92%, var(--panel-bg)), color-mix(in srgb, var(--ok-soft) 55%, var(--panel-bg))); transition: transform 0.7s cubic-bezier(.22, 1, .36, 1), background-color 0.2s; }
.tl-row.is-done .tl-card::after { animation: tl-sheen 0.9s ease-out 0.45s both; }
.tl-row.is-bad .tl-card::before { --p: 1; background: color-mix(in srgb, var(--danger-soft) 80%, var(--panel-bg)); }
.tl-row.is-unsure .tl-card::before { --p: 1; background: color-mix(in srgb, var(--review-soft) 80%, var(--panel-bg)); }
.tl-row.is-queued .tl-card { box-shadow: var(--shadow-panel); }
.tl-row.is-queued .tl-name { color: var(--ink-2); }

.tl-name { font-weight: 500; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.tl-what { grid-column: 1; font-size: 13px; line-height: 18px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 18px; }
.tl-what b { font-weight: 500; color: var(--ink); }
.tl-what .sep { color: var(--faint); }
.tl-row.is-done .tl-what { color: var(--ink-2); }
.tl-row.is-bad .tl-what { color: var(--danger); }
.tl-row.is-unsure .tl-what { color: var(--review); }
.tl-side { grid-row: 1 / span 2; grid-column: 2; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tl-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 52px; text-align: right; }
.tl-side .wp-chip { animation: tl-pop 0.36s cubic-bezier(.34, 1.56, .64, 1) both; }
.tl-swap { animation: tl-fade 0.3s ease-out both; }

/* The three reading steps of a file, shown while it's in flight. */
.tl-steps { display: inline-flex; align-items: center; gap: 10px; }
.tl-step { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); }
.tl-step i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.55; }
.tl-step.now { color: var(--ink); font-weight: 500; }
.tl-step.now i { opacity: 1; background: var(--action); box-shadow: 0 0 0 3px color-mix(in srgb, var(--action) 18%, transparent); animation: tl-breathe 1.2s ease-in-out infinite; }
.tl-step.did { color: var(--ok); }
.tl-step.did i { opacity: 1; background: var(--ok); }

/* PrepDesk's own steps (matching, building a workpaper): the node carries the mark; progress fills the row. */
.tl-row.is-event .tl-card { grid-template-columns: minmax(0, 1fr) auto; }
.tl-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }

/* The milestone: a workpaper ready. Larger node, a burst of sparks, and the one primary action. */
.tl-row.is-goal .tl-node { width: 30px; height: 30px; margin-top: 16px; }
.tl-row.is-goal .tl-node svg { width: 15px; height: 15px; }
.tl-row.is-goal .tl-card { padding: 16px 18px; min-height: 64px; }
.tl-row.is-goal .tl-name { font-size: 15.5px; }
.tl-row.is-goal.is-done .tl-card { box-shadow: var(--shadow-panel), 0 0 0 1px color-mix(in srgb, var(--ok) 28%, transparent), 0 10px 30px color-mix(in srgb, var(--ok) 16%, transparent); }
.tl-spark { position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--ok); opacity: 0; pointer-events: none; }
.tl-row.is-goal.is-done .tl-spark { animation: tl-burst 0.8s cubic-bezier(.22, 1, .36, 1) 0.2s both; }
.tl-cta { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tl-cta[hidden] { display: none; }
.tl-row.is-goal.is-done .tl-cta { animation: tl-in 0.4s cubic-bezier(.22, 1, .36, 1) 0.5s both; }

.tl-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.tl-foot .grow { flex: 1; }

@keyframes tl-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes tl-spin { to { transform: rotate(360deg); } }
@keyframes tl-draw { to { stroke-dashoffset: 0; } }
@keyframes tl-ring { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } to { box-shadow: 0 0 0 12px color-mix(in srgb, var(--ok) 0%, transparent); } }
@keyframes tl-sheen { 0% { opacity: 1; transform: translateX(-100%); } 100% { opacity: 1; transform: translateX(100%); } }
@keyframes tl-pop { from { opacity: 0; transform: scale(0.85); } }
@keyframes tl-fade { from { opacity: 0; transform: translateY(2px); } }
@keyframes tl-breathe { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--action) 8%, transparent); } }
@keyframes tl-burst { 0% { opacity: 1; transform: translate(0, 0) scale(1); } 100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.4); } }

/* Reduced motion: every state still shows (fill, colour, check), just without movement. */
@media (prefers-reduced-motion: reduce) {
  .tl-row, .tl-row *, .tl-row *::before, .tl-row *::after { animation: none !important; transition: none !important; }
  .tl-row.is-done .tl-node .ck { stroke-dashoffset: 0; }
}

@media (max-width: 640px) {
  .tl-card { grid-template-columns: minmax(0, 1fr); }
  .tl-side { grid-row: auto; grid-column: 1; justify-content: flex-start; }
  .tl-head-meta { display: none; }
}

/* Already settled when first shown: no replayed fill, sheen, tick or sparks. */
.tl-row.settled, .tl-row.settled *, .tl-row.settled *::before, .tl-row.settled *::after { animation: none !important; transition: none !important; }
.tl-row.settled .tl-node .ck { stroke-dashoffset: 0; }
.tl-row.settled .tl-spark { display: none; }

.tl-foot-text { font-size: 13px; color: var(--muted); }
