:root {
  --canvas-width: 2364;
  --canvas-height: 1307;
  --mask-left: 18.9509%;
  --mask-top: 17.9801%;
  --mask-width: 62.0981%;
  --mask-height: 64.0398%;
  --mask-radius: clamp(4px, 0.55vw, 13px);
  --frame-shadow:
    0 clamp(6px, 0.78vw, 18px) clamp(13px, 1.55vw, 36px) rgba(75, 52, 28, 0.12),
    0 clamp(18px, 1.9vw, 45px) clamp(24px, 2.8vw, 66px) rgba(74, 48, 24, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #d7b376;
  font-family: Arial, Helvetica, sans-serif;
}

.splash {
  display: grid;
  width: 100vw;
  height: 100vh;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  background-color: #d7b376;
  background-image: url("./assets/bg.png");
  background-image: image-set(
    url("./assets/bg.webp") type("image/webp"),
    url("./assets/bg.png") type("image/png")
  );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.stage {
  position: relative;
  width: min(100vw, calc(100vh * 2364 / 1307));
  height: min(100vh, calc(100vw * 1307 / 2364));
  overflow: hidden;
}

.video-frame {
  position: absolute;
  left: var(--mask-left);
  top: var(--mask-top);
  width: var(--mask-width);
  height: var(--mask-height);
  border-radius: var(--mask-radius);
  box-shadow: var(--frame-shadow);
}

.sound-toggle {
  position: absolute;
  right: clamp(10px, 1vw, 18px);
  bottom: clamp(10px, 1vw, 18px);
  z-index: 2;
  display: grid;
  width: clamp(30px, 2.35vw, 42px);
  height: clamp(30px, 2.35vw, 42px);
  padding: 0;
  place-items: center;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  border: 0;
  cursor: pointer;
  opacity: 0;
  transform: translateY(3px);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.28));
  transition: opacity 180ms ease, transform 180ms ease, color 180ms ease;
}

.video-frame:hover .sound-toggle,
.video-frame:focus-within .sound-toggle {
  opacity: 1;
  transform: translateY(0);
}

.sound-toggle:hover,
.sound-toggle:focus-visible {
  color: rgba(255, 255, 255, 0.96);
}

@media (hover: none) {
  .sound-toggle {
    opacity: 0.72;
    transform: none;
  }
}

.sound-toggle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.64);
  outline-offset: 3px;
}

.sound-toggle svg {
  grid-area: 1 / 1;
  width: 54%;
  height: 54%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sound-toggle svg path:first-child {
  fill: currentColor;
  stroke: none;
}

.sound-toggle .icon-sound,
.sound-toggle.is-unmuted .icon-muted {
  opacity: 0;
}

.sound-toggle.is-unmuted .icon-sound {
  opacity: 1;
}

.video-mask {
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  overflow: hidden;
  border-radius: var(--mask-radius);
  background: transparent;
  isolation: isolate;
  transform: translate(-1px, -1px);
}

.hero-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 640px) and (orientation: portrait) {
  .stage {
    width: 100vw;
    height: 100svh;
  }

  .video-frame {
    left: 50%;
    top: 50%;
    width: min(82vw, calc(78svh * 548 / 960));
    height: auto;
    aspect-ratio: 548 / 960;
    transform: translate(-50%, -50%);
  }

  .sound-toggle {
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .stage {
    width: 100vw;
    height: 100svh;
  }

  .video-frame {
    left: 50%;
    top: 50%;
    width: min(78vw, calc(82svh * 1770 / 1080));
    height: auto;
    aspect-ratio: 1770 / 1080;
    transform: translate(-50%, -50%);
  }

  .sound-toggle {
    right: 10px;
    bottom: 10px;
    width: 34px;
    height: 34px;
  }
}
