/* ============================================================
   spareleg games studio
   Two-colour print: cream paper, ink black, one riso red.
   Palette taken from the logo's own background rect (#f4f1e8),
   not picked by eye.
   ============================================================ */

:root {
  --paper:      #f4f1e8;
  --ink:        #12100c;
  --ink-soft:   #4a4438;
  --ink-faint:  #b3aa96;
  --red:        #d8452f;
  --rule:       rgba(18, 16, 12, 0.22);
  --rule-hair:  rgba(18, 16, 12, 0.13);

  --mark-filter: none;
  --grain:       0.055;

  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --body:    "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1rem, 5vw, 6rem);
  --measure: 34rem;
}

/* Inverting the press rather than dimming the page. The mark is a black
   SVG, so it flips with a filter instead of shipping a second file. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:     #14120e;
    --ink:       #f0ece1;
    --ink-soft:  #b0a996;
    --ink-faint: #5b5445;
    --red:       #ef6b52;
    --rule:      rgba(240, 236, 225, 0.24);
    --rule-hair: rgba(240, 236, 225, 0.13);
    --mark-filter: invert(1);
    --grain: 0.085;
  }
}

:root[data-theme="dark"] {
  --paper:     #14120e;
  --ink:       #f0ece1;
  --ink-soft:  #b0a996;
  --ink-faint: #5b5445;
  --red:       #ef6b52;
  --rule:      rgba(240, 236, 225, 0.24);
  --rule-hair: rgba(240, 236, 225, 0.13);
  --mark-filter: invert(1);
  --grain: 0.085;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* The paper. Without this the page reads as a screen; with it, as a print. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; height: auto; }

.tracked {
  font-family: var(--body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.muted { color: var(--ink-soft); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 10000;
}
.skip:focus { left: 0; }

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

/* ─────────────────────────── links ─────────────────────────── */

a { color: inherit; }

.link {
  text-decoration: none;
  background-image: linear-gradient(var(--red), var(--red));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 100%;
  padding-bottom: 1px;
  transition: background-size 0.25s ease, color 0.25s ease;
}
.link:hover {
  color: var(--red);
  background-size: 100% 2px;
}

/* ───────────────────────── masthead ───────────────────────── */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.6rem var(--gutter);
  border-bottom: 1px solid var(--rule);
}

.masthead__brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
}

.masthead__mark {
  width: 40px;
  height: auto;
  filter: var(--mark-filter);
}

.masthead__name {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

/* The drawn wordmark, now that it exists as its own file. Height-driven
   so it always sits right against the mark regardless of its aspect. */
.masthead__wordmark {
  display: block;
  height: 1.3rem;
  width: auto;
  filter: var(--mark-filter);
}

.theme-toggle {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 0 0 2px;
  margin: 0;
  color: var(--ink-faint);
  cursor: pointer;
  font: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover { color: var(--red); border-bottom-color: var(--red); }

.masthead__name .tracked {
  font-size: 0.6rem;
  color: var(--ink-soft);
  letter-spacing: 0.26em;
}

.masthead__nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2.25rem);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.masthead__nav a {
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.masthead__nav a:hover { border-bottom-color: var(--red); color: var(--red); }

/* ─────────────────────────── hero ─────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(3.5rem, 9vw, 7.5rem) var(--gutter) clamp(3rem, 7vw, 6rem);
  border-bottom: 1px solid var(--rule);
}

.eyebrow {
  color: var(--red);
  margin: 0 0 1.5rem;
}

.hero__line {
  font-family: var(--display);
  font-weight: 400;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 120;
  font-size: clamp(2.75rem, 7.5vw, 5.75rem);
  line-height: 0.99;
  letter-spacing: -0.026em;
  margin: 0 0 1.75rem;
}

.hero__line em {
  font-style: italic;
  font-variation-settings: "SOFT" 60, "WONK" 1;
}

.hero__blurb {
  max-width: var(--measure);
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0 0 2rem;
}

.hero__meta { margin: 0; }
.hero__meta .link { color: var(--ink); }

.hero__figure {
  margin: 0;
  text-align: center;
}

.hero__figure img {
  width: min(100%, 30rem);
  filter: var(--mark-filter);
}

.hero__figure figcaption {
  margin-top: 1.25rem;
  color: var(--ink-faint);
  font-size: 0.62rem;
}

/* A slow idle hop — the creature is drawn mid-stride, so it should not
   sit perfectly still. Small enough to notice only if you look. */
.hopper {
  animation: hop 5.5s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  transform-origin: 50% 92%;
}

@keyframes hop {
  0%, 62%, 100% { transform: translateY(0) rotate(0deg); }
  70%           { transform: translateY(-1.4%) rotate(-0.7deg); }
  80%           { transform: translateY(-0.2%) rotate(0.25deg); }
  88%           { transform: translateY(-0.5%) rotate(0deg); }
}

/* ────────────────────────── sections ────────────────────────── */

.section {
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.section--last { border-bottom: 0; }

.section__title {
  color: var(--ink-faint);
  margin: 0 0 clamp(2rem, 4vw, 3rem);
}

.section__note {
  max-width: var(--measure);
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  color: var(--ink-faint);
  font-size: 0.95rem;
  font-style: italic;
}

/* ─────────────────────── catalogue entry ─────────────────────── */

.entry {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--rule-hair);
}

/* Wide screens get a true catalogue: number, entry, and the standing
   details opposite. Otherwise the right half is just empty paper. */
@media (min-width: 1100px) {
  .entry { grid-template-columns: 4.5rem minmax(0, 1fr) 15rem; }
  .entry__meta { padding-top: 0.6rem; }
}
.entry + .entry { margin-top: 3rem; }

.entry__num {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--red);
  margin: 0.15rem 0 0;
  font-variant-numeric: tabular-nums;
}

.entry__title {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 90;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

.entry__lead {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--ink);
  margin: 0 0 1.4rem;
  max-width: var(--measure);
}

.entry__copy {
  max-width: var(--measure);
  margin: 0 0 2rem;
  color: var(--ink-soft);
}

.entry__facts {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  max-width: 44rem;
}
.entry__facts li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule-hair);
  font-size: 0.95rem;
}
.facts__k {
  color: var(--ink-faint);
  font-size: 0.6rem;
}

.entry__meta { margin: 0; }

.entry__status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
  color: var(--ink-soft);
}

.entry__platform {
  margin: 0;
  color: var(--ink-faint);
}
.entry__status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}

/* ─────────────────────────── prose ─────────────────────────── */

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.25rem; }
.prose p:last-child { margin-bottom: 0; }

/* ─────────────────────────── footer ─────────────────────────── */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: clamp(3rem, 7vw, 5rem) var(--gutter) clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--rule);
  text-align: center;
}

/* Rebuilt from the clean parts rather than the lockup file, which bakes in
   a cream card - that card would have to be inverted wholesale in dark mode
   and would sit as a bright tile on a dark page. */
.footer__lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}
.footer__lockup img { filter: var(--mark-filter); }
.footer__lockup img:first-child { width: 96px; height: auto; }
.footer__lockup img:nth-child(2) { width: 168px; height: auto; }
.footer__lockup p { color: var(--ink-faint); letter-spacing: 0.3em; }

.footer p { margin: 0; font-size: 0.62rem; }
.footer__links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer__links a { color: var(--ink-soft); text-decoration: none; }
.footer__links a:hover { color: var(--red); }

/* Catalogue entries that have their own page. */
.entry__titlelink { text-decoration: none; transition: color 0.2s ease; }
.entry__titlelink:hover { color: var(--red); }
.entry__more { margin: 0 0 2rem; font-size: 0.95rem; }
/* Links inside key/value rows hug their text instead of stretching the grid cell. */
.entry__facts a { justify-self: start; }

/* ───────────────────────── game pages ─────────────────────────
   The studio wrapper stays the same print; the game's own art sits
   inside it as plates, the way a catalogue reproduces a painting. */

.crumb {
  margin: 0 0 1.5rem;
  color: var(--ink-faint);
}
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--red); }

.game-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) clamp(3rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--rule);
}

.game-hero__id {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0 0 1.5rem;
}
.game-hero__icon {
  width: 72px;
  height: 72px;
  border-radius: 22%;
  flex: none;
}
.game-hero__title {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 120;
  font-size: clamp(2.6rem, 6.5vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  margin: 0;
}

.game-hero__status {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
  color: var(--ink-soft);
}
.game-hero__status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex: none;
}

/* A plate: the game's image printed on the page, a hairline around it
   and a small caption underneath. No shadow, no rounding. */
.plate { margin: 0; }
.plate img {
  display: block;
  width: 100%;
  border: 1px solid var(--rule);
  background: #0a0f1c;
}
.plate figcaption {
  margin-top: 0.7rem;
  color: var(--ink-faint);
  font-size: 0.6rem;
}

/* Screenshots: a single row of six on wide screens, a swipeable strip below. */
.shots {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.6vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.prose + .entry__facts { margin-top: 2rem; }
.prose + .ledger { margin-top: 2.5rem; }

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 52rem;
}
.ledger li {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule-hair);
}
.ledger li:last-child { border-bottom: 1px solid var(--rule-hair); }
.ledger__k {
  font-family: var(--display);
  font-size: 1.2rem;
  line-height: 1.3;
  font-variation-settings: "SOFT" 30, "WONK" 1;
}
.ledger p { margin: 0; }
.ledger__fact {
  margin-top: 0.4rem !important;
  color: var(--ink-soft);
  font-family: var(--display);
  font-style: italic;
}

.kit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.kit h3 {
  margin: 0 0 1rem;
  color: var(--ink-faint);
}
.kit .entry__facts { margin: 0; }
.downloads {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
}
.downloads li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--rule-hair);
  font-size: 0.95rem;
}
.downloads li:last-child { border-bottom: 1px solid var(--rule-hair); }
.downloads .muted { white-space: nowrap; font-size: 0.85rem; }

/* Long-form pages such as the privacy policy. */
.policy { max-width: 40rem; }
.policy h1 {
  font-family: var(--display);
  font-weight: 600;
  font-variation-settings: "SOFT" 30, "WONK" 1, "opsz" 90;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}
.policy h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.25;
  margin: 2.5rem 0 0.6rem;
}
.policy p, .policy li { margin: 0 0 1rem; }
.policy ul { padding-left: 1.2rem; margin: 0 0 1rem; }

/* ───────────────────────── responsive ───────────────────────── */

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .hero__figure { order: -1; }
  .hero__figure img { width: min(76%, 20rem); }

  .game-hero { grid-template-columns: 1fr; }
  .kit { grid-template-columns: 1fr; }

  /* Six portraits won't fit across; let them run as a strip you swipe. */
  .shots {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    padding-bottom: 0.75rem;
  }
  .shots li {
    flex: 0 0 min(44vw, 15rem);
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  :root { --gutter: 1rem; }

  .shots li { flex-basis: 62vw; }
  .ledger li { grid-template-columns: 1fr; gap: 0.35rem; }
  .game-hero__icon { width: 60px; height: 60px; }

  .masthead { padding-top: 1.1rem; padding-bottom: 1.1rem; }
  .masthead__nav { width: 100%; justify-content: space-between; align-items: center; }

  .entry { grid-template-columns: 1fr; gap: 0.5rem; }
  .entry__num { font-size: 1.1rem; }
  .entry__facts li { grid-template-columns: 1fr; gap: 0.2rem; }
}

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

@media print {
  body::after, .masthead__nav { display: none; }
  body { background: #fff; color: #000; }
}
