/* NO_OP_ — two colours, always. Everything else is space. */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/JetBrainsMono-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('assets/JetBrainsMono-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #000000;
  --quiet: rgba(0, 0, 0, 0.55);
  --faint: rgba(0, 0, 0, 0.14);
  --cell: 30px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --ink: #ffffff;
    --quiet: rgba(255, 255, 255, 0.55);
    --faint: rgba(255, 255, 255, 0.16);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 28px;
}

section {
  padding: 96px 0;
  border-top: 1px solid var(--faint);
}

section:first-of-type {
  border-top: 0;
}

h1,
h2,
h3 {
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
}

h2 {
  font-size: 15px;
  text-transform: uppercase;
  color: var(--quiet);
  margin-bottom: 34px;
}

h3 {
  font-size: 15px;
  letter-spacing: 0.14em;
}

p {
  margin: 0 0 18px;
  max-width: 62ch;
}

.quiet {
  color: var(--quiet);
}

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

.hero {
  min-height: 92vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 52px;
  padding: 120px 0 96px;
}

.wordmark {
  font-size: clamp(44px, 11vw, 82px);
  letter-spacing: 0.08em;
  line-height: 1;
}

/* The trailing underscore is a terminal cursor, so it blinks like one. */
.cursor {
  animation: blink 1.06s steps(1, end) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.tagline {
  font-size: clamp(17px, 2.6vw, 21px);
  line-height: 1.5;
  max-width: 30ch;
  margin: 0;
}

.hero-layout {
  display: flex;
  gap: 64px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- the live board ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-auto-rows: var(--cell);
  flex-shrink: 0;
}

.board .c {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.54);
  line-height: 1;
  /* Unselected cells draw no background and no border: the only ink is the digit. */
  background: transparent;
  transition: background-color 90ms linear, color 90ms linear;
}

/* Selection is a straight inversion, square cornered and gapless, so adjacent
   selected cells merge into one solid polygon. */
.board .c.on {
  background: var(--ink);
  color: var(--bg);
}

/* Survivors slide from where their digit came from; the transform is driven from script so
   the distance can differ per cell, exactly as it does in the app. */

/* ---------- modes ---------- */

.modes {
  display: grid;
  gap: 40px;
}

.mode-name {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 8px;
}

.mode-name .meta {
  font-size: 13px;
  color: var(--quiet);
  letter-spacing: 0.04em;
}

/* ---------- principles ---------- */

.rules {
  display: grid;
  gap: 30px;
}

.rule h3 {
  margin-bottom: 6px;
}

.rule p {
  margin: 0;
  color: var(--quiet);
}

/* ---------- themes ---------- */

.themes {
  display: flex;
  gap: 40px;
  align-items: center;
  flex-wrap: wrap;
}

.themes img {
  width: 240px;
  height: auto;
  border: 1px solid var(--faint);
  flex-shrink: 0;
}

.themes p:last-child {
  margin-bottom: 0;
}

/* ---------- screens ---------- */

.screens {
  display: flex;
  gap: 26px;
  flex-wrap: wrap;
  justify-content: center;
}

.screens img {
  width: 210px;
  height: auto;
  border: 1px solid var(--faint);
}

/* Device captures are theme specific: show whichever matches the page. */
.only-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .only-light {
    display: none;
  }
  .only-dark {
    display: inline;
  }
}

/* ---------- share card ---------- */

.card {
  border: 1px solid var(--faint);
  padding: 24px 26px;
  display: inline-block;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre;
  letter-spacing: 0.06em;
}

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

footer {
  border-top: 1px solid var(--faint);
  padding: 56px 0 90px;
  color: var(--quiet);
  font-size: 13px;
}

footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--faint);
}

.footer-links {
  margin-top: 22px;
  margin-bottom: 0;
}

.icon {
  width: 62px;
  height: 62px;
  border: 1px solid var(--faint);
  margin-bottom: 22px;
  display: block;
}

@media (max-width: 640px) {
  :root {
    --cell: 22px;
  }
  section {
    padding: 72px 0;
  }
  .hero {
    min-height: auto;
    gap: 44px;
  }
  .hero-layout {
    gap: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
  .board .c {
    animation: none;
    transition: none;
  }
}
