/* Hoja única del sitio: fondo nocturno, texto claro y fuentes del sistema. */

:root {
  color-scheme: dark;
  --fondo: #05070d;
  --fondo-alto: #121a33;
  --texto: #dfe6f5;
  --texto-suave: #a9b4cc;
  --enlace: #9cc0ff;
  --enlace-activo: #cfe0ff;
  --foco: #ffd27a;
  --borde: rgba(223, 230, 245, 0.16);
  --borde-fuerte: rgba(223, 230, 245, 0.32);
  --panel: rgba(18, 26, 51, 0.55);
  --panel-alto: rgba(18, 26, 51, 0.85);
  --ancho: 60rem;
  --ancho-texto: 42rem;
}

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

html {
  background-color: var(--fondo);
  background-image: radial-gradient(ellipse 120% 60rem at 50% 0%, #121a33 0%, #05070d 70%);
  background-repeat: no-repeat;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--texto);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

/* Enlace para saltar al contenido: oculto hasta que recibe el foco. */
body > a:first-child,
a[href="#contenido"] {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  border-radius: 0.4rem;
  background: var(--fondo-alto);
  color: var(--texto);
  border: 1px solid var(--borde-fuerte);
  text-decoration: none;
}

body > a:first-child:focus,
a[href="#contenido"]:focus {
  top: 1rem;
}

/* Cabecera y navegación */
body > header {
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--borde);
}

body > header > a:first-child,
body > header p {
  margin: 0;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 1.05rem;
}

body > header > a:first-child {
  color: var(--texto);
  text-decoration: none;
}

body > header nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

body > header nav li {
  margin: 0;
}

body > header nav a {
  display: inline-block;
  padding: 0.35rem 0;
  color: var(--texto-suave);
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

body > header nav a:hover {
  color: var(--texto);
  border-bottom-color: var(--borde-fuerte);
}

body > header nav a[aria-current] {
  color: var(--texto);
  border-bottom-color: var(--enlace);
}

a[hreflang] {
  white-space: nowrap;
}

/* Contenido */
main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3.5rem;
}

main > * {
  max-width: var(--ancho-texto);
}

main > table,
main > section,
main > div,
main > ul.fichas,
main > .fichas {
  max-width: none;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  color: var(--texto);
}

h1 {
  font-weight: 300;
  letter-spacing: 0.04em;
  font-size: clamp(1.9rem, 6vw, 3.2rem);
  margin: 0 0 0.8em;
}

/* El nombre del juego en la portada: letras separadas, como en la cabecera. En un título largo
   ese espaciado parte las palabras y se lee a trozos, sobre todo en un móvil. */
h1.marca {
  letter-spacing: 0.2em;
}

h2 {
  font-weight: 400;
  letter-spacing: 0.04em;
  font-size: clamp(1.35rem, 3.6vw, 1.75rem);
  margin: 2.2em 0 0.7em;
}

h3 {
  font-weight: 500;
  font-size: 1.15rem;
  margin: 1.6em 0 0.5em;
}

h4 {
  font-weight: 600;
  font-size: 1rem;
  margin: 1.2em 0 0.4em;
}

p {
  margin: 0 0 1em;
}

main > p:first-of-type {
  font-size: 1.125rem;
}

ul,
ol {
  padding-left: 1.4rem;
  margin: 0 0 1em;
}

li {
  margin: 0.3em 0;
}

a {
  color: var(--enlace);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--enlace-activo);
  text-decoration-thickness: 2px;
}

strong,
b {
  font-weight: 600;
}

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

hr {
  border: 0;
  border-top: 1px solid var(--borde);
  margin: 2rem 0;
}

/* Foco visible en todo lo que se puede alcanzar con el teclado */
:focus {
  outline: 2px solid var(--foco);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

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

/* Tablas (galaxias y cualquier listado) */
.tabla {
  width: 100%;
  overflow-x: auto;
  margin: 0 0 1.5em;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  background: var(--panel);
  border: 1px solid var(--borde);
}

.tabla > table {
  margin: 0;
}

caption {
  text-align: left;
  padding: 0 0 0.5rem;
  color: var(--texto-suave);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--borde);
}

th {
  font-weight: 600;
  background: var(--panel-alto);
  border-bottom-color: var(--borde-fuerte);
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Fichas del manual */
.fichas {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
}

.fichas > li {
  margin: 0;
}

article,
.ficha {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 0.6rem;
  padding: 1.1rem 1.2rem 0.4rem;
  margin: 0 0 1rem;
}

.fichas > article,
.fichas > .ficha,
.fichas > li > article {
  margin: 0;
  height: 100%;
}

article > h2,
article > h3,
.ficha > h2,
.ficha > h3 {
  margin-top: 0;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

dl {
  margin: 0 0 1em;
}

dt {
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--texto-suave);
  margin: 0.8em 0 0.15em;
}

dt:first-child {
  margin-top: 0;
}

dd {
  margin: 0;
}

/* Un campo que todavía no se publica: se ve, en gris y en cursiva, y nunca en blanco. */
.por-publicar {
  color: #8d97ad;
  font-style: italic;
}

/* Pie */
body > footer {
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  border-top: 1px solid var(--borde);
  color: var(--texto-suave);
  font-size: 0.9375rem;
}

body > footer p {
  margin: 0 0 0.6em;
}

body > footer nav ul,
body > footer ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

body > footer li {
  margin: 0;
}

body > footer h2 {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 1rem 0 0.25rem;
  color: var(--texto-suave);
}

/* Secciones legales en el segundo idioma */
section[lang] {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--borde);
}

/* Pantallas estrechas */
@media (max-width: 36rem) {
  body {
    font-size: 1rem;
  }

  body > header {
    padding-top: 1rem;
  }

  main {
    padding: 1.75rem 1rem 2.5rem;
  }

  th,
  td {
    padding: 0.6rem 0.65rem;
  }

  .fichas {
    grid-template-columns: 1fr;
  }
}

/* Movimiento: solo si la persona no pidió reducirlo */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  a,
  body > header nav a {
    transition: color 0.15s ease, border-color 0.15s ease;
  }
}

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

/* Alto contraste forzado del sistema */
@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid CanvasText;
  }

  article,
  .ficha,
  table {
    border-color: CanvasText;
  }
}

@media print {
  html {
    background: none;
  }

  body {
    color: #000;
  }

  a {
    color: #000;
  }

  article,
  .ficha,
  table,
  th {
    background: none;
  }
}
