/* ============================================================
   TOKENS
   ============================================================ */
:root {
  --ink: #1b1712;
  --paper: #ece1c6;
  --paper-line: #d8c9a0;
  --accent: #7a2b26;
  --accent-dark: #5e211d;
  --gold: #a98544;
  --ink-muted: #6b5f4b;

  --font-display: 'Fraunces', serif;
  --font-body: 'Source Serif 4', serif;

  --measure: 68ch;

  /* Juegos: ancho máximo del juego (300px reales × 0.75 de escala) */
  --game-size: 225px;
}

/* ============================================================
   RESET Y BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(122, 43, 38, 0.35);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

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

/* ============================================================
   CUBIERTA (header)
   ============================================================ */
header.cover {
  background: var(--ink);
  color: var(--paper);
  padding: 3.5rem 0 2.75rem;
  border-bottom: 1px solid rgba(169, 133, 68, 0.4);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

@keyframes cover-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  animation: cover-in 0.8s ease-out both;
}

.header-text .subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 400;
  font-size: 1.2rem;
  color: var(--gold);
  margin-top: 0.6rem;
  animation: cover-in 0.8s 0.15s ease-out both;
}

@media (prefers-reduced-motion: reduce) {
  .header-text h1,
  .header-text .subtitle { animation: none; }
}

/* Selector de idioma — "sello de edición" */
.language-dropdown {
  position: relative;
}

.lang-btn-dropdown {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-family: var(--font-display);
  font-variant: small-caps;
  letter-spacing: 0.04em;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lang-btn-dropdown:hover {
  background: rgba(169, 133, 68, 0.15);
}

.lang-btn-dropdown i {
  font-size: 0.75rem;
  color: var(--gold);
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 120%;
  background: var(--ink);
  border: 1px solid var(--gold);
  min-width: 170px;
  z-index: 100;
}

.language-dropdown.open .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 0.6rem 1.1rem;
  color: var(--paper);
  font-family: var(--font-display);
  font-variant: small-caps;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-bottom: 1px solid rgba(169, 133, 68, 0.25);
}

.dropdown-content a:last-child {
  border-bottom: none;
}

.dropdown-content a:hover {
  background: rgba(169, 133, 68, 0.15);
  color: var(--gold);
}

/* ============================================================
   ÍNDICE (nav)
   ============================================================ */
nav {
  background: var(--paper);
  border-bottom: 1px solid var(--paper-line);
  position: sticky;
  top: 0;
  z-index: 50;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  padding: 0.85rem 0;
}

nav ul li a {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid transparent;
}

nav ul li a:hover,
nav ul li a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================================
   MAIN Y CAPÍTULOS
   ============================================================ */
main {
  flex: 1;
  padding: 3.5rem 0 3rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
}

.chapter {
  border-top: 1px solid var(--paper-line);
  padding-top: 2.25rem;
}

.chapter:first-child {
  border-top: none;
  padding-top: 0;
}

.chapter h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--ink);
  margin-bottom: 1.6rem;
}

/* Realce de términos ya marcados en los textos traducidos
   (excluye los iconos de Font Awesome, que también son <i>) */
#bio-content i,
#academic-content i,
.game-description i {
  font-style: italic;
  color: var(--ink-muted);
}

.chapter b {
  font-weight: 600;
  font-variant: small-caps;
  letter-spacing: 0.02em;
  color: var(--accent);
}

/* ============================================================
   BIOGRAFÍA
   ============================================================ */
.bio-content {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 2.5rem;
  align-items: start;
}

.bio-content-inner p {
  margin-bottom: 1.1rem;
  line-height: 1.75;
}

.bio-text {
  display: flow-root;
}

.research-figures {
  float: right;
  width: 190px;
  margin: 0.25rem 0 1rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.research-figure {
  width: 100%;
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(27, 23, 18, 0.1);
}

.research-figures .research-figure:first-child {
  transform: rotate(1.2deg);
}

.research-figures .research-figure:last-child {
  transform: rotate(-1deg);
}

.bio-content-inner p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 3.3em;
  line-height: 0.82;
  float: left;
  padding: 0.04em 0.09em 0 0;
  color: var(--accent);
}

.bio-image {
  text-align: center;
}

.profile-image-container {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--paper-line);
  border: 1px solid var(--ink);
  box-shadow: 7px 7px 0 rgba(27, 23, 18, 0.1);
  transform: rotate(-1.5deg);
}

.profile-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: sepia(0.12) contrast(1.05);
}

.attribution {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-top: 0.9rem;
}

/* ============================================================
   ACADÉMICO
   ============================================================ */
.academic-content-inner p {
  margin-bottom: 1.1rem;
  line-height: 1.75;
}

.academic-text {
  display: flow-root;
}

.academic-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.75rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--paper-line);
}

.link-card {
  display: flex;
  gap: 1rem;
}

.link-icon {
  font-size: 1.5rem;
  color: var(--accent);
  flex-shrink: 0;
}

.link-content h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--ink);
}

.link-content p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.btn,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body);
  font-variant: small-caps;
  letter-spacing: 0.03em;
  padding: 0.5rem 1rem;
  border-radius: 2px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.btn {
  background: var(--accent);
  color: var(--paper);
}

.btn:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
}

/* ============================================================
   ESCRITOR
   ============================================================ */
.book-content {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.book-cover-image {
  border: 1px solid var(--ink);
  box-shadow: 9px 9px 0 rgba(27, 23, 18, 0.08);
}

.book-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 0.6rem;
  color: var(--ink);
}

.book-description {
  font-style: italic;
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
  line-height: 1.7;
  color: var(--ink-muted);
}

.book-details {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--paper-line);
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.book-details:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* ============================================================
   CREADOR DE JUEGOS
   ============================================================ */
.game-content {
  display: grid;
  grid-template-columns: 1fr var(--game-size);
  gap: 2.5rem;
  align-items: start;
}

.game-info {
  min-width: 0;
}

.game-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.45rem;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.game-description {
  margin-bottom: 1.1rem;
  line-height: 1.75;
}

.game-details {
  margin-bottom: 1.1rem;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.game-embed {
  width: var(--game-size);
}

.game-container {
  width: var(--game-size);      /* 225px reales = 300px × 0.75 */
  aspect-ratio: 300 / 470;      /* misma proporción que el iframe escalado */
  overflow: hidden;
  position: relative;
}

.game-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;                 /* ancho real del iframe */
  height: 470px;                /* 400 × 1.5 */
  border: none;
  transform: scale(0.75);       /* 300 / 400 = 0.75 */
  transform-origin: top left;
}

/* ============================================================
   COLOFÓN (footer)
   ============================================================ */
footer {
  background: var(--ink);
  color: var(--paper);
  padding: 2.75rem 0 1.5rem;
  margin-top: 1rem;
  border-top: 3px double var(--gold);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.footer-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--paper);
  margin-bottom: 0.5rem;
}

.footer-info p {
  font-size: 0.9rem;
  color: #c9bfa0;
  margin-bottom: 0.25rem;
}

.footer-contact p {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.footer-contact a {
  color: var(--gold);
  text-decoration-color: rgba(169, 133, 68, 0.4);
}

.footer-contact a:hover {
  color: var(--paper);
}

.email-display {
  font-style: italic;
}

.footer-copyleft {
  border-top: 1px solid rgba(169, 133, 68, 0.25);
  padding-top: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: #9c8f74;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .chapter h2 {
    font-size: 1.4rem;
  }

  .bio-content {
    grid-template-columns: 1fr;
  }

  .bio-image {
    max-width: 220px;
    margin: 0 auto;
  }

  .research-figures {
    width: 130px;
    margin: 0.25rem 0 0.75rem 1rem;
    gap: 0.6rem;
  }

  .book-content {
    grid-template-columns: 1fr;
  }

  .book-cover {
    max-width: 180px;
    margin: 0 auto;
  }

  .game-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .game-embed {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .game-container {
    width: 100%;
    max-width: var(--game-size);
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  /* El desplegable crece hacia la derecha en vez de hacia la
     izquierda, para no salirse de la pantalla */
  .dropdown-content {
    left: 0;
    right: auto;
  }

  /* Menú deslizable en una sola línea en vez de partirse */
  nav ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 1.25rem;
  }

  nav ul::-webkit-scrollbar {
    display: none;
  }

  nav ul li {
    flex-shrink: 0;
  }
}