:root {
  --fg: #000;
  --bg: #fff;
  --font: Futura, "Futura PT", "Jost", "Century Gothic", "Avenir Next", sans-serif;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 18px;
  -webkit-font-smoothing: antialiased;
}
#content:not([hidden]) { display: contents; }

a { color: inherit; }

/* Header ------------------------------------------------------------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 20px var(--gutter) 12px;
  text-align: center;
}
.site-header .email { text-decoration: none; }
.site-header .email:hover { text-decoration: underline; }
.site-header .btn { margin-left: 8px; }
.page-title {
  margin: 0;
  padding: 8px var(--gutter) 0;
  text-align: center;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1.5px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 15px;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover, .btn:focus-visible { background: var(--fg); color: var(--bg); }

/* Video stage: each .fit cell is a size container; the player inside is
   sized to the largest box of the video's aspect ratio that fits. -------- */
.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(var(--n, 1), minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
  gap: 32px;
  padding: 12px var(--gutter) var(--gutter);
}
.fit {
  container-type: size;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
}
@media (max-width: 800px) {
  :root { --gutter: 16px; }
  body { font-size: 16px; }
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: repeat(var(--n, 1), minmax(0, 1fr));
    gap: 16px;
  }
  .page-title { font-size: 20px; }
}

/* Player ------------------------------------------------------------- */
.player {
  --cap: 0px;
  --bar: 44px;
  width: min(100cqw, calc((100cqh - var(--cap) - var(--bar)) * var(--ar)));
  display: flex;
  flex-direction: column;
  outline: none;
}
.player.has-caption { --cap: 34px; }
.caption {
  height: var(--cap);
  display: flex;
  align-items: center;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.screen {
  position: relative;
  aspect-ratio: var(--ar);
  background: #000;
}
.screen video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: pointer;
}
.toast {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 14px;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transition: none; }

.bar {
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  transition: opacity 0.3s;
}
.ctl {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.ctl svg { width: 20px; height: 20px; fill: currentColor; }
.ctl svg .stroke { fill: none; stroke: currentColor; stroke-width: 2; }
.ctl:focus-visible { outline: 1.5px solid currentColor; }
.speed { min-width: 44px; font-variant-numeric: tabular-nums; }

.speed-wrap { position: relative; flex: none; }
.speed-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-width: 72px;
  padding: 4px 0;
  border: 1.5px solid currentColor;
  background: var(--bg);
}
.speed-menu button {
  padding: 6px 14px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
}
.speed-menu button:hover, .speed-menu button:focus-visible { background: rgba(0, 0, 0, 0.08); outline: none; }
.speed-menu button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
.time { flex: none; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 6px; }

.scrub {
  position: relative;
  flex: 1;
  height: 28px;
  cursor: pointer;
  touch-action: none;
}
.scrub::before, .scrub-fill {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
}
.scrub::before { background: currentColor; opacity: 0.2; }
.scrub-fill { background: currentColor; transform-origin: left; transform: scaleX(0); }

/* Icon states */
.i-pause, .i-muted, .i-exit-fs { display: none; }
.is-playing .i-play, .is-muted .i-sound, .is-fs .i-enter-fs { display: none; }
.is-playing .i-pause, .is-muted .i-muted, .is-fs .i-exit-fs { display: block; }

/* Narrow players: drop the time readout before anything else */
@container (max-width: 380px) {
  .time { display: none; }
}

/* Full screen */
.player.is-fs {
  width: 100vw;
  height: 100vh;
  background: #000;
  color: #fff;
}
.player.is-fs .caption { display: none; }
.player.is-fs .screen { flex: 1; min-height: 0; aspect-ratio: auto; }
.player.is-fs .bar { padding: 0 var(--gutter); height: 56px; }
.player.is-fs .speed-menu { background: #000; }
.player.is-fs .speed-menu button:hover { background: rgba(255, 255, 255, 0.15); }
.player.is-fs .speed-menu button[aria-checked="true"] { background: #fff; color: #000; }
.player.is-fs.idle .bar { opacity: 0; }
.player.is-fs.idle, .player.is-fs.idle video { cursor: none; }

/* Password screen ---------------------------------------------------- */
.lock {
  flex: 1;
  display: grid;
  place-items: center;
  padding: var(--gutter);
}
.lock form { display: grid; gap: 10px; width: min(360px, 100%); }
.lock label { font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; }
.lock .row { display: flex; gap: 8px; }
.lock input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1.5px solid var(--fg);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
}
.lock input:focus { outline: 1.5px solid var(--fg); outline-offset: 1px; }
.lock .msg { min-height: 1.4em; margin: 0; font-size: 15px; }
