:root {
  --ink: #1d1614;
  --cream: #f6e3bd;
  --yellow: #f9bb2d;
  --orange: #f26a21;
  --pink: #ee5a8f;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: #120d0c;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--cream);
}

img,
svg,
canvas {
  display: block;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 9px var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The sheet: everything is printed on one piece of aged paper. */
.poster {
  position: relative;
  display: block;
  background: var(--ink);
  overflow: hidden;
}
.poster::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background: url("art/paper.svg");
  mix-blend-mode: multiply;
  opacity: 0.28;
  box-shadow: inset 0 0 70px rgba(58, 30, 8, 0.35);
}

/* The hero is the whole page. Its parts are sized in --u, a hundredth of its width (less when it is short). */
.hero {
  position: relative;
  container-type: size;
  --u: min(1cqw, 1.6cqh);
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  background: var(--ink) url("art/bg-wide.svg") center / cover no-repeat;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* holding a finger down fires the lasers; it should not offer to save the title */
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M16 3v7M16 22v7M3 16h7M22 16h7' stroke='%231d1614' stroke-width='5'/%3E%3Ccircle cx='16' cy='16' r='4.5' stroke='%231d1614' stroke-width='5'/%3E%3Cpath d='M16 3v7M16 22v7M3 16h7M22 16h7' stroke='%23f6e3bd' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='4.5' stroke='%23f9bb2d' stroke-width='2'/%3E%3C/g%3E%3C/svg%3E") 16 16, crosshair;
}
.liquid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.25s ease-out;
}
.liquid.is-live {
  opacity: 1;
}
.sky,
.flower {
  position: absolute;
  height: auto;
  pointer-events: none;
}
.sky {
  left: 0;
  top: 0;
  width: calc(36.1 * var(--u));
}
.flower {
  left: calc(-3.4 * var(--u));
  bottom: calc(-5 * var(--u));
  width: calc(12.4 * var(--u));
  z-index: 4;
}

.title {
  position: absolute;
  left: 50%;
  top: calc(3 * var(--u));
  z-index: 3;
  width: calc(64 * var(--u));
  margin: 0 0 0 calc(-32 * var(--u));
  font-size: 1rem;
  pointer-events: none;
}
.wordmark {
  width: 100%;
  height: auto;
}
/* Live, the lettering is painted by liquid.js; the image keeps its place and its name. */
.hero.has-live-title .wordmark {
  opacity: 0;
}

.scene {
  position: absolute;
  right: calc(-1 * var(--u));
  bottom: 0;
  z-index: 1;
  width: calc(51 * var(--u));
  container-type: inline-size;
  pointer-events: none;
}
.scene__art {
  position: relative;
  width: 100%;
  height: auto;
}
.sun-still {
  position: absolute;
  left: 71%;
  top: 27.5%;
  width: 58%;
  height: auto;
  transform: translate(-50%, -50%);
}

/* While WebGPU is starting the hero is dark and the still art stays away, so
   the first thing seen is the sunrise. */
.gpu .hero {
  background-image: none;
}
.gpu .sky,
.gpu .flower,
.gpu .scene .sun-still,
.gpu .scene .scene__art {
  visibility: hidden;
}
.gpu .wordmark {
  opacity: 0;
}
.gpu:not([data-intro]) .sigils {
  opacity: 0;
}
[data-intro="run"] .sigils {
  animation: arrive 1.2s 3.4s both;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* The terminal's glass. Still, a cursor waits on it; live, liquid.js writes on
   it and lays this button over it, so pressing the glass casts a line. */
.cursor {
  position: absolute;
  left: 49.5%;
  top: 62%;
  width: 2.3%;
  height: 5%;
  background: #93f58c;
  box-shadow: 0 0 0.9cqw rgba(110, 255, 120, 0.6);
  transform: skewY(-5deg);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
.gpu .cursor {
  visibility: hidden;
}
.prompt {
  left: 0;
  top: 0;
  width: 300px;
  height: 200px;
  transform-origin: 0 0;
  will-change: transform;
}

/* Places in the picture that can be pressed: the planet, the sun, the glass.
   liquid.js puts them there once the picture is live; they show nothing but focus. */
.hot {
  position: absolute;
  z-index: 5;
  border-radius: 50%;
  /* Over something that can be pressed, the crosshair opens into an eye. */
  cursor:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cg stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20Q20 4 36 20Q20 36 4 20Z' fill='none' stroke='%231d1614' stroke-width='6'/%3E%3Cpath d='M4 20Q20 4 36 20Q20 36 4 20Z' fill='%231d1614' fill-opacity='.35' stroke='%23f6e3bd' stroke-width='2.4'/%3E%3Ccircle cx='20' cy='20' r='4.6' fill='%23f6e3bd' stroke='%231d1614' stroke-width='1.5'/%3E%3C/g%3E%3C/svg%3E")
      20 20,
    pointer;
  pointer-events: auto;
}
.prompt.hot {
  border-radius: 14% / 18%;
}
.hot[hidden],
.sigil[hidden] {
  display: none;
}

/* Two signs in the corner: the mouth turns the sound on, the spiral stops everything moving. */
.sigils {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  display: flex;
  gap: 10px;
}
.sigil {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--cream);
  box-shadow: 3px 4px 0 rgba(29, 22, 20, 0.45);
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.3, 1.6, 0.5, 1), color 0.15s, background-color 0.15s;
}
.sigil svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}
.sigil:hover {
  color: var(--yellow);
  transform: translateY(-2px) scale(1.06);
}
.sigil:active {
  transform: translateY(1px) scale(0.94);
}
.sigil:focus-visible {
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 8px var(--ink);
}

/* The mouth is shut until the sound is on; then it opens and sings. */
.sigil__mouth {
  transform-box: fill-box;
  transform-origin: center;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.2s;
}
.sigil__shut {
  transition: opacity 0.2s;
}
.sigil--sound[aria-pressed="true"] {
  background: var(--pink);
  color: var(--ink);
}
.sigil--sound[aria-pressed="true"] .sigil__mouth {
  transform: scaleY(1);
  opacity: 1;
}
.sigil--sound[aria-pressed="true"] .sigil__shut {
  opacity: 0;
}
[data-motion="on"] .sigil--sound[aria-pressed="true"] .sigil__mouth {
  animation: sing 2.6s ease-in-out infinite;
}
@keyframes sing {
  0%,
  100% {
    transform: scaleY(1);
  }
  30% {
    transform: scaleY(0.55);
  }
  55% {
    transform: scaleY(0.9);
  }
  75% {
    transform: scaleY(0.4);
  }
}
/* Until the sound has been tried once, the shut mouth breathes a little to be found. */
[data-motion="on"] .sigil--sound[aria-pressed="false"]:not(.was-on) {
  animation: beckon 3.2s ease-in-out 6s infinite;
}
@keyframes beckon {
  0%,
  70%,
  100% {
    box-shadow: 3px 4px 0 rgba(29, 22, 20, 0.45), 0 0 0 0 rgba(249, 187, 45, 0);
  }
  80% {
    box-shadow: 3px 4px 0 rgba(29, 22, 20, 0.45), 0 0 0 0 rgba(249, 187, 45, 0.75);
  }
  99% {
    box-shadow: 3px 4px 0 rgba(29, 22, 20, 0.45), 0 0 0 16px rgba(249, 187, 45, 0);
  }
}

/* The spiral turns while things move. */
.sigil--motion svg {
  transform-origin: 50% 50%;
}
[data-motion="on"] .sigil--motion svg {
  animation: spin 7s linear infinite;
}
.sigil--motion[aria-pressed="true"] {
  color: var(--orange);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sigil,
  .sigil__mouth,
  .liquid {
    transition: none;
  }
  .cursor {
    animation: none;
  }
}

/* Narrow screens: the title on two lines at the top, the scene at the bottom. */
@media (max-width: 900px) {
  .hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    container-type: inline-size;
    --u: 1cqw;
    height: auto;
    min-height: 100svh;
    background-image: url("art/bg-narrow.svg");
  }
  .sky {
    left: -3cqw;
    width: 64cqw;
  }
  .flower {
    left: -8cqw;
    bottom: -7cqw;
    width: 30cqw;
  }
  .title {
    position: relative;
    left: auto;
    top: auto;
    width: 90cqw;
    margin: 15cqw 0 0;
  }
  .sun-still {
    left: 76%;
    top: 26%;
    width: 47%;
  }
  .scene {
    position: relative;
    right: auto;
    bottom: auto;
    align-self: flex-start;
    width: 118cqw;
    margin: auto 0 0 -14cqw;
    padding-top: 6cqw;
  }
  .sigils {
    top: 10px;
    right: 10px;
    gap: 8px;
  }
  .sigil {
    width: 42px;
    height: 42px;
  }
}
