/* ═══════════════════════════════════════════════════════════════════════════
   lib/styles/cinema.css — the pieces lib/cinema.js draws for both films:
   progress dots, the shared controls, the play/pause flash, the glow a part of
   the picture arrives with, and the backdrop canvas.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── progress: one dot per beat, the current one fills as it plays; click to jump ── */
.cine-dots { display: flex; align-items: center; gap: 0; flex: 1; min-width: 0; flex-wrap: wrap; }
.cine-dot { position: relative; flex: 1 1 18px; max-width: 34px; min-width: 12px; height: 22px; padding: 0 2px; border: 0; background: none; cursor: pointer; display: grid; align-items: center; }
.cine-dot i { display: block; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; position: relative; transition: background .3s, height .2s; }
.cine-dot:hover i, .cine-dot:focus-visible i { height: 6px; background: rgba(168,230,255,.4); }
.cine-dot:focus-visible { outline: none; }
.cine-dot:focus-visible i { box-shadow: 0 0 0 2px rgba(168,230,255,.7); }
.cine-dot.on i { background: var(--df-ice, #a8e6ff); box-shadow: 0 0 8px rgba(168,230,255,.55); }
.cine-dot.run i { background: rgba(168,230,255,.22); }
.cine-dot.run i::after { content: ""; position: absolute; inset: 0; background: var(--df-ice, #a8e6ff); transform-origin: left; animation: cine-fill var(--beat, 4s) linear forwards; box-shadow: 0 0 10px rgba(168,230,255,.8); }
.cine-dots.paused .cine-dot.run i::after { animation-play-state: paused; }
@keyframes cine-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.cine-count { font: 500 11px var(--df-mono, monospace); color: var(--df-dim, #5d6578); letter-spacing: .06em; white-space: nowrap; margin-left: 8px; min-width: 3.4em; text-align: right; }

/* ── shared controls ── */
.cine-ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cine-b { white-space: nowrap; border: 1px solid var(--df-line, rgba(190,210,255,.13)); background: rgba(6,9,16,.55); color: var(--df-muted, #8e97a9); border-radius: 8px; padding: 7px 11px; font: 500 13px var(--df-sans, system-ui); cursor: pointer; display: inline-flex; align-items: center; gap: 2px; line-height: 1.1; }
.cine-b:hover { color: var(--df-ink, #e9edf4); border-color: var(--df-line-strong, rgba(190,210,255,.22)); }
.cine-b:focus-visible { outline: 2px solid var(--df-ice, #a8e6ff); outline-offset: 2px; }
.cine-b[aria-pressed="true"] { color: #d6f3ff; border-color: rgba(168,230,255,.42); background: rgba(168,230,255,.08); }
.cine-b.warn { color: #ffd6b0; border-color: rgba(255,176,112,.45); }
.cine-b.off .i { opacity: .55; }
.cine-b .i { display: inline-block; min-width: 1em; text-align: center; }
.cine-b[hidden], .cine-ctl [hidden] { display: none !important; }
.cine-sel { max-width: 150px; text-overflow: ellipsis; appearance: auto; }
.cine-sel option { color: #e8eef7; background: #0b1222; }
.cine-spd .l { font-family: var(--df-mono, monospace); font-size: 12px; }

/* the narrator is talking: three bars move beside the caption */
.cine-wave { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; margin-right: 8px; opacity: 0; transition: opacity .3s; vertical-align: middle; }
.cine-wave i { width: 3px; border-radius: 2px; background: var(--df-ice, #a8e6ff); height: 30%; }
.cine-speaking .cine-wave { opacity: .9; }
.cine-speaking .cine-wave i { animation: cine-wave .9s ease-in-out infinite; }
.cine-speaking .cine-wave i:nth-child(2) { animation-delay: .15s; }
.cine-speaking .cine-wave i:nth-child(3) { animation-delay: .3s; }
@keyframes cine-wave { 0%, 100% { height: 25%; } 50% { height: 100%; } }

/* paused: a quiet badge, and everything that drifts holds still */
.cine-paused .q-say::after, .cine-paused .cs-say::after { content: "  ❚❚ paused"; font: 500 11px var(--df-mono, monospace); letter-spacing: .1em; color: #ffd27a; white-space: nowrap; }

/* ── the ▶ / ❚❚ a tap answers with ── */
.cine-flash { position: absolute; z-index: 6; left: 50%; top: 42%; width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%; background: rgba(4,7,14,.62); border: 1px solid rgba(168,230,255,.35); display: grid; place-items: center; pointer-events: none; opacity: 0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.cine-flash svg { width: 34px; height: 34px; fill: #eaf6ff; }
.cine-flash.on { animation: cine-flash .75s ease-out forwards; }
@keyframes cine-flash { 0% { opacity: 0; transform: scale(.7); } 25% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.25); } }

/* ── a part of the picture arrives with a flash of light ── */
.cine-pop { animation: cine-pop 1.2s ease-out; }
@keyframes cine-pop {
  0% { filter: brightness(2.2) drop-shadow(0 0 0 rgba(168,230,255,0)); }
  25% { filter: brightness(1.5) drop-shadow(0 0 9px rgba(168,230,255,.85)); }
  100% { filter: brightness(1) drop-shadow(0 0 0 rgba(168,230,255,0)); }
}

/* ── the backdrop canvas ── */
canvas.cine-gl { position: absolute; inset: 0; width: 100% !important; height: 100% !important; aspect-ratio: auto !important; border-radius: 0 !important; animation: none !important; filter: none !important; image-rendering: auto; }

@media (prefers-reduced-motion: reduce) {
  .cine-dot.run i::after { animation: none; transform: none; }
  .cine-pop, .cine-flash.on { animation: none; }
}
