/* a result card's player (player.js): maktaba's ChunkPlayer.css, adapted */

.chunk-player {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chunk-player__stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  background: #1c1917;
}

.chunk-player__frame,
.chunk-player__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* transparent lid: keeps YouTube's own title bar and end screen unreachable */
.chunk-player__shield {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.chunk-player__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #d6d3d1;
  pointer-events: none;
}

/* ── controls ──────────────────────────────────────────────────────────── */
.chunk-player__controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chunk-player__toggle {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chunk-player__toggle:hover:not(:disabled) {
  background: var(--brand-dark);
}

.chunk-player__toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chunk-player__time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ── scrubber ──────────────────────────────────────────────────────────── */
.chunk-player__bar {
  flex: 1;
  min-width: 0;
  height: 20px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

.chunk-player__bar:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.chunk-player__bar:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 999px;
}

/* the fill is painted into the track, so both halves stay one pill */
.chunk-player__bar::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--brand) 0 var(--progress, 0%),
    var(--line-soft) var(--progress, 0%) 100%
  );
}

.chunk-player__bar::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  border: 2px solid var(--surface-raised);
  background: var(--brand);
  box-shadow: 0 1px 2px rgba(28, 25, 23, 0.25);
}

.chunk-player__bar::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: var(--line-soft);
}

.chunk-player__bar::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: var(--brand);
}

.chunk-player__bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface-raised);
  background: var(--brand);
}


/* hide YouTube's own overlays (the title and channel bar, share / watch later,
   the logo, the "more videos" shelf on pause): the iframe is three times the
   stage's height and centred on it, so YouTube fits the video in the middle
   third — exactly the stage — and draws its overlays at the iframe's top and
   bottom edges, which the stage (overflow: hidden) cuts off */
.chunk-player__frame iframe { inset: auto 0; top: -100%; height: 300%; }

/* the thumbnail over the frame until the video first plays (player.js) */
.chunk-player__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.chunk-player__loading { background: rgb(0 0 0 / 0.45); }

/* the chunk is over (player.js): "استمرار" keeps watching the episode past it.
   over the middle of the video, where YouTube draws its own paused ▶ */
.chunk-player__end {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: rgb(0 0 0 / 0.55);
}
.chunk-player__end[hidden] { display: none; }
.chunk-player__end button {
  border: 0; border-radius: 999px; padding: 8px 16px; cursor: pointer;
  font: inherit; font-size: 0.9rem; font-weight: 600;
}
/* an outlined white pill: the word, then a small ▶ (left of it, the page being right-to-left) */
.chunk-player__end .chunk-player__more {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 20px;
  background: rgb(20 20 20 / 0.85); color: #fff; border: 1.5px solid #fff;
}
.chunk-player__more svg { flex: none; }
.chunk-player__end .chunk-player__more:hover { background: rgb(55 55 55 / 0.9); }

/* the words over the video as they're said (player.js), as the montage's
   captions look (automontage.css .montage-cc): white on a dark band, the word
   being said in yellow. above the bottom fifth, where the bar's dead zone is */
.chunk-player__cc {
  position: absolute; inset-inline: 0; bottom: 14%; z-index: 1; padding: 0 6%;
  text-align: center; pointer-events: none;
}
.chunk-player__cc[hidden] { display: none; }
.chunk-player__cc > span {
  display: inline; padding: 2px 8px; border-radius: 6px; line-height: 1.7;
  background: rgb(0 0 0 / 0.6); color: #fff; font-weight: 700; font-size: 0.95rem;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.chunk-player__cc .on { color: #ffd700; }
/* word by word: the one word, bigger, white, no band behind it; a dark
   outline and shadow keep it readable on a bright picture */
.chunk-player__cc.word > span {
  font-size: 1.35rem; padding: 0; background: none;
  text-shadow: 0 0 2px #000, 0 0 4px #000, 0 2px 6px rgb(0 0 0 / 0.8);
}
.chunk-player__cc.word .on { color: #fff; }
