/* Timeline strip: a dock on the canvas bottom, over the graph it orders. It is a view of the
   SELECTED node, so it lives inside `.stage` beside the zoomer rather than in a side panel. */
.timeline {
  position: absolute; z-index: 3; left: 14px; bottom: 14px;
  width: min(560px, calc(100% - 96px)); max-height: min(46vh, 420px);
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px 12px;
  background: var(--panel); border: 1px solid var(--region); border-radius: var(--r-l);
  box-shadow: var(--shadow); overflow: hidden;
}
.tl-head { display: flex; align-items: baseline; gap: 8px; }
.tl-head h2 { font: italic 600 18px/1.2 var(--f-display); flex: 1; }
.tl-count { font: 600 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }

.timeline > .hint { font-size: 11.5px; line-height: 1.4; }
.timeline > .err {
  padding: 8px 10px; border: 1px solid var(--bad); border-radius: var(--r-s);
  background: color-mix(in srgb, var(--bad) 9%, var(--surface));
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; max-height: 9em; overflow-y: auto;
}
.tl-empty { max-width: 58ch; }
/* The strip's own pre-send check (a trim it can see is wrong). Muted, not alarming: nothing was sent
   and nothing on the server changed. */
.tl-check { font-size: 11.5px; }

.tl-form { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.tl-add { display: flex; gap: 6px; align-items: center; flex: none; }
.tl-pick { flex: 1 1 auto; min-width: 0; height: 34px; }
.tl-add .btn { flex: none; min-height: 34px; padding: 4px 10px; font-size: 13px; }

/* The film itself: the only part that scrolls, so a 12-clip cut never pushes Apply off the strip.
   The bottom fade makes a row clipped by the scroll edge read as "more below" instead of as text
   that got cut in half. */
.tl-clips {
  list-style: none; margin: 0; padding: 0 0 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin;
  -webkit-mask-image: linear-gradient(#000 calc(100% - 14px), transparent);
  mask-image: linear-gradient(#000 calc(100% - 14px), transparent);
}
.tl-clip {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px; border: 1px solid var(--card-line); border-radius: var(--r-m); background: var(--card);
}
.tl-thumb {
  display: grid; place-items: center; width: 52px; aspect-ratio: 4 / 3; overflow: hidden;
  border-radius: var(--r-s); background: var(--sunken);
}
.tl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tl-glyph { font: 600 15px/1 var(--f-mono); color: var(--muted); }
/* A source that has not run: an em dash reads as "nothing yet", where a bare dot read as a stray mark. */
.tl-glyph.none { font: 600 13px/1 var(--f-mono); color: var(--faint); letter-spacing: .04em; }
.tl-body { display: grid; gap: 4px; min-width: 0; }
.tl-line { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.tl-pos { flex: none; font: 700 10px var(--f-mono); letter-spacing: .06em; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-name {
  flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer;
  font: 600 12.5px/1.3 var(--f-ui); color: var(--ink); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tl-name:hover { text-decoration: underline; text-underline-offset: 2px; }
.tl-trim { flex: none; font: 10px var(--f-mono); letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.tl-trimrow { display: flex; align-items: center; gap: 6px; }
.tl-lbl { display: flex; align-items: center; gap: 4px; font: 600 10px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.tl-num { width: 74px; height: 28px; padding: 0 6px; font: 12px var(--f-mono); }
.tl-sec { font: 10px var(--f-mono); color: var(--faint); }
.tl-acts { display: flex; gap: 2px; }
.tl-acts .icon-btn { width: 28px; height: 28px; }
.tl-arrow { font: 600 14px/1 var(--f-mono); }
.tl-acts .icon-btn[disabled] { opacity: .35; cursor: default; }
.tl-acts .danger { color: var(--bad); }

.tl-unused { padding-top: 2px; font-size: 11.5px; }
.tl-foot { display: flex; align-items: center; gap: 8px; padding-top: 2px; }
.tl-foot .btn { min-height: 34px; padding: 4px 12px; font-size: 13px; }
.tl-foot .primary { margin-left: auto; }

@media (max-width: 820px) {
  /* The stage is already inset above the tab bar, so `bottom: 0` is the tab bar's top edge. The
     zoomer owns the right-hand corner, hence the reserved width. */
  .timeline { left: 0; right: 0; bottom: 0; width: auto; max-height: 52vh; border-radius: var(--r-l) var(--r-l) 0 0; border-bottom: 0; }
  .tl-clip { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .tl-thumb { width: 44px; }
}
