/* Malis Games — studio styles. No framework, no web fonts, no JavaScript required.
   Per-game colours live in games.css, which is generated from games.json. */

:root {
  --bg: #f5f3ee;
  --surface: #fbfaf7;
  --ink: #111312;
  --ink-soft: #383d3a;
  --muted: #5a605c;
  --line: #e2dfd7;
  --line-strong: #cbc6ba;
  --accent: #1f5c4a;
  --accent-strong: #154537;
  --accent-tint: #e1eae4;
  --piece: #7fcfa9;
  --focus: #1f7a5f;

  --radius: 14px;
  --radius-lg: 24px;
  --max: 1160px;
  --gutter: clamp(16px, 4vw, 40px);

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 0.5em;
  font-weight: 700;
}
h1 { font-size: clamp(2.75rem, 7.2vw, 5.4rem); letter-spacing: -0.045em; line-height: 1; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.75rem); letter-spacing: -0.035em; }
h3 { font-size: 1.3rem; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; color: var(--bg); }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.lede { font-size: clamp(1.1rem, 1.7vw, 1.3rem); color: var(--ink-soft); max-width: 34rem; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 243, 238, 0.9);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand svg { width: 28px; height: 28px; flex: none; }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; }
.site-nav a {
  display: block; padding: 8px 14px; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-size: 0.95rem; font-weight: 500;
}
.site-nav a:hover { color: var(--ink); background: var(--accent-tint); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--accent-tint); }

@media (max-width: 420px) {
  .site-nav a { padding: 8px 10px; font-size: 0.92rem; }
}
/* Very small phones: the nav moves to its own row instead of overflowing. */
@media (max-width: 379px) {
  html { scroll-padding-top: 116px; }
  .site-header .container { flex-wrap: wrap; gap: 2px 16px; padding-top: 10px; padding-bottom: 6px; }
  .site-nav { width: 100%; }
  .site-nav ul { margin-left: -10px; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: 0.98rem; text-decoration: none;
  border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--accent-strong); color: #fff; }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.arrow { display: inline-block; transition: transform .2s ease; }
a:hover .arrow { transform: translateX(3px); }

.text-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; text-decoration: none; }

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

.section { padding: clamp(72px, 10vw, 128px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { max-width: 40rem; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head p { color: var(--ink-soft); }
.section-head-row { display: flex; justify-content: space-between; align-items: end; gap: 16px 32px; flex-wrap: wrap; max-width: none; }
.section-head-row > div { max-width: 40rem; }

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

.hero { padding: clamp(48px, 9vw, 120px) 0 clamp(64px, 9vw, 120px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 88px); align-items: center;
}
.hero h1 { margin-bottom: 0.35em; }
.hero .tagline {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  letter-spacing: -0.025em; line-height: 1.2; font-weight: 600;
  color: var(--ink); margin-bottom: 0.9em; max-width: 26ch;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }

/* Board motif: a 4×4 grid of tiles with one piece that slides. The static frame is complete;
   motion is an enhancement only. */
.board {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(8px, 1.4vw, 14px);
  width: 100%; max-width: 420px; justify-self: end; aspect-ratio: 1; position: relative;
}
.board .tile { border-radius: 22%; border: 1.5px solid var(--line-strong); }
.board .tile.filled { background: var(--ink); border-color: var(--ink); }
.board .tile.soft { background: #e9e6de; border-color: #e9e6de; }
.board .piece {
  position: absolute; left: 0; top: 0;
  width: calc((100% - 3 * clamp(8px, 1.4vw, 14px)) / 4); aspect-ratio: 1;
  border-radius: 22%; background: var(--accent);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18);
  transform: translate(calc(100% + clamp(8px, 1.4vw, 14px)), calc(200% + 2 * clamp(8px, 1.4vw, 14px)));
}
@media (prefers-reduced-motion: no-preference) {
  .board .piece { animation: slide 7s cubic-bezier(.65, 0, .35, 1) 1s infinite; }
  @keyframes slide {
    0%, 30% { transform: translate(calc(100% + clamp(8px, 1.4vw, 14px)), calc(200% + 2 * clamp(8px, 1.4vw, 14px))); }
    42%, 72% { transform: translate(calc(300% + 3 * clamp(8px, 1.4vw, 14px)), calc(200% + 2 * clamp(8px, 1.4vw, 14px))); }
    84%, 100% { transform: translate(calc(100% + clamp(8px, 1.4vw, 14px)), calc(200% + 2 * clamp(8px, 1.4vw, 14px))); }
  }
}

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .board { max-width: 240px; justify-self: start; order: -1; }
}

/* ---------- Featured game ---------- */

.featured {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--game-bg); color: var(--game-ink);
  border: 1px solid var(--game-line);
  border-radius: 28px; overflow: hidden;
}
.featured-art {
  display: grid; place-items: center; padding: clamp(40px, 6vw, 72px);
  background:
    radial-gradient(circle at 1px 1px, var(--game-line-strong) 1.2px, transparent 1.6px) 0 0 / 22px 22px,
    var(--game-bg-deep);
  min-height: 320px;
}
.featured-art img {
  width: min(280px, 72%); border-radius: 22.5%;
  box-shadow: 0 1px 0 var(--game-line), 0 28px 56px -28px var(--game-shadow);
}
.featured-body { padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: center; }
.featured-body h3 { font-size: clamp(2.2rem, 4.6vw, 3.4rem); letter-spacing: -0.04em; color: var(--game-ink); margin-bottom: .1em; }
.featured-body .game-tagline { font-size: 1.3rem; color: var(--game-accent); font-weight: 600; margin-bottom: 1rem; }
.featured-body p { color: var(--game-ink-soft); }
.featured-body .btn { align-self: flex-start; margin-top: .75rem; background: var(--game-ink); color: var(--game-bg); }
.featured-body .btn:hover { background: var(--game-accent); color: #fff; }
@media (max-width: 820px) { .featured { grid-template-columns: 1fr; } .featured-art { min-height: 0; } }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 1.25rem; }
.tags li {
  font-size: 0.82rem; font-weight: 500; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--game-line-strong, var(--line-strong));
  color: var(--game-ink-soft, var(--ink-soft));
  background: var(--game-surface, var(--surface));
}
.status::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #b9852a; margin-right: 7px; vertical-align: 1px;
}
.status-available::before { background: #2f8a5b; }

/* ---------- Game catalog (generated from games.json) ---------- */

.game-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 20px; }
.game-card { background: var(--game-bg); border: 1px solid var(--game-line); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .25s ease, transform .25s ease; }
.game-card:hover { border-color: var(--game-line-strong); transform: translateY(-2px); }
.game-card a { display: block; height: 100%; color: inherit; text-decoration: none; }
.game-card a:focus-visible { outline-offset: -4px; border-radius: var(--radius-lg); }
.game-card-art {
  display: grid; place-items: center; aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 1px 1px, var(--game-line-strong) 1.2px, transparent 1.6px) 0 0 / 20px 20px,
    var(--game-bg-deep);
}
.game-card-art img { width: 38%; border-radius: 22.5%; box-shadow: 0 20px 40px -24px var(--game-shadow); }
.game-card-body { padding: 22px 24px 26px; }
.game-card-body h2, .game-card-body h3 { color: var(--game-ink); font-size: 1.5rem; margin-bottom: .1em; }
.game-card-tagline { color: var(--game-accent); font-weight: 600; margin-bottom: 14px; }
.game-card .tags { margin: 0; }
.game-card-more { display: inline-flex; gap: 8px; margin-top: 18px; font-weight: 600; color: var(--game-ink); }

/* ---------- About / support ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: clamp(28px, 6vw, 96px); }
.split p { color: var(--ink-soft); }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

.values { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.values li { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.values strong { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: 4px; letter-spacing: -0.01em; }
.values span { color: var(--ink-soft); font-size: 0.95rem; }
@media (max-width: 700px) { .values { grid-template-columns: 1fr; } }

.link-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.link-list li { border-bottom: 1px solid var(--line); }
.link-list a {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 4px; color: var(--ink); text-decoration: none; font-weight: 600;
}
.link-list a:hover { color: var(--accent-strong); }
.link-list small { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }

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

.site-footer { border-top: 1px solid var(--line); padding: 56px 0 40px; color: var(--muted); font-size: 0.95rem; }
.footer-grid { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-brand p { margin: 8px 0 0; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 24px; }
.footer-nav a { color: var(--ink-soft); text-decoration: none; display: inline-block; padding: 4px 0; }
.footer-nav a:hover { color: var(--ink); text-decoration: underline; }
.copyright { margin: 40px 0 0; font-size: 0.875rem; }

/* ---------- Game pages ---------- */

.game-page { background: var(--game-bg); }
.game-page .site-header { background: var(--game-header); border-bottom-color: var(--game-line); }

.breadcrumbs { font-size: 0.9rem; color: var(--muted); padding-top: 24px; }
.game-page .breadcrumbs { color: var(--game-muted); }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; opacity: .5; }
.breadcrumbs a { color: inherit; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }

.game-hero { padding: clamp(36px, 7vw, 88px) 0 clamp(56px, 8vw, 104px); }
.game-hero .hero-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
.game-hero h1 { color: var(--game-ink); }
.game-hero .game-tagline { font-family: var(--font-display); font-size: clamp(1.4rem, 2.8vw, 2rem); font-weight: 600; letter-spacing: -0.02em; color: var(--game-accent); margin-bottom: .9em; }
.game-hero .lede { color: var(--game-ink-soft); }
.game-hero .eyebrow { color: var(--game-muted); }
.game-art { justify-self: center; width: min(340px, 80%); }
.game-art img { width: 100%; border-radius: 22.5%; box-shadow: 0 1px 0 var(--game-line), 0 32px 64px -32px var(--game-shadow); }
@media (max-width: 820px) {
  .game-hero .hero-grid { grid-template-columns: 1fr; }
  .game-art { justify-self: start; width: 128px; order: -1; }
}

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 2rem 0 0; border-top: 1px solid var(--game-line-strong); }
.facts div { padding: 16px 16px 0 0; }
.facts dt { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--game-muted); }
.facts dd { margin: 4px 0 0; font-weight: 600; color: var(--game-ink); }
@media (max-width: 560px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } .facts div { padding-bottom: 8px; } }

.game-page .section + .section { border-top-color: var(--game-line); }
.game-page .section-head h2 { color: var(--game-ink); }
.game-page .section-head p, .game-page .split p { color: var(--game-ink-soft); }
.game-page .eyebrow { color: var(--game-muted); }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature { background: var(--game-surface); border: 1px solid var(--game-line); border-radius: var(--radius-lg); padding: clamp(22px, 3vw, 30px); }
.feature h3 { font-size: 1.15rem; color: var(--game-ink); }
.feature p { color: var(--game-ink-soft); margin: 0; }
.feature .icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--game-tint); color: var(--game-ink); margin-bottom: 20px; }
.feature .icon svg { width: 22px; height: 22px; }
.feature .big-number { font-family: var(--font-display); font-size: 2.5rem; font-weight: 700; letter-spacing: -0.04em; color: var(--game-ink); line-height: 1; margin-bottom: 16px; }
@media (max-width: 900px) { .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .feature-grid { grid-template-columns: 1fr; } }

.availability {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px;
  padding: clamp(26px, 4vw, 40px); border-radius: var(--radius-lg);
  background: var(--game-ink); color: var(--game-bg);
}
.availability h2 { color: var(--game-bg); font-size: clamp(1.45rem, 2.8vw, 2rem); margin-bottom: .25em; }
.availability p { margin: 0; color: var(--game-on-ink-soft); }
.store-links { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-store { background: var(--game-bg); color: var(--game-ink); }
.btn-store:hover { background: #fff; color: var(--game-ink); }

.game-page .btn-primary { background: var(--game-ink); color: var(--game-bg); }
.game-page .btn-primary:hover { background: var(--game-accent); color: #fff; }
.game-page .btn-ghost { border-color: var(--game-line-strong); color: var(--game-ink); }
.game-page a { color: var(--game-accent); }
.game-page .btn-primary, .game-page .btn-primary:hover { color: var(--game-bg); }
.game-page .btn-primary:hover { color: #fff; }
.game-page .brand, .game-page .site-nav a { color: var(--ink); }
.game-page .site-nav a { color: var(--ink-soft); }
.game-page .site-nav a:hover, .game-page .site-nav a[aria-current="page"] { background: var(--game-tint); color: var(--ink); }
.game-page .site-footer { border-top-color: var(--game-line); }
.game-page .footer-nav a { color: var(--ink-soft); }

/* ---------- Long-form documents ---------- */

.doc { padding-top: clamp(28px, 6vw, 64px); padding-bottom: clamp(64px, 9vw, 112px); }
.doc-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(32px, 6vw, 72px); align-items: start; }
.doc-layout > * { min-width: 0; }
.doc-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--game-line, var(--line)); }
.doc-header h1 { font-size: clamp(2.3rem, 5.4vw, 3.6rem); color: var(--game-ink, var(--ink)); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 28px; color: var(--game-muted, var(--muted)); font-size: 0.95rem; margin: 0; }
.doc-meta dd { display: inline; margin: 0 0 0 4px; color: var(--game-ink, var(--ink)); font-weight: 600; }
.doc-meta dt { display: inline; }

.toc { position: sticky; top: 92px; font-size: 0.9rem; }
.toc h2 { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--game-muted, var(--muted)); font-weight: 500; margin-bottom: 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--game-line, var(--line)); counter-reset: toc; }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--game-ink-soft, var(--ink-soft)); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--game-accent, var(--accent)); }
@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc { position: static; padding: 18px 20px; border: 1px solid var(--game-line, var(--line)); border-radius: var(--radius); background: var(--game-surface, var(--surface)); }
  .toc ol { columns: 2; column-gap: 24px; border: 0; }
  .toc a { padding-left: 0; }
}
@media (max-width: 520px) { .toc ol { columns: 1; } }

.prose { max-width: 46rem; }
.prose h2 { font-size: clamp(1.4rem, 2.4vw, 1.7rem); margin: 2.4em 0 0.6em; color: var(--game-ink, var(--ink)); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.12rem; margin: 1.8em 0 0.5em; color: var(--game-ink, var(--ink)); }
.prose p, .prose li { color: var(--game-ink-soft, var(--ink-soft)); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.2em; }
.prose li { margin-bottom: 0.45em; }
.prose li::marker { color: var(--game-accent, var(--accent)); }
.prose strong { color: var(--game-ink, var(--ink)); font-weight: 600; }

.box { border: 1px solid var(--game-line, var(--line)); background: var(--game-surface, var(--surface)); border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 30px); margin: 0 0 1.5rem; }
.box > :last-child { margin-bottom: 0; }
.box .email { font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }

.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; border: 1px solid var(--game-line, var(--line)); border-radius: var(--radius); background: var(--game-surface, var(--surface)); }
.table-wrap:focus-visible { outline-offset: 2px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; min-width: 560px; }
th, td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--game-line, var(--line)); }
th { font-weight: 600; color: var(--game-ink, var(--ink)); background: var(--game-bg-deep, var(--bg)); }
tr:last-child td { border-bottom: 0; }
td { color: var(--game-ink-soft, var(--ink-soft)); }

.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 14px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center;
  font-size: 0.85rem; font-weight: 700; background: var(--game-tint, var(--accent-tint)); color: var(--game-ink, var(--ink));
}

/* ---------- Utilities ---------- */

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .site-footer, .toc, .skip-link { display: none; }
  body, .game-page { background: #fff; color: #000; font-size: 11pt; }
  .doc-layout { display: block; }
  a { color: #000; }
}
