/* T5 — Live chords (src/studio/live/*): the card that follows the playhead.

   Two arrangements, from data-arrangement on the slot:
     row     beside the mixer (Practice, page 3): Now + Next diagrams left of
             the chord strip and two lyric lines;
     column  with the centre to itself (Play along, page 6): one centred
             column of strip, four lyric lines, then the diagrams.
   Sizes are the design's (html/03-practice.html, html/06-play-along.html). */

/* ---- The card ---------------------------------------------------------------- */

[data-slot='live'].live {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 20px 22px;
  border-radius: var(--st-radius-card);
  outline: 1px solid var(--st-line);
  outline-offset: -0.5px;
  background: radial-gradient(ellipse 60% 70% at 50% 0%, color-mix(in srgb, var(--st-accent) 8%, transparent) 0%, var(--st-surface) 100%);
  overflow: hidden;
}
[data-slot='live'].live[data-collapsed='true'] { flex: none; height: auto; }

/* ---- Header ------------------------------------------------------------------ */

.live__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.live__head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.live__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--st-accent) 12.5%, transparent);
  color: var(--st-accent-ink);
  font: 600 10px/normal var(--st-font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.live__badge-dot { width: 6px; height: 6px; border-radius: 3px; background: var(--st-accent); }

.live__where {
  overflow: hidden;
  color: var(--st-text-faint);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live__controls { flex: none; display: flex; align-items: center; gap: 8px; }

.live__select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px 0 10px;
  border-radius: 7px;
  outline: 1px solid var(--st-line);
  outline-offset: -0.5px;
  background: var(--st-surface);
  color: var(--st-text-dim);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.live__select[hidden] { display: none; }
.live__select:hover { outline-color: var(--st-line-strong); color: var(--st-text); }
.live__select:focus-within { outline: 2px solid var(--st-focus-ring, var(--st-accent)); outline-offset: var(--st-focus-offset, 1px); }
.live__select-glyph { display: inline-flex; }
.live__select-glyph[hidden] { display: none; }
.live__select-icon { width: 13px; height: 13px; }
.live__select-chevron { width: 12px; height: 12px; }
.live__select-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 12px;
}

.live__controls .live__collapse { width: 30px; height: 30px; background: none; }
.live__controls .live__collapse .st-icon { width: 15px; height: 15px; }

/* ---- Body --------------------------------------------------------------------- */

.live__body { flex: 1; min-height: 0; display: flex; align-items: center; gap: 24px; }
.live__body[hidden] { display: none; }

.live__flow {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---- Now and Next ------------------------------------------------------------------ */

.live__shapes { flex: none; display: flex; align-items: flex-end; gap: 10px; }
[data-display='names-only'] .live__shapes { display: none; }

.live__label {
  color: var(--st-text-faint);
  font: 600 9.5px/normal var(--st-font-mono);
  letter-spacing: 1.1px;
  text-transform: uppercase;
}
.live__label--now { color: var(--st-accent-ink); font-size: 10px; letter-spacing: 1.2px; }

.live__now {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px 14px 12px;
  border-radius: 14px;
  outline: 1.5px solid var(--st-accent);
  outline-offset: -0.75px;
  background: var(--st-menu-chosen-bg);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--st-accent) 21%, transparent);
}

.live__dia {
  flex: none;
  display: grid;
  place-items: center;
  width: 120px;
  height: 133px;
}
.live__dia .dia { display: block; width: 120px; height: auto; margin: 0; overflow: visible; }
/* A fretboard is placed on the design's grid: strings 18px and frets 21px
   apart, the nut 12px down the panel (html/03-practice.html "Diagram B"). */
.live__dia:not(.live__dia--small) { position: relative; }
.live__dia:not(.live__dia--small) .dia:not(.dia--keyed) { position: absolute; top: -15.5px; left: 2px; width: 127px; max-width: none; }
/* …with the muted × and open ○ just above the nut, as designed (SVG units). */
[data-slot='live'] .live__dia:not(.live__dia--small) :is(.dia__mark:not([text-anchor='start']), .dia__open) { transform: translateY(9.5px); }
.live__dia--small { width: 75px; height: 81px; }
.live__dia--small .dia { width: 75px; margin: 0; overflow: hidden; }

.live__no-shape { color: var(--st-text-faint); font-size: 11px; }

.live__info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; width: 96px; }
.live__name {
  color: var(--st-text);
  font: 600 44px/44px var(--st-font);
  letter-spacing: -1.5px;
  white-space: nowrap;
}
.live__name[data-long='true'] { font-size: 30px; letter-spacing: -0.8px; }
.live__note { color: var(--st-text-dim); font-size: 12px; white-space: nowrap; }
.live__fingering { color: var(--st-text-faint); font: 400 11px/normal var(--st-font-mono); white-space: nowrap; }
.live__fingering[hidden] { display: none; }

.live__progress {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--st-line-strong);
  overflow: hidden;
}
/* The fill is always full width and scaled (view.ts setFill): no layout per tick. */
.live__progress-fill { display: block; width: 100%; height: 100%; background: var(--st-text-faint); transform: scaleX(0); transform-origin: left; }
.live__progress--now { width: 96px; }
.live__progress--now .live__progress-fill,
.live__chip[data-when='now'] .live__progress-fill { background: var(--st-accent); }

.live__next {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 12px;
  border-radius: 12px;
  outline: 1px solid var(--st-line);
  outline-offset: -0.5px;
  background: var(--st-surface-2);
}
.live__next[hidden] { display: none; }
.live__next-head { display: flex; align-items: center; gap: 5px; }
.live__beats { display: flex; align-items: center; gap: 3px; }
.live__beat { width: 5px; height: 5px; border-radius: 3px; background: var(--st-line-strong); }
.live__beat.is-lit { background: var(--st-text-dim); }
.live__next-name { color: var(--st-text); font: 600 18px/normal var(--st-font); white-space: nowrap; }

/* src/diagram's drawing, in the design's colours */
[data-slot='live'] .dia { font-family: var(--st-font); }
[data-slot='live'] .dia__grid { fill: none; stroke: color-mix(in srgb, var(--st-text-strong) 32%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
[data-slot='live'] .dia__nut,
[data-slot='live'] .dia__dot { fill: var(--st-text-strong); }
/* The nut as the design draws it: a thin bar on the top fret line, and none above a barre. */
[data-slot='live'] .dia__nut { y: 14.5px; height: 4.5px; }
[data-slot='live'] .dia:not([data-base='1']) .dia__nut { display: none; }
[data-slot='live'] .dia__num { fill: var(--st-bg); font-size: 6px; font-weight: 700; }
[data-slot='live'] rect.dia__dot + .dia__num { display: none; }
[data-slot='live'] .dia__string { fill: var(--st-text-faint); font: 400 6.1px var(--st-font-mono); }
[data-slot='live'] .dia__mark { fill: var(--st-text-faint); font: 400 6.5px var(--st-font-mono); }
[data-slot='live'] .dia__open { fill: none; stroke: color-mix(in srgb, var(--st-text-strong) 67%, transparent); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
[data-slot='live'] .live__dia--small .dia__num { display: none; }
[data-slot='live'] .live__dia--small .dia__open { r: 3.6px; }
[data-slot='live'] .live__dia--small .dia--keyed .dia__string { display: none; }
[data-slot='live'] .dia__key { fill: var(--st-key); stroke: var(--st-key-edge); stroke-width: 0.6; }
[data-slot='live'] .dia__key--black { fill: var(--st-key-black); }
[data-slot='live'] .dia__tone { fill: var(--st-key-tone); }
[data-slot='live'] .dia__tone--black { fill: var(--st-key); }
[data-slot='live'] .dia__tone--root { fill: var(--st-accent); }

/* ---- Chord strip: names only, the edges fade ------------------------------------------ */

.live__strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  /* Clip chips that do not fit at the strip's own sides (never over the
     Next panel beside it), but keep the current chip's glow above and below. */
  clip-path: inset(-32px 0);
}

.live__chip {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 66px;
  height: 62px;
  border-radius: 12px;
  outline: 1px solid var(--st-line);
  outline-offset: -0.5px;
  background: var(--st-surface-2);
}
/* The strip fades towards its ends. The fade is on the chip's box and name
   (--fade), not the whole chip, so every time stays at 4.5:1 and so do the
   names of the chips beside the current one (0.8) and one further (0.55).
   The outermost chips (0.3) are lighter than that: decorative, as their
   chords are in the chord sheet beside the card too. Their names keep 3:1 in
   light (--st-text-far); dark keeps the agreed 2.57:1. */
.live__chip[data-offset='1'] { --fade: 0.8; }
.live__chip[data-offset='2'] { --fade: 0.55; }
.live__chip[data-offset='3'] { --fade: 0.3; }
.live__chip:not([data-offset='0']) {
  outline-color: color-mix(in srgb, var(--st-line) calc(var(--fade, 1) * 100%), transparent);
  background: color-mix(in srgb, var(--st-surface-2) calc(var(--fade, 1) * 100%), transparent);
}
.live__chip:not([data-offset='0']) .live__chip-name { color: color-mix(in srgb, var(--st-text) calc(var(--fade, 1) * 100%), transparent); }
.live__chip[data-offset='3'] .live__chip-name { color: var(--st-text-far); }
.live__chip:not([data-offset='0']) .live__progress { opacity: var(--fade, 1); }
.live__chip.is-empty { visibility: hidden; }

.live__chip-name { color: var(--st-text); font: 600 17px/normal var(--st-font); letter-spacing: -0.5px; white-space: nowrap; }
.live__chip-time { color: var(--st-text-faint); font: 400 10px/normal var(--st-font-mono); }
.live__progress--chip { width: 42px; }

.live__chip[data-when='now'] {
  width: 80px;
  height: 72px;
  outline: 1.5px solid var(--st-accent);
  outline-offset: -0.75px;
  background: var(--st-menu-chosen-bg);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--st-accent) 27%, transparent);
}
.live__chip[data-when='now'] .live__chip-name { color: var(--st-text-strong); font-size: 24px; }
.live__chip[data-when='now'] .live__progress--chip { width: 56px; }

/* ---- Lyrics ------------------------------------------------------------------------------ */

.live__lyrics {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: center;
}
[data-lyrics='false'] .live__lyrics,
[data-no-lyrics] .live__lyrics { display: none; }

.live__line {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--st-text-faint);
  font: 400 15px/normal var(--st-font);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.live__line:empty::before { content: '\00a0'; }
.live__line[data-line='current'] { color: var(--st-text); font-size: 24px; font-weight: 600; letter-spacing: -0.6px; }
[data-arrangement='row'] .live__line:is([data-line='previous'], [data-line='after']) { display: none; }

/* ---- Play along: one centred column ------------------------------------------------------- */

[data-arrangement='column'] .live__body {
  flex-direction: column;
  /* safe: a column taller than the card runs off the bottom, never over the header. */
  justify-content: safe center;
  gap: 40px;
}
[data-arrangement='column'] .live__flow { flex: none; width: 100%; gap: 36px; }
[data-arrangement='column'] .live__shapes { order: 1; gap: 12px; }

[data-arrangement='column'] .live__strip { gap: 10px; }
[data-arrangement='column'] .live__chip { gap: 6px; width: 86px; height: 80px; }
[data-arrangement='column'] .live__chip-name { font-size: 22px; }
[data-arrangement='column'] .live__chip-time { font-size: 11px; }
[data-arrangement='column'] .live__progress--chip { width: 58px; }
[data-arrangement='column'] .live__chip[data-when='now'] { width: 108px; height: 100px; }
[data-arrangement='column'] .live__chip[data-when='now'] .live__chip-name { font-size: 34px; }
[data-arrangement='column'] .live__chip[data-when='now'] .live__progress--chip { width: 76px; }

[data-arrangement='column'] .live__lyrics { gap: 12px; }
[data-arrangement='column'] .live__line { font-size: 17px; }
/* Previous and next-after lines stay text-faint at full strength (4.5:1 over
   the card), below the next line's text-dim and the current line. */
[data-arrangement='column'] .live__line[data-line='current'] { font-size: 42px; letter-spacing: -1px; }
[data-arrangement='column'] .live__line[data-line='next'] { color: var(--st-text-dim); font-size: 21px; }

/* Short windows (decision 16: down to 1280×720). The column keeps its order
   and proportions, a size smaller, and drops the line after next, so it fits
   the card left between the header and the player. */
@media (max-height: 820px) {
  [data-arrangement='column'] .live__body { gap: 16px; }
  [data-arrangement='column'] .live__flow { gap: 14px; }
  [data-arrangement='column'] .live__strip { gap: 8px; }
  [data-arrangement='column'] .live__chip { gap: 4px; width: 70px; height: 62px; }
  [data-arrangement='column'] .live__chip-name { font-size: 18px; }
  [data-arrangement='column'] .live__chip[data-when='now'] { width: 88px; height: 76px; }
  [data-arrangement='column'] .live__chip[data-when='now'] .live__chip-name { font-size: 26px; }
  [data-arrangement='column'] .live__lyrics { gap: 4px; }
  [data-arrangement='column'] .live__line { font-size: 15px; }
  [data-arrangement='column'] .live__line[data-line='current'] { font-size: 32px; }
  [data-arrangement='column'] .live__line[data-line='next'] { font-size: 18px; }
  [data-arrangement='column'] .live__line[data-line='after'] { display: none; }
}
