/* ==========================================================================
   Shared site styles. Every page loads this file.
   Look: "Sticker Shop" — loud, chunky, made to be tapped. Thick ink outlines,
   hard offset shadows, a bright colour per game, buttons that press in.
   Games: use these variables and classes, and put game-only styles in your
   own game.css. Don't edit this file from a game chat — ask the
   infrastructure chat instead, so every game stays consistent.
   ========================================================================== */

/* Headings: Archivo Black (one weight; the range stops browsers faking a bold). */
@font-face {
  font-family: "Archivo Black";
  src: url("fonts/archivo-black-latin-400-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
/* Body: Space Grotesk 500 (regular text) and 700 (bold, buttons). */
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-500-normal.woff2") format("woff2");
  font-weight: 100 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin-700-normal.woff2") format("woff2");
  font-weight: 601 900; font-style: normal; font-display: swap;
}

:root {
  /* Palette */
  --paper: #fff4d6;        /* page background (cream) */
  --card: #ffffff;         /* raised surfaces */
  --ink: #141414;          /* text, outlines, shadows */
  --ink-soft: #46423a;     /* secondary text */
  --ink-faint: #6b665b;    /* hints, disabled */
  --line: #141414;         /* borders are ink in this look */
  --accent: #ff6ba6;       /* site accent: primary buttons, kickers */
  --accent-ink: #141414;   /* text on accent */
  --good: #1f9d55;         /* correct / success (text, icons) */
  --bad: #d64545;          /* wrong / fail (text, icons) */
  --good-bg: #c8f5b0;      /* correct answer fill */
  --bad-bg: #ffc4c4;       /* wrong answer fill */

  /* Bright game colours, for games that want them (tiles use meta.json "color") */
  --pink: #ffb8d1; --blue: #b8e0ff; --green: #c8f5b0; --orange: #ffd59e; --purple: #d9c8ff; --yellow: #fff08a;

  /* Type */
  --font-display: "Archivo Black", "Arial Black", Impact, system-ui, sans-serif;
  --font-body: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 1vw, 2.2rem);
  --step-3: clamp(2.2rem, 1.8rem + 2vw, 3.4rem);
  --step-4: clamp(2.8rem, 2rem + 4vw, 5.2rem);

  /* Shape and space */
  --border: 3px;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 6px 6px 0 var(--ink);        /* hard offset shadow */
  --shadow-sm: 4px 4px 0 var(--ink);
  --wrap: 1080px;
  --wrap-game: 720px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img, svg, video, canvas { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1; letter-spacing: -0.02em; margin: 0 0 0.4em; }
p { margin: 0 0 1em; }
strong, b { font-weight: 700; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

/* ---------- Header / footer ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem clamp(1rem, 4vw, 2rem);
  max-width: var(--wrap); width: 100%; margin: 0 auto;
}
.wordmark {
  display: inline-block;
  font-family: var(--font-display); font-weight: 400; font-size: 1.2rem; line-height: 1.2;
  letter-spacing: -0.01em; text-decoration: none;
  background: var(--ink); color: var(--paper);
  padding: 0.3rem 0.75rem; border-radius: 10px;
  transform: rotate(-2deg);
  transition: transform 140ms ease;
}
.wordmark:hover { transform: rotate(-4deg) scale(1.03); }
.wordmark--small { font-size: 0.95rem; }
.header-link {
  font-size: var(--step--1); font-weight: 700; text-decoration: none; color: var(--ink);
  background: var(--card); border: var(--border) solid var(--ink); border-radius: 999px;
  padding: 0.45rem 1rem; box-shadow: 3px 3px 0 var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.header-link:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.header-link:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

.site-footer {
  max-width: var(--wrap); width: 100%; margin: 4rem auto 0;
  padding: 2rem clamp(1rem, 4vw, 2rem) 2.5rem;
  border-top: var(--border) solid var(--ink);
  color: var(--ink-soft); font-size: var(--step--1);
}
.site-footer p { margin: 0.6rem 0 0; }
.site-footer__fine { color: var(--ink-faint); }

/* ---------- Home ---------- */
.hero {
  max-width: var(--wrap); margin: 0 auto; width: 100%;
  padding: clamp(2rem, 7vw, 4.5rem) clamp(1rem, 4vw, 2rem) clamp(1.8rem, 4vw, 2.8rem);
}
.hero__title { font-size: var(--step-4); font-weight: 400; letter-spacing: -0.03em; line-height: 0.95; margin-bottom: 0.25em; }
.hero__tagline { font-size: var(--step-1); color: var(--ink); max-width: 36ch; margin: 0; }

.game-grid {
  max-width: var(--wrap); margin: 0 auto; width: 100%;
  padding: 0 clamp(1rem, 4vw, 2rem) 0.5rem;
  display: grid; gap: clamp(1rem, 2.4vw, 1.6rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.tile {
  --tile-bg: var(--orange);
  position: relative; display: flex; flex-direction: column;
  min-height: 260px; padding: 1.4rem;
  background: var(--tile-bg); border: var(--border) solid var(--ink); border-radius: var(--radius);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 140ms ease, box-shadow 140ms ease;
  overflow: hidden;
}
a.tile:hover { transform: translate(-2px, -2px) rotate(-0.5deg); box-shadow: 8px 8px 0 var(--ink); }
a.tile:active { transform: translate(5px, 5px); box-shadow: 1px 1px 0 var(--ink); }
.tile__art { flex: 1; display: grid; place-items: center; min-height: 120px; }
.tile__emoji { font-size: 4.5rem; line-height: 1; transform: rotate(-6deg); }
.tile__thumb { width: 100%; height: 140px; object-fit: contain; }
.tile__title { font-family: var(--font-display); font-weight: 400; font-size: var(--step-1); letter-spacing: -0.01em; line-height: 1.05; margin: 0.8rem 0 0.35rem; }
.tile__tagline { margin: 0; color: var(--ink); font-size: var(--step--1); }
.tile--soon { box-shadow: none; border-style: dashed; }
.tile--soon .tile__art { filter: grayscale(0.4); opacity: 0.8; }
.pill {
  position: absolute; top: 1rem; right: 1rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--card); color: var(--ink); border: 2px solid var(--ink);
  padding: 0.25rem 0.6rem; border-radius: 999px;
}
.pill--new { background: var(--ink); color: var(--paper); transform: rotate(4deg); }

/* ---------- Generic page + game layout ---------- */
.page { max-width: var(--wrap-game); width: 100%; margin: 0 auto; padding: 2rem clamp(1rem, 4vw, 2rem); }
.page--center { text-align: center; padding-top: clamp(3rem, 10vw, 6rem); }
.page__title { font-size: var(--step-3); font-weight: 400; }
.page__lede { font-size: var(--step-1); color: var(--ink-soft); }
.kicker {
  display: inline-block;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: var(--step--1);
  background: var(--ink); color: var(--paper); padding: 0.2rem 0.65rem; border-radius: 999px;
  margin-bottom: 0.8rem;
}

/* A game page: <main class="game"> ... </main> */
.game { max-width: var(--wrap-game); width: 100%; margin: 0 auto; padding: 1rem clamp(1rem, 4vw, 2rem) 2rem; }
.game__title { font-size: var(--step-3); font-weight: 400; text-align: center; margin-top: 1.5rem; }
.game__intro { font-size: var(--step-1); color: var(--ink-soft); text-align: center; max-width: 34ch; margin: 0 auto 1.6rem; }
.screen[hidden] { display: none !important; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 0.9rem; align-items: center; }
.row { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; }

/* Cards / choices */
.card { background: var(--card); border: var(--border) solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.choice {
  display: block; width: 100%; text-align: left;
  font: inherit; font-weight: 700; font-size: var(--step-1);
  padding: 1rem 1.2rem; border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink);
  border: var(--border) solid var(--ink); cursor: pointer;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform 110ms ease, box-shadow 110ms ease, background 110ms ease;
}
.choice:hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--ink); }
.choice:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.choice:disabled { cursor: default; }
.choice.is-right { background: var(--good-bg); transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.choice.is-wrong { background: var(--bad-bg); transform: translate(4px, 4px) rotate(-0.6deg); box-shadow: 1px 1px 0 var(--ink); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font: inherit; font-weight: 700; font-size: var(--step-0);
  padding: 0.8rem 1.4rem; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  border: var(--border) solid var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 110ms ease, box-shadow 110ms ease;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }
.btn--ghost { background: var(--card); color: var(--ink); }
.btn--big { font-size: var(--step-1); padding: 0.95rem 2rem; }

/* Big numbers for scores / results */
.stat { font-family: var(--font-display); font-weight: 400; font-size: var(--step-4); line-height: 1; letter-spacing: -0.03em; margin: 0; }
.stat-label { margin: 0; color: var(--ink); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

/* Toast (used by share()) */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 180%);
  background: var(--ink); color: var(--paper); padding: 0.7rem 1.2rem; border-radius: 999px;
  border: var(--border) solid var(--ink); box-shadow: 4px 4px 0 var(--accent);
  font-weight: 700; font-size: var(--step--1); z-index: 1000;
  transition: transform 220ms ease; pointer-events: none;
}
.toast.is-visible { transform: translate(-50%, 0); }

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

@media (max-width: 560px) {
  :root { --shadow: 5px 5px 0 var(--ink); }
  .tile { min-height: 0; padding: 1.2rem; }
  .tile__art { min-height: 84px; }
  .tile__emoji { font-size: 3.4rem; }
  .tile__thumb { height: 96px; }
}
