/*
 * PATCH-6700 — the inline players' own parts, on the home hero and each watch
 * page, from Cat's spec of 2026-11-10: the Play disc over the poster (again
 * once a film ends, PATCH-6712, which took out the Replay disc) and Try again
 * under the picture. One definition; marketing/video-player.js adds the parts it styles.
 *
 * PATCH-6964 (Cat's spec of 2026-11-13, the owner's speaker-only change): the
 * floating bar that replaces the native controls after the first press, the
 * app's map controls bar rather than a scrim, so it reads on any frame; its
 * wait ring; and the stage's own full screen.
 *
 * Its colours and face are --player-* names, each an alias of the page's own
 * existing token (the bar's edge, tip, hover and corners default to the
 * home's values where a page sets none), set where the page sets its tokens: the home's in its
 * <style> (.hero-trailer), a watch page's in films.css (.watch-figure).
 */
.player-stage { position: relative; }

/* Play covers the whole poster; only its disc is painted. */
.player-play {
  position: absolute; display: grid; place-items: center; margin: 0; padding: 0;
  border: 0; background: transparent; color: #fff; cursor: pointer;
  inset: 0; width: 100%; height: 100%; -webkit-tap-highlight-color: transparent;
}
.player-play[hidden] { display: none; }
.player-disc { display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); }
.player-disc svg { width: 28px; height: 28px; margin-left: 4px; fill: currentColor; }
.player-play:hover .player-disc, .player-play:active .player-disc { background: rgba(0, 0, 0, 0.7); }
/* The ring is on the disc: 3px of accent, 4px out, on a dark surround so it
   shows over a light poster. */
.player-play:focus-visible { outline: 0; }
.player-play:focus-visible .player-disc {
  outline: 3px solid var(--player-accent-text); outline-offset: 4px; box-shadow: 0 0 0 8px var(--player-ground);
}

/* Try again: a short message and its 44px button, 8px under the picture,
   shown only once a pressed play fails. */
.player-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0;
  font: 0.875rem/1.5 var(--player-font); color: var(--player-text);
}
.player-error[hidden] { display: none; }
.player-retry {
  min-height: 44px; min-width: 88px; margin: 0; padding: 0 10px; cursor: pointer;
  font: inherit; color: var(--player-text);
  background: var(--player-rail); border: 1px solid var(--player-border); border-radius: 9px;
}
.player-retry:focus-visible { outline: 3px solid var(--player-accent-text); outline-offset: 3px; }

/* PATCH-6964: the bar. Its fade is --motion-fast, the site's nearest value to
   Cat's 150ms (test/motion.test.mjs: no duration of a page's own); motion.css
   makes it instant under reduced motion.
   Inset 12px, 48px tall, --bg-input at 84% with a blur,
   an --border-strong edge and --r-lg corners; one row at every width. */
.player-bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 1; box-sizing: border-box; height: 48px;
  display: flex; align-items: center; gap: 2px; padding: 0 4px;
  background: color-mix(in srgb, var(--player-input) 84%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--player-border-strong, rgba(255, 253, 247, 0.16)); border-radius: var(--player-radius, 13px);
  color: var(--player-text); font-family: var(--player-font);
  transition: opacity var(--motion-fast) var(--ease-out-soft);
}
.player-bar[hidden] { display: none; }
/* While playing, the bar fades once the pointer rests (marketing/video-player.js
   sets .player-idle); in full screen the cursor goes with it. */
.player-idle .player-bar { opacity: 0; pointer-events: none; }
.player-idle.player-fullscreen, .player-idle.player-fullscreen video { cursor: none; }
.player-button {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; margin: 0; padding: 0;
  border: 0; border-radius: var(--player-radius-small, 9px); background: transparent; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.player-button[hidden] { display: none; }
.player-button:hover { background: var(--player-hover, rgba(255, 253, 247, 0.09)); }
.player-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.player-button svg .f { fill: currentColor; stroke: none; }
.player-button:focus-visible { outline: 2px solid var(--player-accent-text); outline-offset: 2px; }
.player-time {
  flex: none; padding: 0 8px 0 4px; white-space: nowrap;
  font: 13px/1 var(--player-mono); font-variant-numeric: tabular-nums; color: var(--player-text-secondary);
}
.player-now { color: var(--player-text); }
/* The play bar: drawn spans under a native range laid over them. Played is
   --accent, loaded 40% white, the rest 24%; 4px, 6px on hover. */
.player-track { position: relative; flex: 1; min-width: 0; height: 28px; margin: 0 10px; --played: 0; --loaded: 0; }
.player-rail, .player-loaded, .player-played {
  position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 999px; pointer-events: none;
}
.player-rail { right: 0; background: rgba(255, 253, 247, 0.24); }
.player-loaded { width: calc(var(--loaded) * 1%); background: rgba(255, 253, 247, 0.4); }
.player-played { width: calc(var(--played) * 1%); background: var(--player-accent); }
.player-track:hover :is(.player-rail, .player-loaded, .player-played), .player-dragging :is(.player-rail, .player-loaded, .player-played) { height: 6px; margin-top: -3px; }
/* The 12px knob, on hover, focus or drag; Seek's focus ring sits on it. */
.player-knob {
  position: absolute; top: 50%; left: calc(var(--played) * 1%); width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--player-accent); pointer-events: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--player-input) 84%, transparent); opacity: 0;
}
.player-track:hover .player-knob, .player-dragging .player-knob, .player-track:focus-within .player-knob { opacity: 1; }
.player-track:has(.player-seek:focus-visible) .player-knob { outline: 2px solid var(--player-accent-text); outline-offset: 2px; }
.player-seek {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer;
}
.player-seek:focus-visible { outline: 0; }
/* On hover, the time a click would land on. */
.player-tip {
  position: absolute; bottom: 30px; transform: translateX(-50%); padding: 3px 7px; pointer-events: none; white-space: nowrap;
  border: 1px solid var(--player-border-strong, rgba(255, 253, 247, 0.16)); border-radius: 6px; background: var(--player-raised, #2b2520);
  font: 12px/1.2 var(--player-mono); color: var(--player-text);
}
.player-tip[hidden] { display: none; }

/* Waiting for data: a ring, only after 500ms; motion.css stills it under reduced motion. */
.player-wait {
  position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; pointer-events: none;
  border: 3px solid rgba(255, 253, 247, 0.25); border-top-color: var(--player-text); border-radius: 50%;
  animation: player-turn var(--motion-spin) linear infinite;
}
.player-wait[hidden] { display: none; }
@keyframes player-turn { to { rotate: 360deg; } }

/* The stage in its own full screen: the picture fills it, letterboxed on
   black, with no border, corner or poster showing past the film. */
.player-stage.player-fullscreen { width: 100%; height: 100%; max-width: none; aspect-ratio: auto; border: 0; border-radius: 0; background: #000; }
.player-fullscreen video { width: 100%; height: 100%; max-height: none; object-fit: contain; border: 0; border-radius: 0; }
.player-fullscreen picture { visibility: hidden; }

@media (max-width: 639px) {
  .player-disc { width: 64px; height: 64px; }
  .player-disc svg { width: 24px; height: 24px; }
  /* A phone: inset 8px, 44px targets in one row, the current time only. */
  .player-bar { left: 8px; right: 8px; bottom: 8px; height: 46px; padding: 0 1px; gap: 0; }
  .player-button { width: 44px; height: 44px; }
  .player-track { height: 44px; margin: 0 6px; }
  .player-total { display: none; }
  .player-time { padding: 0 4px; }
}
