/* Sword & Soil manual: cover in night navy, pages in cool print white, bands from the game's UI frame. */
:root {
  --navy: #081f5a;
  --navy-deep: #0b143e;
  --sky: #1556b4;
  --plum: #4c1840;
  --plum-lift: #73314c;
  --frame: #5495c3;
  --frame-dark: #5172aa;
  --frame-light: #7bcbed;
  --peach: #fbb17c;
  --gold: #f1d18a;
  --gold-pale: #fde9a6;
  --ink: #1a141f;
  --ink-soft: #4a4152;
  --paper: #f4f6f8;
  --paper-edge: #dfe4ea;
  --grass: #3f8f3a;

  --display: "Pixelify Sans", "Silkscreen", ui-monospace, monospace;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;

  --step--1: clamp(0.84rem, 0.8rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  --step-2: clamp(1.7rem, 1.4rem + 1.3vw, 2.4rem);
  --gap: clamp(16px, 3vw, 32px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--navy-deep); }
body {
  margin: 0;
  background: var(--navy-deep);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold); color: var(--ink); }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
img.px, video.px { image-rendering: pixelated; }
.skip { position: absolute; left: -999px; color: var(--ink); background: var(--gold); }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--gold); padding: 8px 12px; }

/* ---------- top nav ---------- */
.topnav {
  max-width: 1400px; margin: 0 auto;
  padding: 14px var(--gap) 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px;
}
.topnav .home { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--gold); font: 600 var(--step-0)/1 var(--display); }
.topnav .home img { width: 32px; height: 32px; }
.topnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.topnav a { color: var(--gold); font: 500 var(--step-0)/1.2 var(--display); }
.topnav ul a { text-decoration: none; }
.topnav ul a:hover { text-decoration: underline; }

/* ---------- cover ---------- */
.cover {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding-inline: var(--gap);
  padding-block: clamp(16px, 3vw, 28px);
  color: var(--gold-pale);
  display: grid;
  gap: clamp(18px, 3vw, 28px);
  justify-items: center;
  text-align: center;
}
.cover-sheet {
  width: 100%;
  background: var(--navy);
  border: 6px solid var(--frame);
  box-shadow: 0 0 0 3px var(--ink), 0 18px 40px -12px rgb(0 0 0 / 0.6);
  padding: clamp(18px, 3vw, 30px) clamp(16px, 4vw, 48px);
  display: grid;
  gap: clamp(14px, 2vw, 20px);
  justify-items: center;
}
.title { width: calc(97px * 3); height: auto; }
.tagline { margin: 0; font: 500 var(--step-1)/1.3 var(--display); color: var(--gold); text-wrap: balance; max-width: 36ch; }
.plate {
  width: min(100%, 368px);
  aspect-ratio: 1;
  border: 4px solid var(--ink);
  box-shadow: 0 0 0 4px var(--frame-light);
  background: var(--ink);
}
.plate video, .plate img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-copy { display: grid; gap: clamp(14px, 2vw, 20px); justify-items: center; width: 100%; min-width: 0; }
.band {
  width: calc(100% + 2 * clamp(16px, 4vw, 48px));
  background: var(--plum);
  border-block: 4px solid var(--peach);
  padding-block: 10px;
  font: 500 var(--step-0)/1.3 var(--display);
  color: var(--gold);
  letter-spacing: 0.02em;
}
.actions { display: grid; gap: 12px; width: min(100%, 520px); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font: 600 var(--step-1)/1 var(--display);
  padding: 16px 22px;
  background: var(--gold);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: inset 0 -5px 0 #c9a45a, 0 6px 14px -6px rgb(0 0 0 / 0.5);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--gold-pale); }
.btn:active { box-shadow: inset 0 3px 0 #c9a45a; }
.btn small { font: 400 var(--step--1)/1 var(--body); }

.signup { display: grid; gap: 8px; text-align: left; }
.signup label { font: 500 var(--step--1)/1.3 var(--display); color: var(--gold-pale); }
.signup .row { display: flex; gap: 8px; flex-wrap: wrap; }
.signup input[type="email"] {
  flex: 1 1 200px; min-width: 0;
  font: 400 var(--step-0)/1.2 var(--body);
  padding: 13px 14px;
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  caret-color: var(--plum);
}
.signup input::placeholder { color: var(--ink-soft); }
.signup button {
  font: 600 var(--step-0)/1 var(--display);
  padding: 13px 18px;
  background: var(--frame);
  color: var(--ink);
  border: 3px solid var(--ink);
  cursor: pointer;
}
.signup button:hover { background: var(--frame-light); }
.signup button[disabled] { opacity: 0.6; cursor: progress; }
.signup .note { margin: 0; font-size: var(--step--1); color: var(--frame-light); min-height: 1.6em; }
.signup .note[data-state="error"] { color: var(--peach); }
.signup .note[data-state="done"] { color: var(--gold); }
.page .signup label { color: var(--ink); }
.page .signup .note { color: var(--ink-soft); }
.page .signup .note[data-state="error"] { color: #9b2c3c; }
.page .signup .note[data-state="done"] { color: #2b6a27; }

.maker { justify-content: center; display: flex; align-items: center; gap: 10px; margin: 0; font-size: var(--step--1); color: var(--frame-light); }
.maker img { width: 32px; height: 32px; }

/* ---------- booklet ---------- */
.booklet { max-width: 1180px; margin: 0 auto; padding-inline: var(--gap); padding-block: 0 clamp(32px, 6vw, 72px); display: grid; gap: clamp(28px, 5vw, 56px); }
.spread {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--paper);
  box-shadow: 0 20px 40px -18px rgb(0 0 0 / 0.7);
  position: relative;
}
.page {
  position: relative;
  padding: clamp(22px, 4vw, 44px) clamp(18px, 4vw, 44px) 56px;
  display: grid; gap: 18px; align-content: start;
  min-width: 0;
}
.page + .page { border-top: 2px dashed var(--paper-edge); }
.folio { position: absolute; bottom: 18px; font: 500 var(--step--1)/1 var(--display); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.page:nth-child(odd) .folio { left: clamp(18px, 4vw, 44px); }
.page:nth-child(even) .folio { right: clamp(18px, 4vw, 44px); }

@media (min-width: 900px) {
  .title { width: calc(97px * 5); }
  .spread { grid-template-columns: 1fr 1fr; }
  .page + .page { border-top: 0; }
  .spread::before {
    /* centre gutter */
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-1px);
    background: linear-gradient(to right, transparent, rgb(0 0 0 / 0.08));
    box-shadow: 0 0 22px 6px rgb(0 0 0 / 0.06);
  }
}

.page h1, .page h2 {
  margin: 0;
  justify-self: start;
  font: 600 var(--step-2)/1.1 var(--display);
  color: var(--gold);
  background: var(--plum);
  padding: 10px 18px 12px;
  border: 4px solid var(--frame);
  box-shadow: 0 0 0 3px var(--ink);
  text-wrap: balance;
  letter-spacing: 0.01em;
}
.page h3 { margin: 0; font: 600 var(--step-1)/1.2 var(--display); color: var(--plum); }
.page p { margin: 0; max-width: 62ch; }
.lede { font-size: var(--step-1); line-height: 1.45; }
.shot { margin: 0; display: grid; gap: 8px; }
.shot img, .shot video { width: 100%; height: auto; display: block; border: 3px solid var(--ink); background: var(--ink); }
.shot figcaption { font-size: var(--step--1); color: var(--ink-soft); }

/* controls diagram */
.controls { display: grid; gap: 14px; }
.screen { position: relative; border: 3px solid var(--ink); }
.screen img { display: block; width: 100%; height: auto; }
.callout {
  position: absolute; transform: translate(-50%, -50%);
  width: 44px; height: 44px;
  border: 3px solid var(--gold);
  box-shadow: 0 0 0 2px var(--ink);
  opacity: 0; transition: opacity 180ms ease-out, transform 220ms cubic-bezier(.2,.8,.2,1);
  pointer-events: none;
}
.callout.wide { width: 46%; height: 13%; }
.callout.bar { width: 22%; height: 7%; }
.callout.on { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
.keys { display: flex; flex-wrap: wrap; gap: 8px; }
.key {
  font: 600 var(--step--1)/1 var(--display);
  min-width: 46px; padding: 10px 12px;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: inset 0 -4px 0 var(--paper-edge);
  cursor: pointer;
}
.key[aria-pressed="true"] { background: var(--gold); box-shadow: inset 0 -4px 0 #c9a45a; }
.key-caption { margin: 0; min-height: 3.2em; font-size: var(--step-0); }
.key-caption b { font-family: var(--display); font-weight: 600; color: var(--plum); }

/* loop */
.loop { list-style: none; margin: 0; padding: 0; display: grid; gap: 24px 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 326px), 1fr)); }
.loop li { display: grid; gap: 10px; align-content: start; min-width: 0; }
.loop li img { width: 326px; max-width: 100%; height: auto; border: 3px solid var(--ink); }
.loop h3 { font-size: calc(var(--step-0) * 1.25); }

/* features and classes */
.features { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; max-width: 62ch; }
.features li::marker { color: var(--plum); }
.classes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px 32px; }
.classes li { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; }
.classes .sprite { width: 112px; height: 112px; display: grid; place-items: center; background: #9fd36b; border: 3px solid var(--ink); }
.classes .sprite img { image-rendering: pixelated; }
.classes li > div { display: grid; gap: 4px; }
.classes .move { font-size: var(--step--1); }
.key-more { margin: 0; font-size: var(--step--1); color: var(--ink-soft); }

/* back cover */
.back {
  max-width: 1180px; margin: 0 auto;
  padding-inline: var(--gap); padding-block: 8px 48px;
  color: var(--gold-pale);
  display: grid; gap: 18px; justify-items: center; text-align: center;
}
.back img.mark { width: 128px; height: 128px; }
.back nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: center; }
.back a { color: var(--gold); font-family: var(--display); }
.back small { color: var(--frame-light); }

/* press page */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.facts dt { font-family: var(--display); font-weight: 600; color: var(--plum); }
.facts dd { margin: 0; min-width: 0; }
.downloads { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.thumbs a { display: block; border: 3px solid var(--ink); }
.thumbs img { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .callout { transition: none; }
}

/* clip at 1 game pixel per CSS pixel */
.shot.clip video { width: 366px; max-width: 100%; aspect-ratio: 1; }

/* fold-out pages: one wide page */
.foldout { grid-template-columns: 1fr; }
.foldout::before { display: none; }
.controls { align-items: start; grid-template-columns: minmax(0, 1fr); }
.screen { width: 646px; max-width: 100%; }
.screen img { width: 100%; }

/* heading panels carry the peach corners of the game frame */
.page h1, .page h2 {
  background:
    linear-gradient(var(--peach), var(--peach)) top left / 8px 8px no-repeat,
    linear-gradient(var(--peach), var(--peach)) top right / 8px 8px no-repeat,
    linear-gradient(var(--peach), var(--peach)) bottom left / 8px 8px no-repeat,
    linear-gradient(var(--peach), var(--peach)) bottom right / 8px 8px no-repeat,
    var(--plum);
}

@media (min-width: 1000px) {
  .controls { grid-template-columns: auto minmax(0, 1fr); gap: 28px; }
  .cover-sheet { grid-template-columns: 368px minmax(0, 1fr); align-items: center; column-gap: 40px; }
  .title { width: calc(97px * 4); }
  .cover-copy .band { width: 100%; border: 4px solid var(--peach); border-inline-width: 0; }
}
@media (min-width: 1440px) {
  .cover-sheet { grid-template-columns: 728px minmax(0, 1fr); }
  .plate { width: 728px; }
  .title { width: calc(97px * 4); }
}

/* control chart: printed legend, numbered to the screen callouts */
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: key; }
.legend li { display: grid; grid-template-columns: 1.7em 7.5em 1fr; gap: 10px; align-items: center; counter-increment: key; }
.legend li::before {
  content: counter(key); display: grid; place-items: center; width: 1.6em; height: 1.6em;
  font: 600 var(--step--1)/1 var(--display); background: var(--plum); color: var(--gold); border: 2px solid var(--ink);
}
.legend .key { justify-self: start; }
.callout::before {
  content: attr(data-n); position: absolute; top: -14px; left: -14px; width: 24px; height: 24px;
  display: grid; place-items: center; font: 600 13px/1 var(--display);
  background: var(--plum); color: var(--gold); border: 2px solid var(--ink);
}

/* loop as a numbered cycle */
.loop { counter-reset: step; row-gap: 56px; }
.loop li { position: relative; counter-increment: step; }
.loop h3::before {
  content: counter(step); display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; margin-right: 8px;
  background: var(--plum); color: var(--gold); border: 2px solid var(--ink); font-size: 0.85em; vertical-align: 0.1em;
}
.loop li::after {
  content: ""; position: absolute; width: 44px; height: 22px; background: var(--plum-lift);
  clip-path: polygon(0 32%, 62% 32%, 62% 0, 100% 50%, 62% 100%, 62% 68%, 0 68%);
  left: 24px; bottom: -40px; transform: rotate(90deg);
}
.loop li:last-child::after { display: none; }
.loop-return {
  display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 600; color: var(--plum);
}
.loop-return::before {
  content: ""; flex: none; width: 44px; height: 22px; background: var(--plum-lift);
  clip-path: polygon(0 32%, 62% 32%, 62% 0, 100% 50%, 62% 100%, 62% 68%, 0 68%); transform: rotate(-90deg);
}
@media (min-width: 900px) {
  .loop { grid-template-columns: 326px 326px; column-gap: 96px; justify-content: start; }
  .loop li:nth-child(3) { grid-column: 2; grid-row: 2; }
  .loop li:nth-child(4) { grid-column: 1; grid-row: 2; }
  .loop li:nth-child(1)::after { left: auto; right: -72px; bottom: auto; top: 80px; transform: none; }
  .loop li:nth-child(2)::after { left: 140px; }
  .loop li:nth-child(3)::after { left: -72px; bottom: auto; top: 80px; transform: rotate(180deg); }
  .loop li:nth-child(4)::after { display: block; left: 140px; bottom: auto; top: -40px; transform: rotate(-90deg); }
  .loop-return::before { display: none; }
}

/* band holds its two parts on separate lines when it must wrap */
.band { text-wrap: balance; }
@media (min-width: 1000px) {
  .band span:not(.sep) { white-space: nowrap; display: inline-block; }
  .cover-copy .band { padding-inline: 16px; }
}
@media (min-width: 1440px) {
  .band .sep { display: none; }
  .band span:not(.sep) { display: block; }
}

/* phones: title and tagline before the plate, as on the cover */
@media (max-width: 999px) {
  .cover-copy { display: contents; }
  .cover-copy h1 { order: -2; }
  .cover-copy .tagline { order: -1; }
}

/* folios clear the corner registration marks */
.folio { bottom: 26px; }
.page:nth-child(odd) .folio { left: max(30px, clamp(18px, 4vw, 44px)); }
.page:nth-child(even) .folio { right: max(30px, clamp(18px, 4vw, 44px)); }
.foldout .page .folio { left: max(30px, clamp(18px, 4vw, 44px)); right: auto; }
.mac-note { margin: 0; font-size: var(--step--1); color: var(--frame-light); max-width: 52ch; }

/* key art hero */
.hero { position: relative; max-width: 1400px; margin: 14px auto 0; padding-inline: var(--gap); }
.hero picture { display: block; border: 6px solid var(--frame); box-shadow: 0 0 0 3px var(--ink), 0 18px 40px -12px rgb(0 0 0 / 0.6); background: var(--ink); }
.hero-art { display: block; width: 100%; height: auto; }
.hero-logo { margin: 14px auto 0; width: 280px; }
/* phones: the logo sits under the art so it never covers the kid */
.hero-logo img { display: block; width: 100%; height: auto; filter: drop-shadow(0 6px 10px rgb(0 0 0 / 0.55)); }
@media (min-width: 700px) {
  .hero-logo { position: absolute; margin: 0; right: calc(var(--gap) + 5%); width: 350px; top: 9%; }
}
@media (min-width: 1100px) { .hero-logo { width: 420px; } }
/* logo at whole-number scales of its 70 x 38 native size: 4x, 5x, 6x */
