/* KokoroPixel — shared stylesheet.
   Tokens mirror apps/koto/lib/theme/koto_colors.dart so the site and
   the game are recognizably the same palette. The studio pages stay
   ink-forward and let each game's accent do the coloring; a game's own
   page overrides --accent with its palette. */

:root {
  --bg: #f7f4f0;
  --surface: #fdfbf9;
  --surface-alt: #f0ebe4;
  --border: #e1d9ce;
  --ink: #332b26;
  --ink-soft: #6b5f55;
  --ink-faint: #a89c8e;
  --accent: #e2603a;
  --accent-ink: #fff7f2;
  --accent-soft: #f7dfd3;
  --correct: #6b9962;
  --present: #d9a441;

  --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fredoka", var(--font-body);

  --measure: 68ch;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(51 43 38 / 0.04), 0 8px 24px -12px rgb(51 43 38 / 0.16);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #2b2521;
    --surface: #332c27;
    --surface-alt: #3a322c;
    --border: #483f38;
    --ink: #ede6de;
    --ink-soft: #c4b8ac;
    --ink-faint: #8f8377;
    --accent: #d98567;
    --accent-ink: #2e1710;
    --accent-soft: #4a362d;
    --correct: #8fb37f;
    --present: #d9bc7a;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 8px 24px -12px rgb(0 0 0 / 0.5);
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(2.1rem, 6vw, 3.4rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }

p { margin: 0; }
a { color: inherit; }

img { max-width: 100%; display: block; }

/* max-width + inner padding rather than `width: min(100% - Xrem, ...)`:
   the latter resolves its 100% against the parent, so one overflowing
   descendant widens every wrapper on the page with it. */
.wrap {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.stack > * + * { margin-top: var(--gap, 1rem); }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  color: var(--ink-soft);
  max-width: var(--measure);
}

/* --- header ------------------------------------------------------- */

.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 5px;
  background: var(--ink);
}

.brand-mark i {
  border-radius: 2px;
  background: var(--bg);
  opacity: 0.9;
}
.brand-mark i:nth-child(2) { opacity: 0.5; }
.brand-mark i:nth-child(3) { opacity: 0.65; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a:focus-visible { color: var(--ink); border-bottom-color: var(--accent); }

/* --- sections ----------------------------------------------------- */

section { padding-block: clamp(3rem, 8vw, 5.5rem); }
section.tight { padding-block: clamp(2rem, 5vw, 3rem); }

.hero {
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: clamp(2.5rem, 7vw, 4.5rem);
}

/* --- game cards --------------------------------------------------- */

/* Capped rather than 1fr: with a single game in the portfolio a
   full-bleed card reads as a stretched placeholder. Tracks stay the same
   width as more titles land. */
.games {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 400px));
  justify-content: start;
}

.game-card {
  --card-accent: var(--accent);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.6rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.game-card:hover, .game-card:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgb(51 43 38 / 0.06), 0 16px 32px -16px rgb(51 43 38 / 0.22);
}

.game-card .icon {
  width: 62px;
  height: 62px;
  border-radius: 15px;
  background: var(--card-accent);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 600;
  color: var(--accent-ink);
}

.game-card h3 { font-size: 1.35rem; }
.game-card p { color: var(--ink-soft); font-size: 0.98rem; }

.tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.tag.live { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* --- store buttons ------------------------------------------------ */

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  border: 1px solid var(--ink);
  transition: opacity 140ms ease;
}
.store-btn:hover { opacity: 0.86; }

.store-btn svg { width: 24px; height: 24px; flex: none; fill: currentColor; }
.store-btn span { display: block; line-height: 1.2; }
.store-btn .small { font-size: 0.68rem; opacity: 0.75; letter-spacing: 0.02em; }
.store-btn .big { font-size: 1rem; font-weight: 700; font-family: var(--font-display); }

.store-btn[aria-disabled="true"] {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--border);
  cursor: default;
  pointer-events: none;
}

/* --- screenshots -------------------------------------------------- */

.shots {
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  padding-block: 0.5rem 1.25rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}

.shots figure {
  margin: 0;
  flex: none;
  width: min(62vw, 250px);
  scroll-snap-align: center;
}

.shots img {
  width: 100%;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--surface);
}

.shots figcaption {
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
}

/* --- feature list ------------------------------------------------- */

.features {
  display: grid;
  gap: 1.5rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
}

.feature h3 { margin-bottom: 0.35rem; }
.feature p { color: var(--ink-soft); font-size: 0.97rem; }

.feature .dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 0.5rem;
  vertical-align: 1px;
  background: var(--accent);
}
.feature:nth-child(2) .dot { background: var(--correct); }
.feature:nth-child(3) .dot { background: var(--present); }
.feature:nth-child(4) .dot { background: var(--ink-faint); }

/* --- prose (legal pages) ------------------------------------------ */

/* The legal pages put .prose straight under the hero, and both carry
   section padding — together that opened a gap wide enough to read as a
   missing block. */
section.prose { padding-top: 0; }

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.8rem; }
.prose p, .prose ul { margin-top: 0.9rem; color: var(--ink-soft); }
.prose ul { padding-left: 1.2rem; }
.prose li + li { margin-top: 0.4rem; }
.prose a { color: var(--accent); text-underline-offset: 3px; }
.prose strong { color: var(--ink); }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.2rem;
  font-size: 0.93rem;
}
.prose th, .prose td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prose th { color: var(--ink); font-weight: 700; }
.prose td { color: var(--ink-soft); }

.table-scroll { overflow-x: auto; }

.updated {
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}

/* --- language toggle ---------------------------------------------- */

.lang {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
  margin-top: 1.5rem;
}

.lang button {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

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

.site-foot {
  border-top: 1px solid var(--border);
  padding-block: 2.5rem 3.5rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--ink-faint);
}

.site-foot .row {
  display: flex;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
}

.site-foot a { color: var(--ink-soft); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }

.foot-links { display: flex; gap: 1.2rem; flex-wrap: wrap; }

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

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