/*
  SPDX-FileCopyrightText: 2026 Kerrick Long <me@kerricklong.com>
  SPDX-License-Identifier: AGPL-3.0-or-later
*/

/* ---------- Fonts (self-hosted) ---------- */

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

@font-face {
  font-family: "Jost";
  src: url("/assets/jost-italic-8ed617b0.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Nanum Pen Script";
  src: url("/assets/nanum-pen-73448964.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Iosevka";
  src: url("/assets/iosevka-regular-b5d4e6ec.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Iosevka";
  src: url("/assets/iosevka-bold-cb9212e9.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --paper-light: #ffffff;
  --paper-dark: #101012;
  --ink-light: #111111;
  --ink-dark: #e4e4e7;
  --muted-light: #3f3f46;
  --muted-dark: #c4c4cc;
  --red: #be1e2d;
  --blue: #1d3a8a;
  --black: #111111;
  --yellow: #fbbf24;
  --on-yellow: #111111;
  --footer-light: #111111;
  --footer-dark: #27272a;
  --line-light: #111111;
  --line-dark: #27272a;
  --focus-light: #1d3a8a;
  --focus-dark: #fbbf24;

  --paper: var(--paper-light);
  --ink: var(--ink-light);
  --muted: var(--muted-light);
  --focus: var(--focus-light);
  --footer: var(--footer-light);
  --line: var(--line-light);

  @media (prefers-color-scheme: dark) {
    --paper: var(--paper-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --focus: var(--focus-dark);
    --footer: var(--footer-dark);
    --line: var(--line-dark);
  }

  @supports (color: light-dark(white, black)) {
    --paper: light-dark(var(--paper-light), var(--paper-dark));
    --ink: light-dark(var(--ink-light), var(--ink-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --focus: light-dark(var(--focus-light), var(--focus-dark));
    --footer: light-dark(var(--footer-light), var(--footer-dark));
    --line: light-dark(var(--line-light), var(--line-dark));
  }

  --sans: "Jost", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  --mono: "Iosevka", ui-monospace, "SF Mono", Menlo, monospace;

  --pen: #be1e2d;
  --marker: color-mix(in srgb, #fbbf24 70%, transparent);

  @media (prefers-color-scheme: dark) {
    --pen: #fbbf24;
    --marker: color-mix(in srgb, #fbbf24 30%, transparent);
  }
  --hand: "Nanum Pen Script", "Bradley Hand", cursive;

  --rule: 3px;
  --rule-heavy: 6px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --space: clamp(3rem, 7vw, 6rem);
  --max: 80rem;

  color-scheme: light dark;
  accent-color: var(--yellow);
  scrollbar-color: var(--ink) var(--paper);
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  font-size-adjust: from-font;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--yellow);
  color: var(--on-yellow);
}

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-color: var(--red);
}

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

input,
textarea {
  caret-color: var(--red);
}

h1,
h2,
h3,
h4 {
  font-family: var(--mono);
  font-size-adjust: none;
  line-height: 1.3;
  letter-spacing: 0;
  text-wrap: balance;
  margin: 0;
}

/* Tight display lines overlap their neighbours' selection boxes; a translucent
   highlight keeps every line readable while selected. */
h1::selection,
h2::selection,
h3::selection,
h4::selection {
  background: color-mix(in srgb, var(--yellow) 55%, transparent);
}

p,
li,
dd {
  text-wrap: pretty;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.wrap {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  inset-inline-start: var(--gutter);
  inset-block-start: -4rem;
  background: var(--yellow);
  color: var(--on-yellow);
  padding: 0.75rem 1rem;
  font-weight: 600;
  z-index: 10;
}

.skip-link:focus {
  inset-block-start: 0.75rem;
}

.nowrap {
  white-space: nowrap;
}

.mono {
  font-family: var(--mono);
  font-size-adjust: none;
  font-variant-numeric: tabular-nums;
}

/* Undecided facts stay visible in drafts. */
.todo {
  outline: 2px dashed var(--red);
  outline-offset: 2px;
  padding-inline: 0.2em;
}

/* ---------- Logotype ---------- */

.logo {
  font-family: var(--mono);
  font-size-adjust: none;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.3;
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0;
}

.site-header .logo,
.letterhead .logo {
  color: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .site-header .logo,
  .letterhead .logo {
    color: var(--yellow);
  }
}

.logo::after {
  content: "";
  display: inline-block;
  inline-size: 0.5em;
  block-size: 0.95em;
  margin-inline-start: calc(0.5em / 7);
  translate: 0 0.14em;
  background: currentColor;
}

/* ---------- Shapes (circle = games, square = Ruby gems, triangle = Inko tools) ---------- */

.mark {
  flex: none;
  inline-size: 1.1em;
  block-size: 1.1em;
}

.mark--circle {
  fill: var(--red);
}

.mark--square {
  fill: var(--blue);
}

/* On the light ground the triangle is black, as in the composition. On the dark
   ground black would vanish, so the small marks take the ink color there; the
   composition's triangle stays black on yellow. */
.mark--triangle {
  fill: var(--ink);
}

/* ---------- Header ---------- */

.site-header {
  border-block-end: var(--rule-heavy) solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-block: 1.25rem;
}

.site-nav ul {
  font-family: var(--mono);
  font-size-adjust: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 400;
}

.site-nav a,
.site-nav .link-button {
  display: inline-block;
  padding-block: 0.6rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav .link-button:hover,
.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 3px;
}

/* ---------- Home: hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 7fr 5fr;
  border-block-end: var(--rule-heavy) solid var(--line);
}

.hero__copy {
  padding-block: calc(var(--space) * 0.7) calc(var(--space) * 0.75);
  padding-inline-end: clamp(1.5rem, 5vw, 4.5rem);
}

.hero h1 {
  font-size: clamp(2.25rem, 1.4rem + 2.8vw, 4rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
  max-inline-size: 22ch;
}

.hero__lede {
  margin: 1.5rem 0 2rem;
  max-inline-size: 38rem;
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.35rem);
  color: var(--muted);
}

.doors {
  margin: 0;
  padding: 0;
  list-style: none;
  border: var(--rule) solid var(--line);
  max-inline-size: 36rem;
}

.doors li + li {
  border-block-start: var(--rule) solid var(--line);
}

.door {
  font-family: var(--mono);
  font-size-adjust: none;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-block-size: 3.75rem;
  padding: 0.9rem 1.25rem;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  transition: background-color 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.door__label {
  flex: 1;
}

.door__arrow {
  flex: none;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  fill: currentColor;
  transition: translate 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.door:hover .door__arrow,
.door:focus-visible .door__arrow {
  translate: 0.35rem 0;
}

.door--primary {
  background: var(--yellow);
  color: var(--on-yellow);
}


.door:not(.door--primary):hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

/* The composition: each shape is the visual twin of its door. */
.composition {
  position: relative;
  background: var(--yellow);
  border-inline-start: var(--rule-heavy) solid var(--line);
  overflow: hidden;
  min-block-size: 26rem;
}

.composition svg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.composition .shape {
  transform-box: fill-box;
  transform-origin: center;
  transition:
    opacity 260ms cubic-bezier(0.16, 1, 0.3, 1),
    scale 360ms cubic-bezier(0.16, 1, 0.3, 1);
}

.shape--circle {
  fill: var(--red);
}

.shape--square {
  fill: var(--blue);
}

.shape--triangle {
  fill: var(--black);
}

/* Both drawings are pinned to their bottom edge, where the triangle stands on
   the hero's rule; it grows from its base so it never sinks through it. */
.composition .shape--triangle {
  transform-origin: 50% 100%;
}

.hero:has(.door[data-shape="circle"]:is(:hover, :focus-visible)) .shape:not(.shape--circle),
.hero:has(.door[data-shape="square"]:is(:hover, :focus-visible)) .shape:not(.shape--square),
.hero:has(.door[data-shape="triangle"]:is(:hover, :focus-visible)) .shape:not(.shape--triangle) {
  opacity: 0.18;
}

.hero:has(.door[data-shape="circle"]:is(:hover, :focus-visible)) .shape--circle,
.hero:has(.door[data-shape="square"]:is(:hover, :focus-visible)) .shape--square,
.hero:has(.door[data-shape="triangle"]:is(:hover, :focus-visible)) .shape--triangle {
  scale: 1.06;
}

/* ---------- Sections ---------- */

.section {
  padding-block: var(--space) 0;
}

.section__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-block-end: 2rem;
}

.section__head h2 {
  font-size: clamp(2rem, 1.4rem + 2.2vw, 3.25rem);
  font-weight: 700;
  letter-spacing: 0;
}

.section__head .mark {
  inline-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem);
  block-size: clamp(1.75rem, 1.3rem + 1.4vw, 2.5rem);
}

.section__intro {
  margin: -0.75rem 0 2rem;
  max-inline-size: 40rem;
  color: var(--muted);
}

/* Projects: unequal panels inside one ruled frame. */
.projects {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: var(--rule) solid var(--line);
}

/* Games: the red field is a playfield where circles bounce, the circle being
   the games form, and it carries the game; its name, its line, and the way to
   sign up to test it sit beside it on paper, 7/5. The field is at least
   square, the shape it is drawn on, so its dots keep their size. */
.projects--games {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  container-type: inline-size;
}

.playfield {
  position: relative;
  background: var(--red);
  border-inline-end: var(--rule) solid var(--line);
  min-block-size: max(24rem, 100cqi * 7 / 12);
  overflow: hidden;
}

.playfield svg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

/* The pause button: a square of the sheet cut into the field's bottom corner,
   ruled where it meets the red. Paused, it turns yellow, the next thing to do.
   Its focus ring sits inside it, where the red can't swallow it. */
.playfield__pause {
  position: absolute;
  inset-block-end: 0;
  inset-inline-start: 0;
  min-block-size: 2.75rem;
  padding: 0.4rem 1.1rem;
  border: 0;
  border-block-start: var(--rule) solid var(--line);
  border-inline-end: var(--rule) solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size-adjust: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.playfield__pause:hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

.playfield__pause--held {
  background: var(--yellow);
  color: var(--on-yellow);
}

.playfield__pause--held:hover {
  background: color-mix(in srgb, var(--yellow) 85%, #000000);
}

.playfield__pause:focus-visible {
  outline: var(--rule) solid var(--focus);
  outline-offset: -0.45rem;
}

.playfield__pause--held:focus-visible {
  outline-color: var(--on-yellow);
}

/* A popped dot is a ring drawn with the heavy rule, filled with the field, so
   it hides the bright dot when it passes over it; the bright dot is solid
   yellow, the color of the next thing to do. */
.playfield__dot {
  fill: var(--red);
  stroke: var(--black);
  stroke-width: var(--rule-heavy);
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
}

.playfield__dot--bright {
  fill: var(--yellow);
  stroke: none;
}

.playfield--live .playfield__dot--bright {
  cursor: pointer;
}

/* A dot that has just popped lands with a short squash. */
.playfield__dot--popped {
  animation: playfield-pop 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes playfield-pop {
  from { scale: 1.25; }
  to { scale: 1; }
}

.project.game h3 {
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}

/* A game's one line, in the same words and the same bold Jost on the
   homepage and on its sign-up page's red field. */
.game__line {
  font-size: 1.2rem;
  font-weight: 700;
}

/* What the game is stands at the top of the panel; when it's out and the way
   to sign up stand at its foot, level with the bottom of the field. A trailer,
   when there is one, goes under the line, in what the game is. */
.game__about,
.game__join {
  display: contents;
}

.game .game__media {
  margin: 0.5rem 0 0;
}

.game .game__terms {
  margin-block-start: auto;
  padding-block-start: 1rem;
  font-family: var(--mono);
  font-size-adjust: none;
  font-weight: 700;
}

.game__action {
  margin-block-start: 0.5rem;
}

/* Where the field is tall enough to leave the panel room, the panel is ruled
   into two: what the game is, its line set large enough to hold the space
   beside the field, over the way to sign up, which sits on the field's foot.
   Narrower, the panel's words already fill it, and it stays one column so the
   field keeps its height. When the trailer comes, the line goes back to
   1.2rem and the trailer takes the room. */
@container (min-width: 70rem) {
  .project.game {
    padding: 0;
    gap: 0;
  }

  .game__about,
  .game__join {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 2.25rem;
  }

  .game__about {
    flex: 1;
    gap: 1.25rem;
  }

  .game__join {
    border-block-start: var(--rule) solid var(--line);
  }

  .game__line {
    font-size: clamp(1.2rem, 2.65cqi, 2rem);
  }

  .game .game__terms {
    margin-block-start: 0;
    padding-block-start: 0;
    font-size: 1.25rem;
  }
}

/* A heavy panel and a light one, 7/5. */
.projects--pair {
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.projects--pair > * + * {
  border-inline-start: var(--rule) solid var(--line);
}

/* A project alone in its frame fills it as a pair does: what it is in the
   heavy panel, and its facts and links in the light one, 7/5 on the line the
   pairs above are divided on. */
.projects--single > .project {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  padding: 0;
  gap: 0;
}

.project__about,
.project__details {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 2.25rem;
}

.project__details {
  border-inline-start: var(--rule) solid var(--line);
}

/* Gems for Ruby come in groups, each a heading over its own ruled frame. */
.group + .group {
  margin-block-start: calc(var(--space) * 0.6);
}

/* A group's title sits a clear step under the section heading and a clear
   step over the project names in its frame (about 1.3 times them at every
   width), so a group never reads as one more project. */
.group__title {
  font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem);
  font-weight: 700;
  margin-block-end: 1rem;
}

.group__intro {
  margin: 0 0 1.5rem;
  max-inline-size: 56rem;
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.35rem);
}

.group__intro .mono {
  font-weight: 700;
}

.project--lead.project--lead-inko {
  background: var(--black);
}

.project {
  padding: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.project :is(h3, h4) {
  font-size: clamp(1.35rem, 1.1rem + 0.8vw, 1.75rem);
  font-weight: 700;
}

.project--lead :is(h3, h4) {
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}

.project p {
  margin: 0;
  max-inline-size: 34rem;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1.25rem;
  margin: 0;
  font-size: 1rem;
}

.facts > div {
  display: contents;
}

.facts > div[hidden] {
  display: none;
}

.facts dt {
  font-family: var(--mono);
  font-size-adjust: none;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-family: var(--mono);
  font-size-adjust: none;
  font-variant-numeric: tabular-nums;
}

.project__link + a {
  font-weight: 600;
}

.project__link {
  margin-block-start: auto;
  font-weight: 600;
  padding-block-start: 0.5rem;
}

/* Someone else's words about a project, set a step larger than the panel's
   own, with who said it and where underneath. */
.quote {
  margin: 0.25rem 0;
}

.quote blockquote {
  margin: 0;
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.35rem);
}

.quote figcaption {
  margin-block-start: 0.5rem;
  font-size: 1rem;
  color: var(--muted);
}

.project--lead {
  background: var(--blue);
  color: #ffffff;
}

.project--lead .facts dt {
  color: #f4f4f5;
}

.project--lead a:hover {
  text-decoration-color: var(--yellow);
}

.email {
  font-family: var(--mono);
  font-size-adjust: none;
  font-weight: 700;
}

.button {
  font-family: var(--mono);
  font-size-adjust: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-block-size: 3rem;
  padding: 0.7rem 1.4rem;
  border: var(--rule) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

.button--primary {
  background: var(--yellow);
  color: var(--on-yellow);
  border-color: var(--yellow);
}

.button--primary:hover {
  background: color-mix(in srgb, var(--yellow) 85%, #000000);
  border-color: color-mix(in srgb, var(--yellow) 85%, #000000);
}

.button--ink {
  background: var(--on-yellow);
  color: #ffffff;
  border-color: var(--on-yellow);
}

.button--ink:hover {
  background: #2a2a2e;
  border-color: #2a2a2e;
}

.letter__body ul {
  list-style: square;
}

.letter__body li::marker {
  color: var(--blue);
}

/* Subscribe */
.subscribe {
  margin-block: var(--space) 0;
  padding: clamp(1.5rem, 4vw, 3rem);
  background: var(--yellow);
  color: var(--on-yellow);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem 3rem;
}

.subscribe > div {
  max-inline-size: 40rem;
}

.subscribe > p {
  margin: 0;
}

.subscribe h2 {
  font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem);
}

.subscribe p {
  margin: 0.75rem 0 0;
}

/* ---------- Forms ---------- */

.field {
  display: grid;
  gap: 0.35rem;
  margin-block-end: 1.5rem;
}

.field label {
  font-weight: 600;
}



.field input,
.field select,
.field textarea {
  font: inherit;
  font-size: 1.125rem;
  padding: 0.75rem 0.9rem;
  border: var(--rule) solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  inline-size: 100%;
}

.subscribe .field input {
  border-color: var(--on-yellow);
  background: #ffffff;
  color: #111111;
}

.field textarea {
  min-block-size: 7rem;
  resize: vertical;
}

.error {
  display: none;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.error::before {
  content: "";
  display: inline-block;
  inline-size: 0.7em;
  block-size: 0.7em;
  margin-inline-end: 0.5em;
  background: var(--red);
}

/* aria-invalid marks a field the server sent back to fix. */
.field input:user-invalid,
.field textarea:user-invalid,
.field [aria-invalid="true"] {
  border-color: var(--red);
  border-style: dashed;
}

.field input:user-invalid ~ .error,
.field textarea:user-invalid ~ .error,
.field [aria-invalid="true"] ~ .error,
.choices--invalid .error {
  display: block;
}

/* A group of checkboxes, each a ruled tile that turns yellow when chosen. */
.choices {
  margin: 0 0 1.5rem;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.choices legend {
  padding: 0;
  margin-block-end: 0.35rem;
  font-weight: 600;
}

.choices__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.choices .error {
  margin-block-start: 0.5rem;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-block-size: 3rem;
  padding: 0.5rem 1rem;
  border: var(--rule) solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 1.125rem;
  cursor: pointer;
}

.choice:hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

.choice input {
  inline-size: 1.25rem;
  block-size: 1.25rem;
  margin: 0;
  cursor: pointer;
}

.choice:has(input:checked) {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--on-yellow);
  accent-color: var(--on-yellow);
}

.choice:has(input:checked):hover {
  background: color-mix(in srgb, var(--yellow) 85%, #000000);
  border-color: color-mix(in srgb, var(--yellow) 85%, #000000);
}

/* The ring goes round the whole tile, not the small box inside it. */
.choice input:focus-visible {
  outline: none;
}

.choice:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* ---------- Beta tester sign-up (/games/:game/beta-testers/new) ---------- */

/* One sheet, 7/5: what happens and the form on the left, the game's red field
   on the right across both rows. Narrower, the field becomes a band between
   the words and the form. */
.sign-up {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  grid-template-rows: auto 1fr;
  border-block-end: var(--rule-heavy) solid var(--line);
}

.sign-up__head,
.sign-up__form {
  grid-column: 1;
  padding-inline-end: clamp(1.5rem, 5vw, 4rem);
}

.sign-up__head {
  padding-block: var(--space) 2.5rem;
}

.sign-up__head h1 {
  font-size: clamp(2.25rem, 1.4rem + 2.8vw, 4rem);
  font-weight: 700;
}

.sign-up__head > p {
  margin: 1rem 0 0;
  max-inline-size: 36rem;
}

.sign-up__head > p.sign-up__lede {
  margin-block-start: 1.5rem;
  font-size: clamp(1.15rem, 1rem + 0.4vw, 1.35rem);
}

.sign-up__head > p:has(.button) {
  margin-block-start: 2rem;
}

.sign-up__form {
  padding-block-end: var(--space);
  container-type: inline-size;
}

.sign-up__form form {
  max-inline-size: 38rem;
}

.sign-up__submit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
}

.sign-up__submit p {
  margin: 0;
  color: var(--muted);
}

/* The game's field. White on red is 6.2:1, so everything on it is bold and
   at least 1.2rem. */
.game-field {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  background: var(--red);
  color: #ffffff;
  border-inline-start: var(--rule-heavy) solid var(--line);
  font-weight: 700;
  font-size: 1.2rem;
}

.game-field__art {
  position: relative;
  flex: 1;
  min-block-size: 28rem;
  overflow: hidden;
}

.game-field__art svg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.game-field .field-art--band {
  display: none;
}

.dot {
  fill: var(--red);
  stroke: var(--black);
  stroke-width: var(--rule-heavy);
  vector-effect: non-scaling-stroke;
}

.dot--bright {
  fill: var(--yellow);
  stroke: none;
}

/* The bright dot slides out from under a popped one, once, as it does in the
   game. It starts where it ends, so without motion it is simply there. */
@media (prefers-reduced-motion: no-preference) {
  .dot--bright {
    animation: bright-dot-slides-out 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
  }
}

@keyframes bright-dot-slides-out {
  from {
    translate: -56px -42px;
  }
}

.game-field__about {
  padding: 2.25rem;
}

.game-field h2 {
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
}

.game-field p {
  margin: 0.75rem 0 0;
  max-inline-size: 30rem;
}

.game-field__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1.25rem;
  margin: 1.25rem 0 0;
  font-family: var(--mono);
  font-size-adjust: none;
}

.game-field__facts > div {
  display: contents;
}

.game-field__facts dd {
  margin: 0;
}

/* The devices: six cells of one ruled table on the sheet, phones and tablets
   over computers. A chosen cell turns yellow, the next thing to do. */
.devices {
  margin: 0 0 2rem;
  padding: 0;
  border: 0;
  min-inline-size: 0;
}

.devices legend {
  padding: 0;
  font-weight: 600;
}

.devices__hint {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--muted);
}

.devices__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--rule);
  border: var(--rule) solid var(--ink);
  background: var(--ink) padding-box;
}

@container (width < 26rem) {
  .devices__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.device {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-block-size: 4rem;
  padding: 0.75rem 1rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size-adjust: none;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}

.device:hover {
  background: color-mix(in srgb, var(--ink) 7%, var(--paper));
}

.device:has(:checked) {
  background: var(--yellow);
  color: var(--on-yellow);
}

.device:has(:checked):hover {
  background: color-mix(in srgb, var(--yellow) 85%, #000000);
}

/* A drawn box: ruled in the cell's ink, filled black with a yellow check when chosen. */
.device__box {
  appearance: none;
  flex: none;
  display: grid;
  place-content: center;
  inline-size: 1.5rem;
  block-size: 1.5rem;
  margin: 0;
  border: var(--rule) solid currentColor;
  background: transparent;
  cursor: pointer;
}

.device__box::before {
  content: "";
  inline-size: 0.95rem;
  block-size: 0.95rem;
  background: var(--yellow);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 8.5 6 13 14.5 3.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E") center / contain no-repeat;
  visibility: hidden;
}

.device__box:checked {
  background: var(--on-yellow);
  border-color: var(--on-yellow);
}

.device__box:checked::before {
  visibility: visible;
}

/* The ring goes inside the whole cell, black on a chosen yellow cell, where
   the dark theme's yellow ring would vanish. */
.device__box:focus-visible {
  outline: none;
}

.device:has(.device__box:focus-visible) {
  outline: var(--rule) solid var(--focus);
  outline-offset: -0.5rem;
}

.device:has(.device__box:checked:focus-visible) {
  outline-color: var(--on-yellow);
}

@media (forced-colors: active) {
  .device__box {
    appearance: auto;
  }

  .device__box::before {
    content: none;
  }
}

.devices--invalid .devices__grid {
  border-color: var(--red);
  border-style: dashed;
}

.devices .error {
  margin-block-start: 0.6rem;
}

.devices--invalid .error {
  display: block;
}

@media (max-width: 60rem) {
  .sign-up {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  .sign-up__head,
  .sign-up__form,
  .game-field {
    grid-column: 1;
    grid-row: auto;
    padding-inline-end: 0;
  }

  .sign-up__form {
    padding-block-start: 2.5rem;
  }

  .game-field {
    border-inline-start: 0;
  }

  .game-field__art {
    min-block-size: 9rem;
    flex: none;
  }

  .game-field .field-art--wide {
    display: none;
  }

  .game-field .field-art--band {
    display: block;
  }
}

@media (max-width: 44rem) {
  .game-field__about {
    padding: 1.25rem;
  }
}



/* ---------- Footer (sitemap) ---------- */

.site-footer {
  margin-block-start: var(--space);
  background: var(--footer-light);
  color: #f4f4f5;
  padding-block: 3rem 4rem;
}

@media (prefers-color-scheme: dark) {
  .site-footer {
    background: var(--footer-dark);
  }
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 2rem;
}

.site-footer h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-block-end: 0.75rem;
  color: var(--yellow);
}

.site-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  text-decoration: underline;
  text-decoration-color: var(--yellow);
}

.site-footer .logo {
  color: #f4f4f5;
  margin-block-end: 1rem;
}

.site-footer p {
  margin: 0;
  color: #d4d4d8;
  max-inline-size: 22rem;
}

.site-footer .site-footer__contact {
  margin-block-start: 1.25rem;
}

/* ---------- Letter (lota, ratatui, tokra) ---------- */

.letterhead {
  border-block-end: var(--rule-heavy) solid var(--line);
}

.letterhead .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem;
}

.letterhead__from p {
  margin: 0.6rem 0 0;
  font-family: var(--mono);
  font-size-adjust: none;
  font-size: 0.95rem;
  color: var(--muted);
}

.letterhead__mark {
  flex: none;
  inline-size: 5.5rem;
  block-size: 6rem;
}

/* One centered column, like a letter on a desk. Margin notes sit to its right. */
.letter {
  padding-block-start: var(--space);
}

.letter__body {
  margin-inline: auto;
}

.letter__body {
  max-inline-size: 34em;
  font-size: 1.1875rem;
}

.letter__body h1 {
  font-size: clamp(1.9rem, 1.3rem + 1.9vw, 2.9rem);
  font-weight: 700;
  line-height: 1.3;
  margin-block-end: 1.25rem;
}

.letter__body > p.letter__deck {
  color: var(--muted);
  margin: 0 0 2.5rem;
}

.letter__body > p,
.letter__body > ul,
.letter__body > ol {
  margin: 0 0 1.25rem;
}

.letter__body h2 {
  font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0;
  margin: 3.5rem 0 1.25rem;
}

.letter__body h2 .mark {
  display: inline-block;
  inline-size: 0.88em;
  block-size: 0.88em;
  vertical-align: -0.02em;
  margin-inline-end: 0.35em;
}

.letter__body strong {
  font-weight: 700;
}

.salutation {
  font-weight: 600;
}

.price {
  font-family: var(--mono);
  font-size-adjust: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}





.guarantee {
  margin: 2rem 0;
  padding: 1.5rem 1.75rem;
  background: var(--blue);
  color: #ffffff;
  font-size: 1.3rem;
  font-weight: 600;
}

.guarantee p {
  margin: 0;
}



.field-art--band {
  display: none;
}


.request {
  margin: 2rem 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: var(--rule) solid var(--line);
}

.request__alt {
  margin: 1.25rem 0 0;
  font-size: 1rem;
  color: var(--muted);
}

.signature {
  margin-block: 2.5rem;
}

.signature p {
  margin: 0;
}

.ps {
  margin: 0 0 1.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 1.25rem;
}

.pps {
  margin: 0;
}






.slim-footer {
  margin-block-start: var(--space);
  border-block-start: var(--rule-heavy) solid var(--line);
}

.slim-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.5rem 3rem;
}

/* Circled phrases stay on one line wherever there's room. */
[data-mark="circle"] {
  white-space: nowrap;
}

/* A short price list inside a letter: tier on the left, price on the right, ruled. */
.tiers {
  margin: 0 0 1.5rem;
  border-block-start: var(--rule) solid var(--line);
}

.tiers div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.75rem;
  border-block-end: var(--rule) solid var(--line);
}

.tiers dt {
  font-weight: 600;
}

.tiers dd {
  margin: 0;
  font-size: 1.5rem;
}

/* ---------- Markup: a red pen and a highlighter over the printed letter ---------- */

.letter__body {
  position: relative;
}


.annotated {
  position: relative;
}

.note {
  position: absolute;
  inset-inline-start: calc(100% + 1.5rem);
  inset-block-start: -0.35rem;
  inline-size: 11rem;
  font-family: var(--hand);
  font-size-adjust: none;
  font-size: 1.6rem;
  line-height: 1.3;
  font-weight: 400;
  color: var(--pen);
  rotate: -3deg;
  transform-origin: left top;
  pointer-events: none;
}

.note::before {
  content: "";
  position: absolute;
  inset-inline-end: calc(100% + 0.4rem);
  inset-block-start: 0.55em;
  inline-size: 1.1rem;
  block-size: 0.6rem;
  background:
    no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M23 7C16 5 9 5 3 6M7 2 2 6l5 4' fill='none' stroke='%23be1e2d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  .note::before {
    background:
    no-repeat center / contain
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 12'%3E%3Cpath d='M23 7C16 5 9 5 3 6M7 2 2 6l5 4' fill='none' stroke='%23fbbf24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* Without a margin, notes become handwritten asides under their paragraph. */
@media (max-width: 75rem) {
  .note {
    position: relative;
    inset: auto;
    display: block;
    inline-size: auto;
    margin-block-start: 0.35rem;
    padding-inline-start: 1.6rem;
    rotate: -1.5deg;
  }

  .note::before {
    inset-inline-start: 0;
    inset-inline-end: auto;
    inset-block-start: 0.2em;
    rotate: 70deg;
  }
}

/* ---------- License ---------- */

.page-hero {
  display: grid;
  grid-template-columns: 8fr 4fr;
  border-block-end: var(--rule-heavy) solid var(--line);
}

.page-hero__copy {
  padding-block: var(--space) calc(var(--space) * 0.75);
  padding-inline-end: clamp(1.5rem, 5vw, 4rem);
}

.page-hero h1 {
  font-size: clamp(2.25rem, 1.3rem + 3.4vw, 4.25rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.3;
}

.page-hero__copy > p {
  margin: 1.5rem 0 0;
  max-inline-size: 40rem;
  font-size: 1.25rem;
  color: var(--muted);
}

.page-hero__field {
  background: var(--blue);
  border-inline-start: var(--rule-heavy) solid var(--line);
  position: relative;
  overflow: hidden;
  min-block-size: 16rem;
}

.page-hero__field svg {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.projects--license {
  grid-template-columns: minmax(0, 6fr) minmax(0, 3fr) minmax(0, 3fr);
}

.projects--license > * + * {
  border-inline-start: var(--rule) solid var(--line);
}

@media (max-width: 44rem) {
  .projects--license {
    grid-template-columns: minmax(0, 1fr);
  }

  .projects--license > * + * {
    border-inline-start: 0;
    border-block-start: var(--rule) solid var(--line);
  }
}






.faq {
  margin: 0;
  border-block-start: var(--rule) solid var(--line);
}

.faq div {
  display: grid;
  grid-template-columns: minmax(12rem, 5fr) 7fr;
  gap: 0.5rem 2rem;
  padding-block: 1.25rem;
  border-block-end: var(--rule) solid var(--line);
}

.faq dt {
  font-weight: 700;
  font-size: 1.2rem;
}

.faq dd {
  margin: 0;
  max-inline-size: 42rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 60rem) {
  .hero,
  .page-hero {
    grid-template-columns: 1fr;
  }

  .hero__copy,
  .page-hero__copy {
    padding-inline-end: 0;
  }

  .composition {
    border-inline-start: 0;
    border-block-start: var(--rule-heavy) solid var(--line);
    min-block-size: 16rem;
  }

  .field-art--wide {
    display: none;
  }

  .field-art--band {
    display: block;
  }

  .page-hero__field {
    border-inline-start: 0;
    border-block-start: var(--rule-heavy) solid var(--line);
    min-block-size: 10rem;
  }

  .site-footer .wrap {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 44rem) {
  .project {
    padding: 1.25rem;
  }

  .projects--games,
  .projects--pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .projects--games > :nth-child(n),
  .projects--pair > :nth-child(n) {
    grid-column: auto;
    grid-row: auto;
    border-inline: 0;
  }

  .playfield {
    min-block-size: 15rem;
  }

  .projects--games > :first-child,
  .projects--pair > :first-child {
    border-block-end: var(--rule) solid var(--line);
  }

  .projects--single > .project {
    grid-template-columns: minmax(0, 1fr);
  }

  .project__about,
  .project__details {
    padding: 1.25rem;
  }

  .project__details {
    border-inline-start: 0;
    border-block-start: var(--rule) solid var(--line);
  }

  .faq div {
    grid-template-columns: 1fr;
  }



  .site-footer .wrap {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media print {
  .site-header nav,
  .composition,
  .page-hero__field,
  .subscribe,
  .site-footer {
    display: none;
  }
}

/* ---------- App additions ---------- */

.tiers dd {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.tiers dd .button {
  min-block-size: 2.5rem;
  padding-block: 0.4rem;
}

.request__notice {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border: var(--rule) solid var(--line);
  font-weight: 600;
}


.sign-in {
  inline-size: min(100% - 2rem, 28rem);
  margin: clamp(3rem, 12vh, 8rem) auto;
}

.sign-in h1 {
  font-size: 1.75rem;
  margin-block-end: 1.25rem;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.admin-actions form {
  display: contents;
}

.link-button {
  padding: 0;
  border: 0;
  line-height: inherit;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@media (max-width: 40rem) {
  .tiers dd .button {
    font-size: 1rem;
    padding-inline: 0.85rem;
  }
}

/* ---------- Admin: dashboard figures ---------- */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  margin: 1.5rem 0 3rem;
  border-block: var(--rule) solid var(--line);
}

.kpis div {
  padding: 1.25rem 1.25rem 1.25rem 0;
}

.kpis dt {
  font-weight: 600;
}

.kpis__value {
  margin: 0.35rem 0 0;
  font-family: var(--mono);
  font-size-adjust: none;
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  font-weight: 700;
  line-height: 1.3;
}

.kpis__note {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}
