/*
 * BM Studio website (REL-04). One stylesheet for every page, no build step.
 * Colors come from packages/design-tokens/src/color.ts (app `colors.light` / `colors.dark` and the
 * `sky` night gradient); fonts are the app's Fredoka (headings) and Figtree (text), self-hosted
 * under the SIL OFL 1.1 (licences next to the font files).
 */

@font-face {
  font-family: 'Fredoka';
  src: url('/assets/fonts/fredoka_semibold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: url('/assets/fonts/figtree_medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Figtree';
  src: url('/assets/fonts/figtree_bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* colors.light */
  --canvas: #e8edf4;
  --surface: #f8fafd;
  --sunk: #dee5ee;
  --text: #172033;
  --text-2: #5a6477;
  --line: #cbd3df;
  --accent: #2f5bea;
  --link: #1e44c4;
  --accent-tonal: rgba(47, 91, 234, 0.12);
  --gold-text: #7a5400;
  --gold-fill: rgba(171, 120, 0, 0.14);

  /* colors.light.sky top and mid: the night header stays dark in both themes, and the lighter
     sky bottom is left out so header text keeps 4.5:1. */
  --sky-top: #26365f;
  --sky-mid: #3b4c7e;
  --star: #fff6e0;
  --gold: #f4be46;
  --on-sky: #e7ecf5;
  --on-sky-2: #c9d2e6;

  --font-display: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-text: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* colors.dark */
    --canvas: #0e131e;
    --surface: #161d2b;
    --sunk: #1b2333;
    --text: #e7ecf5;
    --text-2: #8e98aa;
    --line: #283246;
    --accent: #7090ff;
    --link: #a7bbff;
    --accent-tonal: rgba(112, 144, 255, 0.12);
    --gold-text: #f4be46;
    --gold-fill: rgba(244, 190, 70, 0.16);

    /* colors.dark.sky top and mid */
    --sky-top: #070b16;
    --sky-mid: #0e1428;
  }
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-text);
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3vw, 3rem);
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
  scroll-margin-top: 1rem;
}

h3 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.5rem;
  scroll-margin-top: 1rem;
}

p,
ul,
ol,
dl,
table {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-inline-start: 1.4rem;
}

li + li {
  margin-top: 0.35rem;
}

strong,
b {
  font-weight: 700;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--sunk);
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
}

.skip:focus {
  top: 1rem;
}

/* Night sky header: gradient plus a few fixed stars drawn with radial gradients. */
.sky {
  color: var(--on-sky);
  background:
    radial-gradient(1.5px 1.5px at 12% 22%, var(--star) 98%, transparent),
    radial-gradient(1px 1px at 27% 68%, rgba(255, 246, 224, 0.7) 98%, transparent),
    radial-gradient(2px 2px at 41% 30%, var(--star) 98%, transparent),
    radial-gradient(1px 1px at 58% 78%, rgba(255, 246, 224, 0.6) 98%, transparent),
    radial-gradient(1.5px 1.5px at 72% 18%, var(--star) 98%, transparent),
    radial-gradient(1px 1px at 86% 52%, rgba(255, 246, 224, 0.7) 98%, transparent),
    radial-gradient(2.5px 2.5px at 93% 24%, var(--gold) 98%, transparent),
    radial-gradient(1px 1px at 6% 84%, rgba(255, 246, 224, 0.6) 98%, transparent),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 100%);
}

.sky a {
  color: var(--on-sky);
}

.bar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  min-height: 4rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  text-decoration: none;
  margin-inline-end: auto;
}

.brand img {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.nav a,
.lang {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: none;
  font-weight: 700;
}

.nav a:hover,
.lang:hover {
  text-decoration: underline;
}

.nav a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 2px;
}

.lang {
  padding: 0 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
}

.hero {
  padding-top: 2.5rem;
  padding-bottom: 3rem;
}

.hero p {
  max-width: 38rem;
  color: var(--on-sky-2);
  font-size: 1.15rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
}

main {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.doc {
  max-width: var(--measure);
}

.doc > header {
  margin-bottom: 1.5rem;
}

.meta {
  color: var(--text-2);
  margin: 0;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2rem;
}

.toc h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.toc ol {
  margin: 0;
}

.note {
  background: var(--accent-tonal);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 0 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  margin: 0;
}

th,
td {
  text-align: start;
  vertical-align: top;
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  font-weight: 700;
  background: var(--sunk);
}

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 1.5rem 0 2rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card h2,
.card h3 {
  margin-top: 0;
}

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

.game {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: auto 1fr;
  align-items: start;
}

.game img {
  width: 6rem;
  height: 6rem;
  border-radius: 1.4rem;
}

.game h2,
.game h3 {
  margin-top: 0;
}

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

.stores li + li {
  margin-top: 0;
}

.store {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  min-height: 3.25rem;
  min-width: 10.5rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--canvas);
  text-decoration: none;
  line-height: 1.25;
}

.store small {
  font-size: 0.75rem;
  opacity: 0.8;
}

.store span {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.store[aria-disabled='true'] {
  background: var(--sunk);
  color: var(--text-2);
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--gold-fill);
  color: var(--gold-text);
  font-size: 0.85rem;
  font-weight: 700;
}

details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  margin: 0 0 0.75rem;
}

summary {
  cursor: pointer;
  min-height: 2.75rem;
  padding: 0.7rem 0;
  font-weight: 700;
}

details[open] summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 0.95rem;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-bottom: 0.75rem;
}

.site-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.site-footer p {
  margin: 0;
}

@media (max-width: 30rem) {
  body {
    font-size: 1rem;
  }

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

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

@media print {
  .sky,
  .site-footer nav,
  .skip,
  .toc {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
