:root {
  color-scheme: dark;
  --page-bg: #050505;
  --text: rgba(255, 255, 255, 0.94);
  --control-bg: rgba(10, 10, 10, 0.58);
  --control-bg-hover: rgba(24, 24, 24, 0.78);
  --control-border: rgba(255, 255, 255, 0.74);
  --focus: #ffffff;
  --header-gutter: clamp(1.25rem, 3vw, 2.5rem);
  --header-top: max(1.25rem, env(safe-area-inset-top));
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 20rem;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page-bg);
}

body {
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.ambient,
.ambient-scrim {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient {
  overflow: hidden;
  background: var(--page-bg) url("assets/poster.jpg") center / cover no-repeat;
}

.ambient-video {
  position: absolute;
  inset: -7%;
  width: 114%;
  height: 114%;
  object-fit: cover;
  filter: blur(48px) brightness(0.3) saturate(0.7);
  transform: scale(1.08);
}

.ambient-scrim {
  background: rgba(0, 0, 0, 0.32);
}

.site-header {
  position: fixed;
  z-index: 3;
  top: var(--header-top);
  right: var(--header-gutter);
  left: var(--header-gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.wordmark,
.sound-toggle {
  pointer-events: auto;
}

.wordmark {
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: clamp(0.75rem, 1.1vw, 0.925rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  text-decoration: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.78);
}

.sound-toggle,
.play-fallback {
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease, border-color 160ms ease;
}

.sound-toggle {
  width: clamp(2.875rem, 4vw, 3.35rem);
  height: clamp(2.875rem, 4vw, 3.35rem);
}

.sound-toggle:hover,
.play-fallback:hover {
  background: var(--control-bg-hover);
  border-color: rgba(255, 255, 255, 0.96);
  transform: scale(1.035);
}

.sound-toggle:active,
.play-fallback:active {
  transform: scale(0.97);
}

.sound-toggle:focus-visible,
.play-fallback:focus-visible,
.wordmark:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

@supports (backdrop-filter: blur(16px)) {
  .sound-toggle,
  .play-fallback {
    backdrop-filter: blur(16px);
  }
}

.sound-icon {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  height: 100svh;
  min-height: 100%;
  place-items: center;
  padding: clamp(4.75rem, 7vh, 6.5rem) clamp(1rem, 4vw, 3rem) clamp(1rem, 3vh, 2rem);
}

.video-credit {
  position: fixed;
  z-index: 3;
  right: var(--header-gutter);
  bottom: max(0.8rem, env(safe-area-inset-bottom));
  left: var(--header-gutter);
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(0.625rem, 0.8vw, 0.75rem);
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.95);
  pointer-events: none;
}

.video-credit span {
  display: inline-block;
  max-width: 100%;
  padding: 0.38rem 0.7rem;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

@supports (backdrop-filter: blur(10px)) {
  .video-credit span {
    backdrop-filter: blur(10px);
  }
}

.video-frame {
  position: relative;
  aspect-ratio: 480 / 854;
  height: min(86dvh, 56rem);
  max-width: 100%;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: clamp(1.25rem, 2.2vw, 1.8rem);
  box-shadow:
    0 2rem 5rem rgba(0, 0, 0, 0.54),
    0 0 0 1px rgba(0, 0, 0, 0.28);
}

.main-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

.play-fallback {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4rem;
  height: 4rem;
  transform: translate(-50%, -50%);
}

.play-fallback:hover {
  transform: translate(-50%, -50%) scale(1.035);
}

.play-fallback:active {
  transform: translate(-50%, -50%) scale(0.97);
}

.play-fallback svg {
  width: 1.65rem;
  height: 1.65rem;
  margin-left: 0.16rem;
  fill: currentColor;
}

[hidden] {
  display: none !important;
}

@media (max-width: 43.75rem) {
  :root {
    --header-gutter: max(1.2rem, env(safe-area-inset-left));
    --header-top: max(1.2rem, env(safe-area-inset-top));
  }

  .site-header {
    right: max(1.2rem, env(safe-area-inset-right));
  }

  .wordmark {
    font-size: clamp(0.82rem, 4vw, 1rem);
  }

  .sound-toggle {
    width: 3rem;
    height: 3rem;
    background: rgba(5, 5, 5, 0.72);
  }

  .stage {
    height: 100dvh;
    padding: 0;
  }

  .video-frame {
    width: 100%;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .main-video {
    object-fit: cover;
    object-position: center;
    background: transparent;
  }

  .ambient-video {
    filter: blur(34px) brightness(0.34) saturate(0.72);
  }

  .video-credit {
    right: 1rem;
    bottom: max(0.65rem, env(safe-area-inset-bottom));
    left: 1rem;
    font-size: 0.625rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-video {
    display: none;
  }

  .sound-toggle,
  .play-fallback {
    transition: none;
  }
}
