* {
  box-sizing: border-box;
}

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

body {
  background: #f5f5f2;
}

.demo-stage {
  min-height: 100svh;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.polygon-hero {
  --hero-aspect: 0.8;
  --polygon-hero-aspect-ratio: 4 / 5;
  --intro-duration: 900ms;

  position: relative;
  width: min(86vw, 720px, calc((100vh - 64px) * var(--hero-aspect)));
  width: min(86vw, 720px, calc((100svh - 64px) * var(--hero-aspect)));
  aspect-ratio: var(--polygon-hero-aspect-ratio);
  overflow: hidden;
  background: #fff;
  opacity: 0;
  transform-origin: center center;
}

.polygon-hero canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.polygon-hero.is-ready[data-intro-animation="soft-reveal"] {
  animation: polygonHeroSoftReveal var(--intro-duration) cubic-bezier(0.19, 1, 0.22, 1) both;
}

.polygon-hero.is-ready[data-intro-animation="clip-reveal"] {
  animation: polygonHeroClipReveal var(--intro-duration) cubic-bezier(0.19, 1, 0.22, 1) both;
}

.polygon-hero.is-ready[data-intro-animation="pop-reveal"] {
  animation: polygonHeroPopReveal var(--intro-duration) cubic-bezier(0.19, 1, 0.22, 1) both;
}

.polygon-hero.is-ready[data-intro-animation="none"] {
  opacity: 1;
}

.loading::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #f5f5f2;
}

@keyframes polygonHeroSoftReveal {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(1.035);
    filter: blur(10px) brightness(1.08);
    clip-path: inset(6% 6% 6% 6%);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0) brightness(1);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes polygonHeroClipReveal {
  0% {
    opacity: 0;
    transform: scale(1.025);
    clip-path: inset(0 52% 0 52%);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    clip-path: inset(0 0 0 0);
  }
}

@keyframes polygonHeroPopReveal {
  0% {
    opacity: 0;
    transform: scale(0.965);
    filter: brightness(1.12) contrast(1.03);
  }
  100% {
    opacity: 1;
    transform: scale(1);
    filter: brightness(1) contrast(1);
  }
}

@media (max-width: 767px) {
  .demo-stage {
    padding: 20px;
  }

  .polygon-hero {
    width: min(92vw, calc((100vh - 40px) * var(--hero-aspect)));
    width: min(92vw, calc((100svh - 40px) * var(--hero-aspect)));
  }
}
