/* =========================================================
   The Record — timeline strip (assets/js/trajectory.js).
   One lane per ledger entry on a real month axis, and a ruler
   with two bracket handles that choose the window.
   Tokens only, from base.css: --ink bars, --accent handles and
   anything under the pointer, --mark dates.
   ========================================================= */
.traj { position: relative; padding: 14px 0 18px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper); overflow: hidden; }
html:not(.js) .traj { display: none; }
.traj-top { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; min-height: 32px; }
.traj-read { margin: 0; font-family: var(--mono); font-size: 13px; letter-spacing: .02em; color: var(--ink-2); }
.traj-read b { font-weight: 500; color: var(--ink); }
.traj-tools { display: inline-flex; align-items: center; gap: 14px; }
.traj-whole { min-height: 32px; padding: 0 2px; font-size: 13px; font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.traj-whole:hover { text-decoration-thickness: 2px; }
.traj-whole[hidden] { display: none; }
.traj-whole:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* The strip sits between the hero and Education: the person first, the timeline one press away. */
.rec-hero + .traj { margin-top: clamp(-56px, -4vw, -24px); }
.traj + .rec-edu { padding-top: clamp(32px, 5vw, 64px); }

/* Folded: only the readout, the cue and a slim ruler (the overview lines, the ticks, the brackets).
   The lanes and the playhead row open on a grid-rows transition, so nothing below jumps on load. */
.traj-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .55s var(--ease), opacity .35s var(--ease); }
.traj-body-in { min-height: 0; overflow: hidden; }
.traj.is-slim .traj-body { grid-template-rows: 0fr; opacity: 0; }
.traj.is-slim .traj-play, .traj.is-slim .traj-speed, .traj.is-slim .traj-skip { display: none; }
.traj.is-slim .traj-ruler { margin-top: 8px; }
.traj-open { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--accent); background: var(--accent-soft); transition: background .25s var(--ease), color .25s var(--ease); }
.traj-open::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg);
  transition: transform .35s var(--ease); }
.traj-open[aria-expanded="true"] { background: none; border-color: var(--rule); color: var(--ink-2); }
.traj-open[aria-expanded="true"]::after { transform: translateY(2px) rotate(-135deg); }
.traj-open:hover { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.traj-open:focus-visible, .traj-speed:focus-visible, .traj-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Replay speed (1× / 2×) and the skip hint that shows while it plays */
.traj-speed { min-width: 36px; min-height: 32px; padding: 0 8px; border: 1px solid var(--rule); border-radius: 999px; font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease); }
.traj-speed:hover { color: var(--accent); border-color: var(--accent); }
.traj-speed[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.traj-skip { display: none; font-size: 12px; color: var(--ink-3); }
.traj.is-playing .traj-skip { display: inline; }

/* On-object cue (same look as the site's .cue chip; removed after the first drag) */
.traj .cue { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--accent);
  transition: opacity .5s var(--ease), transform .5s var(--ease); }
.traj .cue::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: traj-cue 2.4s var(--ease) infinite; }
.traj .cue.is-gone { opacity: 0; transform: translateY(-4px); }
@keyframes traj-cue { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

/* ---------- Lanes ---------- */
.traj-lanes, .traj-ruler { position: relative; width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--max) - 2 * var(--gutter)); margin: 0 auto; }
.traj-lanes { margin-top: 10px; overflow: hidden; touch-action: pan-y; }
.traj-lane { position: relative; height: 30px; border-bottom: 1px dotted var(--rule); }
.traj-lane:last-child { border-bottom: 0; }
.traj-bar { position: absolute; top: 0; height: 100%; color: var(--ink); -webkit-tap-highlight-color: transparent; }
.traj-bar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 5px; height: 8px; border-radius: 1px; background: currentColor; }
.traj-bar.is-open::after { right: 0; clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%); }
.traj-bar.is-approx::after { background: repeating-linear-gradient(-45deg, currentColor 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1px currentColor; }
.traj-bar.is-point::after { left: 50%; right: auto; width: 10px; height: 10px; bottom: 4px; margin-left: -5px; border-radius: 0; transform: rotate(45deg); }
.tb-l { position: absolute; left: 0; top: 2px; white-space: nowrap; font-family: var(--mono); font-size: 11px; letter-spacing: .02em; line-height: 1.2; color: var(--ink-2); pointer-events: none; }
.traj-bar.is-point .tb-l { top: 9px; }
.traj-bar:hover, .traj-bar.is-active { color: var(--accent); }
.traj-bar:hover .tb-l, .traj-bar.is-active .tb-l { color: var(--accent); }
.traj-bar.is-out { visibility: hidden; }
.traj-bar:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 2px; }

/* ---------- Ruler: overview, month ticks, window, brackets ---------- */
.traj-ruler { height: 56px; margin-top: 12px; border-top: 1px solid var(--ink); }
.traj-mini { position: absolute; left: 0; right: 0; top: 4px; height: 26px; pointer-events: none; }
.traj-mini i { position: absolute; height: 2px; background: var(--ink-3); opacity: .7; }
.traj-mini i.is-point { width: 3px; margin-left: -1.5px; }
.traj-ticks { position: absolute; left: 0; right: 0; top: 30px; height: 26px; pointer-events: none; }
.traj-ticks i { position: absolute; top: 0; width: 1px; height: 4px; background: var(--rule); }
.traj-ticks i.is-year { height: 9px; background: var(--ink-3); }
.traj-ticks i::after { position: absolute; top: 6px; left: 0; font-family: var(--mono); font-size: 10px; font-style: normal; color: var(--ink-3); white-space: nowrap; }
.traj-ticks i[data-m]::after { content: attr(data-m); transform: translateX(calc(50% + 6px)); opacity: .8; }
.traj-ticks i[data-y]::after { content: attr(data-y); top: 10px; left: 4px; color: var(--ink-2); }
.traj-win { position: absolute; top: 0; height: 30px; background: var(--accent-soft); border-bottom: 2px solid var(--accent); cursor: grab; touch-action: none; }
.traj.is-dragging .traj-win { cursor: grabbing; }
/* Each handle's 44px target reaches into the window rather than out past the ruler's ends, so at the ends of
   the record it never spills past the page edge (the bracket itself still sits exactly on its month). */
.traj-h { position: absolute; top: -6px; width: 44px; height: 44px; margin-left: -10px; cursor: ew-resize; touch-action: none; z-index: 1; -webkit-tap-highlight-color: transparent; }
.traj-h--b { margin-left: -34px; }
/* The bracket: a 2px upright with two short arms pointing into the window */
.traj-h::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 9px; width: 9px; border: 2px solid var(--accent); border-right: 0; border-radius: 2px 0 0 2px;
  background: color-mix(in srgb, var(--paper) 70%, transparent); transition: transform .2s var(--ease); }
.traj-h--b::before { left: 26px; border: 2px solid var(--accent); border-left: 0; border-radius: 0 2px 2px 0; }
.traj-h:hover::before, .traj-h.is-held::before { transform: scaleY(1.08); }
.traj-h:focus-visible { outline: none; }
.traj-h:focus-visible::before { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 4px var(--accent); }

/* ---------- Card ---------- */
.traj-card { position: absolute; left: 0; top: 0; z-index: 3; width: 292px; max-width: calc(100vw - 24px); padding: 12px 16px 10px;
  background: var(--paper-2); border: 1px solid var(--rule); border-left: 2px solid var(--accent); border-radius: 4px;
  box-shadow: 0 18px 44px -26px color-mix(in srgb, var(--ink) 55%, transparent);
  opacity: 0; visibility: hidden; transform: translate3d(var(--cx, 0px), calc(var(--cy, 0px) + 6px), 0);
  transition: opacity .25s var(--ease), visibility 0s linear .25s, transform .45s var(--ease); }
.traj-card.is-open { opacity: 1; visibility: visible; transform: translate3d(var(--cx, 0px), var(--cy, 0px), 0);
  transition: opacity .25s var(--ease), visibility 0s, transform .45s var(--ease); }
.traj-card.no-glide { transition: opacity .25s var(--ease), visibility 0s; }
.tc-date { font-family: var(--mono); font-size: 12px; letter-spacing: .04em; color: var(--mark); }
.tc-role { margin: 4px 0 0; font-family: var(--serif); font-size: 19px; line-height: 1.2; color: var(--ink); font-variation-settings: "SOFT" 40, "WONK" 0; }
.tc-org { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.tc-note { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.tc-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; min-height: 32px; font-size: 14px; font-weight: 500; color: var(--ink); }
.tc-link:hover { color: var(--accent); }
.tc-link .arr { transition: transform .35s var(--ease); }
.tc-link:hover .arr { transform: translateX(4px); }

@media (max-width: 700px) {
  .traj { padding: 10px 0 14px; }
  .traj-read { font-size: 12px; }
  .traj .cue { font-size: 12px; }
  .traj-lane { height: 22px; }
  .tb-l { top: 0; font-size: 10px; }
  .traj-bar::after { bottom: 3px; height: 6px; }
  .traj-bar.is-point::after { width: 8px; height: 8px; bottom: 3px; margin-left: -4px; }
  .traj-bar.is-point .tb-l { top: 5px; }
  .traj-ticks i[data-m]::after { display: none; }
  .traj-card { width: 260px; padding: 10px 12px 8px; }
  .tc-role { font-size: 17px; }
  .tc-note { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .traj .cue::before { animation: none; }
  .traj-card, .traj-card.is-open { transition: opacity .01s, visibility 0s; }
  .traj-h::before { transition: none; }
}

/* ---------- Playhead (trajectory.js): a line on one month, a row to drag it along, Replay ---------- */
.traj-play { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px 0 10px; border: 1px solid var(--rule); border-radius: 999px;
  font-size: 13px; font-weight: 500; color: var(--ink-2); transition: color .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease); }
.traj-play:hover { color: var(--accent); border-color: var(--accent); }
.traj-play[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.traj-play-i { position: relative; width: 10px; height: 10px; flex: none; }
.traj-play-i::before { content: ""; position: absolute; inset: 0; background: currentColor; clip-path: polygon(10% 0, 100% 50%, 10% 100%); }
.traj-play[aria-pressed="true"] .traj-play-i::before { clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }

.traj-scrub { position: relative; width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--max) - 2 * var(--gutter)); margin: 8px auto 0; height: 24px;
  touch-action: pan-y; cursor: col-resize; -webkit-tap-highlight-color: transparent; border-bottom: 1px solid var(--rule); }
.traj-scrub::before { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--accent); transform-origin: 0 50%;
  transform: scaleX(0); opacity: .5; transition: transform .3s var(--ease); }
.traj.is-scrubbing .traj-scrub::before { transform: scaleX(var(--php, 0)); }
.traj-now { position: absolute; left: 0; top: 3px; max-width: min(64%, 520px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--mono); font-size: 12px; letter-spacing: .02em; color: var(--ink-3); pointer-events: none;
  transform: translateX(var(--nowx, 10px)); }
.traj-scrub.is-flip .traj-now { text-align: right; }
.traj-now-d { font-weight: 500; color: var(--accent); }
.traj.is-scrubbing .traj-now-r { color: var(--ink-2); }
.traj-ph { position: absolute; left: 0; top: 0; width: 44px; height: 32px; margin-left: -22px; touch-action: none; cursor: ew-resize; z-index: 2; outline: none; }
.traj-ph::before { content: ""; position: absolute; left: calc(50% + var(--phoff, 0px)); top: 4px; width: 12px; height: 16px; margin-left: -6px; border-radius: 3px 3px 6px 6px;
  background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); transition: transform .2s var(--ease); }
.traj-ph:hover::before, .traj.is-dragging-ph .traj-ph::before { transform: scale(1.15); }
.traj-ph:focus-visible::before { box-shadow: 0 0 0 3px var(--accent-soft); outline: 2px solid var(--accent); outline-offset: 3px; }
.traj-line { position: absolute; left: 0; top: 0; bottom: 0; width: 1.5px; margin-left: -.75px; background: var(--accent); opacity: .35; z-index: 2; pointer-events: none;
  transition: opacity .3s var(--ease); }
.traj.is-scrubbing .traj-line { opacity: 1; }
.traj.ph-off .traj-ph, .traj.ph-off .traj-line, .traj.ph-off .traj-now { visibility: hidden; }
.traj-lanes { cursor: col-resize; }
.traj-bar { cursor: pointer; }
.traj-bar { transition: opacity .3s var(--ease), color .3s var(--ease); }
.traj.is-scrubbing .traj-bar.is-ahead { opacity: .16; }
.traj.is-scrubbing .traj-bar.is-past { color: var(--ink-3); opacity: .6; }
.traj.is-scrubbing .traj-bar.is-run, .traj.is-scrubbing .traj-bar.is-run .tb-l { color: var(--accent); }
/* Pinned in the ledger for comparison: a plum ring, the visitor's own mark */
.traj-bar.is-pinned::after { outline: 2px solid var(--play); outline-offset: 2px; }
.traj-bar.is-pinned .tb-l { color: var(--play); }

@media (max-width: 700px) {
  .traj-tools { gap: 8px; flex-wrap: wrap; }
  .traj-play { min-height: 30px; padding: 0 10px 0 8px; font-size: 12px; }
  .traj-scrub { height: 22px; }
  .traj-now { font-size: 11px; max-width: 72%; top: 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .traj-bar, .traj-line, .traj-ph::before, .traj-scrub::before, .traj-body, .traj-open::after { transition: none; }
}
@media print { .traj-scrub, .traj-play, .traj-line, .traj-speed, .traj-open, .traj-skip { display: none !important; } }
/* Phones: the bracket ruler is too narrow to drag with a thumb, and the ledger below already reads in date order. */
@media (max-width: 700px) { .traj { display: none; } }
