/* =========================================================================
   Galería fotográfica — hoja de estilo
   Paleta oscura, tipografía editorial, mucho aire alrededor de las fotos.
   ========================================================================= */

:root {
  --fondo:        #0c0c0d;
  --fondo-suave:  #141416;
  --texto:        #e8e6e3;
  --texto-tenue:  #8d8a86;
  --linea:        rgba(232, 230, 227, 0.13);
  --hueco:        14px;

  --ancho-max:    1560px;
  --margen:       clamp(1.25rem, 4vw, 3.75rem);

  --tipo: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --suave: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--fondo);
  color: var(--texto);
  font-family: var(--tipo);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

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

.saltar {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1.25rem;
  background: var(--texto);
  color: var(--fondo);
}
.saltar:focus { left: 1rem; top: 1rem; }

/* ----------------------------------------------------- Etiquetas chicas */
.etiqueta {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}

/* En pantallas chicas se agranda un poco y se aprieta el espaciado,
   para que siga siendo legible sin ocupar más ancho. */
@media (max-width: 560px) {
  .etiqueta { font-size: 0.75rem; letter-spacing: 0.18em; }
}

/* ------------------------------------------------------- Barra superior */
.barra {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Si el nombre y el menú no caben en una línea (celulares angostos),
     el menú baja a un segundo renglón en vez de salirse de la pantalla. */
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  padding: 1.15rem var(--margen);
  transition: background 0.4s var(--suave), backdrop-filter 0.4s var(--suave),
              border-color 0.4s var(--suave), padding 0.4s var(--suave);
  border-bottom: 1px solid transparent;
}

.barra.fija {
  background: rgba(12, 12, 13, 0.78);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom-color: var(--linea);
  padding-block: 0.85rem;
}

.marca {
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.menu {
  display: flex;
  /* Si algún día agregas más secciones o el idioma alarga las palabras,
     los enlaces bajan de renglón en vez de salirse de la pantalla. */
  flex-wrap: wrap;
  gap: 0.35rem clamp(1rem, 2.5vw, 2.25rem);
  font-size: 0.9rem;
  color: var(--texto-tenue);
}

.menu a {
  position: relative;
  transition: color 0.25s var(--suave);
}
.menu a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -3px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--suave);
}
.menu a:hover { color: var(--texto); }
.menu a:hover::after { transform: scaleX(1); transform-origin: left; }

/* -------------------------------------------------------------- Portada */
.portada {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  /* El espacio de arriba reserva sitio para la barra fija, para que el
     texto nunca se encime con el nombre del encabezado. */
  padding: clamp(6rem, 14vh, 9rem) var(--margen) clamp(3rem, 8vh, 6rem);
  overflow: hidden;
}

.portada--vacia {
  min-height: 80svh;
  align-items: center;
  border-bottom: 1px solid var(--linea);
}

.portada__foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: acercar 2.4s var(--suave) both;
}

@keyframes acercar {
  from { transform: scale(1.06); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.portada__velo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(12,12,13,0.94) 0%, rgba(12,12,13,0.55) 38%, rgba(12,12,13,0.28) 68%, rgba(12,12,13,0.62) 100%);
}

.portada__texto {
  position: relative;
  z-index: 2;
  /* Ancho generoso: el nombre va en dos renglones por diseño, no por falta
     de espacio. La frase de abajo se limita aparte, en .lema.
     El width: 100% es necesario porque .portada es flex y, sin él, este
     bloque se encogería al ancho del texto más largo. */
  width: 100%;
  max-width: min(92%, 900px);
  animation: subir 1.1s 0.35s var(--suave) both;
}

.portada--vacia .portada__texto { max-width: min(92%, 34rem); }

@keyframes subir {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

.titular {
  margin: 1.1rem 0 0;
  /* La mitad del tamaño original, que era clamp(2.9rem, 11.5vw, 9.5rem). */
  font-size: clamp(1.45rem, 5.75vw, 4.75rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.045em;
}
.titular span, .titular em { display: block; }
.titular em {
  font-style: italic;
  font-weight: 700;
}

.lema {
  max-width: 34ch;
  margin: clamp(1.5rem, 3vh, 2.5rem) 0 0;
  font-size: clamp(1rem, 1.7vw, 1.22rem);
  font-weight: 300;
  color: rgba(232, 230, 227, 0.82);
}

.portada__bajar {
  position: absolute;
  right: var(--margen);
  bottom: clamp(3rem, 8vh, 6rem);
  z-index: 2;
  width: 34px;
  height: 54px;
  border: 1px solid var(--linea);
  border-radius: 20px;
  display: grid;
  place-items: start center;
  padding-top: 9px;
}
.portada__bajar span {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: var(--texto);
  animation: gotear 1.9s var(--suave) infinite;
}
@keyframes gotear {
  0%, 100% { transform: translateY(0);    opacity: 0.3; }
  50%      { transform: translateY(20px); opacity: 1; }
}

/* ------------------------------------------------------------ Contenido */
.contenedor {
  max-width: var(--ancho-max);
  margin: 0 auto;
  padding: clamp(4rem, 12vh, 8rem) var(--margen) 0;
}

.cabecera-seccion {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--linea);
}

.conteo {
  margin: 0;
  font-size: 0.8rem;
  color: var(--texto-tenue);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- Filtros */
.filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.75rem 0 0;
}

.filtro {
  padding: 0.42rem 0.95rem;
  border: 1px solid var(--linea);
  border-radius: 100px;
  font-size: 0.82rem;
  color: var(--texto-tenue);
  transition: color 0.25s var(--suave), border-color 0.25s var(--suave),
              background 0.25s var(--suave);
}
.filtro:hover { color: var(--texto); border-color: rgba(232,230,227,0.4); }
.filtro.activo {
  background: var(--texto);
  border-color: var(--texto);
  color: var(--fondo);
}

/* --------------------------------------------------------------- Rejilla */
.rejilla {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hueco);
  margin-top: clamp(1.75rem, 4vh, 2.75rem);
}

.celda {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: var(--fondo-suave);
  /* Antes de que el JS acomode las filas, cada foto respeta su proporción. */
  flex: 1 1 calc(var(--proporcion, 1.5) * 300px);
  aspect-ratio: var(--proporcion, 1.5);

  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--suave), transform 0.7s var(--suave);
}

/* Cuando el JS toma el control, él fija ancho y alto exactos. */
.rejilla.acomodada .celda {
  flex: 0 0 auto;
  aspect-ratio: auto;
}

.celda.visible { opacity: 1; transform: none; }

.celda__boton {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  cursor: zoom-in;
}

.celda img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--suave), filter 0.5s var(--suave);
}

.celda figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 2.5rem 1.1rem 0.95rem;
  font-size: 0.85rem;
  letter-spacing: 0.01em;
  background: linear-gradient(to top, rgba(10,10,11,0.85), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--suave), transform 0.4s var(--suave);
  pointer-events: none;
}

@media (hover: hover) {
  .celda:hover img { transform: scale(1.035); }
  .celda:hover figcaption { opacity: 1; transform: none; }
  /* Al pasar el ratón por una foto, las demás bajan un poco de intensidad. */
  .rejilla:hover .celda:not(:hover) img { filter: brightness(0.62); }
}

/* ============================================================= CONTROLES
   Orden y agrupación de la galería
   ===================================================================== */
.controles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
}

.control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--texto-tenue);
}

.control select {
  padding: 0.4rem 2rem 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--linea);
  border-radius: 100px;
  color: var(--texto);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238d8a86' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 10px;
  transition: border-color 0.25s var(--suave);
}
.control select:hover { border-color: rgba(232, 230, 227, 0.4); }
.control select option { background: var(--fondo-suave); color: var(--texto); }

/* Encabezado de grupo dentro de la rejilla: ocupa la fila completa. */
.grupo-titulo {
  flex: 0 0 100%;
  width: 100%;
  margin: 1.75rem 0 0.35rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--linea);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.grupo-titulo:first-child { margin-top: 0; }

.grupo-titulo h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}
.grupo-titulo span {
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-tenue);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Pie de foto con año y lugar */
.celda figcaption b {
  display: block;
  font-weight: 600;
}
.celda figcaption em {
  display: block;
  margin-top: 0.15rem;
  font-style: normal;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: rgba(232, 230, 227, 0.72);
}

/* ==================================================================== BLOG */

.contenedor--blog { max-width: 1100px; padding-top: clamp(6.5rem, 16vh, 10rem); }

.lista-entradas {
  list-style: none;
  margin: 0;
  padding: 0;
}

.entrada-fila { border-top: 1px solid var(--linea); }
/* La cabecera de sección ya trae su propia línea: no la repetimos. */
.entrada-fila:first-child { border-top: 0; }
.entrada-fila:last-child { border-bottom: 1px solid var(--linea); }

.entrada-fila__enlace {
  display: block;
  padding: clamp(1.75rem, 4vh, 2.75rem) 0;
  transition: opacity 0.3s var(--suave);
}

/* Con foto: texto a la izquierda, imagen a la derecha, ambos de la misma
   altura para que la fila quede pareja. */
.entrada-fila__enlace--con-foto {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}

@media (min-width: 760px) {
  .entrada-fila__enlace--con-foto {
    grid-template-columns: minmax(0, 1fr) clamp(200px, 26vw, 320px);
    gap: clamp(1.5rem, 4vw, 3rem);
    align-items: stretch;
  }
  .entrada-fila__texto {
    display: flex;
    flex-direction: column;
  }
  /* El «Leer» se pega abajo: así el bloque de texto ocupa toda la altura
     de la foto y las dos columnas terminan a la misma altura. */
  .entrada-fila__leer { margin-top: auto; padding-top: 1rem; }
}

.entrada-fila__foto {
  position: relative;
  overflow: hidden;
  border-radius: 3px;
  background: var(--fondo-suave);
  aspect-ratio: 4 / 3;
}
.entrada-fila__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s var(--suave);
}

@media (min-width: 760px) {
  /* La altura de la fila la manda el TEXTO. La foto se posiciona en
     absoluto para no aportar altura propia y se estira a la del texto:
     así una foto vertical no dispara el alto de toda la fila. */
  .entrada-fila__foto {
    aspect-ratio: auto;
    align-self: stretch;
    min-height: 170px;
  }
  .entrada-fila__foto img { position: absolute; inset: 0; }
}

.entrada-fila__fecha { margin-bottom: 0.75rem; }

.entrada-fila__titulo {
  max-width: 22ch;
  margin: 0 0 0.7rem;
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  transition: opacity 0.3s var(--suave);
}

.entrada-fila__resumen {
  max-width: 58ch;
  margin: 0 0 1.1rem;
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--texto-tenue);
}

.entrada-fila__leer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.1rem;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--texto);
}
.entrada-fila__leer > span[aria-hidden] {
  display: inline-block;
  transition: transform 0.3s var(--suave);
}

.entrada-fila__minutos {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--texto-tenue);
  white-space: nowrap;
}

.entrada-fila[hidden] { display: none; }

.controles--blog {
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
}
.controles--blog .filtros { margin-top: 0; }

@media (min-width: 760px) {
  .controles--blog {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.sin-resultados {
  margin: 2.5rem 0;
  font-size: 0.95rem;
  color: var(--texto-tenue);
}

@media (hover: hover) {
  .lista-entradas:hover .entrada-fila:not(:hover) { opacity: 0.45; }
  .entrada-fila { transition: opacity 0.3s var(--suave); }
  .entrada-fila__enlace:hover .entrada-fila__leer > span[aria-hidden] { transform: translateX(5px); }
  .entrada-fila__enlace:hover .entrada-fila__foto img { transform: scale(1.04); }
}

/* ------------------------------------------- Encabezado de la sección Libros */
.libros-cabecera {
  padding-bottom: 1.4rem;
  border-bottom: 1px solid var(--linea);
}

.libros-cabecera__fila {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.libros-cabecera__titulo {
  margin: 0;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.libros-cabecera__nota {
  max-width: 60ch;
  margin: 1.1rem 0 0;
  font-size: clamp(0.98rem, 1.6vw, 1.12rem);
  font-weight: 300;
  line-height: 1.7;
  color: var(--texto-tenue);
}

/* --------------------------------------- Portada de una entrada del blog
   La foto queda de fondo y el velo degradado deja leer el texto encima sin
   tapar la imagen: se ven las dos cosas a la vez. */
.entrada-portada {
  position: relative;
  min-height: clamp(360px, 66svh, 720px);
  display: flex;
  align-items: flex-end;
  padding: clamp(6rem, 14vh, 9rem) var(--margen) clamp(2.5rem, 6vh, 4rem);
  overflow: hidden;
}

.entrada-portada__foto {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: acercar 2.2s var(--suave) both;
}

.entrada-portada__velo {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(12, 12, 13, 0.96) 0%,
    rgba(12, 12, 13, 0.72) 26%,
    rgba(12, 12, 13, 0.34) 55%,
    rgba(12, 12, 13, 0.55) 100%
  );
}

.entrada-portada__texto {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: min(100%, 1100px);
  margin: 0 auto;
  animation: subir 1s 0.25s var(--suave) both;
}

.entrada-portada__texto .etiqueta { margin-bottom: 0.9rem; }

/* Con portada, el texto arranca más pegado a la foto. */
.contenedor--tras-portada { padding-top: clamp(2.5rem, 7vh, 4.5rem); }

/* ------------------------------------------------------- Una entrada */
.entrada { max-width: 100%; }

.entrada__cabecera {
  /* Ojo: el ancho se limita en el título, no aquí. Si se pone en «ch» sobre
     este contenedor, la medida se calcula con la letra chica y aplasta todo. */
  max-width: min(100%, 900px);
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}

.entrada__titulo {
  /* En «em» el ancho se mide con la letra del propio titular. */
  max-width: 15em;
  margin: 1rem 0 0;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.03;
}

.entrada__resumen {
  max-width: 52ch;
  margin: 1.5rem 0 0;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--texto-tenue);
}

/* El cuerpo del texto: medida corta y aire, para leer a gusto. */
.prosa {
  max-width: 66ch;
  font-size: clamp(1.05rem, 1.5vw, 1.16rem);
  font-weight: 300;
  line-height: 1.8;
  color: rgba(232, 230, 227, 0.9);
}

.prosa > *:first-child { margin-top: 0; }
.prosa p { margin: 0 0 1.4em; }

.prosa h2 {
  max-width: 24ch;
  margin: 2.4em 0 0.7em;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--texto);
}

.prosa h3 {
  max-width: 30ch;
  margin: 2em 0 0.6em;
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--texto);
}

.prosa blockquote {
  margin: 2em 0;
  padding-left: clamp(1.1rem, 3vw, 1.75rem);
  border-left: 2px solid var(--linea);
  font-size: 1.08em;
  font-style: italic;
  color: var(--texto);
}
.prosa blockquote p:last-child { margin-bottom: 0; }

.prosa ul, .prosa ol { margin: 0 0 1.4em; padding-left: 1.35rem; }
.prosa li { margin-bottom: 0.55em; padding-left: 0.25rem; }
.prosa li::marker { color: var(--texto-tenue); }

.prosa a {
  color: var(--texto);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: rgba(232, 230, 227, 0.4);
  transition: text-decoration-color 0.25s var(--suave);
}
.prosa a:hover { text-decoration-color: var(--texto); }

.prosa hr {
  width: 60px;
  margin: 3em 0;
  border: 0;
  border-top: 1px solid var(--linea);
}

.prosa strong, .prosa b { font-weight: 600; color: var(--texto); }

/* Las fotos dentro de una entrada respiran un poco más ancho que el texto.
   El tope de altura evita que una foto vertical ocupe tres pantallas. */
.prosa img {
  display: block;
  max-width: 100%;
  max-height: 82svh;
  width: auto;
  height: auto;
  margin: 2.4em auto;
  border-radius: 3px;
  background: var(--fondo-suave);
}
.prosa p:has(> img:only-child) { margin: 0; }

@media (min-width: 1000px) {
  .prosa img { max-width: min(124%, 86vw); }
}

.entrada__pie {
  margin-top: clamp(3.5rem, 9vh, 6rem);
  padding-top: 2rem;
  border-top: 1px solid var(--linea);
}

.volver-blog {
  font-size: 0.9rem;
  color: var(--texto-tenue);
  transition: color 0.25s var(--suave);
}
.volver-blog:hover { color: var(--texto); }

.pagina-blog .pie { margin-top: clamp(3rem, 8vh, 5rem); }

/* =================================================================== LIBROS */

.libros-bloque { margin-top: clamp(2.5rem, 7vh, 4.5rem); }

.libros-bloque__titulo {
  margin: 0 0 0.5rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}

.libros {
  list-style: none;
  margin: 0;
  padding: 0;
}

.libro { border-top: 1px solid var(--linea); }
.libro:last-child { border-bottom: 1px solid var(--linea); }

.libro__enlace {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.15rem 0;
  transition: opacity 0.3s var(--suave);
}

.libro__datos { min-width: 0; }

.libro__titulo {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.libro__autor {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  font-weight: 300;
  color: var(--texto-tenue);
}

.libro__meta {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  font-size: 0.82rem;
  color: var(--texto-tenue);
  white-space: nowrap;
}

.libro__estrellas {
  letter-spacing: 0.12em;
  color: rgba(232, 230, 227, 0.75);
}

.libro__anio { font-variant-numeric: tabular-nums; }

.libro__resena-enlace { color: var(--texto); }
.libro__resena-enlace span {
  display: inline-block;
  transition: transform 0.3s var(--suave);
}

/* Los pendientes se ven un punto más apagados: aún no son parte del archivo. */
.libros--pendientes .libro__titulo { font-weight: 400; color: rgba(232, 230, 227, 0.82); }

/* -------------------------------------------- Encabezados de grupo */
.libros-grupo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.25rem 0 0;
  padding-bottom: 0.55rem;
  border-top: 0;
  border-bottom: 1px solid var(--linea);
}
.libros-grupo:first-child { margin-top: 0.5rem; }

.libros-grupo__nombre {
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.libros-grupo__conteo {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-tenue);
  white-space: nowrap;
}

/* Con encabezados, la línea de cada grupo ya la pone el encabezado. */
.libros--agrupados .libro { border-top: 0; border-bottom: 1px solid var(--linea); }
.libros--agrupados .libro:last-child { border-bottom: 1px solid var(--linea); }
.libros--agrupados .libros-grupo + .libro { border-top: 0; }

/* ------------------------------------------- Leyendo actualmente */
.libro__marca-leyendo {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--linea);
  border-radius: 100px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--texto);
  white-space: nowrap;
}

.controles--libros { margin: 1.5rem 0 0; }

@media (hover: hover) {
  .libros:hover .libro:not(:hover) { opacity: 0.5; }
  .libro { transition: opacity 0.3s var(--suave); }
  a.libro__enlace:hover .libro__resena-enlace span { transform: translateX(5px); }
}

/* Cabecera de una reseña */
.libro__autor-grande {
  margin: 0.9rem 0 0;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  font-weight: 300;
  color: var(--texto-tenue);
}

.libro__estrellas--grande {
  margin: 0.85rem 0 0;
  font-size: 1.05rem;
  letter-spacing: 0.16em;
}

/* ------------------------------------------------------------ Sobre mí */
.sobre {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 100%;
  margin: clamp(5rem, 14vh, 9rem) 0 0;
  padding-top: clamp(2.5rem, 6vh, 4rem);
  border-top: 1px solid var(--linea);
}

.sobre__texto {
  max-width: 62ch;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  font-weight: 300;
  line-height: 1.7;
  color: rgba(232, 230, 227, 0.86);
}
.sobre__texto p { margin: 0 0 1.2em; }
.sobre__texto p:last-child { margin-bottom: 0; }

@media (min-width: 900px) {
  .sobre { grid-template-columns: 200px minmax(0, 1fr); gap: 3rem; }
}

/* ------------------------------------------------------- Estado vacío */
.vacio {
  max-width: 46ch;
  margin: clamp(2rem, 8vh, 5rem) 0 clamp(4rem, 12vh, 8rem);
}
.vacio h2 {
  margin: 1rem 0 0.75rem;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.vacio p { color: var(--texto-tenue); margin: 0 0 1.75rem; }

.boton {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  background: var(--texto);
  color: var(--fondo);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 100px;
  transition: transform 0.3s var(--suave), opacity 0.3s var(--suave);
}
.boton:hover { transform: translateY(-2px); opacity: 0.9; }

/* ------------------------------------------------------------------ Pie */
.pie {
  max-width: var(--ancho-max);
  margin: clamp(5rem, 14vh, 9rem) auto 0;
  padding: 2rem var(--margen) 2.5rem;
  border-top: 1px solid var(--linea);
}

.pie__fila {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--texto-tenue);
}
.pie__fila p { margin: 0; }

.pie__enlaces {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.pie__enlaces a { transition: color 0.25s var(--suave); }
.pie__enlaces a:hover { color: var(--texto); }
.pie__admin { opacity: 0.45; }

.pie__licencia {
  max-width: 78ch;
  margin: 1.75rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--linea);
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--texto-tenue);
}
.pie__licencia a {
  color: var(--texto);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* ------------------------------------------------------------- El visor */
.visor {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 9, 0.97);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s var(--suave);
  overflow: hidden;   /* el desplazamiento lo maneja .visor__scroll */
}
.visor[hidden] { display: none; }
.visor.abierto { opacity: 1; }

/* Capa que se desplaza cuando la foto y su texto no caben de una vez.
   Los botones viven fuera de ella, así que no se mueven al hacer scroll. */
.visor__scroll {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  /* En los dos ejes: si por lo que sea algo no cabe, se puede alcanzar
     en vez de quedar cortado sin remedio. */
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Los botones y el contador van por encima de la capa que se desplaza. */
.visor__cerrar,
.visor__nav,
.visor__contador { z-index: 2; }

/* Foto centrada, lo más grande posible, y la nota debajo.
   IMPORTANTE: aquí no se usan unidades «vw» a propósito. Con zoom del
   navegador o ciertas ventanas, «vw» no coincide con el ancho real
   disponible y el texto terminaba saliéndose de la pantalla.
   Todo se mide contra el propio contenedor, que nunca miente. */
.visor__contenido {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 2vh, 1.4rem);

  width: 100%;
  max-width: 100%;
  height: 100%;           /* alto exacto de la pantalla, sin desbordar */
  padding: 3.75rem 1.25rem 3.25rem;
}

/* La foto se queda con TODO el espacio que sobra después de la nota.
   Por eso se ajusta sola: con nota corta crece, con nota larga cede.
   El «0» de flex-basis es lo importante: sin él la imagen reclamaría su
   tamaño natural y se saldría de la pantalla. */
.visor__marco {
  flex: 1 1 0;
  min-height: 0;          /* sin esto, el flex no deja encoger la imagen */
  min-width: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visor__marco img {
  /* Sin agrandar más allá de su tamaño real: así nunca se ve pixeleada. */
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s var(--suave);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.visor__marco img.lista { opacity: 1; }

/* ------------------------------ La nota, debajo de la foto y centrada */
.visor__ficha {
  flex: 0 0 auto;
  width: 100%;
  max-width: 68ch;
  margin: 0;
  text-align: center;
}
.visor__ficha[hidden] { display: none; }

.visor__titulo {
  margin: 0;
  font-size: clamp(0.98rem, 1.4vh, 1.12rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}
.visor__titulo:empty { display: none; }

.visor__meta {
  margin: 0.4rem 0 0;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--texto-tenue);
}
.visor__meta:empty { display: none; }

.visor__historia {
  max-width: 62ch;
  margin: 0.85rem auto 0;
  font-size: clamp(0.86rem, 1.25vh, 0.95rem);
  font-weight: 300;
  line-height: 1.7;
  color: rgba(232, 230, 227, 0.76);
  text-wrap: pretty;
}
.visor__historia:empty { display: none; }

/* Sin ningún dato, la foto se queda con toda la pantalla. */
.visor__ficha:empty { display: none; }

@media (max-width: 700px) {
  .visor__contenido { padding: 3.5rem 1rem 3rem; }
  .visor__historia { line-height: 1.65; }
}

.visor__contador {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--texto-tenue);
  font-variant-numeric: tabular-nums;
}

.visor__cerrar {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--texto-tenue);
  transition: color 0.25s var(--suave), transform 0.25s var(--suave);
}
.visor__cerrar:hover { color: var(--texto); transform: rotate(90deg); }

.visor__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  font-size: 2.4rem;
  line-height: 1;
  color: var(--texto-tenue);
  transition: color 0.25s var(--suave), background 0.25s var(--suave);
  border-radius: 50%;
}
.visor__nav:hover { color: var(--texto); background: rgba(255,255,255,0.06); }
.visor__nav--izq { left: 0.75rem; }
.visor__nav--der { right: 0.75rem; }
.visor__nav[disabled] { opacity: 0.18; pointer-events: none; }

body.sin-scroll { overflow: hidden; }

/* --------------------------------------------------------------- Móvil */
@media (max-width: 640px) {
  .marca { font-size: 0.92rem; }
  /* El menú baja a un segundo renglón completo, alineado con el nombre.
     La separación va fija (no en vw) para que los cuatro enlaces quepan
     siempre en una sola línea y la barra no crezca de más. */
  .barra { padding-block: 0.7rem; }
  .barra .menu {
    flex: 1 0 100%;
    gap: 0.3rem 0.95rem;
    font-size: 0.82rem;
  }
  .visor__nav { width: 44px; height: 44px; font-size: 1.9rem; }
  .visor__nav--izq { left: 0.15rem; }
  .visor__nav--der { right: 0.15rem; }
  .celda figcaption { opacity: 1; transform: none; font-size: 0.78rem; }
}

/* ------------------------------------------- Respeto por quien lo pide */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .celda { opacity: 1; transform: none; }
}
