@font-face {
  font-family: "Nunito";
  src: url("assets/fonts/nunito-latin.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

/* Tema claro (por defecto) */
:root {
  --green: #1c461c;
  --yellow: #ffd43b;
  --yellow-dark: #f5b700;
  --bg: #f7f6ee;
  --card: #ffffff;
  --text: #1c2a1c;
  --muted: #5b6b58;
  --line: #e3e5d8;
  --button-bg: #eef1e4;
  --button-text: var(--green);
  --primary-bg: var(--green);
  --primary-text: #ffffff;
  --card-shadow: 0 0.9rem 2rem rgb(28 70 28 / 16%);
  --logo-ink: #1c461c;
  --logo-labs: #4c7a3a;
  --icon-moon: block;
  --icon-sun: none;
  color-scheme: light;
}

/* Tema oscuro: elegido con el botón o, si no hay elección, el del sistema */
:root[data-theme="dark"] {
  --bg: #0f1d0f;
  --card: #162a16;
  --text: #e8f1dc;
  --muted: #a9c99a;
  --line: #23401f;
  --button-bg: #20391e;
  --button-text: #e8f1dc;
  --primary-bg: var(--yellow);
  --primary-text: var(--green);
  --card-shadow: 0 0.9rem 2rem rgb(0 0 0 / 45%);
  --logo-ink: #e8f1dc;
  --logo-labs: #a9c99a;
  --icon-moon: none;
  --icon-sun: block;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1d0f;
    --card: #162a16;
    --text: #e8f1dc;
    --muted: #a9c99a;
    --line: #23401f;
    --button-bg: #20391e;
    --button-text: #e8f1dc;
    --primary-bg: var(--yellow);
    --primary-text: var(--green);
    --card-shadow: 0 0.9rem 2rem rgb(0 0 0 / 45%);
    --logo-ink: #e8f1dc;
    --logo-labs: #a9c99a;
    --icon-moon: none;
    --icon-sun: block;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

/* tamaño base fijo: 16 px en móvil y tablet, 14,4 px en escritorio (el tamaño aprobado).
   Sin escalado por ancho de ventana: el tamaño lo decide el zoom del navegador. Todo va en rem. */
html {
  font-size: 100%;
}

@media (min-width: 64em) {
  html {
    font-size: 90%;
  }
}

/* la página ocupa al menos toda la altura y el pie queda abajo */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
}

a {
  color: inherit;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
}

/* Botón de tema, arriba a la derecha */
.theme-toggle {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle .icon {
  width: 1.3rem;
  height: 1.3rem;
}

.icon-moon {
  display: var(--icon-moon);
}

.icon-sun {
  display: var(--icon-sun);
}

/* Cabecera */
.hero {
  padding: 3.5rem 1.5rem 2.5rem;
  text-align: center;
}

.logo {
  display: block;
  width: min(22.5rem, 80vw);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.logo-ink {
  fill: var(--logo-ink);
}

.logo-stem {
  stroke: var(--logo-ink);
}

.logo-labs {
  fill: var(--logo-labs);
}

/* Animación del logo: el cubo se abre en tres pétalos y las espinas se erizan.
   Una vez al cargar la página y mientras el ratón está encima del logo. */
.face,
.spike {
  transform-box: fill-box;
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* cada espina gira sobre su base, en el eje del tallo */
.spike-left.spike-top {
  transform-origin: 93.3% 82.2%;
}

.spike-right.spike-top {
  transform-origin: 6.7% 82.2%;
}

.spike-left.spike-bottom {
  transform-origin: 87.4% 69.8%;
}

.spike-right.spike-bottom {
  transform-origin: 12.6% 69.8%;
}

.logo:hover .face-top {
  transform: translate(0, -2px);
}

.logo:hover .face-left {
  transform: translate(-1.73px, 1px);
}

.logo:hover .face-right {
  transform: translate(1.73px, 1px);
}

.logo:hover .spike-left {
  transform: rotate(8deg);
}

.logo:hover .spike-right {
  transform: rotate(-8deg);
}

.face-top {
  animation: bloom-top 1.8s ease-in-out 0.6s;
}

.face-left {
  animation: bloom-left 1.8s ease-in-out 0.6s;
}

.face-right {
  animation: bloom-right 1.8s ease-in-out 0.6s;
}

.spike-left {
  animation: bristle-left 1.8s ease-in-out 0.6s;
}

.spike-right {
  animation: bristle-right 1.8s ease-in-out 0.6s;
}

@keyframes bloom-top {
  35%,
  65% {
    transform: translate(0, -2px);
  }
}

@keyframes bloom-left {
  35%,
  65% {
    transform: translate(-1.73px, 1px);
  }
}

@keyframes bloom-right {
  35%,
  65% {
    transform: translate(1.73px, 1px);
  }
}

@keyframes bristle-left {
  35%,
  65% {
    transform: rotate(8deg);
  }
}

@keyframes bristle-right {
  35%,
  65% {
    transform: rotate(-8deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .face,
  .spike {
    transition: none;
    animation: none;
  }

  .logo:hover .face,
  .logo:hover .spike {
    transform: none;
  }
}

.tagline {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 1.2rem;
}

/* Juegos */
main {
  flex: 1;
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1.5rem 3.5rem;
}

.section-title {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: var(--card);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

/* la tarjeta se eleva un poco al pasar por encima */
.card:hover,
.card:focus-within {
  box-shadow: var(--card-shadow);
  transform: translateY(-0.35rem);
}

@media (prefers-reduced-motion: reduce) {
  .card {
    transition: box-shadow 0.2s ease;
  }

  .card:hover,
  .card:focus-within {
    transform: none;
  }
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1.91 / 1;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1.4rem;
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
  font-weight: 800;
}

.card p {
  margin: 0 0 0.75rem;
}

.badge {
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
}

.badge-ended {
  background: var(--button-bg);
  color: var(--muted);
}

.platforms {
  color: var(--muted);
  font-size: 0.95rem;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

/* Botones de enlace: solo icono, redondos */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  background: var(--button-bg);
  color: var(--button-text);
  text-decoration: none;
  transition: transform 0.15s ease;
}

.button .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.button.primary {
  background: var(--primary-bg);
  color: var(--primary-text);
}

.button:hover,
.theme-toggle:hover {
  transform: scale(1.08);
}

.button:focus-visible,
.theme-toggle:focus-visible,
.contact:focus-visible {
  outline: 2px solid var(--yellow-dark);
  outline-offset: 2px;
}

/* Pie en el verde de la marca */
footer {
  padding: 2.25rem 1.5rem 2.5rem;
  background: var(--green);
  color: #e8f1dc;
  text-align: center;
}

footer p {
  margin: 0.3rem 0;
}

footer p:first-child {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.contact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 10%);
  color: #e8f1dc;
  transition:
    background 0.15s ease,
    transform 0.15s ease;
}

.contact .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.contact:hover {
  background: var(--yellow);
  color: var(--green);
  transform: scale(1.08);
}

.small {
  color: #a9c99a;
  font-size: 0.85rem;
}
