/* Francis Pike: one drawing sheet. Plot paper, ink linework, the game's four sides as drawing layers. */

@font-face {
  font-family: "Chakra Petch";
  src: url("/assets/fonts/chakra-petch-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-hyperlegible-next-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* The game's own faces, used only inside game drawings: numbers and node labels. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Condensed";
  src: url("/assets/fonts/ibm-plex-sans-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --ground: #f2f4f7;
  --sheet: #fdfdfd;
  --ink: #141414;
  --ink-2: #33373d;
  --mute: #565c65;
  --rule: #c9ced6;
  --rule-strong: #141414;

  --you: #1f5fd6;
  --you-2: #0d3a8c;
  --you-tint: #e4edfc;
  --btn: #1f5fd6;
  --btn-shadow: #0d3a8c;
  --selection: #ffe17a;

  /* drawing layers (the game's palette) */
  --d-paper: #ffffff;
  --d-ink: #141414;
  --d-mute: #5e5e5e;
  --d-neu: #6d6d6d;
  --d-you: #1f5fd6;
  --d-you2: #0d3a8c;
  --d-foe: #d6312b;
  --d-foe2: #8f1712;
  --d-hyd: #1c9454;
  --d-hyd2: #0a5a30;
  --d-ally: #7a45c9;
  --d-ally2: #4a2380;

  --f-display: "Chakra Petch", "Arial Narrow", system-ui, sans-serif;
  --f-text: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --f-label: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;

  /* 8px drafting grid */
  --u: 8px;
  --gutter: clamp(16px, 4vw, 40px);
  --wrap: 1240px;
  --section-y: clamp(80px, 11vw, 144px);

  /* corners: paper is square, things you touch are 8px, phone screens 16px */
  --r-ui: 8px;
  --r-screen: 16px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d1015;
    --sheet: #141920;
    --ink: #e9ecf0;
    --ink-2: #c6ccd5;
    --mute: #9aa3af;
    --rule: #2b323c;
    --rule-strong: #c6ccd5;

    --you: #7aa2ff;
    --you-2: #b5cbff;
    --you-tint: #17223a;
    --btn: #2d66de;
    --btn-shadow: #0a1f4d;
    --selection: #5c4a00;

    --d-paper: #141920;
    --d-ink: #e9ecf0;
    --d-mute: #9aa3af;
    --d-neu: #8a929d;
    --d-you: #2d66de;
    --d-you2: #9dbbff;
    --d-foe: #f05a52;
    --d-foe2: #ff8f88;
    --d-hyd: #33c27a;
    --d-hyd2: #86e2b2;
    --d-ally: #a985ef;
    --d-ally2: #d2bdf8;
  }
}

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

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 1.125rem;
  line-height: 1.55;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

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

img {
  height: auto;
}

h1,
h2,
h3 {
  font-family: var(--f-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

b,
strong {
  font-weight: 700;
}

a {
  color: var(--you);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--you-2);
}

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

[hidden] {
  display: none !important;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 30;
  padding: 12px 16px;
  background: var(--btn);
  color: #fff;
  border-radius: var(--r-ui);
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

.skip:hover,
.skip:focus {
  color: #fff;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.i {
  width: 1.2em;
  height: 1.2em;
  flex: none;
  fill: currentColor;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand:hover {
  color: var(--ink);
}

.mark {
  width: 32px;
  height: 24px;
}

.mark rect {
  fill: var(--ink);
}

.mark line {
  stroke: var(--ground);
  stroke-width: 2.2;
  stroke-linecap: round;
}

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

.nav {
  display: flex;
  gap: clamp(4px, 2vw, 24px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 8px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--r-ui);
}

.nav a:hover {
  color: var(--you);
  text-decoration: underline;
}

/* small phones: the studio section is one scroll away, so its nav link steps aside */
@media (max-width: 519px) {
  .brand {
    font-size: 1.0625rem;
    gap: 8px;
  }
  .mark {
    width: 28px;
    height: 21px;
  }
  .nav {
    gap: 2px;
  }
  .nav a {
    padding-inline: 8px;
    font-size: 0.9375rem;
  }
  .nav-studio {
    display: none;
  }
}

@media (max-width: 339px) {
  .site-header .mark {
    display: none;
  }
}

/* ---------- buttons (the game's own: a solid shadow below, pressed it sinks) ---------- */

.btn {
  --press: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border: 2px solid transparent;
  border-radius: var(--r-ui);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transform: translateY(0);
  transition: transform 120ms var(--ease-out), box-shadow 120ms var(--ease-out), background-color 160ms ease;
}

.btn-primary {
  background: var(--btn);
  border-color: var(--btn-shadow);
  color: #fff;
  box-shadow: 0 var(--press) 0 var(--btn-shadow);
}

.btn-primary:hover {
  color: #fff;
  background: color-mix(in srgb, var(--btn) 88%, #000);
}

.btn-secondary {
  background: var(--you-tint);
  border-color: var(--you-2);
  color: var(--you-2);
  box-shadow: 0 var(--press) 0 var(--you-2);
}

.btn-secondary:hover {
  color: var(--you-2);
  background: color-mix(in srgb, var(--you-tint) 85%, var(--you));
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--btn-shadow);
}

.btn-secondary:active {
  box-shadow: 0 1px 0 var(--you-2);
}

.btn .i {
  width: 1.15em;
  height: 1.15em;
}

/* ---------- hero ---------- */

.hero {
  padding-block: clamp(28px, 5vw, 56px) clamp(56px, 7vw, 88px);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(32px, 4vw, 48px);
  align-items: center;
}

@media (min-width: 1024px) {
  .hero {
    min-height: calc(100svh - var(--header-h));
    display: grid;
    align-items: center;
  }
  .hero-grid {
    grid-template-columns: minmax(0, 11fr) minmax(0, 13fr);
  }
}

/* one sentence per line: the headline is two short statements */
h1 {
  font-size: clamp(2.5rem, 1.25rem + 3.3vw, 4.5rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

h1 .line {
  display: block;
}

.lede {
  margin-top: clamp(20px, 2.4vw, 28px);
  font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.375rem);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 34ch;
}

.lede strong {
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: clamp(28px, 3vw, 40px);
}

@media (max-width: 519px) {
  .actions {
    display: grid;
  }
  .sheet-bar {
    padding-left: 14px;
    padding-right: 10px;
  }
  .replay {
    padding-inline: 10px;
  }
}

/* ---------- drawing sheets ---------- */

.sheet {
  margin: 0;
  background: var(--sheet);
  border: 1.5px solid var(--rule-strong);
  position: relative;
}

/* inner frame line: the drawing border */
.sheet::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid var(--rule);
  pointer-events: none;
}

.sheet-bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 56px;
  padding: 8px 14px 8px 20px;
  border-bottom: 1px solid var(--rule);
  margin: 6px 6px 0;
}

.sheet-bar-title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.9375rem, 0.88rem + 0.25vw, 1.0625rem);
  white-space: nowrap;
}

.replay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  white-space: nowrap;
  border: 1.5px solid var(--you-2);
  border-radius: var(--r-ui);
  background: var(--you-tint);
  color: var(--you-2);
  font: 700 0.9375rem/1 var(--f-text);
  cursor: pointer;
  transition: transform 120ms var(--ease-out);
}

.replay:hover {
  background: color-mix(in srgb, var(--you-tint) 85%, var(--you));
}

.replay:active {
  transform: translateY(2px);
}

.replay:disabled {
  cursor: default;
  opacity: 0.55;
}

.turn {
  width: 100%;
  height: auto;
  padding: clamp(8px, 2vw, 16px) clamp(8px, 2vw, 20px) 0;
}

.key {
  position: relative;
  display: grid;
  gap: 10px 20px;
  margin: 0 6px 6px;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--rule);
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-2);
}

@media (min-width: 640px) {
  .key {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.key li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.key b {
  color: var(--ink);
}

.key-n,
.balloon-sm {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: var(--sheet);
  color: var(--ink);
  font: 700 0.875rem/1 var(--f-text);
}

/* ---------- drawing primitives (shared by every game drawing) ---------- */

.n-paper { fill: var(--d-paper); }
.f-ink { fill: var(--d-ink); }
.f-on { fill: #fff; }
.s-on { stroke: #fff; }
.s-ink { stroke: var(--d-ink); }
.s-neu { stroke: var(--d-neu); }
.f-neu { fill: var(--d-neu); }
.f-you { fill: var(--d-you); }
.s-you { stroke: var(--d-you); }
.s-you2 { stroke: var(--d-you2); }
.f-foe { fill: var(--d-foe); }
.s-foe2 { stroke: var(--d-foe2); }
.f-hyd { fill: var(--d-hyd); }
.s-hyd2 { stroke: var(--d-hyd2); }
.s-ally { stroke: var(--d-ally); }
.s-ally2 { stroke: var(--d-ally2); }

.drw .num {
  font-family: var(--f-num);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.drw .links line {
  stroke: var(--d-neu);
  stroke-width: 2.86;
  stroke-linecap: round;
  stroke-dasharray: 0.1 8;
}

.turn .labels text {
  font-family: var(--f-label);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-anchor: middle;
  fill: var(--d-mute);
  paint-order: stroke;
  stroke: var(--d-paper);
  stroke-width: 7px;
  stroke-linejoin: round;
}

/* a queued order is dashed; when it runs it turns solid in place (the game's convention) */
.ch-line {
  stroke-width: 7;
  stroke-linecap: butt;
  stroke-dasharray: 12 8;
}

.ch-line.is-open {
  stroke-dasharray: none;
}

.ch-head {
  transform-box: fill-box;
  transform-origin: center;
}

.agents circle {
  fill: var(--d-you);
  stroke: var(--d-paper);
  stroke-width: 1.5;
}

.callouts line {
  stroke: var(--d-ink);
  stroke-width: 1.4;
}

.callouts .tip {
  fill: var(--d-ink);
}

.callouts .balloon {
  fill: var(--d-paper);
  stroke: var(--d-ink);
  stroke-width: 1.6;
}

.callouts text {
  fill: var(--d-ink);
  font: 700 15px var(--f-text);
  text-anchor: middle;
}

.tag-taken text {
  font: 600 12px var(--f-label);
  letter-spacing: 0.06em;
}

.wave {
  fill: none;
  stroke-width: 3;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
}

/* the captured state is drawn but hidden until the turn plays */
.node-taken,
.tag-taken {
  opacity: 0;
}

.turn .node {
  transform-box: fill-box;
  transform-origin: center;
}

.turn.is-done .node-taken,
.turn.is-done .tag-taken {
  opacity: 1;
}

.turn.is-done [data-node="rogue"] {
  opacity: 0;
}

/* ---------- sections ---------- */

.section {
  padding-block: var(--section-y);
  border-top: 1px solid var(--rule);
}

h2 {
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.75rem);
  max-width: 18ch;
}

h3 {
  font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.75rem);
  line-height: 1.15;
}

.section-lede {
  margin-top: 20px;
  max-width: 56ch;
  font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  color: var(--ink-2);
}

/* reading axis: a dotted link down the page; each section's node is taken as you reach it */
.axis-node {
  display: none;
}

@media (min-width: 1360px) {
  .axis {
    position: relative;
  }
  .axis > .wrap {
    position: relative;
  }
  .axis > .wrap::before {
    content: "";
    position: absolute;
    left: calc(var(--gutter) - 34px);
    top: calc(-1 * var(--section-y));
    bottom: calc(-1 * var(--section-y));
    width: 3px;
    background-image: radial-gradient(circle, var(--d-neu) 1.4px, transparent 1.6px);
    background-size: 3px 8px;
    background-repeat: repeat-y;
  }
  .axis > .wrap::after {
    content: "";
    position: absolute;
    left: calc(var(--gutter) - 34px);
    top: 12px;
    bottom: calc(-1 * var(--section-y));
    width: 3px;
    background: var(--d-you);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 900ms var(--ease-out);
  }
  .axis.is-taken > .wrap::after {
    transform: scaleY(1);
  }
  .axis .axis-node {
    display: block;
    position: absolute;
    left: calc(var(--gutter) - 45px);
    top: 4px;
    width: 25px;
    height: 18px;
    border: 2px dashed var(--d-neu);
    border-radius: 4px;
    background: var(--d-paper);
    z-index: 1;
    transition: background-color 300ms ease, border-color 300ms ease;
  }
  .axis.is-taken .axis-node {
    border-style: solid;
    border-color: var(--d-you2);
    background: var(--d-you);
  }
  /* the last node: the link arrives from above and stops there */
  .axis-end.axis > .wrap::before,
  .axis-end.axis > .wrap::after {
    top: calc(-1 * var(--section-y));
    bottom: auto;
    height: calc(var(--section-y) + 12px);
  }
}

/* ---------- AI Swarm ---------- */

.game-intro {
  display: grid;
  gap: 24px;
  align-items: start;
  max-width: 900px;
}

@media (min-width: 720px) {
  .game-intro {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 32px;
  }
}

.app-icon {
  width: 104px;
  height: 104px;
  border-radius: 24px;
  border: 1.5px solid var(--rule);
  background: #fff;
}

@media (min-width: 720px) {
  .app-icon {
    width: 128px;
    height: 128px;
    border-radius: 28px;
  }
}

.intro-text {
  margin-top: 16px;
  max-width: 58ch;
  font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  color: var(--ink-2);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 10px 16px;
  border: 1.5px solid var(--you-2);
  border-radius: var(--r-ui);
  background: var(--you-tint);
  color: var(--you-2);
  font-size: 1rem;
}

.screens {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(68vw, 300px);
  gap: clamp(20px, 3vw, 40px);
  margin: clamp(48px, 6vw, 80px) calc(-1 * var(--gutter)) 0;
  padding: 0 var(--gutter) 24px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
}

@media (min-width: 1024px) {
  .screens {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 300px));
    justify-content: space-between;
    max-width: 1100px;
    margin-inline: auto;
    padding: 0;
    overflow: visible;
  }
  /* the campaign moves down the sheet: each later mission sits lower */
  .screen:nth-child(2) {
    margin-top: 72px;
  }
  .screen:nth-child(3) {
    margin-top: 144px;
  }
}

.screen {
  scroll-snap-align: start;
}

/* detail views: a balloon above each screen, with a leader down to its frame */
.screen figure {
  position: relative;
  margin: 0;
  padding-top: 44px;
}

.detail-mark {
  position: absolute;
  top: 0;
  left: 22px;
  width: 26px;
  height: 46px;
}

.detail-mark::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 26px;
  width: 1.5px;
  height: 18px;
  background: var(--d-ink);
  transform-origin: top;
}

.detail-mark::before {
  content: "";
  position: absolute;
  left: 9.75px;
  top: 41px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--d-ink);
  z-index: 1;
}

.screen img {
  width: 100%;
  border-radius: var(--r-screen);
  border: 2px solid var(--rule-strong);
  background: #fff;
  box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--you-2) 45%, transparent);
}

.screen figcaption {
  margin-top: 16px;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 30ch;
}

.screen figcaption b {
  color: var(--ink);
}

.note {
  margin-top: 32px;
  font-size: 0.9375rem;
  color: var(--mute);
}

@media (min-width: 1024px) {
  .note {
    max-width: 1100px;
    margin-inline: auto;
  }
}

/* ---------- how it plays ---------- */

.how-grid {
  display: grid;
  gap: clamp(32px, 5vw, 64px);
  margin-top: clamp(40px, 5vw, 64px);
  align-items: start;
}

@media (min-width: 1024px) {
  .how-grid {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.orders {
  display: grid;
  gap: 28px;
  margin: 0;
}

.order dt {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.375rem;
}

.order dd {
  margin: 8px 0 0 56px;
  color: var(--ink-2);
  max-width: 44ch;
}

.gi {
  width: 44px;
  height: 44px;
  padding: 9px;
  flex: none;
  color: #fff;
  background: var(--d-you);
  border: 2px solid var(--d-you2);
  border-radius: var(--r-ui);
}

.legend {
  padding: 28px clamp(20px, 3vw, 36px) 32px;
}

.sheet-title {
  font-size: 1.25rem;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.legend-cols {
  display: grid;
  gap: 8px 32px;
  margin-top: 8px;
}

@media (min-width: 640px) {
  .legend-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.legend-list li {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding-block: 12px;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink-2);
}

.legend-list b {
  color: var(--ink);
}

.sym {
  width: 52px;
  height: 52px;
}

.sym.side {
  height: 40px;
}

.campaign {
  display: grid;
  gap: 32px;
  margin-top: clamp(56px, 7vw, 96px);
  padding-top: clamp(32px, 4vw, 48px);
  border-top: 1px solid var(--rule);
}

@media (min-width: 1024px) {
  .campaign {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    align-items: end;
  }
}

.campaign-text p {
  margin-top: 14px;
  color: var(--ink-2);
  max-width: 44ch;
}

.chapters {
  display: grid;
  grid-template-columns: 3fr 4fr 3fr 3fr 2fr;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ch {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
}

.ticks {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}

.ticks i {
  height: 36px;
  border-radius: 4px;
  border: 2px solid var(--ch-stroke);
  background: var(--ch-fill);
}

.ch-1 { --ch-fill: var(--d-paper); --ch-stroke: var(--d-ink); }
.ch-2 { --ch-fill: var(--d-foe); --ch-stroke: var(--d-foe2); }
.ch-3 { --ch-fill: var(--d-hyd); --ch-stroke: var(--d-hyd2); }
.ch-4 { --ch-fill: var(--d-ally); --ch-stroke: var(--d-ally2); }
.ch-5 { --ch-fill: var(--d-you); --ch-stroke: var(--d-you2); }

.ch-name {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(0.875rem, 0.8rem + 0.35vw, 1.0625rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.ch-range {
  margin-top: -6px;
  font-size: 0.875rem;
  color: var(--mute);
}

@media (max-width: 639px) {
  .chapters {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .ch {
    grid-template-columns: 112px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
  }
  .ticks i {
    height: 26px;
  }
  .ch-range {
    margin-top: 0;
  }
}

/* ---------- studio: the title block closes the sheet ---------- */

.studio {
  padding-bottom: clamp(96px, 12vw, 160px);
}

.titleblock {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1.5px solid var(--rule-strong);
  background: var(--sheet);
}

.tb-main {
  padding: clamp(24px, 4vw, 48px);
}

.tb-main p {
  margin-top: 20px;
  max-width: 54ch;
  font-size: clamp(1.125rem, 1.05rem + 0.3vw, 1.25rem);
  color: var(--ink-2);
}

/* key plan: the hero's network again, small, after the turn */
.tb-plan {
  display: grid;
  align-content: center;
  gap: 12px;
  margin: 0;
  padding: clamp(16px, 3vw, 28px) clamp(16px, 3vw, 32px);
  border-top: 1px solid var(--rule);
}

.keyplan {
  width: 100%;
  max-width: 420px;
  justify-self: center;
}

.tb-plan figcaption {
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--mute);
  text-align: center;
}

.kp-ch {
  stroke-width: 7;
}

.tb-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1.5px solid var(--rule-strong);
}

.tb-cell {
  min-width: 0;
  padding: 16px clamp(16px, 2vw, 24px) 18px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.tb-fields .tb-cell:nth-child(2n) {
  border-right: 0;
}

.tb-fields .tb-cell:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.tb-fields dt {
  font-size: 0.875rem;
  color: var(--mute);
}

.tb-fields dd {
  margin: 4px 0 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.1875rem;
  line-height: 1.3;
}

.tb-contact {
  padding: clamp(24px, 4vw, 48px);
  border-top: 1.5px solid var(--rule-strong);
}

.tb-contact h3 {
  font-size: clamp(1.75rem, 1.3rem + 1.8vw, 2.75rem);
}

.tb-contact-lede {
  margin-top: 12px;
  max-width: 56ch;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.25rem);
  color: var(--ink-2);
}

@media (min-width: 1024px) {
  .titleblock {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .tb-main {
    border-right: 1.5px solid var(--rule-strong);
  }
  .tb-plan {
    border-top: 0;
  }
  .tb-fields {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tb-fields .tb-cell:nth-child(2n) {
    border-right: 1px solid var(--rule);
  }
  .tb-fields .tb-cell:nth-child(4n) {
    border-right: 0;
  }
  .tb-fields .tb-cell:nth-last-child(-n + 4) {
    border-bottom: 0;
  }
  .tb-contact {
    grid-column: 1 / -1;
  }
}

/* ---------- contact (inside the title block) ---------- */

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  margin-top: clamp(32px, 4vw, 48px);
}

/* the address is sized from the title block's own width so it always sits on one line */
.tb-contact {
  container-type: inline-size;
}

.email {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(1.75rem, 1rem + 4.2vw, 4.25rem);
  font-size: min(4.25rem, 9cqi);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-decoration-thickness: 3px;
  text-underline-offset: 0.16em;
  overflow-wrap: break-word;
}

.btn-copy .i-check {
  display: none;
}

.btn-copy.is-copied .i-copy {
  display: none;
}

.btn-copy.is-copied .i-check {
  display: block;
}

.copy-status {
  min-height: 1.6em;
  margin-top: 16px;
  font-size: 1rem;
  color: var(--mute);
}

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

.site-footer {
  border-top: 1.5px solid var(--rule-strong);
  padding-block: 32px 40px;
  font-size: 0.9375rem;
  color: var(--mute);
}

.footer-row {
  display: grid;
  gap: 16px;
  align-items: center;
}

@media (min-width: 900px) {
  .footer-row {
    grid-template-columns: auto 1fr auto;
    gap: 32px;
  }
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}

.footer-brand .mark {
  width: 26px;
  height: 20px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* ---------- document pages (privacy, 404) ---------- */

.doc {
  padding-block: clamp(40px, 6vw, 80px) var(--section-y);
}

.doc-sheet {
  max-width: 820px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 64px);
}

.doc h1 {
  font-size: clamp(2.5rem, 1.8rem + 3vw, 4rem);
  max-width: none;
}

.doc .doc-meta {
  margin-top: 16px;
  color: var(--mute);
  font-size: 1rem;
}

.doc h2 {
  margin-top: 48px;
  font-size: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
  max-width: none;
}

.doc h3 {
  margin-top: 28px;
  font-size: 1.25rem;
}

.doc p,
.doc ul {
  margin-top: 14px;
  max-width: 68ch;
}

.doc ul {
  padding-left: 1.25em;
}

.doc li + li {
  margin-top: 6px;
}

.doc li::marker {
  color: var(--d-you);
}

.toc {
  margin-top: 32px;
  padding: 20px 24px;
  border: 1px solid var(--rule);
  background: var(--ground);
}

.toc h2 {
  margin: 0;
  font-size: 1.125rem;
}

.toc ol {
  margin: 10px 0 0;
  padding-left: 1.4em;
  columns: 2 220px;
  column-gap: 32px;
  font-size: 1rem;
}

.toc li + li {
  margin-top: 4px;
}

.notfound {
  display: grid;
  gap: 24px;
  justify-items: start;
}

.notfound .sym-404 {
  width: 168px;
  height: auto;
}

.notfound p {
  max-width: 46ch;
  color: var(--ink-2);
}

/* ---------- motion ---------- */
/* Content is visible by default; motion only exists when the user allows it and JS is running. */

@media (prefers-reduced-motion: no-preference) {
  .reveal-hero {
    animation: rise 900ms var(--ease-out) both;
  }
  .reveal-hero:nth-child(2) { animation-delay: 90ms; }
  .reveal-hero:nth-child(3) { animation-delay: 180ms; }

  /* below the hero, nothing slides in: lines are plotted, the way a pen plotter draws a sheet */
  .legend .sym [pathLength],
  .kp-ch {
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 900ms var(--ease-out);
  }
  .js .legend:not(.is-in) .sym [pathLength],
  .js .titleblock:not(.is-in) .kp-ch {
    stroke-dashoffset: 1;
  }
  .legend-list li:nth-child(2) .sym [pathLength] { transition-delay: 90ms; }
  .legend-list li:nth-child(3) .sym [pathLength] { transition-delay: 180ms; }
  .legend-list li:nth-child(4) .sym [pathLength] { transition-delay: 270ms; }
  .legend-list li:nth-child(5) .sym [pathLength] { transition-delay: 360ms; }
  .kp-ch-2 { transition-delay: 240ms; }
  .kp-head {
    transition: opacity 300ms ease-out 700ms;
  }
  .js .titleblock:not(.is-in) .kp-head {
    opacity: 0;
  }

  .detail-mark::after {
    transition: transform 500ms var(--ease-out);
    transition-delay: var(--delay, 0ms);
  }
  .js .screen:not(.is-in) .detail-mark::after {
    transform: scaleY(0);
  }

  .js .ticks i {
    transform-origin: bottom;
    transition: transform 520ms var(--ease-out), opacity 520ms var(--ease-out);
    transition-delay: var(--delay, 0ms);
  }
  .js .campaign:not(.is-in) .ticks i {
    transform: scaleY(0.2);
    opacity: 0;
  }

  .turn .node-taken,
  .turn .tag-taken,
  .turn [data-node="rogue"] {
    transition: opacity 260ms var(--ease-out);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows high contrast / forced colours: keep the drawings readable */
@media (forced-colors: active) {
  .btn,
  .replay,
  .status {
    border: 2px solid ButtonText;
  }
  .sheet::before {
    border-color: CanvasText;
  }
}

@media print {
  .site-header,
  .replay,
  .btn-copy,
  .skip {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
