/* Shared video showcase — a featured stage above a horizontal rail of
   episode cards, all built from this site's own tokens. Used by both
   q-explorator.html and q-expert.html (js/video-theater.js); the only
   thing that differs per page is the accent color, themed through
   --video-theater-accent(-rgb) rather than forking this file. The
   default here is Q-Explorator's amber; q-expert.html repoints it to the
   Q-Expert teal in css/q-expert-overrides.css, the same pattern already
   used there for the pricing/compare tables. */
.video-theater {
  --video-theater-accent: var(--color-accent-video);
  --video-theater-accent-rgb: 242, 166, 84;
  margin-top: var(--space-3);
}

.video-theater__stage {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  flex-wrap: wrap;
}

.video-theater__player {
  position: relative;
  flex: 1 1 560px;
  max-width: 720px;
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--radius) * 2);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--color-border);
  box-shadow: 0 0 0 1px rgba(var(--video-theater-accent-rgb), 0.25), 0 0 32px rgba(var(--video-theater-accent-rgb), 0.12);
  transition: opacity 0.2s ease;
}
.video-theater__player.is-swapping { opacity: 0.4; }
.video-theater__player.is-unavailable { animation: video-theater-shake 0.4s ease; }
@keyframes video-theater-shake {
  0%, 100% { box-shadow: 0 0 0 1px rgba(var(--video-theater-accent-rgb), 0.25), 0 0 32px rgba(var(--video-theater-accent-rgb), 0.12); }
  50% { box-shadow: 0 0 0 2px #e2574c, 0 0 32px rgba(226, 87, 76, 0.35); }
}

.video-theater__poster,
.video-theater__iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  object-fit: cover;
}
.video-theater__player.is-playing .video-theater__poster,
.video-theater__player.is-playing .video-theater__play,
.video-theater__player.is-playing .video-theater__duration { display: none; }

.video-theater__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--video-theater-accent);
  background: rgba(11, 14, 20, 0.6);
  color: var(--video-theater-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(2px);
}
.video-theater__play svg { margin-left: 3px; }
.video-theater__play:hover { background: var(--video-theater-accent); color: var(--color-bg); }
.video-theater__play.has-pulse { animation: video-theater-pulse 2.4s ease-in-out infinite; }
@keyframes video-theater-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--video-theater-accent-rgb), 0.45); }
  50% { box-shadow: 0 0 0 14px rgba(var(--video-theater-accent-rgb), 0); }
}
@media (prefers-reduced-motion: reduce) {
  .video-theater__play.has-pulse { animation: none; }
}
/* Coming-soon episode: the play button goes inert instead of embedding
   anything — muted, no pulse (renderStage() already withholds has-pulse
   for it), no hover state, not clickable. */
.video-theater__play[aria-disabled="true"] {
  border-color: var(--color-text-label);
  color: var(--color-text-label);
  cursor: not-allowed;
}
.video-theater__play[aria-disabled="true"]:hover { background: transparent; color: var(--color-text-label); }

.video-theater__duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(11, 14, 20, 0.8);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text);
}

.video-theater__meta { flex: 1 1 280px; min-width: 240px; }
.video-theater__episode { color: var(--video-theater-accent); margin-bottom: 6px; }
.video-theater__title { margin: 0 0 8px; font-size: 24px; }
/* .premium-badge (components.css) sets display:inline-block unconditionally,
   which otherwise beats the plain [hidden] attribute's UA-stylesheet
   display:none — author rules always win over UA defaults regardless of
   matching specificity, so toggling just the `hidden` property here left
   the badge visible on every episode, not only the premium ones. This
   rule has one more selector than that one, so it wins instead. */
.video-theater__premium { margin-bottom: 8px; }
.video-theater__premium[hidden] { display: none; }
.video-theater__body { color: var(--color-text-secondary); font-size: 14px; margin: 0; }

.video-theater__rail-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-3);
}
.video-theater__rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  list-style: none;
  margin: 0;
  padding: 4px 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}
.video-theater__rail::-webkit-scrollbar { height: 6px; }
.video-theater__rail::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.video-theater__card { flex: 0 0 200px; scroll-snap-align: start; }
.video-theater__card-btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  overflow: hidden;
  text-align: left;
}
.video-theater__card-btn:hover { border-color: var(--color-text-secondary); }
.video-theater__card.is-active .video-theater__card-btn { border-color: var(--video-theater-accent); }

/* height: auto is load-bearing — the <img>'s own width/height="1280"/"720"
   attributes (kept for layout-shift prevention) otherwise set a used
   height of 720px directly once width is overridden to 100%, which boxes
   out aspect-ratio entirely (it only fills in a dimension left auto). */
.video-theater__card-thumb { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.video-theater__card-number {
  position: absolute;
  top: 6px;
  left: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(11, 14, 20, 0.8);
  border-radius: 3px;
  padding: 2px 5px;
  color: var(--color-text);
}
.video-theater__card-duration {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(11, 14, 20, 0.8);
  border-radius: 3px;
  padding: 2px 5px;
  color: var(--color-text);
}
.video-theater__card-now-playing {
  display: none;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--video-theater-accent);
  color: var(--color-bg);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: center;
  padding: 3px 0;
}
.video-theater__card.is-active .video-theater__card-now-playing { display: block; }
/* "Coming <date>" is permanent (not tied to is-active like "Now playing"
   above) and deliberately muted rather than accent-colored, so a rail
   full of not-yet-released episodes doesn't look like 10 things are all
   "now playing" at once. Same specificity as the is-active rule above,
   so source order (this rule second) is what makes it win when a
   coming-soon episode also happens to be the active one. */
.video-theater__card.is-coming-soon .video-theater__card-now-playing {
  display: block;
  background: var(--color-text-label);
  color: var(--color-bg);
}
.video-theater__card-title {
  display: block;
  padding: 8px;
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.3;
}
.video-theater__card.is-active .video-theater__card-title { color: var(--color-text); }

.video-theater__arrow {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.video-theater__arrow:hover { border-color: var(--video-theater-accent); color: var(--video-theater-accent); }

.video-theater__playlist-link {
  display: inline-block;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--video-theater-accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

@media (max-width: 640px) {
  .video-theater__arrow { display: none; }
  .video-theater__title { font-size: 20px; }
}
