/* Elequate film player: full-page video, brand glass controls, YouTube-style
   call-to-action card and end screen. Used by the home page (#film, opens from
   "Watch the Video") and /video/<slug>/. Behaviour: shared/film-player.js.

   Treatments are taken from the app, not invented:
   - round frosted glass, no outline: the assessment deck's close (#deckClose in
     apps/hub/assessment-deck.html) and its × glyph set in Inter;
   - the rounded pill bar, round cyan play button, 6px cyan track and cyan thumb:
     the call scoring player (.audio-inline in apps/hub/call-review.html);
   - loading: the deck's ring spinner (.spin), no logo mark (the staircase icon
     is retired; the wordmark is the only logo). */

.efp {
  --efp-cyan: #21c0ff;
  --efp-cyan-hover: #1ba8e0;
  --efp-ink-2: rgba(255, 255, 255, 0.6);
  --efp-frost: rgba(10, 22, 40, 0.3);
  --efp-frost-hover: rgba(10, 22, 40, 0.42);
  --efp-frost-solid: rgba(10, 22, 40, 0.3);
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #0d1e36;
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.efp[hidden] { display: none; }
.efp--page { position: relative; inset: auto; width: 100%; height: 100vh; height: 100dvh; z-index: auto; }
.efp button { font-family: inherit; }

.efp-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #0d1e36;
  opacity: 0;
  transition: opacity 0.5s ease, filter 0.6s ease;
}
.efp.is-ready .efp-video { opacity: 1; }
/* Fill more of the screen when it is close to the film's 16:9. The film is
   scaled up to 4% past the screen edge, no more: a 16:10 laptop keeps only a
   thin strip top and bottom, and edge cards (the $560 lead card) stay whole.
   Far-off shapes like an upright phone still fit the whole film. */
@media (min-aspect-ratio: 4/3) and (max-aspect-ratio: 16/9) {
  .efp:not(.is-tall) .efp-video {
    inset: auto; left: 50%; top: 50%; translate: -50% -50%;
    width: min(104vw, 177.78vh); height: min(58.5vw, 100vh);
  }
}
@media (min-aspect-ratio: 16/9) and (max-aspect-ratio: 21/9) {
  .efp:not(.is-tall) .efp-video {
    inset: auto; left: 50%; top: 50%; translate: -50% -50%;
    width: min(184.9vh, 100vw); height: min(104vh, 56.25vw);
  }
}
.efp.is-ended .efp-video { opacity: 0; }

/* ── opening: grows out of the button that was clicked ────────────── */
.efp.is-opening { animation: efp-grow 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes efp-grow {
  from { clip-path: var(--efp-from, inset(50% round 8px)); }
  to { clip-path: inset(0 round 0); }
}
.efp.is-closing { animation: efp-fade 0.25s ease both; }
@keyframes efp-fade { to { opacity: 0; } }

/* loader: the deck's ring, until the first frame plays */
.efp-spin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--efp-cyan);
  animation: efp-sp 0.8s linear infinite;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.efp.is-ready .efp-spin { opacity: 0; animation: none; }
@keyframes efp-sp { to { transform: rotate(360deg); } }

/* ── round frosted glass, no outline ──────────────────────────────── */
.efp-round {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--efp-frost);
  -webkit-backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.25s ease;
}
.efp-round:hover { background: var(--efp-frost-hover); }
.efp-round:active { transform: scale(0.95); }
.efp-round:focus-visible, .efp-ico:focus-visible, .efp-play:focus-visible, .efp-cta:focus-visible, .efp-again:focus-visible { outline: 2px solid var(--efp-cyan); outline-offset: 3px; }

/* close: 52px circle with the × glyph out of Inter, as on the assessment deck */
.efp-close { width: 52px; height: 52px; font-size: 30px; line-height: 1; }
.efp-close span { display: block; transform: translateY(-0.0833em); pointer-events: none; }

/* big centre play: only before the film starts; once it has, the bar's play button is the one */
.efp-big {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 200px;
  height: 200px;
  margin: -100px 0 0 -100px;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.92);
}
.efp-big svg { width: 64px; height: 64px; margin-left: 10px; }
.efp.is-ready.is-paused:not(.is-ended):not(.is-started) .efp-big { opacity: 1; pointer-events: auto; transform: none; }

/* chrome hides while the film plays untouched */
.efp-chrome { transition: opacity 0.3s ease, transform 0.3s ease; }
.efp.is-idle .efp-chrome { opacity: 0; pointer-events: none; }
.efp.is-idle { cursor: none; }

.efp-top {
  position: absolute;
  top: calc(clamp(16px, 2.6vw, 34px) + env(safe-area-inset-top));
  right: calc(clamp(16px, 3.4vw, 48px) + env(safe-area-inset-right));
  z-index: 6;
}

/* ── control bar: the call scoring player's rounded pill ──────────── */
.efp-bar {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(16px, 2.6vw, 32px) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(980px, calc(100% - 32px));
  height: 76px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 10px;
  border-radius: 999px;
  background: rgba(10, 22, 40, 0.18);
  -webkit-backdrop-filter: blur(16px) saturate(140%) brightness(0.92);
  backdrop-filter: blur(16px) saturate(140%) brightness(0.92);
  z-index: 3;
}
.efp.is-idle .efp-bar { transform: translate(-50%, 10px); }
.efp.is-ended .efp-bar, .efp:not(.is-ready) .efp-bar, .efp:not(.is-started) .efp-bar { opacity: 0; pointer-events: none; }
.efp-play {
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--efp-cyan);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 18px rgba(33, 192, 255, 0.35);
}
.efp-play:hover { background: var(--efp-cyan-hover); transform: scale(1.06); }
.efp-play:active { transform: scale(0.94); }
.efp-play svg { width: 24px; height: 24px; }
.efp-play .i-play { margin-left: 2px; }
.efp-ico {
  width: 52px;
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, background 0.15s, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.efp-ico:hover { color: #fff; background: rgba(255, 255, 255, 0.1); transform: scale(1.12); }
.efp-ico:active { transform: scale(0.92); }
.efp-ico svg { width: 28px; height: 28px; }
.efp-time {
  flex: none;
  min-width: 104px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
.efp-scrub {
  position: relative;
  flex: 1;
  height: 40px;
  cursor: pointer;
  touch-action: none;
}
.efp-track, .efp-fill, .efp-buf {
  position: absolute;
  left: 0;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  border-radius: 4px;
  pointer-events: none;
  transition: height 0.15s, margin-top 0.15s;
}
.efp-track { right: 0; background: rgba(255, 255, 255, 0.12); }
.efp-buf { width: 0; background: rgba(255, 255, 255, 0.12); }
.efp-fill { width: 0; background: var(--efp-cyan); }
.efp-knob {
  position: absolute;
  top: 50%;
  left: 0;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px var(--efp-cyan);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.efp-scrub:hover .efp-knob, .efp.is-scrubbing .efp-knob { opacity: 1; }
.efp-scrub:hover .efp-track, .efp-scrub:hover .efp-fill, .efp-scrub:hover .efp-buf { height: 10px; margin-top: -5px; }

/* ── end screen: the film hands over to the blueprint ────────────────
   Same blueprint and same hero button as the home page (.hero, .hero-cta-btn),
   nothing invented. The blueprint drifts in slowly, the lines slide up in turn. */
.efp-end {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 24px;
  text-align: center;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease, visibility 0.7s;
}
.efp.is-ended .efp-end { opacity: 1; visibility: visible; }
.efp-end-bg {
  position: absolute;
  inset: -4%;
  z-index: -1;
  background: url('/assets/background.webp') center / cover no-repeat;
  /* matched to the film's own blueprint scenes (about rgb 24,38,69) */
  filter: brightness(0.6) saturate(1.15);
  transform: scale(1.12);
  transition: transform 14s cubic-bezier(0.16, 1, 0.3, 1);
}
.efp.is-ended .efp-end-bg { transform: scale(1); }
.efp-end > :not(.efp-end-bg) {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.efp.is-ended .efp-end > :not(.efp-end-bg) { opacity: 1; transform: none; }
.efp.is-ended .efp-end > :nth-child(2) { transition-delay: 0.25s; }
.efp.is-ended .efp-end > :nth-child(3) { transition-delay: 0.4s; }
.efp.is-ended .efp-end > :nth-child(4) { transition-delay: 0.55s; }
.efp-head {
  margin-top: 0;
  font-size: clamp(32px, 5vw, 72px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 19ch;
}
.efp-head em { font-style: normal; color: var(--efp-cyan); }
.efp-cta {
  margin-top: clamp(48px, 8vh, 88px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 25px 48px;
  border-radius: 12px;
  background: var(--efp-cyan);
  color: #fff;
  font: 700 clamp(20px, 1.7vw, 24px)/1 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(33, 192, 255, 0.35);
  transition: background 0.3s, box-shadow 0.3s, translate 0.3s;
}
/* Slow pulse once the end screen has settled: grows a little and glows, to
   invite the click (Ryan 2026-11-13). Stops on hover and for reduced motion. */
.efp.is-ended .efp-cta { animation: efp-pulse 2.8s ease-in-out 1.4s infinite; }
.efp.is-ended .efp-cta:hover { animation: none; }
@keyframes efp-pulse {
  0%, 100% { scale: 1; box-shadow: 0 10px 30px rgba(33, 192, 255, 0.35); }
  50% { scale: 1.06; box-shadow: 0 12px 48px rgba(33, 192, 255, 0.7), 0 0 0 8px rgba(33, 192, 255, 0.12); }
}
.efp-cta:hover { background: var(--efp-cyan-hover); translate: 0 -2px; box-shadow: 0 14px 40px rgba(33, 192, 255, 0.5); }
.efp-cta svg { width: 25px; height: 25px; transition: translate 0.3s; }
.efp-cta:hover svg { translate: 4px 0; }
.efp-again {
  position: absolute;
  right: max(24px, env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--efp-frost);
  -webkit-backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  color: rgba(255, 255, 255, 0.85);
  font: 600 15px/1 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.efp-again:hover { background: var(--efp-frost-hover); color: #fff; }
.efp-again svg { width: 20px; height: 20px; }

/* Tap for Sound: shown while a share page plays by itself with the sound off */
.efp-sound {
  position: absolute;
  left: 50%;
  top: calc(clamp(16px, 2.6vw, 34px) + env(safe-area-inset-top));
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px 14px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--efp-frost);
  -webkit-backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  backdrop-filter: blur(14px) saturate(140%) brightness(0.88);
  color: #fff;
  font: 700 18px/1 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: background 0.2s, opacity 0.25s ease;
}
.efp-sound:hover { background: var(--efp-frost-hover); }
.efp-sound:focus-visible { outline: 2px solid var(--efp-cyan); outline-offset: 3px; }
.efp-sound svg { width: 24px; height: 24px; }
.efp.is-quiet:not(.is-ended) .efp-sound { opacity: 1; pointer-events: auto; }

@media (max-width: 640px) {
  .efp-bar { height: 64px; gap: 6px; width: calc(100% - 24px); padding: 0 10px 0 8px; }
  .efp-play { width: 48px; height: 48px; }
  .efp-play svg { width: 20px; height: 20px; }
  .efp-ico { width: 44px; height: 44px; }
  .efp-ico svg { width: 24px; height: 24px; }
  .efp-time { min-width: 0; font-size: 12px; }
  .efp-dl { display: none; }
  .efp-close { width: 44px; height: 44px; font-size: 26px; }
  .efp-big { width: 128px; height: 128px; margin: -64px 0 0 -64px; }
  .efp-big svg { width: 44px; height: 44px; }
  .efp-head { font-size: 38px; max-width: 12ch; }
  /* phones: a normal content-width button, never edge to edge (Ryan 2026-11-13) */
  .efp-cta { margin-top: 36px; padding: 16px 26px; gap: 10px; font-size: 18px; border-radius: 10px; }
  .efp-cta svg { width: 20px; height: 20px; }
}
@media (max-height: 500px) {
  .efp-big { width: 110px; height: 110px; margin: -55px 0 0 -55px; }
  .efp-big svg { width: 38px; height: 38px; }
  .efp-head { margin-top: 0; font-size: 32px; max-width: none; }
  .efp-cta { margin-top: 24px; padding: 16px 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .efp.is-opening { animation: efp-fade-in 0.2s ease both; }
  @keyframes efp-fade-in { from { opacity: 0; } }
  .efp-spin { animation-duration: 1.6s; }
  .efp-end-bg { transition: none; transform: none; }
  .efp.is-ended .efp-cta { animation: none; }
  .efp-end > :not(.efp-end-bg) { transition: opacity 0.3s; transform: none; }
}
