/* Hallmark · macrostructure: Split Studio · genre: playful · theme: custom (brand: Tiny Realms 2.0 storybook tokens, shared with src/components/ui/theme.ts)
 * knobs: halves 5/7 · hero text-first · alternation per row · one colour-shift band (realms) · nav: N9 (wordmark + text CTA) · footer: Ft1 (ink band, wordmark display)
 * pre-emit critique: P4 H5 E4 S5 R4 V4
 * contrast: pass (40–41) · slop: pass (42–45) · honest: pass (46) · chrome: pass (47) · tokens: pass (48) · responsive: pass (49) · icons: pass (30) · mobile: pass (34, 49, 50–57)
 */

/* ── Fonts (self-hosted, copied by npm run landing:build) ───────── */
@font-face { font-family: 'Fredoka'; font-weight: 400; font-display: swap; src: url('/fonts/Fredoka_400Regular.ttf') format('truetype'); }
@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('/fonts/Fredoka_500Medium.ttf') format('truetype'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('/fonts/Fredoka_600SemiBold.ttf') format('truetype'); }

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  /* paper + ink: the game's storybook surfaces */
  --color-paper: #FFF1D6;
  --color-panel: #FFFBF0;
  --color-sunk: #F6E6C4;
  --color-ink: #5A3A2E;          /* outlines, rims, footer band */
  --color-text: #4A2E22;         /* 11.0:1 on paper */
  --color-muted: #7A5A48;        /* 5.6:1 on paper */
  --color-on-ink: #FFF1D6;       /* 9.0:1 on ink */
  --color-on-ink-muted: #E8D3B8; /* 6.9:1 on ink */
  /* accent: a deepened Tiny Realms coral so paper text clears 4.5:1 (4.64) */
  --color-accent: #B84A2A;
  --color-accent-hover: #A03F23;
  --color-accent-ink: #FFF1D6;
  --color-gold: #F2C14E;         /* ink text on gold 7.3:1 */
  --color-sky: #BFE3F5;          /* realms band */
  --color-focus: #5A3A2E;
  --color-focus-on-ink: #F2C14E;

  --font-display: 'Fredoka', ui-rounded, 'Segoe UI', sans-serif;
  --font-body: 'Fredoka', ui-rounded, 'Segoe UI', sans-serif;

  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.5rem, 1.2rem + 1.2vw, 2.125rem);
  --text-2xl: clamp(2.25rem, 1.55rem + 3vw, 3.75rem);

  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  --border: 3px solid var(--color-ink);
  --rim: 0 6px 0 var(--color-ink);
  --rim-pressed: 0 2px 0 var(--color-ink);
  --radius-card: 24px;
  --radius-button: 18px;
  --gutter: 16px;
  --page-max: 1120px;
}

@media (min-width: 48rem) {
  :root { --gutter: 32px; }
}

/* ── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.55;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: normal;
  line-height: 1.08;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
a { color: var(--color-text); text-decoration-thickness: 2px; text-underline-offset: 2px; }
a:hover { color: var(--color-accent); }
a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ── Nav · N9 edge-aligned minimal ──────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding-block: var(--space-md);
}
.site-nav__home { display: block; line-height: 0; border-radius: 12px; }
.site-nav__home img { width: 148px; }
.site-nav__cta {
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
}

/* ── Button ─────────────────────────────────────────────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 52px;
  padding: var(--space-sm) var(--space-lg);
  border: var(--border);
  border-radius: var(--radius-button);
  box-shadow: var(--rim);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease-out, transform 80ms ease-out, box-shadow 80ms ease-out;
}
.button:hover { background: var(--color-accent-hover); color: var(--color-accent-ink); }
.button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 4px;
  transition: none;
}
.button:active { transform: translateY(4px); box-shadow: var(--rim-pressed); }
.button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Split rows (the macrostructure) ────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: center;
}
@media (min-width: 55rem) {
  .split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-3xl); }
  .split--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .split--flip > :first-child { order: 2; }
}
/* Phone screenshots are narrow, so their rows pair up earlier than the rest. */
@media (min-width: 40rem) {
  .split--screen { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
  .split--screen.split--flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .split--screen.split--flip > :first-child { order: 2; }
}
.copy { max-width: 46ch; display: flex; flex-direction: column; gap: var(--space-md); }
.copy h2 { font-size: var(--text-xl); }
.copy p { color: var(--color-text); }

.section { padding-block: var(--space-3xl); }
@media (min-width: 55rem) { .section { padding-block: var(--space-4xl); } }

/* ── Hero ───────────────────────────────────────────────────────── */
.hero { padding-block: var(--space-lg) var(--space-3xl); }
.hero h1 { font-size: var(--text-2xl); line-height: 1.04; }
.hero .copy { gap: var(--space-lg); }
.hero__lede { font-size: var(--text-lg); max-width: 40ch; }
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-lg);
}
.hero__note { color: var(--color-muted); font-size: var(--text-sm); line-height: 1.2; }

.plate {
  margin: 0;
  border: var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--rim);
  overflow: hidden;
  background: var(--color-sky);
}
.plate img { width: 100%; }

/* ── Roster ─────────────────────────────────────────────────────── */
.roster {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-sm);
}
@media (min-width: 36rem) {
  .roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .roster__hero:first-child { grid-column: 1 / -1; }
}
.roster__hero {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-panel);
  border: var(--border);
  border-radius: 20px;
  box-shadow: var(--rim);
}
.roster__face {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-sunk);
  border: var(--border);
  overflow: hidden;
}
.roster__name { font-size: var(--text-lg); font-weight: 600; line-height: 1.1; }
.roster__meta { color: var(--color-muted); font-size: var(--text-sm); line-height: 1.35; }
.roster__unlock {
  display: inline-block;
  margin-top: var(--space-2xs);
  padding: 2px var(--space-xs);
  border-radius: 999px;
  background: var(--color-gold);
  color: var(--color-text);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
}

/* ── Screens (real device screenshots, no drawn frame) ──────────── */
.screen {
  margin: 0 auto;
  width: min(100%, 300px);
  border: var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--rim);
  overflow: hidden;
  background: var(--color-sunk);
}
.screen img { width: 100%; }

/* ── Realms band (the one colour shift) ─────────────────────────── */
.realms {
  background: var(--color-sky);
  border-block: var(--border);
  padding-block: var(--space-3xl);
}
@media (min-width: 55rem) { .realms { padding-block: var(--space-4xl); } }
.realms__head { display: flex; flex-direction: column; gap: var(--space-md); max-width: 52ch; }
.realms__head h2 { font-size: var(--text-xl); }
.realms__list {
  list-style: none;
  margin: var(--space-2xl) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-xl);
}
@media (min-width: 48rem) {
  .realms__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
  .realms__list > :nth-child(2) { margin-top: var(--space-2xl); }
}
.realm { display: flex; flex-direction: column; gap: var(--space-sm); }
.realm .plate { background: var(--color-panel); }
.realm__name { font-size: var(--text-lg); }
.realm__meta { color: var(--color-text); font-size: var(--text-sm); }

/* ── Costs (honest Q&A) ─────────────────────────────────────────── */
.costs { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xl); }
@media (min-width: 55rem) {
  .costs { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-3xl); align-items: start; }
}
.costs h2 { font-size: var(--text-xl); }
.qa { margin: 0; display: flex; flex-direction: column; gap: var(--space-lg); max-width: 62ch; }
.qa dt { font-weight: 600; font-size: var(--text-lg); line-height: 1.25; }
.qa dd { margin: var(--space-2xs) 0 0; }

/* ── Footer · Ft1 mast-headed ───────────────────────────────────── */
.site-foot {
  background: var(--color-ink);
  color: var(--color-on-ink);
  padding-block: var(--space-3xl) var(--space-2xl);
}
.site-foot__mast {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}
.site-foot__mast img { width: min(100%, 320px); }
.site-foot .button:focus-visible { outline-color: var(--color-focus-on-ink); }
.site-foot__links {
  list-style: none;
  margin: var(--space-2xl) 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
}
.site-foot__links a {
  color: var(--color-on-ink);
  white-space: nowrap;
  line-height: 1;
}
.site-foot__links a:hover { color: var(--color-gold); }
.site-foot a:focus-visible { outline-color: var(--color-focus-on-ink); }
.site-foot__fine { margin-top: var(--space-lg); color: var(--color-on-ink-muted); font-size: var(--text-sm); }

/* ── Legal + support pages ──────────────────────────────────────── */
.doc {
  max-width: 68ch;
  margin-inline: auto;
  padding: var(--space-xl) var(--gutter) var(--space-3xl);
}
.doc h1 { font-size: var(--text-xl); margin-bottom: var(--space-md); }
.doc h2 { font-size: var(--text-lg); margin: var(--space-xl) 0 var(--space-xs); }
.doc h3 { font-size: var(--text-base); margin: var(--space-lg) 0 var(--space-2xs); }
.doc p { margin-bottom: var(--space-sm); }
.doc ul { padding-left: var(--space-lg); margin: 0 0 var(--space-sm); line-height: 1.7; }
.doc code {
  font-size: 0.875em;
  background: var(--color-sunk);
  padding: 1px var(--space-2xs);
  border-radius: 6px;
}
.doc table { width: 100%; border-collapse: collapse; margin: 0 0 var(--space-md); display: block; overflow-x: auto; }
.doc th, .doc td { border: 2px solid var(--color-ink); padding: var(--space-xs); text-align: left; vertical-align: top; }
.doc th { background: var(--color-sunk); }

@media (prefers-reduced-motion: reduce) {
  .button { transition: background-color 120ms ease-out; }
  .button:active { transform: none; }
}
