/* Sample videos (public/samples.js): the muted preview inside a card, and the player that grows out of the card.
   Loaded by the landing page and the app. Cards keep each page's own look; the player is always dark, like any
   video player, in both themes. Motion: grow 380 ms / shrink 280 ms, ease-out in, ease-in out (tokens in samples.js). */

/* ---------- inside a card ---------- */
.sx-card {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: inherit;
  cursor: pointer;
}
.sx-media {
  position: relative;
  display: block;
  overflow: hidden;
  isolation: isolate;
}
.sx-media > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sx-media > span {
  z-index: 1; /* labels stay above the preview video */
}
.sx-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.is-playing .sx-preview {
  opacity: 1;
}
/* The video has its own captions, so the title laid over the poster steps aside while it plays. */
.sx-media .po-cap {
  transition: opacity 150ms ease;
}
.is-playing .po-cap {
  opacity: 0;
}
/* Shown on the playing card: this one is muted, open it for sound. */
.sx-sound {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.5);
  color: #fff;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 150ms ease;
  pointer-events: none;
}
.is-playing .sx-sound {
  opacity: 1;
}

/* ---------- the player ---------- */
html.sx-lock {
  overflow: hidden;
  padding-right: var(--sx-gutter, 0px);
}
.sx-dialog {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: transparent;
  color: #fafafa;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.sx-dialog::backdrop {
  background: transparent;
}
.sx-dialog:focus {
  outline: none;
}
.sx-scrim {
  position: absolute;
  inset: 0;
  background: rgb(8 8 10 / 0.9);
  backdrop-filter: blur(24px); /* the page behind never competes with the title */
}
html.sx-lock .reel-nav {
  visibility: hidden;
}
.sx-stage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: auto 280px;
  align-items: center;
  justify-content: center;
  column-gap: 40px;
  padding: 32px 104px;
  pointer-events: none;
}
.sx-stage > * {
  pointer-events: auto;
}
.sx-frame {
  position: relative;
  height: min(calc(100dvh - 64px), 880px);
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  transform-origin: 0 0; /* the grow-from-card move is measured from the top-left corners */
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
}
.sx-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sx-hit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  cursor: pointer;
  touch-action: none; /* sideways swipes reach our handler instead of the browser */
}
.sx-glyph {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.5);
  color: #fff;
  backdrop-filter: blur(8px);
  opacity: 0;
  transform: scale(0.9);
  transition:
    opacity 150ms ease,
    transform 150ms cubic-bezier(0.32, 0.72, 0, 1);
  pointer-events: none;
}
.is-paused .sx-glyph {
  opacity: 1;
  transform: none;
}
.sx-glyph.is-flash {
  animation: sx-flash 600ms ease forwards;
}
.is-paused .sx-glyph.is-flash {
  animation: none;
}
@keyframes sx-flash {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  25% {
    opacity: 1;
    transform: none;
  }
  65% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.sx-fail {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  translate: 0 -50%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgb(0 0 0 / 0.7);
  color: #e4e4e7;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}
.sx-mute,
.sx-close,
.sx-nav {
  appearance: none;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  color: #fafafa;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    transform 150ms cubic-bezier(0.32, 0.72, 0, 1);
}
.sx-mute {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 40px;
  height: 40px;
  border: 0;
  background: rgb(0 0 0 / 0.45);
  backdrop-filter: blur(8px);
}
.sx-close,
.sx-nav {
  position: absolute;
  border: 1px solid rgb(255 255 255 / 0.12);
  background: rgb(255 255 255 / 0.06);
}
.sx-close {
  top: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
}
.sx-nav {
  top: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
}
.sx-nav.prev {
  left: 28px;
}
.sx-nav.next {
  right: 28px;
}
.sx-nav[hidden] {
  display: none;
}
.sx-mute:active,
.sx-close:active,
.sx-nav:active {
  transform: scale(0.96);
}
@media (hover: hover) and (pointer: fine) {
  .sx-mute:hover {
    background: rgb(0 0 0 / 0.65);
  }
  .sx-close:hover,
  .sx-nav:hover {
    background: rgb(255 255 255 / 0.14);
  }
}
.sx-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 28px;
  cursor: pointer;
  touch-action: none;
}
.sx-bar::before,
.sx-fill {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  height: 3px;
  border-radius: 2px;
}
.sx-bar::before {
  background: rgb(255 255 255 / 0.3);
}
.sx-fill {
  display: block;
  background: #fff;
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.sx-hit:focus-visible,
.sx-bar:focus-visible,
.sx-mute:focus-visible,
.sx-close:focus-visible,
.sx-nav:focus-visible,
.sx-cta:focus-visible {
  outline: 2px solid #fafafa;
  outline-offset: 2px;
}
.sx-hit:focus-visible {
  outline-offset: -4px;
}
.sx-info {
  display: grid;
  justify-items: start;
  gap: 8px;
  width: 280px;
}
.sx-niche {
  font-size: 13px;
  color: #a1a1aa;
  font-variant-numeric: tabular-nums;
}
.sx-title {
  margin: 0 0 12px;
  font: 600 24px / 1.2 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.01em;
  color: #fafafa;
  text-wrap: balance;
}
.sx-cta[hidden] {
  display: none;
}

/* Tablets and narrow windows: the details go under the video. */
@media (max-width: 1080px) and (min-height: 601px) {
  .sx-stage {
    grid-template-columns: auto;
    justify-items: center;
    align-content: center;
    row-gap: 18px;
    padding: 24px 88px;
  }
  .sx-frame {
    height: min(calc(100dvh - 200px), 880px);
  }
  .sx-info {
    width: auto;
    max-width: 460px;
    justify-items: center;
    text-align: center;
  }
  .sx-title {
    margin-bottom: 6px;
  }
}

/* Phones: the video takes the width; swipe sideways for the next one. */
@media (max-width: 720px) {
  .sx-stage {
    grid-template-columns: auto;
    justify-items: center;
    align-content: center;
    row-gap: 14px;
    padding: max(12px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom));
  }
  .sx-frame {
    width: min(100%, calc((100dvh - 156px) * 9 / 16));
    height: auto;
    border-radius: 16px;
  }
  .sx-info {
    width: auto;
    justify-items: center;
    gap: 6px;
    text-align: center;
  }
  .sx-title {
    margin-bottom: 4px;
    font-size: 18px;
  }
  /* next/previous sit beside the button; swiping sideways on the video works too */
  .sx-nav {
    top: auto;
    bottom: max(16px, env(safe-area-inset-bottom));
    width: 40px;
    height: 40px;
    margin: 0;
  }
  .sx-nav.prev {
    left: 16px;
  }
  .sx-nav.next {
    right: 16px;
  }
  .sx-close {
    top: max(18px, calc(env(safe-area-inset-top) + 6px));
    right: 18px;
    width: 40px;
    height: 40px;
    border-color: transparent;
    background: rgb(0 0 0 / 0.45);
    backdrop-filter: blur(8px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sx-preview,
  .sx-media .po-cap,
  .sx-sound,
  .sx-glyph,
  .sx-mute,
  .sx-close,
  .sx-nav {
    transition: none;
  }
  .sx-glyph.is-flash {
    animation: none;
  }
}
