/* UI layer — one visual language for every overlay (lyrics modal, island, language switch).
   Shared variables live here and are reused by island.css and lang.css. Loads after baseline-ui.css. */
:root {
  --ov-bg: rgb(10 22 51 / 0.88);
  --ov-line: rgb(242 230 201 / 0.16);
  --ov-line-strong: rgb(242 230 201 / 0.38);
  --ov-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
  --ov-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ov-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ov-in: 280ms;
  --ov-out: 200ms;
  --wave-h: 44px; /* waveform bar height */
  --tr-h: 76px; /* transport row height */
  /* every overlay icon: 2 px stroke, rounded caps, inline SVG (see .ico in sections.css) */
}

/* Round overlay buttons (modal close/toggle, island toggle/stop). Icons are inline SVG; the baseline's
   CSS-drawn glyphs are switched off. Specificity matches the baseline rules and this sheet loads later. */
html[data-player] [data-player-toggle]::before, [data-player-stop]::before, [data-player-stop]::after, .modal__close::before { content: none; }
.modal__close, .modal__mute, .modal__toggle, .modal__skip, .island__toggle, .island__skip, .island__stop {
  display: grid; place-items: center; flex: none; padding: 0; color: var(--c-cream);
  background: rgb(10 22 51 / 0.55); border: 1px solid var(--ov-line-strong); border-radius: 50%; cursor: pointer;
  transition: background-color 180ms var(--ov-ease), border-color 180ms var(--ov-ease);
}
.modal__close:hover, .modal__mute:hover, .modal__toggle:hover, .modal__skip:hover, .island__toggle:hover, .island__skip:hover, .island__stop:hover { background: rgb(242 230 201 / 0.16); border-color: var(--c-cream); }
[data-player-toggle] .ico--pause, html[data-player="playing"] [data-player-toggle] .ico--play { display: none; }
html[data-player="playing"] [data-player-toggle] .ico--pause { display: block; }

/* ---- Lyrics modal: transparent, full viewport — the stage (video / end frame) stays visible behind
   the words (owner requirement, docs/decisions.md D-033). No solid or bordered panel. ------------ */
.modal { transition: opacity var(--ov-out) var(--ov-ease); }
.modal.is-open { transition-duration: 240ms; }
.modal__panel { transform: translateY(24px); transition: transform var(--ov-out) var(--ov-ease); }
.modal.is-open .modal__panel { transform: none; transition-duration: 240ms; }
@media (max-width: 820px) { .modal__panel { transform: translateY(36svh); } } /* mobile: slides up from the bottom */

/* Symmetric chrome: [close] · cover + title, centred · [spacer of the same width]; the transport trio (previous ·
   play/pause · next) sits on the centre axis above the waveform. Nothing hangs off one side. */
.modal__bar { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: var(--sp-3); padding: calc(env(safe-area-inset-top, 0px) + var(--row-top) + var(--row-h) + 8px) var(--sp-4) var(--sp-3); } /* below the chip / language row */
.modal__id { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); min-width: 0; }
.modal__meta { flex: 0 1 auto; max-width: 100%; }
.modal__bar-end { width: 44px; height: 44px; }
/* Preview volume: a slider row centred between the transport and the waveform (speaker = mute toggle + range). --v (0–100) fills the track. */
.modal__vol { flex: none; display: flex; align-items: center; gap: var(--sp-2); width: min(280px, calc(100% - 2 * var(--sp-5))); height: 40px; margin: 0 auto 2px; --v: 100; }
.modal__vol[hidden] { display: none; } /* iOS ignores audio.volume (the hardware buttons rule): no control */
.modal__mute { width: 36px; height: 36px; }
.modal__mute .ico { width: 20px; height: 20px; }
.modal__vol[data-lv="1"] .w2, .modal__vol[data-lv="0"] :is(.w1, .w2), .modal__vol:not([data-lv="0"]) .wx { display: none; }
/* Optical centring: the one-wave state is narrower, so its glyph sat ~1.5px left of the circle centre. */
.modal__vol[data-lv="1"] .modal__mute .ico { transform: translateX(1.5px); }
.modal__vol input { flex: 1 1 auto; min-width: 0; height: 28px; margin: 0; padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; background: linear-gradient(90deg, var(--c-cream) calc(var(--v) * 1%), rgb(242 230 201 / 0.28) calc(var(--v) * 1%)) center / 100% 4px no-repeat; border-radius: 2px; }
.modal__vol input::-webkit-slider-runnable-track { height: 28px; background: transparent; }
.modal__vol input::-moz-range-track { height: 28px; background: transparent; }
.modal__vol input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 5px; border: 2px solid var(--c-ink); border-radius: 50%; background: var(--c-cream); box-shadow: 0 1px 6px rgb(0 0 0 / 0.5); }
.modal__vol input::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--c-ink); border-radius: 50%; background: var(--c-cream); box-shadow: 0 1px 6px rgb(0 0 0 / 0.5); }
.modal__vol input:focus-visible { outline: 2px solid var(--c-cream); outline-offset: 4px; }
.modal__close { width: 44px; height: 44px; }
.modal__transport { flex: none; display: flex; align-items: center; justify-content: center; gap: 22px; height: var(--tr-h); padding-bottom: 6px; }
.modal__skip { width: 48px; height: 48px; }
.modal__skip .ico { width: 20px; height: 20px; }
.modal__toggle { width: 60px; height: 60px; background: rgb(10 22 51 / 0.7); border-color: var(--c-cream); }
.modal__toggle .ico { width: 24px; height: 24px; }
.modal__skip[aria-disabled="true"] { opacity: 0.4; cursor: default; }
.modal__close .ico { width: 22px; height: 22px; transition: transform 180ms var(--ov-ease); }
.modal__close:hover .ico { transform: translateY(3px); }
.modal__cover { width: 48px; height: 48px; flex: none; border-radius: var(--radius-2); border: 1px solid rgb(242 230 201 / 0.5); object-fit: cover; box-shadow: var(--ov-shadow); }
.modal__meta h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 400 clamp(1.75rem, 1.3rem + 2vw, 2.5rem) / 1 var(--font-display); color: var(--c-red); text-shadow: 0 0 3px rgb(5 11 26 / 0.95), 0 0 16px rgb(5 11 26 / 0.85); }
.modal__meta p { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; margin-top: 2px; font-size: var(--fs-0); color: rgb(242 230 201 / 0.78); opacity: 1; }
.modal__state { display: none; margin-top: 2px; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-ochre); }
html[data-player="paused"] .modal__state { display: block; }

/* Waveform progress (core/wave.js): 96 rounded bars, no panel behind. Played bars red, unplayed cream 35 %,
   the playhead bar light cream. Every bar scales with --beat (transform only): the bars at the playhead (--w 1 → .25)
   most, the rest of the track at .35 so the whole waveform moves on every beat and half beat. */
.modal__panel > .modal__progress[data-wave] {
  display: flex; align-items: center; gap: 2px; height: var(--wave-h); margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: none; border-radius: 0; overflow: visible;
}
.modal__progress span { display: none; }
[data-wave] i {
  flex: 1 1 0; min-width: 1px; height: calc(10% + var(--h, 0.3) * 90%); border-radius: 3px; background: rgb(242 230 201 / 0.35);
  box-shadow: 0 0 4px rgb(5 11 26 / 0.7); transform: scaleY(calc(1 + var(--beat, 0) * var(--w, 0.35) * 0.55));
}
[data-wave] i.is-played { background: var(--c-red); }
[data-wave] i.is-head { background: #fff6dc; }
@media (max-width: 560px) { :root { --wave-h: 36px; } .modal__panel > .modal__progress[data-wave] { gap: 1px; } }

/* ---- The lyrics engine's DOM inside #lyrics-stage (docs/contracts.md "Lyrics engine DOM").
   Only this file may style .le-*; the engine injects its stylesheet later, hence the #id prefix. ---- */
#lyrics-stage { min-height: 240px; }
/* Contrast fix: a soft dark halo on the words themselves — no panel, no extra background layer. The tight inner layers
   (1–7 px) separate the strokes from busy video; the wide ones (16–70 px) darken the neighbourhood without a visible edge.
   Measured before/after in docs/report-ui.md (node tests/ui/contrast.mjs). */
#lyrics-stage .le-word, #lyrics-stage .le-line {
  text-shadow: 0 0 1px rgb(5 11 26 / 1), 0 0 3px rgb(5 11 26 / 1), 0 0 7px rgb(5 11 26 / 0.97), 0 0 16px rgb(5 11 26 / 0.95), 0 0 34px rgb(5 11 26 / 0.9), 0 0 70px rgb(5 11 26 / 0.75);
}
#lyrics-stage .le-hint { padding: 8px 16px; font-size: var(--fs-0); border: 1px solid var(--ov-line); border-radius: var(--radius-pill); }
#lyrics-stage .le-root[data-le-state="loading"] .le-hint { animation: shimmer 1.3s ease-in-out infinite alternate; }
@keyframes shimmer { from { opacity: 0.45; } to { opacity: 1; } }
/* Calibration and the engine's own close button stay off: our chevron closes, music keeps playing. */
#lyrics-stage :is(.le-bar, .le-tune, .le-close, .le-pick) { display: none !important; }

/* Landscape phones and other very short viewports */
@media (max-height: 480px) {
  :root { --tr-h: 60px; }
  .modal__skip { width: 40px; height: 40px; }
  .modal__toggle { width: 48px; height: 48px; }
  .modal__cover { display: none; }
  .modal__bar { padding-block: calc(env(safe-area-inset-top, 0px) + var(--row-top) + var(--row-h) + 4px) 8px; }
  .modal__meta h2 { font-size: 1.5rem; }
  #lyrics-stage { min-height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal__panel, .modal.is-open .modal__panel { transform: none !important; transition: none; }
  .modal__close:hover .ico { transform: none; }
  [data-wave] i { transform: none !important; } /* no beat pulse */
  #lyrics-stage .le-root[data-le-state="loading"] .le-hint { animation: none; }
}
