/* =========================================================
   style.css — tema do site de jogos (claro / escuro)
   Tema escuro: Catppuccin Mocha
   ========================================================= */

/* ---------- tokens compartilhados ---------- */
:root {
  --radius: 12px;
  --gap:    1rem;
  --card-h: 280px;
  --maxw:   1100px;
}

/* ---------- tema escuro (padrão) — Catppuccin Mocha ---------- */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  /* Catppuccin Mocha
     base     #1e1e2e
     mantle   #181825
     crust    #11111b
     surface0 #313244
     surface1 #45475a
     surface2 #585b70
     overlay0 #6c7086
     overlay1 #7f849c
     overlay2 #9399b2
     subtext0 #a6adc8
     subtext1 #bac2de
     text     #cdd6f4
     blue     #89b4fa
     mauve    #cba6f7
  */
  --bg:          #1e1e2e;   /* base     */
  --surface:     #181825;   /* mantle   */
  --surface-2:   #313244;   /* surface0 */
  --border:      #45475a;   /* surface1 */
  --text:        #cdd6f4;   /* text     */
  --muted:       #a6adc8;   /* subtext0 */
  --accent:      #89b4fa;   /* blue     */
  --accent-soft: rgba(137, 180, 250, 0.08);
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* ---------- tema claro ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:            #f5f7fa;
  --surface:       #ffffff;
  --surface-2:     #eef1f6;
  --border:        #d9dee6;
  --text:          #1a1f29;
  --muted:         #5a6473;
  --accent:        #2f6fe4;
  --accent-soft:   rgba(47, 111, 228, 0.08);
  --shadow-card:   0 8px 24px rgba(0, 0, 0, 0.12);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  transition: background-color 0.2s ease, color 0.2s ease;
}

img { max-width: 100%; }

a { color: var(--accent); }

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

/* ---------- header ---------- */
.site-header {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2rem 4rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  transition: border-color 0.2s ease;
}
.site-title {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: -0.02em;
}
.site-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- botão de tema ---------- */
.theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.15s ease;
}
.theme-toggle:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: translateY(0); }

/* ---------- página / seções ---------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.75rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.section__title {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
}

/* ---------- fila horizontal de cards ---------- */
.card-row {
  display: flex;
  gap: var(--gap);
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding: 0.25rem 0.25rem 0.75rem;
  margin: -0.25rem;
  justify-content: center;
  justify-content: safe center;
}
.card-row::-webkit-scrollbar { height: 8px; }
.card-row::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.card-row > * {
  flex: 0 0 auto;
}

/* ---------- card ---------- */
.game-card {
  width: max-content;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}
.game-card__image {
  display: block;
  height: var(--card-h);
  width: auto;
  background: var(--surface-2);
}
.game-card__name {
  width: 0;
  min-width: 100%;
  padding: 0.6rem 0.75rem 0.7rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- tabela ---------- */
.section--table .section__content {
  max-height: 520px;
  overflow: auto;
  padding-bottom: 0.25rem;
}
.section--table .section__content::-webkit-scrollbar { width: 8px; height: 8px; }
.section--table .section__content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
.section--table .section__content::-webkit-scrollbar-track {
  background: transparent;
}

.games-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.games-table th,
.games-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.games-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--border);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.games-table tbody tr:last-child td { border-bottom: none; }
.games-table tbody tr:hover { background: var(--accent-soft); }

/* ---------- gráficos ---------- */
.chart-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.chart {
  margin: 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.chart svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}
.chart__caption {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- responsivo ---------- */
@media (max-width: 600px) {
  :root {
    --card-h: 200px;
    --gap:    0.75rem;
  }
  .site-header { padding: 1.5rem 3.5rem 1rem; }
  .theme-toggle { top: 0.9rem; right: 0.75rem; width: 36px; height: 36px; }
  .page { gap: 2rem; }
  .games-table th,
  .games-table td { padding: 0.55rem 0.6rem; }
  .section--table .section__content { max-height: 420px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
