.diorama-hero {
  --diorama-x: 0px;
  --diorama-y: 0px;
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(536px, 45vw, 658px);
  background: #142425;
  overflow: clip;
}

.diorama-scene, .diorama-back, .diorama-front {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.diorama-scene {
  overflow: hidden;
  z-index: -1;
}

.diorama-scene::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, #0c151cf2, #0c151cde 21%, #0c151ca8 34%, #0e181e33 54%, transparent 74%),
    linear-gradient(0deg, #10171e 0%, #10171eb8 5%, #10171e21 25%, transparent 49%, #1320344d 100%);
}

.diorama-world {
  position: absolute;
  inset: -4px -4px auto auto;
  width: max(calc(100% + 8px), 1072px);
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
}

.diorama-back { transform: translate3d(var(--diorama-x), var(--diorama-y), 0); }
.diorama-front { transform: translate3d(calc(var(--diorama-x) * 2), calc(var(--diorama-y) * 2), 0); }

.diorama-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.diorama-windows { animation: diorama-firelight 6s steps(1) infinite; }
.diorama-lanterns { animation: diorama-firelight 3.7s steps(1) -1.3s infinite; }
.diorama-runes { animation: diorama-radiance 5.2s ease-in-out -2.4s infinite; }

.diorama-cabinet {
  position: absolute;
  inset: 61.5% auto auto 82%;
  width: 13.28125%;
  isolation: isolate;
  transform: translate3d(calc(var(--diorama-x) * .35), calc(var(--diorama-y) * .35), 0);
}

.diorama-cabinet img { width: 100%; height: auto; image-rendering: pixelated; }
.diorama-cabinet::before, .diorama-cabinet::after {
  position: absolute;
  inset: 2% -23% -28%;
  z-index: -1;
  background: radial-gradient(ellipse, #2376fb8f, #3a84ec52 36%, transparent 70%);
  animation: diorama-radiance 4.6s ease-in-out -1.2s infinite;
  content: "";
}

.diorama-cabinet::after {
  inset: auto -10% -8%;
  height: 20%;
  background: radial-gradient(ellipse, #110d14, #151321a8 45%, transparent 74%);
  animation: none;
}

.diorama-fog {
  position: absolute;
  width: 76%;
  aspect-ratio: 4.7 / 1;
  background: url("../media/hero/fog.webp") center / 100% 100% no-repeat;
  animation: diorama-drift 19s ease-in-out alternate infinite;
}

.diorama-fog-far { inset: 8% auto auto 30%; opacity: .66; }
.diorama-fog-near { inset: 57% auto auto 24%; width: 91%; opacity: .74; animation-duration: 27s; animation-delay: -9s; }
.diorama-motes { position: absolute; inset: 0; }
.diorama-motes span {
  position: absolute;
  top: var(--top);
  left: var(--left);
  width: 2px;
  height: 2px;
  background: #fff0aa;
  box-shadow: 0 0 4px #ffc56b;
  opacity: .48;
  animation: diorama-motes var(--cycle) steps(20) var(--offset) infinite;
}

.diorama-motes span:nth-child(3n) { background: #a0e2ff; box-shadow: 0 0 7px #62b7ff; }
.diorama-hero.diorama-asleep :is(.diorama-windows, .diorama-lanterns, .diorama-runes, .diorama-fog, .diorama-motes span),
.diorama-hero.diorama-asleep .diorama-cabinet::before { animation-play-state: paused; }

.diorama-inner { padding-block: 56px 81px; }
.diorama-copy { width: min(100%, 570px); }
.diorama-copy .badges { margin-bottom: 24px; }
.diorama-copy .diorama-wordmark {
  width: 512px;
  max-width: none;
  height: auto;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 0 #0a1322) drop-shadow(0 3px 14px #060b1be0);
}

.diorama-tagline {
  max-width: 510px;
  margin-top: 22px;
  color: #fff0cc;
  font: 700 44px/1.14 var(--display);
  text-wrap: balance;
  text-shadow: 2px 3px 0 #0a1422, 0 1px 16px #0a1422;
}

.diorama-pitch {
  max-width: 45ch;
  margin-top: 13px;
  color: #e6ebef;
  font-size: 1.02rem;
  text-shadow: 1px 2px 0 #10171e, 0 2px 6px #10171e;
}

.diorama-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 25px; }
.diorama-actions .button { max-width: 100%; }
.diorama-rail {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 13px;
  background: linear-gradient(#3b2e25 0 2px, #a77945 2px 3px, #211c1c 3px 5px, #39424a 5px 7px, #151721 7px 10px, #070c13 10px);
}

.diorama-rail i {
  display: block;
  width: 7px;
  height: 7px;
  background: #77b7ff;
  box-shadow: 0 0 0 3px #192033, 0 0 0 4px #996e42, 0 0 10px 4px #427ddd70;
  transform: rotate(45deg);
}

.diorama-rail i:nth-child(2) { width: 10px; height: 10px; background: #c5e7ff; }

@keyframes diorama-firelight {
  0%, 100% { opacity: .7; }
  12% { opacity: 1; }
  35% { opacity: .48; }
  39% { opacity: .83; }
  67% { opacity: 1; }
  87% { opacity: .6; }
}

@keyframes diorama-radiance {
  0%, 100% { opacity: .55; }
  50% { opacity: .96; }
}

@keyframes diorama-drift {
  from { transform: translate3d(-9%, 0, 0); }
  to { transform: translate3d(12%, -9%, 0); }
}

@keyframes diorama-motes {
  0%, 100% { transform: translate(0, 9px); opacity: .07; }
  40% { opacity: .69; }
  85% { opacity: .17; }
  99% { transform: translate(16px, -21px); opacity: .07; }
}

@media (min-width: 1620px) {
  .diorama-world {
    right: calc((100% - 1620px) / 2);
    width: 1620px;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 94%, transparent);
  }
}

@media (max-width: 1024px) {
  .diorama-copy .diorama-wordmark { width: 384px; }
  .diorama-tagline { max-width: 440px; font-size: 37px; }
  .diorama-pitch { max-width: 40ch; }
}

@media (max-width: 740px) {
  .diorama-hero { min-height: 0; background: #111820; }
  .diorama-scene { height: 375px; }
  .diorama-world { inset: -3px -28px auto auto; width: max(640px, calc(100% + 32px)); }
  .diorama-scene::after { background: linear-gradient(0deg, #111820 0%, #111820f0 14%, #11182080 29%, transparent 53%), linear-gradient(90deg, #1017205c, transparent 85%); }
  .diorama-inner { padding-block: 223px 44px; }
  .diorama-copy { width: min(100%, 510px); margin-inline: auto; }
  .diorama-copy .badges { margin-bottom: 14px; }
  .diorama-copy .diorama-wordmark { width: 256px; }
  .diorama-tagline { max-width: 23ch; margin-top: 14px; font-size: 30px; }
  .diorama-pitch { margin-top: 11px; font-size: 1rem; }
  .diorama-actions { margin-top: 16px; }
}

@media (max-width: 300px) {
  .diorama-copy .diorama-wordmark { width: 128px; }
}

@media (prefers-reduced-motion: reduce) {
  .diorama-back, .diorama-front, .diorama-cabinet { transform: none; }
  .diorama-hero :is(.diorama-windows, .diorama-lanterns, .diorama-runes, .diorama-fog, .diorama-motes span),
  .diorama-cabinet::before { animation: none; }
  .diorama-motes { display: none; }
}
