/* CodecMem video titles v1: crisp HTML labels over videos, synced to the video time.
   Runtime: titles.js next to this file. Spec format and usage: codecmem/viz/titles/README.md */

.tl-layer {
  --tl-strip-bg: #101010;                       /* header strips melt into the page */
  --tl-strip-ink: var(--ink-soft, #d6d6d6);
  --tl-chip-bg: rgba(14, 16, 18, .86);          /* chips over the picture: white on a dark rounded rect */
  --tl-chip-ink: #fff;
  --tl-ours: var(--accent-light, #9bdc2a);
  --tl-hit: var(--hit, #3ecf6e);                /* verdict text on dark */
  --tl-miss: var(--miss, #f0575c);
  --tl-hit-bg: #1a7f37;                         /* verdict badges, white text, as in the original videos */
  --tl-miss-bg: #cf2331;
  --tl-neutral-bg: #3b4048;
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  z-index: 2; pointer-events: none;
  color: #fff; font-family: var(--font-sans, Arial, Helvetica, sans-serif); font-size: 12px; font-weight: 700;
  line-height: 1.2; letter-spacing: normal; text-align: left; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none; user-select: none;
}
.tl-host > .play { z-index: 3; }               /* the page's play pill stays above the labels */

.tl-item { position: absolute; display: flex; align-items: center; justify-content: center; box-sizing: border-box; white-space: nowrap; }
.tl-al-left { justify-content: flex-start; }
.tl-al-right { justify-content: flex-end; }
.tl-va-top { align-items: flex-start; }
.tl-va-bottom { align-items: flex-end; }
.tl-b { box-sizing: border-box; display: flex; align-items: center; max-width: 100%; min-width: 0; }
.tl-fill > .tl-b { width: 100%; height: 100%; }
.tl-fill.tl-al-center > .tl-b { justify-content: center; }
.tl-fill.tl-al-right > .tl-b { justify-content: flex-end; }
.tl-fill.tl-va-top > .tl-b { align-items: flex-start; }
.tl-fill.tl-va-bottom > .tl-b { align-items: flex-end; }
.tl-free > .tl-b { max-width: none; flex-shrink: 0; }            /* fit "free": may extend past the rect */
.tl-fill.tl-free > .tl-b { width: auto; min-width: 100%; }
.tl-t { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-off { display: none !important; }
.tl-measure { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; visibility: hidden; }
.tl-measure > .tl-item { left: 0; top: 0; }

/* ---- box variants (pick one) ---- */
/* strip: a header cell; fills its rect */
.tl-v-strip > .tl-b { background: var(--tl-strip-bg); color: var(--tl-strip-ink); padding: 0 .55em; }
/* label: strip text without a background, e.g. a verdict on top of a strip */
.tl-v-label > .tl-b { color: var(--tl-strip-ink); padding: 0 .55em; }
/* chip: a label over the picture */
.tl-v-chip > .tl-b { background: var(--tl-chip-bg); color: var(--tl-chip-ink); border-radius: .32em; padding: .2em .55em; }
/* badge: a small pill, e.g. a verdict or a distance inside a strip */
.tl-v-badge > .tl-b, .tl-v-badge-hit > .tl-b, .tl-v-badge-correct > .tl-b, .tl-v-badge-miss > .tl-b, .tl-v-badge-wrong > .tl-b {
  background: var(--tl-neutral-bg); color: #fff; border-radius: .3em; padding: .14em .48em;
}
/* plain: text straight on the picture */
.tl-v-plain > .tl-b { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .85), 0 0 8px rgba(0, 0, 0, .55); }

/* ---- background modifiers (with chip, badge or strip) ---- */
.tl-v-bg-hit > .tl-b, .tl-v-badge-hit > .tl-b, .tl-v-badge-correct > .tl-b { background: var(--tl-hit-bg); color: #fff; }
.tl-v-bg-miss > .tl-b, .tl-v-badge-miss > .tl-b, .tl-v-badge-wrong > .tl-b { background: var(--tl-miss-bg); color: #fff; }
.tl-v-bg-neutral > .tl-b { background: var(--tl-neutral-bg); color: #fff; }

/* ---- text modifiers ---- */
.tl-v-ours > .tl-b { color: var(--tl-ours); }
.tl-v-hit > .tl-b, .tl-v-correct > .tl-b { color: var(--tl-hit); }
.tl-v-miss > .tl-b, .tl-v-wrong > .tl-b { color: var(--tl-miss); }
.tl-v-muted > .tl-b { color: var(--ink-muted, #a7a7a7); }
.tl-v-white > .tl-b { color: #fff; }
.tl-v-regular { font-weight: 400; }

/* ---- inline helpers for items with "html": true ---- */
.tl-layer .tl-ours { color: var(--tl-ours); }
.tl-layer .tl-hit { color: var(--tl-hit); }
.tl-layer .tl-miss { color: var(--tl-miss); }
.tl-layer .tl-muted { color: var(--ink-muted, #a7a7a7); font-weight: 400; }
.tl-layer .tl-sep { opacity: .5; padding: 0 .28em; font-weight: 400; }

/* labels inside the native control bar fade while a mouse pointer is over a video with controls; never on touch
   screens, where :hover sticks after a tap and would hide those labels for the whole playback */
.tl-low { transition: opacity .2s; }
@media (hover: hover) and (pointer: fine) {
  .tl-host:hover > .tl-layer.tl-ctl .tl-low, .tl-hostel:hover + .tl-layer.tl-ctl .tl-low { opacity: 0; }
}

/* debug (?titles-debug in the URL, or data-titles-debug on the host): rects outlined, labels see-through */
.tl-debug .tl-item:not(.tl-clock) { outline: 1px dashed rgba(255, 0, 200, .95); outline-offset: -1px; }
.tl-debug .tl-item:not(.tl-clock) > .tl-b { opacity: .55; }
.tl-clock { left: 4px; top: 4px; padding: 2px 6px; background: rgba(255, 0, 200, .85); color: #fff; font: 700 11px/1.3 ui-monospace, Menlo, monospace; border-radius: 3px; z-index: 1; }
