/* Ferris' Forge website: the game's wood-and-parchment palette, as a page. */

:root {
  --font-pixel: "Pixelify Sans", "VT323", ui-monospace, monospace;
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-code: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo,
    monospace;

  /* Ferris' own colors, from sprites.js. */
  --ferris: #f2601c;
  --ferris-hi: #ff9a52;
  --ferris-shadow: #c13f0d;
  --ferris-outline: #4a1607;

  /* The code panels are dark wood in both themes, like the game's editor. */
  --code-bg: #2a1c15;
  --code-bar: #36251b;
  --code-line: #57392a;
  --code-text: #f3e2c3;
  --code-dim: #b49a7c;
  --tok-kw: #ff9a52;
  --tok-fn: #ffd54a;
  --tok-ty: #8fd3f5;
  --tok-str: #a6dc7c;
  --tok-num: #f5a6c8;
  --tok-mac: #c9a2ff;

  --good: #4caf50;
  --good-dark: #2e7d32;
  --bad: #e2533b;
  --bad-dark: #9e2b1a;
  --gold: #ffd54a;

  --step: 3px;
  --radius: 0;
  --container: 1120px;
  --nav-h: 56px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fff2cf;
  --bg-deep: #fbe0a6;
  --surface: #fff8e4;
  --surface-2: #fbe0a6;
  --ink: #3b1d0b;
  --ink-soft: #6b3a1a;
  --line: #4a2410;
  --line-soft: #c99a5b;
  --shadow: #9a5228;
  --accent: #c13f0d;
  --accent-bg: #f2601c;
  --link: #a33508;
  --mark: #ffd54a;
  --sky-top: #8fd3f5;
  --sky-bottom: #d8f1ff;
  --sea: #3f8fd2;
  --sand: #f5c46b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1f150f;
  --bg-deep: #170f0a;
  --surface: #2a1c15;
  --surface-2: #36251b;
  --ink: #f3e2c3;
  --ink-soft: #d8b98d;
  --line: #57392a;
  --line-soft: #4a3123;
  --shadow: #0f0905;
  --accent: #ff9a52;
  --accent-bg: #f2601c;
  --link: #ffb37a;
  --mark: #8a5a12;
  --sky-top: #1b2a4a;
  --sky-bottom: #3a3a6a;
  --sea: #1d4e7a;
  --sand: #8a6233;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-pixel);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin: 0 0 0.5em;
}

h2:focus {
  outline: none;
}

a {
  color: var(--link);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

code {
  font-family: var(--font-code);
  font-size: 0.86em;
  background: var(--surface-2);
  padding: 0.05em 0.35em;
  border-radius: 2px;
}

pre {
  margin: 0;
  overflow-x: auto;
}

pre code {
  display: block;
  background: none;
  padding: 0;
  font-size: 14.5px;
  line-height: 1.65;
}

kbd {
  font-family: var(--font-pixel);
  font-size: 0.85em;
  min-width: 1.6em;
  display: inline-grid;
  place-items: center;
  padding: 0 0.3em;
  color: var(--ink);
  background: var(--surface);
  border: 2px solid var(--line);
  border-bottom-width: 4px;
}

mark {
  background: linear-gradient(
    transparent 58%,
    var(--mark) 58%,
    var(--mark) 92%,
    transparent 92%
  );
  color: inherit;
  padding: 0 0.1em;
}

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

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

.container {
  width: min(100% - 48px, var(--container));
  margin-inline: auto;
}

.narrow {
  --container: 780px;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 8px 16px;
  background: var(--surface);
  border: var(--step) solid var(--line);
}

.skip-link:focus {
  top: 16px;
}

/* ---------- Pixel buttons ---------- */

.button,
.copy-button,
.step-selector button,
.theme-switch {
  font: 600 16px/1 var(--font-pixel);
  color: var(--ink);
  background: var(--surface);
  border: var(--step) solid var(--line);
  box-shadow: inset 0 -4px 0 var(--surface-2);
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 80ms ease;
}

.button:hover:not(:disabled),
.copy-button:hover,
.step-selector button:hover,
.theme-switch:hover {
  transform: translateY(-2px);
}

.button:active:not(:disabled),
.step-selector button:active {
  transform: translateY(1px);
  box-shadow: none;
}

.button {
  background: var(--accent-bg);
  color: #fff8ec;
  box-shadow: inset 0 -4px 0 var(--ferris-shadow);
  text-shadow: 0 2px 0 var(--ferris-outline);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---------- Header and page navigation ---------- */

.site-header {
  border-bottom: var(--step) solid var(--line);
  background: var(--bg-deep);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 24px/1 var(--font-pixel);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  font-size: 28px;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: 600 16px/1 var(--font-pixel);
  color: var(--ink);
  text-decoration: none;
  padding: 8px 10px;
}

.header-links svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.star-count {
  white-space: nowrap;
  padding: 2px 8px;
  background: var(--surface-2);
  border: 2px solid var(--line);
}

.star-count::before {
  content: "★ ";
  color: var(--accent);
}

.theme-switch {
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.theme-switch[aria-pressed="false"] .theme-icon-sun,
.theme-switch[aria-pressed="true"] .theme-icon-moon {
  display: none;
}

.home-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: var(--step) solid var(--line);
}

.home-nav summary {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100% - 48px, var(--container));
  min-height: var(--nav-h);
  margin-inline: auto;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-pixel);
}

.home-nav summary::-webkit-details-marker {
  display: none;
}

.home-nav summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--ink-soft);
}

.home-nav[open] summary::after {
  content: "▴";
}

.home-nav-heading {
  color: var(--ink-soft);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.home-nav-current {
  font-weight: 700;
}

.home-nav ol {
  list-style: none;
  margin: 0 auto;
  padding: 0 0 16px;
  width: min(100% - 48px, var(--container));
  display: grid;
  gap: 2px;
}

.home-nav a {
  display: block;
  padding: 6px 12px;
  color: var(--ink);
  text-decoration: none;
  border-left: var(--step) solid transparent;
  font-family: var(--font-pixel);
}

.home-nav a:hover {
  background: var(--surface-2);
}

.home-nav a[aria-current="location"] {
  border-left-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

@media (min-width: 1600px) {
  .home-nav {
    position: fixed;
    top: 104px;
    left: max(16px, calc((100vw - var(--container)) / 2 - 220px));
    width: 190px;
    background: none;
    border: 0;
  }

  .home-nav summary {
    width: auto;
    min-height: 0;
    margin-bottom: 8px;
    pointer-events: none;
  }

  .home-nav summary::after,
  .home-nav-current {
    display: none;
  }

  .home-nav ol {
    width: auto;
    padding: 0;
  }

  html {
    scroll-padding-top: 24px;
  }
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 32px 56px;
  align-items: center;
  padding-block: 72px 56px;
}

.eyebrow,
.section-kicker,
.level-tag {
  font: 600 15px/1.2 var(--font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 12px;
}

.hero h1 {
  font-size: clamp(40px, 6vw, 68px);
}

.lede {
  font-size: 20px;
  color: var(--ink-soft);
  max-width: 34em;
}

.terminal {
  margin-top: 28px;
  background: var(--code-bg);
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
  color: var(--code-text);
}

.terminal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 16px;
  background: var(--code-bar);
  border-bottom: 2px solid var(--code-line);
  font: 600 15px/1 var(--font-pixel);
  color: var(--code-dim);
}

.copy-button {
  font-size: 14px;
  padding: 6px 12px;
  background: var(--code-bg);
  color: var(--code-text);
  border-color: var(--code-line);
  box-shadow: none;
}

.terminal-prompt {
  padding: 16px 20px;
}

.terminal-prompt code {
  font-size: 15px;
}

.terminal-prompt code::after {
  content: "▌";
  color: var(--tok-kw);
  animation: terminal-blink 1.1s steps(1) infinite;
}

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

.hint-line {
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 16px;
}

.hero-art {
  margin: 0;
  text-align: center;
}

.hero-ferris {
  display: block;
  width: 100%;
  padding: 0;
  cursor: pointer;
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
  /* A pixel beach: sky, a strip of sea, then sand. */
  background: linear-gradient(
    var(--sky-top) 0 30%,
    var(--sky-bottom) 30% 52%,
    var(--sea) 52% 60%,
    #ffffff55 60% 62%,
    var(--sand) 62%
  );
}

.hero-ferris canvas {
  display: block;
  width: 100%;
  image-rendering: pixelated;
}

.hero-art figcaption {
  font: 15px var(--font-pixel);
  color: var(--ink-soft);
  margin-top: 14px;
}

.hero-stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 24px 0 0;
}

.hero-stats div {
  display: flex;
  flex-direction: column-reverse;
  padding: 14px 18px;
  background: var(--surface);
  border: var(--step) solid var(--line);
  box-shadow: inset 0 -5px 0 var(--surface-2);
}

.hero-stats dt {
  font-size: 15px;
  color: var(--ink-soft);
}

.hero-stats dd {
  margin: 0;
  font: 700 36px/1.1 var(--font-pixel);
  color: var(--accent);
}

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

.section {
  padding-block: 72px;
  border-top: var(--step) dashed var(--line-soft);
}

.section h2 {
  font-size: clamp(30px, 4vw, 44px);
  max-width: 22em;
}

.section-lede {
  color: var(--ink-soft);
  max-width: 40em;
  margin-bottom: 32px;
}

/* ---------- Code blocks ---------- */

.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
}

.code-block pre {
  padding: 16px 0;
}

.code-block pre code {
  padding-inline: 18px;
  color: var(--code-text);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--code-bar);
  border-bottom: 2px solid var(--code-line);
  font: 15px/1.3 var(--font-pixel);
  color: var(--code-dim);
}

.code-header strong {
  color: var(--code-text);
}

.code-header code {
  background: none;
  padding: 0;
  color: var(--tok-fn);
}

details.code-block > summary {
  cursor: pointer;
  list-style: none;
}

details.code-block > summary::-webkit-details-marker {
  display: none;
}

details.code-block:not([open]) > summary {
  border-bottom: 0;
}

.disclosure::after {
  content: "▾ hide";
}

details:not([open]) > summary .disclosure::after {
  content: "▸ show";
}

.tok-kw {
  color: var(--tok-kw);
}
.tok-fn {
  color: var(--tok-fn);
}
.tok-ty {
  color: var(--tok-ty);
}
.tok-str {
  color: var(--tok-str);
}
.tok-num {
  color: var(--tok-num);
}
.tok-mac {
  color: var(--tok-mac);
}
.out-error {
  color: #ff8a73;
  font-weight: 600;
}
.out-note {
  color: var(--tok-ty);
  font-weight: 600;
}

/* ---------- How Ferris helps: the step comparison ---------- */

.step-comparison {
  margin: 0;
}

.step-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.step-selector button span {
  color: var(--accent);
  margin-right: 4px;
}

.step-selector button[aria-pressed="true"] {
  background: var(--accent-bg);
  color: #fff8ec;
  box-shadow: inset 0 -4px 0 var(--ferris-shadow);
}

.step-selector button[aria-pressed="true"] span {
  color: var(--gold);
}

.step-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.hero-copy,
.step-code,
.ferris-notes,
.predict-questions {
  min-width: 0;
}

.step-code {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.compiler-output pre code {
  font-size: 13.5px;
  color: var(--code-dim);
}

.code-step {
  display: inline-block;
  min-width: 100%;
  margin-inline: -18px;
  padding-inline: 15px 18px;
  border-left: var(--step) solid transparent;
  transition: background-color 160ms ease;
}

.code-step.is-active {
  background: #f2601c33;
  border-left-color: var(--ferris-hi);
  color: var(--code-text);
}

.ferris-notes {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}

.notes-label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font: 700 20px/1.2 var(--font-pixel);
  margin: 0 0 14px;
}

.notes-disclaimer {
  font: 400 13px var(--font-body);
  color: var(--ink-soft);
}

.speech {
  position: relative;
  background: var(--surface);
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
  padding: 18px 20px;
}

.speech::before {
  /* The bubble's pixel tail, pointing up at Ferris' name. */
  content: "";
  position: absolute;
  top: -12px;
  left: 24px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: var(--step) solid var(--line);
  border-top: var(--step) solid var(--line);
  transform: rotate(45deg);
}

.speech p {
  margin: 0 0 12px;
}

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

.speech-action {
  font: 600 14px var(--font-pixel);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.speech-aside {
  font-size: 15px;
  color: var(--ink-soft);
}

.diff {
  background: var(--code-bg);
  border: 2px solid var(--line);
  padding: 10px 0;
  margin-bottom: 12px;
}

.diff code {
  font-size: 13px;
  padding-inline: 12px;
}

.diff-del {
  color: #ff8a73;
}

.diff-add {
  color: var(--tok-str);
}

.console-pass {
  font: 600 16px var(--font-pixel);
  color: var(--good-dark);
}

:root[data-theme="dark"] .console-pass {
  color: #8be08f;
}

.step-comparison figcaption {
  margin-top: 32px;
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 44em;
}

/* ---------- Try a level: the Predict it demo ---------- */

.predict-demo {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.predict-stage {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: grid;
  gap: 16px;
}

.predict-stage canvas {
  width: 100%;
  image-rendering: pixelated;
  background: linear-gradient(transparent 70%, var(--sand) 70%);
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
}

.predict-status {
  font-size: 16px;
  min-height: 4.6em;
}

.predict-xp {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 8px 16px;
  font: 700 22px var(--font-pixel);
  background: var(--code-bg);
  color: var(--gold);
  border: var(--step) solid var(--line);
}

.predict-xp span {
  font-size: 15px;
  color: var(--code-dim);
}

.predict-question {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.predict-question + .predict-question {
  margin-top: 40px;
}

.predict-question[hidden] {
  display: none;
}

.predict-choices {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.predict-choices button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  font: 16px/1.4 var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: var(--step) solid var(--line);
  box-shadow: inset 0 -4px 0 var(--surface-2);
  cursor: pointer;
}

.predict-choices button:hover:not([aria-disabled]) {
  background: var(--surface-2);
}

.predict-choices button[aria-disabled] {
  cursor: default;
}

.predict-choices button[aria-disabled]:not(.is-correct, .is-wrong) {
  opacity: 0.55;
}

.predict-choices .is-correct {
  background: var(--good);
  border-color: var(--good-dark);
  box-shadow: inset 0 -4px 0 var(--good-dark);
  color: #fff;
}

.predict-choices .is-wrong {
  background: var(--bad);
  border-color: var(--bad-dark);
  box-shadow: inset 0 -4px 0 var(--bad-dark);
  color: #fff;
}

.predict-choices .is-correct code,
.predict-choices .is-wrong code {
  background: #0000002e;
  color: inherit;
}

.predict-answer {
  background: var(--surface);
  border: var(--step) solid var(--line);
  padding: 12px 18px;
}

.predict-answer summary {
  font: 700 17px var(--font-pixel);
  cursor: pointer;
}

.predict-answer p {
  margin: 10px 0 0;
}

.predict-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  font-family: var(--font-pixel);
  color: var(--ink-soft);
}

.predict-controls[hidden] {
  display: none;
}

/* ---------- A look around ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  margin-top: 32px;
}

.shot {
  margin: 0;
}

.shot img {
  display: block;
  width: 100%;
  border: var(--step) solid var(--line);
  box-shadow: 0 6px 0 var(--shadow);
  image-rendering: pixelated;
}

.shot figcaption {
  margin-top: 12px;
  font-size: 16px;
  color: var(--ink-soft);
}

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

.shot-wide {
  grid-column: 1 / -1;
}

.shot-wide img {
  background: var(--surface);
}

/* ---------- How it works ---------- */

.feature-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 32px 0 0;
}

.feature-list div {
  padding: 20px;
  background: var(--surface);
  border: var(--step) solid var(--line);
  box-shadow: inset 0 -5px 0 var(--surface-2);
}

.feature-list dt {
  font: 700 19px/1.3 var(--font-pixel);
  margin-bottom: 8px;
}

.feature-list dd {
  margin: 0;
  font-size: 16px;
  color: var(--ink-soft);
}

.kinds {
  margin: 48px 0 0;
  text-align: center;
}

.kinds img {
  image-rendering: pixelated;
}

.kinds figcaption {
  font: 17px var(--font-pixel);
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ---------- The islands ---------- */

.island-list {
  counter-reset: island -1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.island-list li {
  counter-increment: island;
  align-content: start;
  position: relative;
  display: grid;
  gap: 4px;
  padding: 14px 16px 14px 60px;
  background: var(--surface);
  border: var(--step) solid var(--line);
}

.island-list li::before {
  content: counter(island);
  position: absolute;
  left: 12px;
  top: 14px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font: 700 17px var(--font-pixel);
  color: #fff8ec;
  background: var(--sea);
  border: 2px solid var(--line);
}

.island-list strong {
  font: 700 18px/1.2 var(--font-pixel);
}

.island-list span {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.island-list .is-project::before {
  background: var(--accent-bg);
}

.island-list .is-project strong::after {
  content: " 🛠";
}

.island-list .is-bonus::before {
  background: #8e5bd8;
}

.island-list .is-bonus strong::after {
  content: " 📚";
}

/* ---------- Questions ---------- */

.faq {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.faq details {
  background: var(--surface);
  border: var(--step) solid var(--line);
}

.faq summary {
  padding: 14px 18px;
  font: 700 19px var(--font-pixel);
  cursor: pointer;
}

.faq details[open] summary {
  border-bottom: 2px dashed var(--line-soft);
}

.faq p {
  margin: 0;
  padding: 14px 18px 18px;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 48px;
  padding-bottom: 32px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
}

.site-footer img {
  image-rendering: pixelated;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 16px;
}

.footer-inner p {
  margin: 0;
}

.noscript {
  text-align: center;
  padding: 12px;
  background: var(--surface-2);
  margin: 0;
}

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

@media (min-width: 851px) and (max-width: 1250px) {
  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 48px;
  }

  .hero-art {
    max-width: 440px;
    margin-inline: auto;
    width: 100%;
  }

  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .step-grid,
  .predict-demo {
    grid-template-columns: minmax(0, 1fr);
  }

  .ferris-notes,
  .predict-stage {
    position: static;
  }

  .predict-stage {
    grid-template-columns: 140px 1fr;
    align-items: start;
  }

  .predict-stage canvas {
    grid-row: span 2;
  }

  .feature-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 17px;
  }

  .section {
    padding-block: 52px;
  }

  .gallery {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .brand {
    gap: 8px;
    font-size: 20px;
  }

  .brand-mark {
    font-size: 22px;
  }

  .header-links {
    gap: 4px;
    margin-left: auto;
  }

  .header-links a {
    padding-inline: 6px;
  }

  /* Hidden visually but kept as the link's accessible name. */
  .header-links a span:not(.star-count) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .step-selector button {
    flex: 1 1 100%;
    text-align: left;
  }

  .predict-stage {
    grid-template-columns: 1fr;
  }

  .predict-stage canvas {
    grid-row: auto;
    max-width: 220px;
  }
}

@media (max-width: 400px) {
  .hero-stats dd {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
