/* css/player.css — fullscreen <video> + custom chrome (Step 4).
   Pause strip + end overlay live in watch.css. */

.player {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 100;
}
.player[hidden] { display: none !important; }

.chrome {
  position: fixed;
  inset: 0;
  z-index: 110;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-med) var(--ease);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.chrome.is-visible { opacity: 1; pointer-events: auto; }

.chrome-top {
  padding: 24px 64px 32px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.back-btn {
  flex-shrink: 0;
  margin-top: 4px;
}
.back-btn svg { width: 36px; height: 36px; }
.chrome-meta { flex: 1; min-width: 0; }
.chrome-title {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: var(--fs-h2);
  color: var(--yt-text);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chrome-channel {
  font-size: var(--fs-card-meta);
  color: var(--yt-text-2);
}

.chrome-bottom {
  padding: 24px 64px 32px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
  display: flex;
  align-items: center;
  gap: 20px;
}

.chrome-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--yt-text);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background var(--t-fast) var(--ease);
}
.chrome-btn:hover { background: rgba(255, 255, 255, 0.1); }
.chrome-btn svg { width: 32px; height: 32px; }

.play-btn .icon-play  { display: none; }
.play-btn .icon-pause { display: block; }
.chrome.is-paused .play-btn .icon-play  { display: block; }
.chrome.is-paused .play-btn .icon-pause { display: none; }

/* Mute toggle (touch). On TV volume is the arrow keys; this gives the iPad a
   one-tap silence, since there's otherwise no in-app volume control on touch. */
.vol-btn .icon-vol-off { display: none; }
.vol-btn.is-muted .icon-vol-on  { display: none; }
.vol-btn.is-muted .icon-vol-off { display: block; }

.chrome-time {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--yt-text);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-card-meta);
}

.progress {
  flex: 1;
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  /* touch-action: none claims horizontal-drag from the browser so pointermove
     events flow continuously instead of being cancelled when the browser
     decides the swipe is a page-pan gesture. Without this, drag-the-dot
     silently stops working after ~10px of finger movement on mobile. */
  touch-action: none;
}
.progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: visible;
  transition: height var(--t-fast) var(--ease);
}
.progress:hover .progress-track,
.chrome.is-visible .progress-track { height: 6px; }
.progress-buf {
  position: absolute;
  inset: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.45);
  border-radius: inherit;
}
.progress-fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: var(--yt-red);
  border-radius: inherit;
}
.progress-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 14px;
  height: 14px;
  background: var(--yt-red);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: opacity var(--t-fast) var(--ease), width var(--t-fast) var(--ease), height var(--t-fast) var(--ease);
}
.chrome:not(.is-visible) .progress-dot { opacity: 0; }
/* Touch devices: bigger dot for easier finger targeting. */
@media (hover: none) and (pointer: coarse) {
  .progress-dot { width: 22px; height: 22px; }
}

/* Loading spinner — between player (z=100) and chrome (z=110) so it sits
   over the video but under the chrome gradients. pointer-events: none so
   taps pass through to the video for play-toggle. */
.player-spinner {
  position: fixed;
  inset: 0;
  z-index: 105;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.player-spinner.is-visible { display: flex; }
.player-spinner::after {
  content: '';
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: player-spinner-rotate 0.8s linear infinite;
}
@keyframes player-spinner-rotate {
  to { transform: rotate(360deg); }
}
@media (max-width: 600px) {
  .player-spinner::after { width: 44px; height: 44px; border-width: 3px; }
}

/* Phone: real YT-mobile uses ~12-16px chrome padding, not the 64px we use
   on TV. Without this, the title wraps to 7+ lines on a 390px viewport. */
@media (max-width: 600px) {
  .chrome-top    { padding: 12px 14px 24px; }
  .chrome-bottom { padding: 16px 14px 14px; gap: 12px; }
  .chrome-title   { font-size: 18px; line-height: 1.25; }
  .chrome-channel { font-size: 13px; }
  .back-btn svg   { width: 28px; height: 28px; }
  .chrome-btn     { width: 44px; height: 44px; }
  .chrome-btn svg { width: 24px; height: 24px; }
  .chrome-time    { gap: 10px; font-size: 12px; }
}
