/* Estilos comunes. Los colores vienen de theme.css de la web, aquí solo uso sus variables. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.25em;
}

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

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

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 40rem) {
  .container {
    padding: 0 1.5rem;
  }
}

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

/* modo ?demo: solo el juego, para la vista previa del menú */
.demo .site-header {
  display: none;
}

/* Sin barras de desplazamiento: un píxel de más por redondeo las haría aparecer */
.demo,
.demo body {
  overflow: hidden;
}

.demo body {
  min-height: 0;
  background: var(--surface);
}

/* cabecera */

.site-header .bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.site-header .brand {
  margin-right: auto;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.site-header nav a {
  display: inline-block;
  padding: 0.35rem 0;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-header nav a[aria-current='page'] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.theme {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme:hover {
  color: var(--accent);
}

.theme .sun {
  display: none;
}

:root[data-theme='light'] .theme .sun {
  display: block;
}

:root[data-theme='light'] .theme .moon {
  display: none;
}

/* menú */

.head {
  padding-top: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 4px solid var(--rule);
}

.head h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.5rem, 1.5rem + 4.5vw, 4.5rem);
  line-height: 1.1;
  font-weight: 750;
  letter-spacing: -0.045em;
}

.head p {
  margin: 0;
  color: var(--muted);
}

.game-list {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  list-style: none;
  margin: 0;
  padding: 2.5rem 0;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
}

.game-card:hover,
.game-card:focus-within {
  border-color: var(--accent);
}

.game-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  pointer-events: none;
}

.game-card h2 {
  margin: 0;
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 2.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* Toda la tarjeta es clicable a través del enlace del título */
.game-card h2 a {
  color: var(--accent);
  text-decoration: none;
}

.game-card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}
