/* Derivecode: the story page.
   One fixed 3D scene, story beats scrolling over it. Colours follow the sky (html[data-sky]). */

@property --fg { syntax: "<color>"; inherits: true; initial-value: #f7f0e3; }
@property --fg2 { syntax: "<color>"; inherits: true; initial-value: #cdc6b8; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #ffbf5a; }
@property --halo { syntax: "<color>"; inherits: true; initial-value: rgb(4 7 18 / 0.8); }
@property --scrim { syntax: "<color>"; inherits: true; initial-value: rgb(6 9 22 / 0.78); }
@property --line { syntax: "<color>"; inherits: true; initial-value: rgb(247 240 227 / 0.26); }
@property --field { syntax: "<color>"; inherits: true; initial-value: #0e1428; }
@property --btn { syntax: "<color>"; inherits: true; initial-value: #ffbf5a; }
@property --btn-fg { syntax: "<color>"; inherits: true; initial-value: #1d1405; }
@property --lay { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --paper: #fbf6ea;
  --ink: #17211e;
  --muted-ink: #646b66;
  --teal: #0b6e6e;
  --amber: #ffbf5a;
  --gutter: clamp(20px, 5.4vw, 96px);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --error: #ff9b7d;
  color-scheme: dark;
  transition:
    --fg 1.1s ease,
    --fg2 1.1s ease,
    --accent 1.1s ease,
    --halo 1.1s ease,
    --scrim 1.4s ease,
    --line 1.1s ease,
    --field 1.1s ease,
    --btn 1.1s ease,
    --btn-fg 1.1s ease;
}

html[data-sky="day"] {
  --fg: #14201c;
  --fg2: #42504a;
  --accent: #0b6e6e;
  --halo: rgb(255 249 237 / 0.85);
  --scrim: rgb(246 240 226 / 0.82);
  --line: rgb(20 32 28 / 0.22);
  --field: #fffbf2;
  --btn: #14201c;
  --btn-fg: #fbf6ea;
  --error: #b3361f;
  color-scheme: light;
}

/* ---------- base */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #070b18;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg);
  background: #070b18;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

svg {
  display: block;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--amber);
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

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

.skip {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 50;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s ease;
}

.skip:focus {
  transform: none;
}

/* ---------- the stage */

#world {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.is-live #world {
  opacity: 1;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.scrim i {
  position: absolute;
  inset: 0;
}

.scrim__side {
  opacity: var(--lay);
  background: linear-gradient(
    90deg,
    var(--scrim) 0%,
    color-mix(in srgb, var(--scrim) 74%, transparent) 22%,
    color-mix(in srgb, var(--scrim) 32%, transparent) 38%,
    transparent 54%
  );
}

.scrim__mid {
  opacity: calc(1 - var(--lay));
  background: radial-gradient(
    ellipse 46% 38% at 50% 52%,
    color-mix(in srgb, var(--scrim) 60%, transparent),
    transparent 74%
  );
}

.overlays {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.overlays > * {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  will-change: transform, opacity;
}

/* ---------- chrome: header, clock rail, chapter label */

.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  padding-top: max(18px, env(safe-area-inset-top));
  pointer-events: none;
}

.top > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.34rem;
  font-weight: 620;
  letter-spacing: -0.025em;
  font-variation-settings: "SOFT" 100, "WONK" 0;
  text-shadow: 0 0 18px var(--halo);
}

.brand__mark {
  width: 26px;
  height: 26px;
  color: var(--accent);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 45%, transparent));
}

.top__end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-fg);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 8px 22px -12px rgb(0 0 0 / 0.6);
  transition:
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.25s ease;
}

.pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -12px rgb(0 0 0 / 0.7);
}

.sound {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 15px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--scrim) 60%, transparent);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.sound:hover {
  border-color: color-mix(in srgb, var(--fg) 55%, transparent);
}

.sound svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.sound__wave {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sound__mute {
  transition: opacity 0.3s ease;
}

.sound-on .sound__wave {
  opacity: 1;
}

.sound-on .sound__mute {
  opacity: 0;
}

.rail {
  position: fixed;
  z-index: 10;
  right: clamp(20px, 2.6vw, 44px);
  top: 50%;
  height: min(54vh, 470px);
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  color: var(--fg2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 12px var(--halo);
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.rail.is-hidden {
  opacity: 0;
}

.rail__part {
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 500;
}

.rail__track {
  position: relative;
  flex: 1;
  width: 1px;
  background: var(--line);
  container-type: size;
}

.rail__track::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 100%;
  background: var(--accent);
  transform: scaleY(var(--f, 0));
  transform-origin: top;
  opacity: 0.8;
}

.rail__dot {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  transform: translate3d(0, calc(var(--f, 0) * 100cqh), 0);
}

.rail__dot::before {
  content: "";
  position: absolute;
  left: -4px;
  top: -4px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent),
    0 0 16px 2px color-mix(in srgb, var(--accent) 60%, transparent);
}

.rail__time {
  position: absolute;
  right: 14px;
  top: 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--scrim) 92%, transparent);
  transform: translateY(-50%);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.chapter {
  position: fixed;
  z-index: 10;
  left: var(--gutter);
  top: 88px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-shadow: 0 0 14px var(--halo);
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.chapter::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
}

.chapter.is-hidden {
  opacity: 0;
}

.chapter.is-new {
  animation: chapter-in 0.9s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes chapter-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- story beats */

main {
  position: relative;
  z-index: 3;
}

.beat {
  position: relative;
  height: calc(var(--h) * var(--vh, 1vh));
}

.beat__pin {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  height: calc(100 * var(--vh, 1vh));
  padding: 104px var(--gutter) 64px;
}

.beat__text {
  width: min(31rem, 40vw);
  text-shadow:
    0 0 22px var(--halo),
    0 0 3px var(--halo);
}

.beat--center .beat__pin {
  justify-content: center;
  text-align: center;
}

.beat--center .beat__text {
  width: min(44rem, 86vw);
}

.is-off {
  pointer-events: none;
}

.beat__text:focus-within {
  opacity: 1 !important;
  transform: none !important;
}

.beat__text h1,
.beat__text h2,
.beat__text .display {
  margin: 0;
  font-family: var(--display);
  font-weight: 560;
  letter-spacing: -0.022em;
  line-height: 1.03;
  font-variation-settings: "SOFT" 40, "WONK" 0;
  font-optical-sizing: auto;
  text-wrap: balance;
}

.beat__text h2 {
  font-size: clamp(2rem, 3.5vw, 3.55rem);
}

.beat__text h1.display {
  font-size: clamp(2.4rem, 4.7vw, 4.8rem);
  line-height: 0.99;
}

.beat__text .display--quiet {
  font-size: clamp(2.4rem, 5.4vw, 5.3rem);
  font-weight: 340;
  line-height: 1.02;
}

.beat--center h2 {
  max-width: 17ch;
  margin-inline: auto;
  font-size: clamp(2.2rem, 4.3vw, 4.4rem);
}

.beat__text h1 em,
.beat__text h2 em,
.beat__text .display em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.beat__text .display--quiet em {
  color: var(--fg);
  font-weight: 340;
}

.soft {
  color: var(--fg2);
  font-weight: 430;
}

.beat__text p {
  margin: 1.15rem 0 0;
  color: var(--fg);
  font-size: clamp(1.02rem, 1.16vw, 1.17rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.beat__text .lead {
  font-size: clamp(1.08rem, 1.36vw, 1.32rem);
  line-height: 1.55;
}

.beat__text .kicker {
  color: var(--accent);
  font-family: var(--display);
  font-size: clamp(1.45rem, 2vw, 1.95rem);
  font-style: italic;
  line-height: 1.2;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.beat__text .aside {
  color: var(--fg2);
  font-family: var(--display);
  font-size: clamp(1.15rem, 1.45vw, 1.42rem);
  font-style: italic;
  line-height: 1.38;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.beat__text .stamp {
  margin: 0 0 1rem;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.beat__text .whisper {
  margin-top: 0.8rem;
  color: var(--fg2);
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.beat__text .cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: clamp(3rem, 15vh, 9rem);
  color: var(--fg2);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.cue::after {
  content: "";
  width: 1px;
  height: 46px;
  background: linear-gradient(var(--fg2), transparent);
  transform-origin: top;
  animation: cue 2.4s ease-in-out infinite;
}

@keyframes cue {
  0% {
    transform: scaleY(0);
    opacity: 1;
  }
  60% {
    transform: scaleY(1);
    opacity: 1;
  }
  100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

/* ---------- buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  margin-top: 1.8rem;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-fg);
  font-family: var(--sans);
  font-size: 1.02rem;
  font-weight: 700;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  box-shadow: 0 14px 30px -14px rgb(0 0 0 / 0.65);
  transition:
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.25s ease,
    opacity 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -14px rgb(0 0 0 / 0.7);
}

.button:active {
  transform: translateY(0);
}

.ghost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  margin-top: 2.2rem;
  padding: 0 18px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--scrim) 45%, transparent);
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: none;
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    color 0.3s ease;
}

.ghost svg {
  width: 18px;
  height: 18px;
}

.ghost:hover {
  border-color: color-mix(in srgb, var(--fg) 55%, transparent);
}

.ghost[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- the store's messages */

.msg {
  position: relative;
  width: 100%;
  max-width: 27rem;
  margin: 1.5rem 0 0;
  padding: 15px 18px 17px;
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  text-shadow: none;
  box-shadow:
    0 1px 1px rgb(0 0 0 / 0.08),
    0 22px 44px -22px rgb(6 10 20 / 0.62);
}

.beat--center .msg {
  margin-inline: auto;
}

.msg__head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.msg__head b {
  font-weight: 700;
}

.msg__head time,
.notif time {
  margin-left: auto;
  color: var(--muted-ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.msg__avatar {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f2a23a
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M7 20.5a9 9 0 0 1 18 0z' fill='white'/%3E%3Cpath d='M4.5 24.5h23' stroke='white' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E")
    center / 18px no-repeat;
  box-shadow: 0 0 0 3px rgb(242 162 58 / 0.2);
}

.beat__text .msg p {
  margin: 9px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.5;
}

.msg__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.chip:hover {
  background: #085a5a;
}

.chip[aria-pressed="true"] {
  padding-left: 14px;
  background: rgb(11 110 110 / 0.1);
  color: var(--teal);
  cursor: default;
}

.chip[aria-pressed="true"]::before {
  content: "";
  width: 11px;
  height: 6px;
  margin-right: 9px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(-45deg);
}

.chip:disabled {
  opacity: 0.4;
  cursor: default;
}

.held {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  padding: 11px 0 0;
  border-top: 1px dashed #cfc6b3;
  list-style: none;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  animation: rise-in 0.5s ease both;
}

.held li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
}

.held li span:last-child {
  color: #a3391d;
  white-space: nowrap;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.msg--thread {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.line {
  max-width: 92%;
  padding: 9px 14px 11px;
  border-radius: 16px 16px 16px 6px;
  background: #efe7d6;
}

.line--me {
  justify-self: end;
  border-radius: 16px 16px 6px 16px;
  background: var(--teal);
  color: #fff;
}

.line b {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.beat__text .line p {
  margin: 3px 0 0;
  color: inherit;
  font-size: 0.97rem;
  line-height: 1.45;
}

.line small {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  font-style: italic;
  line-height: 1.4;
  opacity: 0.72;
}

.msg--register {
  background: #13222a;
  color: #f2ede3;
  box-shadow:
    inset 4px 0 0 var(--amber),
    0 22px 44px -22px rgb(0 0 0 / 0.75);
}

.msg--register .msg__head time {
  color: #9aa5a8;
}

.beat__text .msg--register p {
  color: #f2ede3;
}

.msg--register strong {
  color: var(--amber);
}

.msg__pos {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #24363f
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='9' y='5' width='14' height='8' rx='1.5' fill='%23ffbf5a'/%3E%3Crect x='5' y='15' width='22' height='12' rx='2' fill='%23ffbf5a'/%3E%3Cpath d='M9 19h3M14 19h3M19 19h4M9 23h3M14 23h3' stroke='%2324363f' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E")
    center / 17px no-repeat;
}

.msg--register .chip {
  background: var(--amber);
  color: #1d1405;
}

.msg--register .chip:hover {
  background: #ffcd7a;
}

.msg--register .chip[aria-pressed="true"] {
  background: rgb(255 191 90 / 0.14);
  color: var(--amber);
}

/* ---------- the phone at 11:58 p.m. */

.phone {
  display: grid;
  justify-items: center;
  gap: 1.1rem;
}

.beat__text .phone__time {
  margin: 0;
  color: var(--fg);
  font-family: var(--display);
  font-size: clamp(4.5rem, 10vw, 8rem);
  font-weight: 280;
  letter-spacing: -0.045em;
  line-height: 1;
  font-variation-settings: "SOFT" 100;
}

.notif {
  width: min(25rem, 100%);
  padding: 14px 16px 16px;
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  text-shadow: none;
  box-shadow: 0 26px 60px -24px rgb(0 0 0 / 0.85);
}

.notif header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
}

.beat__text .notif p {
  margin: 9px 0 0;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.5;
}

/* ---------- receipts: requests in owners' own words */

.receipt {
  width: 250px;
  padding: 14px 16px 22px;
  background: #fbf8f1;
  color: #1f2321;
  font-family: var(--mono);
  text-align: left;
  text-shadow: none;
  filter: drop-shadow(0 16px 18px rgb(0 0 0 / 0.35));
  --z: 5px;
  -webkit-mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--z)) 100%;
  mask: conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) 50% / calc(2 * var(--z)) 100%;
}

.receipt__head {
  display: block;
  margin-bottom: 9px;
  padding-bottom: 9px;
  border-bottom: 1px dashed #c9c3b5;
  color: #6c716c;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.beat__text .receipt p {
  margin: 0;
  color: #1f2321;
  font-size: 12.5px;
  line-height: 1.55;
}

.beat--receipts .beat__text {
  position: static;
  width: auto;
  opacity: 1 !important;
  transform: none !important;
}

.receipts {
  margin: 0;
  padding: 0;
  list-style: none;
}

.js .receipts {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.js .receipts .receipt {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  will-change: transform;
}

.receipt__foot {
  display: block;
  margin-top: 10px;
  color: var(--teal);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- "add one for your store" */

.wish {
  max-width: 30rem;
  margin: 2.2rem auto 0;
  text-align: left;
  text-shadow: none;
}

.wish label {
  color: var(--fg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 0 14px var(--halo);
}

.wish__row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.wish input {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--field);
  color: var(--fg);
  font-size: 1rem;
}

.wish input::placeholder {
  color: color-mix(in srgb, var(--fg) 45%, transparent);
}

.wish button {
  flex: none;
  height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-fg);
  font-weight: 700;
  cursor: pointer;
}

.receipt--yours {
  margin: 1.6rem auto 0;
  transform: rotate(-1.5deg);
}

.receipt--yours.is-printing {
  animation: print 1.2s steps(14) both;
}

@keyframes print {
  from {
    clip-path: inset(0 0 100% 0);
    transform: translateY(-18px) rotate(-1.5deg);
  }
  to {
    clip-path: inset(0 0 -40px 0);
    transform: rotate(-1.5deg);
  }
}

/* ---------- waitlist */

.form {
  display: grid;
  gap: 14px;
  max-width: 26rem;
  margin-top: 1.7rem;
  text-shadow: none;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--fg);
  font-size: 0.86rem;
  font-weight: 650;
  text-shadow: 0 0 14px var(--halo);
}

.field label span {
  color: var(--fg2);
  font-weight: 400;
}

.field input,
.field select {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background-color: var(--field);
  color: var(--fg);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.field input::placeholder {
  color: color-mix(in srgb, var(--fg) 40%, transparent);
}

.field input:focus,
.field select:focus,
.wish input:focus {
  border-color: var(--accent);
  outline: none;
}

.field select {
  appearance: none;
  padding-right: 40px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--fg) 50%),
    linear-gradient(135deg, var(--fg) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 52%,
    calc(100% - 16px) 52%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.field select option {
  background: #fff;
  color: #111;
}

.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  box-shadow: 0 0 0 100px var(--field) inset;
}

.form .button {
  justify-self: start;
  margin-top: 6px;
}

.form.is-sending .button {
  opacity: 0.6;
  cursor: progress;
}

.beat__text .form__msg {
  min-height: 1.5em;
  margin: 0;
  font-size: 0.98rem;
}

.beat__text .form__msg:empty {
  min-height: 0;
  margin-top: -14px;
}

.form.has-error .form__msg {
  color: var(--error);
}

.form.has-error input[name="email"] {
  border-color: var(--error);
}

.beat__text .form__note {
  margin: 0;
  color: var(--fg2);
  font-size: 0.86rem;
}

.form.is-done .field,
.form.is-done .button {
  display: none;
}

.beat__text .form.is-done .form__msg {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.3;
  animation: rise-in 0.6s ease both;
}

/* ---------- footer */

.foot {
  position: relative;
  z-index: 4;
  padding: clamp(64px, 10vw, 140px) var(--gutter) 44px;
  background: #0c1311;
  color: #efe8da;
}

.foot__line {
  max-width: 17ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.6vw, 3.4rem);
  font-weight: 520;
  letter-spacing: -0.022em;
  line-height: 1.04;
  font-variation-settings: "SOFT" 60;
}

.foot__line span {
  color: var(--amber);
  font-style: italic;
  font-variation-settings: "SOFT" 100, "WONK" 1;
}

.foot__sub {
  margin: 1.1rem 0 0;
  color: #b9b3a6;
}

.foot__small {
  margin: 3.4rem 0 0;
  color: #8a857b;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

/* ---------- overlays: the fragmented software of chapter one.
   Each vendor brings its own look on purpose. */

.ow {
  width: 232px;
  overflow: hidden;
  border: 1px solid rgb(0 0 0 / 0.22);
  border-radius: 5px;
  background: #f3f3f1;
  color: #222;
  font-size: 12px;
  box-shadow:
    0 16px 34px -14px rgb(0 0 0 / 0.55),
    0 2px 4px rgb(0 0 0 / 0.12);
}

.ow__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 8px;
  color: #fff;
  font: 700 11.5px/1 Tahoma, Verdana, sans-serif;
}

.ow__bar i {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.85);
}

.ow__bar span {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ow__bar b {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
}

.ow__body {
  padding: 11px 12px 12px;
}

.ow__row {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.ow__row label {
  color: #555;
  font-size: 11px;
}

.ow__in {
  display: block;
  height: 22px;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid #a9a9a9;
  border-top-color: #858585;
  background: #fff;
  color: #333;
  font-size: 11.5px;
  line-height: 15px;
  white-space: nowrap;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 0.08);
}

.ow__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.ow__btn {
  flex: none;
  padding: 4px 12px;
  border-radius: 3px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.ow__foot em {
  color: #b03a2e;
  font-size: 10.5px;
  font-style: normal;
  line-height: 1.25;
}

.ot {
  width: 196px;
}

.ot .ow__body {
  padding: 10px 12px 12px;
}

.ot p {
  margin: 0;
  color: #333;
  font-size: 12px;
}

.ot--err p {
  color: #b03a2e;
  font-weight: 700;
}

.ot--warn p {
  color: #8a5a00;
  font-weight: 700;
}

.ot--err p::before,
.ot--warn p::before {
  content: "\26A0\FE0E  ";
}

.ot__bar {
  height: 9px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #9a9a9a;
  background: #e1e1e1;
}

.ot__bar i {
  display: block;
  height: 100%;
  background: repeating-linear-gradient(45deg, #2b8a3e 0 5px, #3aa652 5px 10px);
  background-size: 14px 100%;
  animation: barber 0.9s linear infinite;
}

@keyframes barber {
  to {
    background-position: 14px 0;
  }
}

.ob {
  width: 214px;
  padding: 9px 12px 11px;
  border: 1px solid rgb(0 0 0 / 0.08);
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: #222;
  box-shadow: 0 14px 28px -12px rgb(0 0 0 / 0.5);
}

.ob__from {
  display: flex;
  align-items: center;
  gap: 5px;
  font: 700 10.5px/1.2 var(--sans);
  letter-spacing: 0.02em;
}

.ob__from svg {
  width: 10px;
  height: 10px;
}

.ob p {
  margin: 5px 0 0;
  color: #222;
  font-size: 13px;
  line-height: 1.35;
}

.onote {
  --tilt: -4deg;
  width: 184px;
  padding: 16px 14px 14px;
  border-radius: 2px 2px 7px 2px;
  background: linear-gradient(#fff27c, #ffe35a);
  color: #2b2a24;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.12;
  box-shadow: 0 14px 20px -10px rgb(0 0 0 / 0.5);
}

.onote p {
  margin: 0;
  white-space: pre;
}

.onote::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 50%;
  width: 64px;
  height: 18px;
  margin-left: -32px;
  background: rgb(255 255 255 / 0.5);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1);
  transform: rotate(3deg);
}

.ofocus {
  width: 0;
  height: 0;
}

.ofocus__ring {
  position: absolute;
  left: -58px;
  top: -58px;
  width: 116px;
  height: 116px;
  border: 1.5px solid var(--amber);
  border-radius: 50%;
  box-shadow:
    0 0 24px rgb(255 191 90 / 0.45),
    inset 0 0 24px rgb(255 191 90 / 0.22);
}

.ofocus__ring::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border: 1.5px solid var(--amber);
  border-radius: 50%;
  animation: ping 2.4s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

@keyframes ping {
  from {
    transform: scale(1);
    opacity: 0.8;
  }
  to {
    transform: scale(1.6);
    opacity: 0;
  }
}

.ofocus__label {
  position: absolute;
  left: 0;
  top: 70px;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--amber);
  color: #1d1405;
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(-50%);
}

/* ---------- phones and small tablets */

@media (max-width: 859px) {
  body {
    font-size: 16px;
  }

  .top {
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .brand {
    gap: 8px;
    font-size: 1.16rem;
  }

  .brand__mark {
    width: 22px;
    height: 22px;
  }

  .top__end {
    gap: 8px;
  }

  .pill {
    height: 38px;
    padding: 0 15px;
    font-size: 0.88rem;
  }

  .sound {
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
  }

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

  .chapter {
    left: 16px;
    top: calc(max(12px, env(safe-area-inset-top)) + 52px);
    max-width: calc(100vw - 150px);
    gap: 8px;
    font-size: 9.5px;
  }

  .chapter::before {
    width: 14px;
  }

  .rail {
    right: 16px;
    top: calc(max(12px, env(safe-area-inset-top)) + 46px);
    height: auto;
    transform: none;
    flex-direction: row;
    gap: 0;
  }

  .rail__part,
  .rail__end,
  .rail__track::after {
    display: none;
  }

  .rail__track {
    flex: none;
    width: auto;
    height: auto;
    background: none;
    container-type: normal;
  }

  .rail__dot {
    position: static;
    display: flex;
    align-items: center;
    gap: 8px;
    width: auto;
    height: auto;
    transform: none;
  }

  .rail__dot::before {
    position: static;
    width: 7px;
    height: 7px;
  }

  .rail__time {
    position: static;
    transform: none;
    font-size: 11px;
  }

  .scrim__side {
    background: linear-gradient(
      0deg,
      var(--scrim) 0%,
      color-mix(in srgb, var(--scrim) 80%, transparent) 30%,
      color-mix(in srgb, var(--scrim) 30%, transparent) 52%,
      transparent 68%
    );
  }

  .scrim__mid {
    background: radial-gradient(
      ellipse 84% 44% at 50% 55%,
      color-mix(in srgb, var(--scrim) 64%, transparent),
      transparent 76%
    );
  }

  .beat__pin {
    align-items: flex-end;
    align-items: safe flex-end;
    padding: 104px 20px calc(30px + env(safe-area-inset-bottom));
  }

  .beat--center .beat__pin {
    align-items: center;
    align-items: safe center;
  }

  .beat__text,
  .beat--center .beat__text {
    position: relative;
    isolation: isolate;
    width: 100%;
  }

  /* a soft sheet behind the words, so long beats stay readable over any scene */
  .beat__text::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -64px -20px calc(-30px - env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, var(--scrim) 64px);
    pointer-events: none;
  }

  .beat--center .beat__text::before {
    inset: -56px -20px;
    background: linear-gradient(
      to bottom,
      transparent,
      color-mix(in srgb, var(--scrim) 80%, transparent) 56px,
      color-mix(in srgb, var(--scrim) 80%, transparent) calc(100% - 56px),
      transparent
    );
  }

  .beat--cold .beat__text::before,
  .beat--receipts .beat__text::before {
    display: none;
  }

  /* receipts fly across the whole screen, so their box must stay the pin */
  .beat--receipts .beat__text {
    position: static;
    isolation: auto;
  }

  .beat__text h2 {
    font-size: clamp(1.85rem, 7.4vw, 2.6rem);
  }

  .beat--center h2 {
    font-size: clamp(2rem, 8.6vw, 3rem);
  }

  .beat__text p {
    font-size: 1rem;
  }

  .msg {
    max-width: none;
  }

  .receipt {
    width: min(210px, 56vw);
  }

  .beat__text .receipt p {
    font-size: 11.5px;
  }
}

/* ---------- without WebGL: the story still reads, over a painted sky */

html.no-webgl #world,
html.no-webgl .overlays,
html.no-webgl .scrim {
  display: none;
}

html.no-webgl body::before,
html.no-webgl body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  transition: opacity 1.2s ease;
}

html.no-webgl body::before {
  background: linear-gradient(180deg, #070d22 0%, #18224a 55%, #3b3152 100%);
}

html.no-webgl body::after {
  background: linear-gradient(180deg, #7fb0d6 0%, #cfe2ee 52%, #f4ead8 100%);
  opacity: 0;
}

html.no-webgl[data-sky="day"] body::after {
  opacity: 1;
}

/* ---------- without JavaScript: a plain, readable page */

html:not(.js) .beat {
  height: auto;
}

html:not(.js) .beat__pin {
  position: static;
  height: auto;
  min-height: 100vh;
}

html:not(.js) .receipts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

/* the held items are revealed by a chip; without scripts, just show them */
html:not(.js) .held[hidden] {
  display: grid !important;
}

html:not(.js) .msg__actions,
html:not(.js) .wish {
  display: none;
}

/* ---------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  :root {
    transition: none;
  }

  .cue::after,
  .ofocus__ring::after,
  .ot__bar i,
  .chapter.is-new,
  .held,
  .receipt--yours.is-printing,
  .beat__text .form.is-done .form__msg {
    animation: none;
  }

  #world {
    transition: none;
  }
}
