@property --sweep {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 125%;
}

:root {
  color-scheme: dark;
  background: #080f13;
  color: #f8ebd2;
  font-family: Georgia, serif;
}

* { box-sizing: border-box; }
body { margin: 0; }

.scene {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: end;
  justify-items: center;
  min-height: 100vh;
  min-height: max(30rem, 100svh);
  overflow: hidden;
}

.sky, .embers, .light {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.sky {
  z-index: -2;
  transform-origin: 52% 28%;
}

.artwork {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 52% top;
}

.light {
  background: radial-gradient(ellipse at 52% 31%, #ffe1a7 0, #ffac3c55 17%, transparent 49%);
  opacity: 0;
  mix-blend-mode: screen;
}

.scene::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(0deg, #05090deb 0%, #05090d75 20%, transparent 52%);
  pointer-events: none;
}

.caption {
  width: 100%;
  padding: 0 1.25rem clamp(6.5rem, 13svh, 10rem);
  text-align: center;
  pointer-events: none;
}

h1 {
  margin: 0;
  font-size: clamp(3.5rem, 11vw, 11rem);
  line-height: .90;
  font-weight: 400;
  letter-spacing: -.064em;
}

h1 span {
  display: inline-block;
  color: #f8ebd2;
  background: linear-gradient(110deg, #fff5da, #fff5da, #ffdc94, #fff5da, #fff5da);
  background-size: 230% 100%;
  background-position: var(--sweep) center;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 .05em .1em #060b0f);
}

h1 span + span { font-style: italic; }

.rule {
  position: relative;
  display: grid;
  place-items: center;
  width: min(23rem, 64vw);
  height: 1px;
  margin: clamp(1.25rem, 3svh, 2.5rem) auto 0;
  background: linear-gradient(90deg, transparent, #d39e58, transparent);
}

.rule i {
  position: absolute;
  width: 8px;
  aspect-ratio: 1;
  rotate: 45deg;
  border: 1px solid #edbf76;
  background: #10191d;
}

.replay {
  position: absolute;
  bottom: clamp(1.25rem, 4svh, 3rem);
  min-height: 44px;
  padding: .5rem 1rem;
  border: 1px solid #9c794f90;
  border-radius: 3px;
  background: #10191de6;
  color: #f8ebd2;
  font: .875rem system-ui, sans-serif;
  cursor: pointer;
}

.replay span {
  margin-inline-end: .35rem;
  color: #edbf76;
  font-size: 1.15em;
}

.replay:not([aria-disabled="true"]):hover {
  border-color: #edbf76;
  background: #263136;
}

.replay:focus-visible { outline: 2px solid #edbf76; outline-offset: 4px; }

.playing .sky { animation: approach 4.4s cubic-bezier(.18,.58,.32,1) both; }
.playing .light { animation: ignition 3s 350ms ease-out both; }
.playing h1 span { animation: reveal 1.25s 800ms both, sheen 1.7s 1.55s ease-in-out both; }
.playing h1 span + span { animation-delay: 1.04s, 1.75s; }
.playing .rule { animation: draw 1.25s 1.6s both; }

@keyframes approach {
  0% { scale: 1.22; filter: brightness(.48); }
  34% { filter: brightness(1.12); }
  100% { scale: 1; filter: brightness(1); }
}

@keyframes ignition {
  0%, 100% { opacity: 0; transform: scale(.84); }
  31% { opacity: .64; }
  75% { transform: scale(1.26); }
}

@keyframes reveal {
  from { opacity: 0; translate: 0 .34em; clip-path: inset(0 0 100%); }
  to { opacity: 1; translate: 0; clip-path: inset(-.2em -.25em -.3em); }
}

@keyframes sheen {
  from { --sweep: 125%; }
  to { --sweep: -25%; }
}

@keyframes draw {
  from { opacity: 0; scale: .06 1; }
  to { opacity: 1; scale: 1; }
}

@media (max-width: 640px) {
  .artwork { object-position: 52% top; }
  h1 { font-size: clamp(4rem, 18vw, 7rem); }
  h1 span { display: block; }
  .caption { padding-bottom: clamp(6.25rem, 14svh, 9rem); }
}

@media (prefers-reduced-motion: reduce) {
  .playing .sky, .playing .light, .playing h1 span, .playing .rule { animation: none; }
  .embers, .replay { display: none; }
}
