@font-face {
  font-family: "Jost";
  src: url("../fonts/jost-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Caveat";
  src: url("../fonts/caveat-wght.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --desk: #e4e5e7;
  --paper: #fdfdfb;
  --ink: #1d2126;
  --quiet: #3f454c;
  --grid: #8da1b5;
  --pencil: #7d828a;
  --gaffer: #1c1d1f;
  --tui: #cc2438;
  --marco: #1d58ba;
  --ellie: #127a50;
  --dev: #b54e08;
  --gutter: clamp(16px, 4.5vw, 56px);
  --measure: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 400 18px/1.5 "Jost", system-ui, sans-serif;
}

a { color: inherit; text-underline-offset: 0.18em; }

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

.topline {
  display: flex;
  gap: 0.9em;
  align-items: center;
  height: 48px;
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin-inline: auto;
  font-size: 0.95rem;
}

.topline .wordmark { font-weight: 600; }
.topline span:last-child { color: var(--quiet); }

main { display: block; }

/* Opening: a frame that fits the screen it's on. */
.opening {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 2svh, 24px);
  height: calc(100svh - 48px);
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding: clamp(8px, 3svh, 40px) 0 clamp(8px, 2svh, 24px);
  overflow: hidden;
}

@media (min-aspect-ratio: 5/4) {
  .opening {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
  }
}

.becomes {
  margin: 0 0 0.4em;
  color: var(--quiet);
  font-size: clamp(0.95rem, 2.2svh, 1.1rem);
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, min(6.4vw, 7.6svh), 4.1rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 13em;
}

.lede {
  max-width: 30em;
  margin: 0.8em 0 0;
  font-size: clamp(1rem, 2.4svh, 1.2rem);
}

.opening-desk {
  position: relative;
  min-height: 0;
  height: 100%;
}

.opening-desk svg,
.world svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Pinned scenes: the stage sticks while the scene's extra height scrolls by. */
.scene {
  position: relative;
  height: calc((1 + var(--travel, 2)) * 100svh);
}

.stage {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100svh;
  margin: 0;
  overflow: hidden;
}

.caption {
  flex: none;
  display: flex;
  align-items: flex-end;
  min-height: calc(2 * 1.25em + clamp(10px, 2.4svh, 24px));
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin-inline: auto;
  padding-top: clamp(8px, 2svh, 20px);
  font-size: clamp(1rem, min(2.4vw, 3svh), 1.45rem);
  font-weight: 500;
  line-height: 1.25;
}

.caption span { display: block; max-width: 34em; }

.world {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

/* The sheet, as signed: a typed form on the desk. */
.signed {
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin: clamp(48px, 9svh, 96px) auto 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 600;
  line-height: 1.1;
}

.signed-intro {
  max-width: 34em;
  margin: 0.6em 0 1.6em;
  font-size: 1.1rem;
}

.sheet {
  max-width: 900px;
  padding: clamp(18px, 3.4vw, 40px);
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12), 0 8px 18px rgba(0, 0, 0, 0.06);
}

.sheet-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4em 2em;
  align-items: baseline;
  padding-bottom: 0.7em;
  border-bottom: 2px solid var(--ink);
}

.sheet-title {
  flex: 1 1 100%;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.label {
  color: var(--quiet);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hand {
  font-family: "Caveat", "Jost", cursive;
  font-size: 1.55em;
  font-weight: 700;
  line-height: 1;
}

.sheet-rule {
  margin: 1em 0 1.1em;
  font-size: 1.05rem;
}

.bar {
  display: flex;
  height: 22px;
  margin-bottom: 1.2em;
}

.bar span { flex: var(--share) 0 0; }
.bar span:nth-child(1) { background: var(--tui); }
.bar span:nth-child(2) { background: var(--marco); }
.bar span:nth-child(3) { background: var(--ellie); }
.bar span:nth-child(4) { background: var(--dev); }
.bar span + span { box-shadow: inset 2px 0 0 var(--paper); }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  padding: 0 0.6em 0.5em 0;
  color: var(--quiet);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

tbody th,
tbody td {
  padding: 0.55em 0.6em 0.55em 0;
  border-top: 1px solid #cfd6dd;
  text-align: left;
  vertical-align: top;
}

tbody th {
  font-family: "Jost", sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
}

tr[data-person="tui"] th { color: var(--tui); }
tr[data-person="marco"] th { color: var(--marco); }
tr[data-person="ellie"] th { color: var(--ellie); }
tr[data-person="dev"] th { color: var(--dev); }

.share {
  font-family: "Jost", sans-serif;
  font-size: 1.3rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.sig { width: 44%; }

details summary {
  display: flex;
  gap: 0.8em;
  align-items: center;
  cursor: pointer;
  list-style: none;
}

details summary::-webkit-details-marker { display: none; }

summary svg {
  flex: none;
  width: 150px;
  height: 44px;
}

summary .when {
  color: var(--quiet);
  font-size: 0.9rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

details[open] summary .when { text-decoration: none; }

.record {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2em 1em;
  margin: 0.7em 0 0.3em;
  padding: 0.7em 0.9em;
  border-left: 3px solid currentColor;
  font-size: 0.95rem;
}

.record dt { color: var(--quiet); }
.record dd { margin: 0; color: var(--ink); }

tr[data-person="tui"] .record { color: var(--tui); }
tr[data-person="marco"] .record { color: var(--marco); }
tr[data-person="ellie"] .record { color: var(--ellie); }
tr[data-person="dev"] .record { color: var(--dev); }

.sheet-foot {
  display: grid;
  gap: 1.2em 3em;
  margin-top: 1.6em;
  padding-top: 1em;
  border-top: 2px solid var(--ink);
}

@media (min-width: 720px) {
  .sheet-foot { grid-template-columns: 1fr 1fr; }
}

h3 {
  margin: 0 0 0.4em;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sheet-foot ul {
  margin: 0;
  padding-left: 1.1em;
}

.sheet-foot li + li { margin-top: 0.3em; }

@media (max-width: 620px) {
  thead { display: none; }
  tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 1em;
    padding: 0.6em 0;
    border-top: 1px solid #cfd6dd;
  }
  tbody th,
  tbody td { padding: 0; border: 0; }
  tbody td:nth-child(2) { grid-column: 1; color: var(--quiet); }
  tbody td.share { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  tbody td.sig { grid-column: 1 / -1; width: auto; margin-top: 0.4em; }
}

/* The tape deck: two keys, like the ones on a cassette player. */
.deck {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8em 1.4em;
  align-items: center;
  margin-top: 1.6em;
}

.keys { display: flex; gap: 4px; }

.key {
  min-height: 48px;
  padding: 0.6em 1.1em 0.7em;
  border: 0;
  border-bottom: 4px solid #9ea3a9;
  border-radius: 3px;
  background: linear-gradient(#f4f4f2, #d9dadc);
  color: var(--ink);
  font: 500 1rem "Jost", sans-serif;
  cursor: pointer;
}

.key[aria-pressed="true"] {
  transform: translateY(3px);
  border-bottom-width: 1px;
  background: linear-gradient(#d9dadc, #eceded);
}

.key span { margin-right: 0.35em; }

.deck-note {
  margin: 0;
  color: var(--quiet);
  font-size: 0.95rem;
}

/* Close. */
.close {
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin: clamp(56px, 10svh, 112px) auto 0;
  padding-bottom: 56px;
}

.note {
  max-width: 36em;
  margin: 0 0 1.6em;
  font-size: 1.05rem;
}

.film { margin: 0; max-width: 960px; }

.film video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: #cfd1d4;
}

.film figcaption {
  margin-top: 0.5em;
  color: var(--quiet);
  font-size: 0.95rem;
}

.back { margin: 2em 0 0; }

/* Reduced motion: stills in place of pinned scenes. */
.stills {
  display: grid;
  gap: clamp(20px, 4svh, 40px);
  width: min(var(--measure), 100% - 2 * var(--gutter));
  margin: clamp(40px, 8svh, 80px) auto 0;
}

.still { margin: 0; }

.still .world {
  height: min(78svh, 62vw);
  min-height: 240px;
}

.still figcaption {
  margin-bottom: 0.5em;
  font-size: 1.1rem;
  font-weight: 500;
}

/* Films: only the stage, filling the frame. */
html.capture body { overflow: hidden; }
html.capture .topline,
html.capture main { display: none; }
html.capture .film-stage {
  display: block;
  position: fixed;
  inset: 0;
  background: var(--desk);
}
html.capture .film-stage .stage { position: absolute; inset: 0; height: 100%; }
html.capture .caption {
  width: auto;
  margin: 0;
  padding: 3.2vh 4.4vw 0;
  font-size: 3.4vh;
}
html.capture.square .caption { font-size: 4.3vh; padding-inline: 5vw; padding-top: 3vh; }
