:root {
  color-scheme: dark;
  --ink: #101412;
  --ink-2: #161d18;
  --ink-3: #222b23;
  --egret: #f1f3e9;
  --mist: #dde4d8;
  --muted: #a8b3a5;
  --line: #333d32;
  --accent: #d9eea2;
  --reed: var(--accent);
  --sans: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
  --serif: 'Songti SC', 'Noto Serif CJK SC', 'SimSun', Georgia, serif;
  --gutter: clamp(18px, 4vw, 62px);
  --width: 1400px;
}
* { box-sizing: border-box; }
html { background: var(--ink); scroll-padding-top: 96px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--mist);
  font: 16px/1.58 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
h1:focus, h2:focus, main:focus { outline: none; }
.shell { width: min(calc(100% - var(--gutter) * 2), var(--width)); margin-inline: auto; }
.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 30;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--ink);
  transform: translateY(-140%);
}
.skip-link:focus { transform: translateY(0); }

/* Site navigation */
.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(16, 20, 18, .96);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  width: min(calc(100% - var(--gutter) * 2), var(--width));
  min-height: 72px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--egret);
  font-size: 16px;
  font-weight: 690;
  text-decoration: none;
}
.brand img { flex: none; }
.bar-links { display: flex; align-items: center; gap: clamp(12px, 2.8vw, 38px); }
.bar-links a, .foot a { color: var(--muted); text-decoration: none; }
.bar-links a:hover, .foot a:hover { color: var(--egret); }
.bar-links a { font-size: 14px; white-space: nowrap; }
.lang {
  min-width: 48px;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--ink-2);
  cursor: pointer;
  font-size: 13px;
}
.lang:hover { border-color: var(--muted); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 17px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: inherit;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #19230f; }
.btn-primary:hover { background: #e8f6c5; }
.btn-secondary { background: transparent; border-color: #53614e; color: var(--egret); }
.btn-secondary:hover { background: var(--ink-3); }

/* Opening and game catalog */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
  padding-block: clamp(40px, 4.7vw, 65px) clamp(38px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  margin: 0;
  color: var(--egret);
  font: 750 clamp(44px, 5.4vw, 84px)/1.05 var(--serif);
  letter-spacing: -.055em;
}
.hero h1 span { display: block; }
.hero h1 span:last-child { margin-top: .08em; color: var(--accent); }
.hero-lead {
  max-width: 30rem;
  margin: 21px 0 28px;
  color: var(--muted);
  font-size: clamp(15px, 1.3vw, 19px);
}
.featured { min-width: 0; }
.featured-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #40513e;
  border-radius: 12px;
  background: var(--ink-2);
  text-decoration: none;
}
.featured-link img, .card-art img, .case-cover img { width: 100%; height: 100%; object-fit: cover; }
.featured-link img, .card-art img, .case-cover img { object-position: var(--image-focus, center); }
.featured-link::after {
  content: "";
  position: absolute;
  inset: 38% 0 0;
  background: linear-gradient(transparent, rgba(6, 9, 7, .89));
  pointer-events: none;
}
.featured-info {
  position: absolute;
  inset: auto 22px 19px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  color: #fff;
}
.featured-kicker { display: block; margin-bottom: 4px; color: var(--accent); font-size: 12px; }
.featured-info strong { font-size: clamp(21px, 2.4vw, 36px); line-height: 1.2; }
.feature-arrow {
  min-width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #c6d0bb80;
  border-radius: 50%;
  font-size: 19px;
  line-height: 1;
}
.featured-link:hover .feature-arrow { background: var(--accent); color: var(--ink); }
.catalog { padding-block: clamp(31px, 3.5vw, 52px) 76px; }
.catalog-header { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 23px; }
.catalog h2, .case-section > h2 {
  margin: 0;
  color: var(--egret);
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.15;
  letter-spacing: -.03em;
}
.catalog-count { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.filters {
  display: inline-flex;
  flex: none;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--ink-2);
}
.filters button {
  padding: 5px 12px;
  min-height: 33px;
  min-width: 42px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.filters button:hover { color: var(--egret); }
.filters button[aria-pressed="true"] { background: var(--accent); color: var(--ink); }
.game-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 27px); }
.game-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.game-card:focus-within, .game-card:hover { border-color: #6a7f5d; }
.card-art { display: block; aspect-ratio: 16 / 9; background: var(--ink-3); overflow: hidden; }
.card-art:focus-visible { outline-offset: -5px; }
.card-art img, .featured-link img { transition: transform .3s ease; }
.card-art:hover img, .featured-link:hover img { transform: scale(1.035); }
.card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: clamp(15px, 1.85vw, 25px);
}
.case-meta { margin: 0; color: var(--accent); font-size: 12px; font-weight: 600; }
.case-meta span { margin-inline: 3px; opacity: .6; }
.card-info h3 { margin: 6px 0 8px; color: var(--egret); font-size: clamp(20px, 2vw, 28px); line-height: 1.13; }
.card-info h3 a { text-decoration: none; }
.card-summary { margin: 0 0 15px; color: var(--muted); font-size: 14px; }
.feature-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: auto 0 16px; padding: 0; list-style: none; }
.feature-tags li {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--mist);
  background: #1d271e;
  font-size: 11px;
}
.card-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 9px 12px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
  font-size: 13px;
}
.text-link { color: var(--accent); font-weight: 650; text-decoration: none; }
.text-link:hover, .case-link:hover, .case-path a:hover { text-decoration: underline; text-underline-offset: 4px; }
.case-link, .case-path a { color: var(--muted); text-decoration: none; }

/* Individual case study */
.case { padding-block: 26px 65px; }
.case-path { margin-bottom: 22px; font-size: 14px; }
.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 4.5fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(23px, 4vw, 64px);
}
.case-intro h1 {
  margin: 9px 0 16px;
  color: var(--egret);
  font: 730 clamp(36px, 5vw, 73px)/1.07 var(--serif);
  letter-spacing: -.045em;
}
.case-intro > p:not(.case-meta) { margin: 0 0 23px; color: var(--muted); }
.case-cover, .gallery button {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink-2);
  cursor: zoom-in;
}
.case-cover { aspect-ratio: 16 / 9; }
.case-section { margin-top: clamp(34px, 5vw, 69px); }
.case-section > h2 { margin-bottom: 18px; }
.capability-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
/* Three, four or five cards always fill their rows: three across, two by two, or three over two. */
@media (min-width: 691px) {
  .capability-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .capability { grid-column: span 2; }
  .capability-grid[data-count="4"] .capability,
  .capability-grid[data-count="5"] .capability:nth-child(n + 4) { grid-column: span 3; }
}
.capability {
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 2vw, 25px);
  border: 1px solid var(--line);
  border-top-color: #718663;
  border-radius: 7px;
  background: var(--ink-2);
}
.capability h3 { margin: 0; color: var(--egret); font-size: 19px; line-height: 1.28; }
.capability p { margin: 8px 0 14px; color: var(--muted); font-size: 14px; }
.capability .text-link { margin-top: auto; align-self: flex-start; font-size: 13px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.gallery figure { margin: 0; min-width: 0; }
.gallery button { aspect-ratio: 16 / 10; }
.gallery img { width: 100%; height: 100%; object-fit: contain; }
.gallery figcaption { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.gallery-portrait { max-width: 840px; }
.gallery-portrait button { aspect-ratio: 9 / 14; }
.related > div { display: flex; flex-wrap: wrap; gap: 9px; }
.related a {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.related a:hover { color: var(--accent); border-color: #6a7f5d; }

/* Full-size image viewer */
.viewer { margin: auto; width: min(94vw, 1400px); max-width: none; max-height: 94dvh; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #0a0d0b; color: var(--egret); }
.viewer::backdrop { background: #090c0ade; }
.viewer figure { margin: 0; }
.viewer img { width: 100%; height: min(78dvh, 900px); object-fit: contain; }
.viewer-caption { min-height: 34px; padding: 6px 48px; color: var(--muted); text-align: center; font-size: 13px; }
.viewer-close, .viewer-step {
  position: absolute;
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  padding: 0;
  border: 1px solid #a9b6a383;
  border-radius: 50%;
  background: #111813db;
  color: var(--egret);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.viewer-close { top: 10px; right: 10px; }
.viewer-step { top: 46%; }
.viewer-step.prev { left: 10px; }
.viewer-step.next { right: 10px; }
.viewer-close:hover, .viewer-step:hover { background: var(--accent); color: var(--ink); }

.foot { border-top: 1px solid var(--line); }
.foot-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 18px;
  min-height: 76px;
  color: var(--muted);
  font-size: 13px;
}
.foot-inner p { margin: 0; }
.foot-inner nav { display: flex; flex-wrap: wrap; gap: 14px; }

@media (max-width: 970px) {
  .game-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { gap: 30px; }
  .hero h1 { font-size: clamp(38px, 6vw, 62px); }
}
@media (max-width: 690px) {
  html { scroll-padding-top: 74px; }
  .bar-inner { min-height: 58px; }
  .brand { gap: 7px; font-size: 14px; }
  .brand img { width: 30px; height: 30px; }
  .bar-links { gap: 10px; }
  .bar-links a { font-size: 12px; }
  .bar-links .engine-link { display: none; }
  .lang { min-height: 34px; min-width: 42px; }
  .hero, .case-hero { grid-template-columns: 1fr; }
  .hero { padding-block: 33px 32px; gap: 24px; }
  .hero h1 { font-size: clamp(39px, 8.8vw, 58px); }
  .hero-lead { margin: 15px 0 19px; }
  .featured-info { inset: auto 12px 12px; }
  .catalog { padding-bottom: 45px; }
  .catalog-header { margin-bottom: 15px; }
  .capability-grid { grid-template-columns: 1fr; }
}
@media (max-width: 465px) {
  .game-grid, .gallery { grid-template-columns: 1fr; }
  .filters button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ---- the capability matrix page --------------------------------------------------------------- */
.matrix {
  padding: clamp(29px, 5vw, 58px) var(--gutter) 48px;
  max-width: 1400px;
  margin-inline: auto;
}
.matrix h1 {
  margin: 0 0 12px;
  font: 600 clamp(28px, 4vw, 40px)/1.2 var(--serif);
  color: var(--egret);
}
.matrix h2 {
  margin: 40px 0 12px;
  font: 600 22px/1.3 var(--serif);
  color: var(--egret);
}
.matrix-lead,
.matrix > p {
  max-width: 68ch;
  color: var(--muted);
}
/* Wide tables scroll sideways inside their own box, so the page itself never does. */
.matrix-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.matrix-scroll:focus-visible {
  outline: 2px solid var(--reed);
  outline-offset: 2px;
}
.matrix table {
  border-collapse: collapse;
  font-size: 14px;
  min-width: 100%;
}
.matrix th,
.matrix td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
.matrix thead th {
  vertical-align: bottom;
  font-weight: 600;
  color: var(--mist);
  background: var(--ink-2);
}
.matrix thead th span {
  display: inline-block;
  max-width: 9em;
  white-space: normal;
  line-height: 1.3;
}
/* The capability's name stays in view while the games scroll past. */
.matrix th[scope='row'],
.matrix thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--ink-2);
  color: var(--egret);
}
.matrix thead th:first-child {
  font-family: var(--sans);
}
.matrix td.count {
  color: var(--muted);
}
.matrix tr.thin th[scope='row'] {
  box-shadow: inset 3px 0 0 var(--reed);
}
.matrix .mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--reed);
  vertical-align: middle;
}
.matrix .mark:hover,
.matrix .mark:focus-visible {
  outline: 2px solid var(--egret);
  outline-offset: 3px;
}
.matrix-gaps {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2 22em;
  column-gap: 32px;
}
.matrix-gaps li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  break-inside: avoid;
}
.matrix-gaps code {
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--egret);
}
.matrix-gaps em {
  color: var(--muted);
  font-style: normal;
}
