/* Race videos - the pieces more than one page uses: the thumbnail and its overlays, the card,
   the grid, the player, status pills, the upload progress bar and the owner/preview banner.
   Used by Driver, Videos/Watch, Me/Videos and Admin/Videos. */

/* ---------- Thumbnail ---------- */
/* A 16:9 box that is a striped dark plate until the image arrives (and while a video has no
   frames yet). The stripes are the record header's 104° rake. */
.vthumb {
    position: relative; display: block; overflow: hidden;
    aspect-ratio: 16 / 9; border-radius: .75rem;
    background-color: var(--thumb-bg);
    background-image: repeating-linear-gradient(104deg, transparent 0 54px, rgba(255, 255, 255, .06) 54px 56px);
    color: #fff;
}
.vthumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vthumb-sm { flex: none; width: 9rem; border-radius: .55rem; }
.vthumb-xs { flex: none; width: 6.5rem; border-radius: .5rem; }

.vthumb-play {
    position: absolute; left: 50%; top: 50%; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem;
    border-radius: 50%; background: rgba(255, 255, 255, .92);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
    transition: transform .15s ease;
}
.vthumb-play::after {
    content: ""; position: absolute; left: 1.2rem; top: .95rem;
    border-style: solid; border-width: .55rem 0 .55rem .9rem;
    /* The disc is white in both themes, so the triangle on it stays dark in both. */
    border-color: transparent transparent transparent #14171F;
}
.vthumb-lg .vthumb-play { width: 4.75rem; height: 4.75rem; margin: -2.375rem 0 0 -2.375rem; }
.vthumb-lg .vthumb-play::after { left: 1.85rem; top: 1.45rem; border-width: .9rem 0 .9rem 1.45rem; border-left-color: var(--red-strong); }
a:hover > .vthumb-play, a:focus-visible > .vthumb-play, .vcard:hover .vthumb-play { transform: scale(1.08); }

.vthumb-tag, .vthumb-dur {
    position: absolute; z-index: 1;
    font-family: var(--font-display); font-weight: 700; color: #fff;
    background: rgba(11, 13, 19, .8); border-radius: .35rem; line-height: 1.2;
}
.vthumb-tag { left: .6rem; top: .6rem; padding: .25rem .5rem; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; }
.vthumb-tag.is-featured { background: var(--red-strong); }
.vthumb-dur { right: .6rem; bottom: .6rem; padding: .15rem .45rem; font-size: .74rem; font-variant-numeric: tabular-nums; }
.vthumb-sm .vthumb-dur, .vthumb-xs .vthumb-dur { right: .3rem; bottom: .3rem; font-size: .66rem; }
.vthumb-msg {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 600; font-size: .9rem; color: #C8CCD6;
}

/* ---------- Card + grid ---------- */
.vgrid { margin-top: 1.75rem; display: grid; gap: 1.75rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.vcard { display: block; color: var(--ink); }
.vcard:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: .75rem; }
.vcard-title { display: block; margin-top: .75rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.vcard:hover .vcard-title { color: var(--blue-ink); }
.vcard-meta { display: block; margin: .25rem 0 0; font-size: .82rem; color: var(--muted); }

.vfeature-tags { display: flex; flex-wrap: wrap; gap: .5rem; }

/* ---------- Player ---------- */
/* video-player.js replaces the browser's controls with the bar below (.has-controls). Fixed
   colours throughout: the bar sits on video, which is dark whatever the site theme. */
.vplayer-wrap { position: relative; border-radius: .9rem; background: #000; }
.vplayer-wrap:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.vplayer { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: .9rem; background: #000; }
.has-controls .vplayer { cursor: pointer; }
.has-controls.is-playing:not(.is-active):not(.is-menu) .vplayer { cursor: none; }

/* Big play button, before the first play. */
.vbig-play {
    position: absolute; left: 50%; top: 50%; width: 4.5rem; height: 4.5rem; margin: -2.25rem 0 0 -2.25rem;
    display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
    background: rgba(255, 255, 255, .92); color: var(--red-strong); box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}
.vbig-play svg { margin-left: 4px; fill: currentColor; }
.vbig-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.vbig-play[hidden], .vplayer-wrap:not(.is-fresh) .vbig-play { display: none; }

/* The bar: a gradient up from the bottom edge, seek bar on top, buttons below. */
.vctrl {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
    padding: 1.75rem .6rem .35rem;
    background: linear-gradient(to top, rgba(0, 0, 0, .78), rgba(0, 0, 0, .35) 60%, transparent);
    color: #fff; border-radius: 0 0 .9rem .9rem; transition: opacity .2s ease;
}
.vctrl[hidden] { display: none; }
.vplayer-wrap.is-playing:not(.is-active):not(.is-menu) .vctrl { opacity: 0; }
.vplayer-wrap.is-fresh .vctrl { opacity: 0; }

/* Changing quality: picture blurred and dimmed, a spinner, and the bar kept up, until the new
   quality is ready and playback carries on (video-player.js, switchTo). */
/* Clipping the player while it switches keeps the blur inside its rounded edge (the menu is
   closed by then, so nothing needs to hang outside). clip-path on the video itself drops the blur. */
.vplayer-wrap.is-switching { overflow: hidden; }
.vplayer-wrap.is-switching .vplayer { filter: blur(18px) brightness(.7); }
.vplayer-wrap.is-switching .vctrl { opacity: 1; }
.vplayer-wrap.is-switching::after {
    content: ""; position: absolute; left: 50%; top: 50%; z-index: 1;
    width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .3); border-top-color: #fff;
    animation: rlag-spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .vplayer-wrap.is-switching::after { animation-duration: 2s; } }
.vplayer-wrap.is-fresh:hover .vctrl, .vplayer-wrap.is-fresh:focus-within .vctrl { opacity: 1; }

.vctrl-progress { position: relative; height: 1rem; margin: 0 .4rem; }
.vctrl-track {
    position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px;
    border-radius: 2px; background: rgba(255, 255, 255, .25); transition: height .12s ease, margin .12s ease;
}
.vctrl-progress:hover .vctrl-track { height: 6px; margin-top: -3px; }
.vctrl-buffered, .vctrl-played { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; }
.vctrl-buffered { background: rgba(255, 255, 255, .4); }
.vctrl-played { background: var(--red-strong); }
.vctrl-marks span { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: #fff; }
/* The real control: a range input laid over the track, its own track invisible. */
.vctrl-scrub {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
    -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer;
}
.vctrl-scrub::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.vctrl-scrub::-moz-range-track { height: 100%; background: transparent; }
.vctrl-scrub::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; margin-top: 1px; border-radius: 50%;
    background: var(--red-strong); border: 0; transform: scale(0); transition: transform .12s ease;
}
.vctrl-scrub::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; background: var(--red-strong); border: 0;
    transform: scale(0); transition: transform .12s ease;
}
.vctrl-progress:hover .vctrl-scrub::-webkit-slider-thumb, .vctrl-scrub:focus-visible::-webkit-slider-thumb { transform: scale(1); }
.vctrl-progress:hover .vctrl-scrub::-moz-range-thumb, .vctrl-scrub:focus-visible::-moz-range-thumb { transform: scale(1); }
.vctrl-scrub:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }

.vctrl-row { display: flex; align-items: center; gap: .15rem; }
.vctrl-spacer { flex: 1; }
.vctrl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem; border: 0; border-radius: .5rem;
    background: transparent; color: #fff; cursor: pointer;
    font-family: var(--font-display); font-weight: 600; font-size: .82rem; font-variant-numeric: tabular-nums;
}
.vctrl-btn:hover { background: rgba(255, 255, 255, .14); }
.vctrl-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.vctrl-time { margin-left: .4rem; font-family: var(--font-display); font-size: .84rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Each two-state button carries both icons; the player's state picks one. */
.vctrl .i-pause, .vctrl .i-muted, .vctrl .i-exit { display: none; }
.is-playing .vctrl .i-play { display: none; }
.is-playing .vctrl .i-pause { display: block; }
.is-muted .vctrl .i-sound { display: none; }
.is-muted .vctrl .i-muted { display: block; }
.is-full .vctrl .i-full { display: none; }
.is-full .vctrl .i-exit { display: block; }

/* Volume slides out on hover or focus; touch devices have hardware volume, so just mute. */
.vctrl-volume { display: flex; align-items: center; }
.vctrl-vol { width: 0; opacity: 0; margin: 0; transition: width .15s ease, opacity .15s ease; accent-color: #fff; cursor: pointer; }
.vctrl-volume:hover .vctrl-vol, .vctrl-volume:focus-within .vctrl-vol { width: 5rem; opacity: 1; margin: 0 .35rem; }
@media (hover: none) { .vctrl-vol { display: none; } }

/* Quality: the menu opens upward from the bar. */
.vquality { position: relative; }
.vquality[hidden] { display: none; }
.vquality-menu {
    position: absolute; right: 0; bottom: calc(100% + .4rem); min-width: 10rem;
    margin: 0; padding: .3rem; list-style: none; border-radius: .6rem;
    background: rgba(11, 13, 19, .94); box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.vquality-menu[hidden] { display: none; }
.vquality-menu button {
    display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 2.5rem; padding: 0 .75rem;
    border: 0; border-radius: .45rem; background: none; color: #fff; text-align: left; cursor: pointer;
    font: inherit; font-size: .88rem;
}
.vquality-menu button::before { content: ""; width: .9rem; flex: none; }
.vquality-menu button[aria-checked="true"]::before { content: "\2713"; }
.vquality-menu button:hover, .vquality-menu button:focus-visible { background: rgba(255, 255, 255, .14); outline: none; }

/* Small players (the review queue, phones): drop the quality name, keep the gear. */
@container (max-width: 26rem) { .vctrl-quality-btn [data-quality-label] { display: none; } }
.vplayer-wrap { container-type: inline-size; }

/* Full screen is the whole player, so the controls come along; the video fills it. */
.vplayer-wrap:fullscreen { display: flex; align-items: center; border-radius: 0; }
.vplayer-wrap:fullscreen .vplayer { height: 100%; aspect-ratio: auto; border-radius: 0; object-fit: contain; }
.vplayer-wrap:-webkit-full-screen { display: flex; align-items: center; border-radius: 0; }
.vplayer-wrap:-webkit-full-screen .vplayer { height: 100%; aspect-ratio: auto; border-radius: 0; object-fit: contain; }

/* ---------- Status ---------- */
.vstatus {
    flex: none; display: inline-block; padding: .3rem .75rem; border-radius: 999px;
    font-size: .8rem; font-weight: 600; line-height: 1.2; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--ink-soft); white-space: nowrap;
}
.vstatus-live { color: var(--green-ink); border-color: color-mix(in srgb, var(--green-ink) 45%, transparent); background: color-mix(in srgb, var(--green-ink) 10%, var(--surface)); }
.vstatus-review { color: var(--blue-ink); border-color: color-mix(in srgb, var(--blue-ink) 40%, transparent); background: color-mix(in srgb, var(--blue-ink) 9%, var(--surface)); }
.vstatus-changes { color: var(--amber-ink); border-color: var(--amber-line); background: var(--amber-bg); }
.vstatus-bad { color: var(--red-ink); border-color: color-mix(in srgb, var(--red-strong) 40%, transparent); background: color-mix(in srgb, var(--red-strong) 8%, var(--surface)); }

.vtag {
    display: inline-block; vertical-align: middle; margin-left: .4rem; padding: .15rem .45rem; border-radius: .3rem;
    font-family: var(--font-display); font-weight: 700; font-size: .62rem; letter-spacing: .12em; text-transform: uppercase;
}
.vtag-featured { background: var(--red-strong); color: #fff; }

/* ---------- Progress ---------- */
.vprogress { height: .4rem; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.vprogress > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--blue); transition: width .3s ease; }
.vprogress.is-done > span { background: var(--green-ink); }
/* Processing has no percentage to show, so the bar moves instead. */
.vprogress.is-working > span {
    width: 100%;
    background: repeating-linear-gradient(104deg, var(--blue) 0 12px, color-mix(in srgb, var(--blue) 55%, transparent) 12px 24px);
    background-size: 200% 100%; animation: vprogress-run 1.4s linear infinite;
}
@keyframes vprogress-run { to { background-position: -48px 0; } }

/* ---------- Owner / preview banner ---------- */
.vowner {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem;
    margin: 0 0 2rem; padding: .85rem 1.1rem; border-radius: .8rem;
    background: color-mix(in srgb, var(--blue) 9%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--border));
    font-size: .9rem; color: var(--ink);
}
.vowner p { margin: 0; flex: 1 1 20rem; }
.vowner .cta { padding: .55rem 1rem; font-size: .88rem; }

/* ---------- Key moments ---------- */
/* Watch page and review queue: each moment is a button that jumps the player there. */
.vmoments { list-style: none; margin: .85rem 0 0; padding: 0; display: grid; gap: .3rem; max-width: 34rem; }
.vmoments button {
    width: 100%; min-height: 2.75rem; display: flex; align-items: center; gap: 1rem; padding: .35rem .8rem;
    border: 1px solid transparent; border-radius: .6rem; background: var(--surface);
    font: inherit; font-size: .95rem; text-align: left; color: var(--ink); cursor: pointer;
}
.vmoments button:hover { border-color: var(--border); }
.vmoments button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.vmoments button[aria-current] { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.vmoment-time { flex: none; min-width: 3.4rem; font-family: var(--font-display); font-weight: 700; color: var(--blue-ink); font-variant-numeric: tabular-nums; }
