/* player.css — the skin for js/player.js, the ONE video player (read that file's header for the markup contract).
   Loaded by every page that plays a video: index.html (showreel dialog), the project pages, /trailer-showcase/.

   Look (Brandon, 2026-10-27: "like the Wistia player in some aspects, not one to one"): a bare video with NO outline,
   corners rounded like the site's own gallery tiles (style.css .gallery-item, 10px), a solid brand-red control bar
   floating inset from the edges, and a rounded-rectangle play button. White icons on the red.

   Tokens: the page's own --accent / --text-secondary when it defines them (style.css and editorial.css do), else the
   brand values. /trailer-showcase/ has its own palette and gets the fallbacks. */

.vp {
  --vp-accent: var(--accent, #ea1821);
  --vp-muted: var(--text-secondary, #999);
  --vp-radius: 10px;
  --vp-inset: clamp(8px, 1.6vw, 16px);       /* how far the bar floats in from the video's edges */
  box-sizing: border-box;
  position: relative;
  aspect-ratio: var(--vp-aspect, 16 / 9);   /* set inline per video: reserves the space, so no layout shift when it loads */
  /* Never taller than --vp-maxh: the box narrows to keep its aspect instead of letterboxing inside a short window.
     A page may set --vp-maxh (project pages: the screen under the nav, css/project.css §2). */
  width: min(100%, calc(var(--vp-maxh, 82vh) * var(--vp-aspect, 16 / 9)));
  margin-inline: auto;
  background: #000;
  border-radius: var(--vp-radius);
  overflow: hidden;
  isolation: isolate;                        /* keeps the rounded clip honest around a <video> layer in Safari */
  user-select: none; -webkit-user-select: none;
}
.vp:fullscreen { max-height: none; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.vp:-webkit-full-screen { max-height: none; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.vp:focus { outline: 0; }                    /* focused by script/click only (tabindex=-1); keyboard focus lands on the controls */
.vp :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }   /* white: red would vanish on the red bar */

.vp video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; object-fit: contain; }
.vp.is-ready video { cursor: pointer; }

/* Everything below exists only after js/player.js has mounted. Before that (or without JS) the browser's own controls show. */
.vp-big, .vp-bar, .vp-msg { display: none; }

.vp-big {
  position: absolute; inset: 0; margin: auto; width: 96px; height: 66px; border-radius: 18px; padding: 0;
  border: 0; background: var(--vp-accent); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.4); cursor: pointer;
  align-items: center; justify-content: center; transition: transform 0.25s ease, filter 0.25s ease;
}
.vp-big::after { content: ""; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }
.vp-big:hover { transform: scale(1.06); filter: brightness(1.1); }
.vp.is-ready.is-paused .vp-big { display: flex; }

.vp.is-ready.is-loading::before {            /* thin red sweep while buffering */
  content: ""; position: absolute; left: 0; top: 0; height: 2px; width: 30%; background: var(--vp-accent); z-index: 3;
  animation: vp-sweep 1.1s ease infinite;
}
@keyframes vp-sweep { from { transform: translateX(-100%); } to { transform: translateX(340%); } }

.vp-bar {
  position: absolute; left: var(--vp-inset); right: var(--vp-inset); bottom: var(--vp-inset); z-index: 2;
  align-items: center; gap: 0.5rem; height: 48px; padding: 0 0.45rem;
  background: var(--vp-accent); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.vp.is-ready .vp-bar { display: flex; }
.vp.is-ready.is-idle:not(.is-paused) .vp-bar { opacity: 0; transform: translateY(6px); pointer-events: none; }
.vp.is-ready.is-idle:not(.is-paused) { cursor: none; }

.vp-btn {
  flex: 0 0 auto; width: 38px; height: 38px; padding: 0; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 8px; color: #fff; cursor: pointer;
  font: inherit; font-size: 0.72rem; line-height: 1; letter-spacing: 0.06em;
  transition: background 0.2s ease;
}
.vp-btn:hover { background: rgba(255, 255, 255, 0.2); }
.vp-btn:active { background: rgba(0, 0, 0, 0.25); }
.vp-btn svg { width: 16px; height: 16px; fill: currentColor; display: block; }
.vp-speed, .vp-quality { width: auto; min-width: 44px; padding: 0 0.6rem; }

.vp-time { flex: 0 0 auto; min-width: 5.6em; font-size: 0.74rem; letter-spacing: 0.06em; color: #fff; font-variant-numeric: tabular-nums; }

/* seek bar: a native range input, so touch and keyboard work everywhere, restyled white-on-red */
.vp-seek {
  -webkit-appearance: none; appearance: none; flex: 1 1 auto; min-width: 0; height: 24px; margin: 0; background: transparent; cursor: pointer;
  --p: 0%;
}
.vp-seek::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, #fff var(--p), rgba(255, 255, 255, 0.35) var(--p)); }
.vp-seek::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); }
.vp-seek::-moz-range-progress { height: 4px; border-radius: 2px; background: #fff; }
.vp-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.vp-seek::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }

.vp-msg {
  position: absolute; inset: 0; z-index: 4; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem;
  background: rgba(0, 0, 0, 0.82); text-align: center; padding: 2rem;
}
.vp.is-ready.is-error .vp-msg { display: flex; }
.vp-msg b { font-family: var(--heading-font, var(--heading, Georgia, serif)); font-weight: 900; font-size: 1.15rem; color: #fff; }
.vp-msg span { font-size: 0.78rem; color: var(--vp-muted); }
.vp-retry { margin-top: 0.4rem; padding: 0.7rem 1.3rem; background: var(--vp-accent); border: 0; border-radius: 8px; color: #fff; cursor: pointer; font: inherit; font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; }
.vp-retry:hover { filter: brightness(1.1); }

@media (max-width: 760px) {
  .vp-big { width: 78px; height: 54px; border-radius: 15px; }
  .vp-big::after { border-width: 10px 0 10px 17px; margin-left: 4px; }
}
@media (max-width: 620px) {
  .vp-bar { height: 42px; gap: 0.35rem; padding: 0 0.3rem; }
  .vp-btn { width: 36px; height: 36px; }       /* the tap-target floor the player test enforces */
  .vp-speed, .vp-quality { min-width: 38px; padding: 0 0.4rem; }
}
@media (max-width: 460px) {
  /* A 390 px phone leaves the seek bar too short with everything shown (measured 2026-10-26: 48 px): the rate toggle
     and the "/ total" are the two things it can live without; the slider's aria-valuetext still carries "x of y". */
  .vp-speed, .vp-tot { display: none; }
  .vp-time { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vp *, .vp::before { transition: none !important; animation: none !important; }
}
