/* Shared video player — used by the video-*.html pages. */
:root {
  --ink: #040a15;
  --accent: #3d94f0;
  --muted: #9fb5d6;
  --expo: cubic-bezier(0.16, 1, 0.3, 1);
  --pop: cubic-bezier(0.45, 1.45, 0.8, 1);
  /* player is 1040×585 at 1440×900, shrinking to fit smaller windows */
  --w: min(1040px, calc(100vw - 32px), calc((100vh - 220px) * 16 / 9));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: #000;
  color: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-variation-settings: "opsz" 14;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.backdrop {
  position: fixed; inset: 0;
  background: var(--ink);
  opacity: 0.92;
  cursor: default;
}

.stage {
  position: relative;
  min-height: 100%;
  display: grid;
  align-content: center;
  justify-content: center;
  gap: 28px;
  padding: 48px 16px 56px;
  pointer-events: none;
}
.stage > * { pointer-events: auto; }

/* ---------- Player ---------- */
.player {
  position: relative;
  width: var(--w);
  aspect-ratio: 1040 / 585;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player:fullscreen { border-radius: 0; }
.player:fullscreen video { object-fit: contain; }

/* As drawn in Figma: dark at the top edge of the band, fading to clear at the bottom. */
.scrim {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 27.35%; /* 160 / 585 */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  pointer-events: none;
  transition: opacity .4s ease-out;
}
/* Clear the footage while it plays; bring the band back when paused. */
.playing .scrim { opacity: 0; }

.big-play {
  position: absolute; left: 50%; top: 50%;
  width: 96px; height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
}
.big-play img { position: absolute; }
.big-play .disc  { inset: 0; width: 96px; height: 96px; }
.big-play .glyph { left: 30px; top: 28px; width: 40px; height: 40px; }
.big-play .disc, .big-play .glyph { transition: opacity .25s ease-out, scale .25s ease-out; }
.big-play .glyph { transition-duration: .17s; }
.playing .big-play { pointer-events: none; }
.playing .big-play .disc  { opacity: 0; scale: 1.5; }
.playing .big-play .glyph { opacity: 0; }

.controls {
  position: absolute; left: 24px; right: 24px; bottom: 16px;
  height: 40px;
  display: flex; align-items: center;
}
.ctrl { width: 22px; height: 22px; flex: none; display: grid; place-items: center; }
.ctrl img, .ctrl svg { width: 22px; height: 22px; }
.ctrl:hover { opacity: .8; }
.toggle .icon-play { display: none; }
.player:not(.playing) .toggle .icon-pause { display: none; }
.player:not(.playing) .toggle .icon-play { display: block; }
.muted .mute img { opacity: .45; }

.track {
  position: relative;
  flex: 1;
  height: 4px;
  margin: 0 30px 0 18px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.3);
}
.progress {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--p, 0%);
  min-width: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.seek {
  position: absolute; left: 0; right: 0; top: 50%;
  width: 100%; height: 20px;
  margin-top: -10px;
  opacity: 0;
  cursor: pointer;
}
.time {
  width: 110px; flex: none;
  font-weight: 500; font-size: 14px; line-height: normal;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mute { margin-right: 16px; }

.notice {
  position: absolute; left: 50%; top: calc(50% + 72px);
  translate: -50% 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(4, 10, 21, 0.8);
  font-size: 14px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.notice.show { opacity: 1; }

/* ---------- Caption & close ---------- */
.caption { display: flex; flex-direction: column; gap: 6px; line-height: normal; }
.caption h1 { font: 600 28px/normal "Barlow", sans-serif; }
.caption p { font-size: 15px; color: var(--muted); }

.close {
  position: fixed; top: 40px; right: 40px;
  width: 48px; height: 48px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  display: grid; place-items: center;
  transition: background-color .2s;
  z-index: 2;
}
.close:hover { background: rgba(255, 255, 255, 0.22); }
.close img { width: 22px; height: 22px; }

/* ---------- Opening motion (from the Figma timeline) ---------- */
@keyframes fade-in { from { opacity: 0; } }
/* each page sets where its player grows from (its thumbnail's spot on the portfolio) */
@keyframes zoom-in { from { translate: var(--from-x, 0px) var(--from-y, 160px); scale: var(--from-s, .338); } }
@keyframes rise    { from { translate: 0 20px; } }
@keyframes spin-in { from { rotate: 90deg; } }

@media (prefers-reduced-motion: no-preference) {
  .backdrop { animation: fade-in .4s ease-out both; }
  .player   { animation: fade-in .12s ease-out both, zoom-in .65s var(--expo) both; }
  .scrim    { animation: fade-in .3s ease-out .8s backwards; }
  .controls { animation: fade-in .3s ease-out .8s both; }
  .caption  { animation: fade-in .45s ease-out .55s both, rise .45s var(--expo) .55s both; }
  .close    { animation: fade-in .3s ease-out .5s both, spin-in .4s var(--pop) .5s both; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .close { top: 16px; right: 16px; width: 44px; height: 44px; }
  .stage { gap: 20px; }
  .player { border-radius: 12px; }
  .big-play { scale: .67; }
  .controls { left: 12px; right: 12px; bottom: 8px; }
  .track { margin: 0 14px 0 12px; }
  .time { width: auto; margin-right: 14px; font-size: 12px; }
  .mute { margin-right: 12px; }
  .caption h1 { font-size: 22px; }
  .caption p { font-size: 14px; }
}
