@property --wash { syntax: '<color>'; inherits: true; initial-value: #e56b22; }
@property --ink { syntax: '<color>'; inherits: true; initial-value: #fbf3ec; }
@property --glow { syntax: '<number>'; inherits: true; initial-value: 0.18; }
@property --gx { syntax: '<percentage>'; inherits: true; initial-value: 50%; }
@property --gy { syntax: '<percentage>'; inherits: true; initial-value: 40%; }

:root {
  --night: #1b1015;
  --night-deep: #120a0e;
  --paper: #fbf3ec;
  --dim: rgba(251, 243, 236, 0.62);
  --font: "Bricolage Grotesque", "Avenir Next Condensed", "Avenir Next", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transition: --wash 1.8s ease, --ink 1.2s ease, --glow 1.6s ease;
  animation: drift 38s ease-in-out infinite alternate;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --night: #110a0d; --night-deep: #0a0507; }
}
:root[data-theme="dark"] { --night: #110a0d; --night-deep: #0a0507; }

@keyframes drift {
  0%   { --gx: 30%; --gy: 35%; }
  35%  { --gx: 68%; --gy: 28%; }
  70%  { --gx: 55%; --gy: 62%; }
  100% { --gx: 24%; --gy: 55%; }
}

*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
html, body { margin: 0; }
body {
  background: var(--night);
  color: var(--ink);
  font-family: var(--font);
  font-variation-settings: "opsz" 24;
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.25rem);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* The light in the room */
.wash {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at var(--gx) var(--gy),
      color-mix(in oklab, var(--wash) calc(var(--glow) * 100%), transparent) 0%,
      color-mix(in oklab, var(--wash) calc(var(--glow) * 55%), transparent) 38%,
      transparent 78%),
    radial-gradient(80% 60% at calc(100% - var(--gx)) 100%,
      color-mix(in oklab, var(--wash) calc(var(--glow) * 40%), transparent) 0%,
      transparent 70%),
    color-mix(in oklab, var(--wash) calc(var(--glow) * 70%), var(--night));
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: .09;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

main { position: relative; z-index: 2; }
.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }

/* The door */
.door {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(1.5rem, 4vh, 3rem);
  padding-block: clamp(1.5rem, 4vw, 3rem);
}
.mark {
  width: clamp(170px, 26vw, 300px);
  aspect-ratio: 757 / 289;
  background: var(--ink);
  -webkit-mask: url(images/wordmark.png) center / contain no-repeat;
          mask: url(images/wordmark.png) center / contain no-repeat;
  opacity: 0;
  animation: lightsup 1.6s .2s ease forwards;
}
.mark span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.line {
  align-self: center;
  margin: 0;
  font-weight: 760;
  font-variation-settings: "opsz" 96, "wdth" 78;
  font-size: clamp(3rem, 0.6rem + 8vw, 8.6rem);
  line-height: .88;
  letter-spacing: -0.02em;
}
.line span { display: block; opacity: 0; animation: lightsup 1.4s ease forwards; }
.line span:nth-child(1) { animation-delay: .9s; }
.line span:nth-child(2) { animation-delay: 1.5s; }
.line span:nth-child(3) { animation-delay: 2.3s; }
.door-foot {
  display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap;
  color: var(--dim);
  opacity: 0; animation: lightsup 1.4s 3s ease forwards;
}
.door-foot p { margin: 0; max-width: 32ch; }
.door-foot a { color: inherit; text-underline-offset: .25em; }

@keyframes lightsup {
  from { opacity: 0; filter: brightness(.2) blur(6px); }
  to   { opacity: 1; filter: none; }
}

/* The night */
.night { padding-block: 12vh 6vh; }
.beat {
  margin: 0;
  font-weight: 700;
  font-variation-settings: "opsz" 96, "wdth" 82;
  font-size: clamp(2.1rem, 1rem + 5vw, 5.2rem);
  line-height: .95;
  letter-spacing: -0.015em;
  max-width: 14ch;
  padding-block: 14vh;
}
.beat.right { margin-left: auto; text-align: right; }
.shot {
  margin: 0;
  width: min(100%, var(--w, 900px));
  opacity: 0;
  filter: brightness(.15) saturate(.6);
  transition: opacity 1.4s ease, filter 2.2s ease;
}
.shot.in { opacity: 1; filter: none; }
.shot img { display: block; width: 100%; height: auto; }
.shot.l { margin-right: auto; }
.shot.r { margin-left: auto; }
.shot.c { margin-inline: auto; }
.shot.tall { --w: 600px; }
.shot.wide { width: 100vw; max-width: none; margin-left: calc(50% - 50vw); }

/* The moment */
.moment {
  min-height: 100svh;
  display: grid; place-items: center; text-align: center;
  padding-block: 10vh;
}
.moment h2 {
  margin: 0 0 .4em;
  font-weight: 700;
  font-variation-settings: "opsz" 96, "wdth" 82;
  font-size: clamp(2rem, 1rem + 4vw, 4.2rem);
  line-height: 1;
}
.moment p { margin: 0 auto; max-width: 34ch; color: var(--dim); }
.play {
  --p: 0;
  appearance: none; border: 0; cursor: pointer;
  margin: clamp(2rem, 6vh, 4rem) auto;
  width: clamp(190px, 42vw, 280px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
  font: inherit; font-weight: 700; font-variation-settings: "opsz" 48, "wdth" 85;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem); line-height: 1.05;
  color: var(--night-deep);
  background:
    radial-gradient(circle, color-mix(in oklab, var(--wash), white 14%) 0 62%, transparent 63%),
    conic-gradient(var(--paper) calc(var(--p) * 1turn), color-mix(in oklab, var(--paper) 18%, transparent) 0);
  box-shadow: 0 0 calc(40px + var(--pulse, 0) * 120px) color-mix(in oklab, var(--wash) 70%, transparent);
  transition: transform .25s ease;
}
.play:hover { transform: scale(1.03); }
.play:active { transform: scale(.97); }
.play:focus-visible { outline: 3px solid var(--paper); outline-offset: 8px; }
.play .label { max-width: 8ch; }
.found { margin-top: 1.5rem; font-size: .95em; }
.found em { font-style: normal; color: var(--ink); }

/* Lights down */
.down {
  min-height: 80svh; display: grid; place-items: center; text-align: center;
  padding-block: 12vh 8vh;
}
.closer { margin: clamp(2.5rem, 8vh, 5rem) auto 0; width: min(100vw - 2.5rem, 960px); }
.closer img { display: block; width: 100%; height: auto; }
.down h2 {
  margin: 0;
  font-weight: 760;
  font-variation-settings: "opsz" 96, "wdth" 78;
  font-size: clamp(2.8rem, 1rem + 8vw, 8rem);
  line-height: .9; letter-spacing: -0.02em;
}

/* Start your own */
.own { padding-block: 6vh 14vh; }
.own h2 {
  margin: 0 0 .8em;
  font-weight: 700;
  font-variation-settings: "opsz" 96, "wdth" 82;
  font-size: clamp(2rem, 1rem + 4vw, 4.2rem);
  line-height: 1;
}
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  font-weight: 500;
  font-variation-settings: "opsz" 48, "wdth" 92;
  font-size: clamp(1.45rem, 1rem + 2.2vw, 2.6rem);
  line-height: 1.12;
  padding-block: .38em;
  max-width: 26ch;
}
.steps li:last-child { font-weight: 760; }
.send {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  margin-top: clamp(2.5rem, 7vh, 4.5rem);
}
.share {
  appearance: none; cursor: pointer;
  font: inherit; font-weight: 650; font-variation-settings: "opsz" 24, "wdth" 92;
  font-size: 1.1em;
  color: var(--night-deep); background: var(--paper);
  border: 0; border-radius: 999px;
  padding: .85em 1.5em;
  transition: transform .2s ease;
}
.share:hover { transform: translateY(-1px); }
.share:focus-visible { outline: 3px solid var(--paper); outline-offset: 5px; }
.send small { color: var(--dim); font-size: .9em; }

footer {
  position: relative; z-index: 2;
  padding-block: 3rem 2.5rem;
  color: var(--dim); font-size: .95rem;
}
footer .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer p { margin: 0; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  .beat { padding-block: 10vh; }
  .shot { width: 100%; }
  .shot.tall { width: 82%; }
  .shot.wide { width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  :root { animation: none; transition: none; }
  .mark, .line span, .door-foot { animation: none; opacity: 1; }
  .shot { transition: none; opacity: 1; filter: none; }
  .play, .share { transition: none; }
}
