/* ============================================================
   Design System — Portal de Jogos play.jhonatanwll.com
   Tokens + reset + primitivos compartilhados por hub e jogos.
   ============================================================ */

/* ---------- Fontes (self-hosted, OFL) ---------- */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/fredoka-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-400.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-700.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  /* Marca / cores vivas */
  --violet: #7c3aed;
  --violet-2: #a78bfa;
  --pink: #ec4899;
  --amber: #f59e0b;
  --cyan: #06b6d4;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;

  /* Cores por categoria */
  --cat-palavras: var(--violet);
  --cat-quiz: var(--amber);
  --cat-digitacao: var(--cyan);
  --cat-acao: var(--pink);
  --cat-educativos: var(--green);

  /* Semânticas (tema claro) */
  --bg: #f4f1fb;
  --bg-grad-1: #ede9fe;
  --bg-grad-2: #fce7f3;
  --surface: #ffffff;
  --surface-2: #faf8ff;
  --border: #e7e3f3;
  --text: #1e1b2e;
  --text-soft: #55506b;
  --text-mute: #8b849f;
  --brand: var(--violet);
  --brand-ink: #ffffff;
  --focus: #7c3aed;

  /* Tipografia */
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-xs: clamp(0.72rem, 0.68rem + 0.2vw, 0.8rem);
  --fs-sm: clamp(0.82rem, 0.78rem + 0.25vw, 0.92rem);
  --fs-base: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem);
  --fs-lg: clamp(1.1rem, 1rem + 0.6vw, 1.35rem);
  --fs-xl: clamp(1.4rem, 1.15rem + 1.2vw, 2rem);
  --fs-2xl: clamp(1.9rem, 1.4rem + 2.4vw, 3rem);
  --fs-3xl: clamp(2.4rem, 1.6rem + 4vw, 4rem);

  /* Espaçamento / raio / sombra */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4rem;
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;
  --shadow-sm:
    0 1px 2px rgba(30, 27, 46, 0.06), 0 1px 3px rgba(30, 27, 46, 0.08);
  --shadow-md:
    0 4px 12px rgba(90, 60, 180, 0.1), 0 2px 4px rgba(30, 27, 46, 0.06);
  --shadow-lg:
    0 12px 32px rgba(90, 60, 180, 0.16), 0 4px 8px rgba(30, 27, 46, 0.06);
  --shadow-pop: 0 18px 50px rgba(124, 58, 237, 0.22);

  /* Movimento */
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: 0.14s;
  --dur: 0.24s;
  --dur-slow: 0.45s;

  --maxw: 1160px;
}

/* Tema escuro */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d1a;
    --bg-grad-1: #1a1430;
    --bg-grad-2: #2a1338;
    --surface: #1a1728;
    --surface-2: #221d33;
    --border: #322c47;
    --text: #f4f1fb;
    --text-soft: #c3bcd8;
    --text-mute: #8b849f;
    --brand: var(--violet-2);
    --brand-ink: #1a1130;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
  }
}
/* Override manual via [data-theme] (botão de tema) */
:root[data-theme="dark"] {
  --bg: #0f0d1a;
  --bg-grad-1: #1a1430;
  --bg-grad-2: #2a1338;
  --surface: #1a1728;
  --surface-2: #221d33;
  --border: #322c47;
  --text: #f4f1fb;
  --text-soft: #c3bcd8;
  --text-mute: #8b849f;
  --brand: var(--violet-2);
  --brand-ink: #1a1130;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"] {
  --bg: #f4f1fb;
  --bg-grad-1: #ede9fe;
  --bg-grad-2: #fce7f3;
  --surface: #fff;
  --surface-2: #faf8ff;
  --border: #e7e3f3;
  --text: #1e1b2e;
  --text-soft: #55506b;
  --text-mute: #8b849f;
  --brand: var(--violet);
  --brand-ink: #fff;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img,
svg,
canvas {
  display: block;
  max-width: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

/* ---------- Primitivos compartilhados ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-base);
  padding: 0.7em 1.3em;
  border-radius: var(--r-full);
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: var(--shadow-md);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) ease,
    filter var(--dur) ease;
  will-change: transform;
}
.btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-lg);
}
.btn:active {
  transform: translateY(0) scale(0.98);
}
.btn--ghost {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--border);
}
.btn--lg {
  font-size: var(--fs-lg);
  padding: 0.8em 1.6em;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

/* Botão flutuante "voltar ao hub" — usado por todos os jogos */
.back-hub {
  position: fixed;
  top: max(0.9rem, env(safe-area-inset-top));
  left: 0.9rem;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 0.55em 1em 0.55em 0.8em;
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) ease;
}
.back-hub:hover {
  transform: translateX(-2px);
  box-shadow: var(--shadow-lg);
}
.back-hub svg {
  width: 1.1em;
  height: 1.1em;
}

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