/* ==========================================================================
   BIBLIOTECA · REVISTAS DIGITALES
   styles.css — tema editorial oscuro con acento dorado.

   Índice:
     01. Variables globales
     02. Reset y base
     03. Utilidades (overlay, avisos, botones, iconos…)
     04. Barras superiores (biblioteca y lector)
     05. Vista biblioteca (cabecera, chips, estantería, fichas)
     06. Visor y libro (páginas y pliegue 3D)
     07. Controles flotantes (dock, progreso, miniaturas)
     08. Panel lateral de información
     09. Pantalla completa, animaciones y accesibilidad
     10. Responsive fino
   ========================================================================== */

/* ========================== 01. VARIABLES ================================ */
:root {
  /* Paleta: tinta profunda con un único acento dorado */
  --fondo: #0a0c10;
  --superficie: #14171d;
  --superficie-2: #1c2027;
  --superficie-3: #242932;
  --borde: #2c313b;
  --borde-fuerte: #3a4150;

  --texto: #e8e4da;
  --texto-2: #a8a394;
  --texto-3: #7b7668;

  --acento: #e6b450;          /* dorado editorial */
  --acento-suave: #f0cf8a;
  --acento-tenue: rgba(230, 180, 80, 0.16);
  --peligro: #e0685c;

  --foco: #6f9bff;            /* anillo de foco (teclado) */

  /* Tipografías */
  --fuente-display: "Fraunces", "Georgia", "Times New Roman", serif;
  --fuente-texto: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Formas y sombras */
  --radio: 12px;
  --radio-lg: 18px;
  --sombra-libro: 0 18px 45px rgba(0, 0, 0, 0.55), 0 2px 6px rgba(0, 0, 0, 0.4);
  --curva: cubic-bezier(0.22, 0.68, 0.32, 1);

  /* Barras */
  --alto-barra: 64px;
}

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

html,
body {
  height: 100%;
}

body {
  font-family: var(--fuente-texto);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texto);
  background:
    radial-gradient(1100px 600px at 85% -10%, rgba(230, 180, 80, 0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111, 155, 255, 0.05), transparent 55%),
    var(--fondo);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1, h2, h3 {
  font-family: var(--fuente-display);
  font-weight: 600;
  line-height: 1.12;
}

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

code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.9em;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

kbd {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82em;
  background: var(--superficie-2);
  border: 1px solid var(--borde-fuerte);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1em 0.45em;
  color: var(--texto-2);
}

[hidden] { display: none !important; }

/* Sombra bajo el libro que aísla el pliegue de la página */
.zona-libro::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -1px;
  height: 6%;
  background: radial-gradient(52% 100% at 50% 100%, rgba(0, 0, 0, 0.55), transparent 70%);
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
}

/* ========================== 03. UTILIDADES =============================== */

/* --- Saltar al contenido (accesibilidad) --- */
.salto-contenido {
  position: fixed;
  top: -100%;
  left: 16px;
  z-index: 200;
  background: var(--acento);
  color: #14161c;
  padding: 10px 16px;
  border-radius: 0 0 var(--radio) var(--radio);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s;
}

.salto-contenido:focus { top: 0; }

/* --- Iconos SVG (línea) --- */
.icono {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Botones --- */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  font: 600 0.85rem var(--fuente-texto);
  color: var(--texto);
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.boton:hover:not(:disabled) {
  background: var(--superficie-3);
  border-color: var(--borde-fuerte);
}

.boton:active:not(:disabled) { transform: translateY(1px); }

.boton:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.boton--icono {
  width: 40px;
  padding: 0;
}

.boton--suave { background: transparent; }

.boton--principal,
.boton--acento {
  background: var(--acento);
  border-color: transparent;
  color: #14161c;
}

.boton--principal:hover:not(:disabled),
.boton--acento:hover:not(:disabled) {
  background: var(--acento-suave);
  border-color: transparent;
}

/* Botones del dock: semitransparentes sobre el libro */
.dock .boton--icono {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
}

.dock .boton--icono:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

/* Botón de sonido silenciado: ondas tachadas */
#btnSonido[aria-pressed="false"] .sonido__onda { display: none; }

#btnSonido[aria-pressed="false"] { color: var(--peligro); }

/* --- Campos de texto --- */
input[type="search"],
input[type="text"] {
  font: 500 0.88rem var(--fuente-texto);
  color: var(--texto);
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="search"]::placeholder,
input[type="text"]::placeholder { color: var(--texto-3); }

/* --- Diálogo de carga (overlay) --- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  background: rgba(6, 8, 12, 0.82);
  backdrop-filter: blur(8px);
  padding: 24px;
}

.overlay.oculto { display: none; }

.overlay__caja {
  text-align: center;
  max-width: 420px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: 34px 30px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.overlay__caja--ancha { max-width: 520px; }

.overlay__caja--ancha h2 { font-size: 1.5rem; margin-bottom: 10px; }

.overlay__caja--ancha p {
  font-size: 0.92rem;
  color: var(--texto-2);
  margin-bottom: 16px;
}

.overlay__caja--ancha .boton { width: 100%; margin-bottom: 10px; }

.overlay__texto {
  font-family: var(--fuente-display);
  font-size: 1.18rem;
  margin-top: 18px;
}

.overlay__detalle {
  font-size: 0.85rem;
  color: var(--texto-2);
  margin-top: 6px;
}

/* Círculo giratorio */
.girador {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(230, 180, 80, 0.25);
  border-top-color: var(--acento);
  animation: girar 0.9s linear infinite;
}

/* Aviso de errores/sugerencias */
.aviso {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  z-index: 130;
  max-width: min(640px, calc(100vw - 32px));
  background: var(--superficie-2);
  border: 1px solid var(--borde-fuerte);
  border-left: 4px solid var(--acento);
  border-radius: var(--radio);
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--texto);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--curva);
}

.aviso.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.aviso.error { border-left-color: var(--peligro); }

/* Zona de arrastre de archivos */
.zona-arrastre {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  place-items: center;
  background: rgba(8, 10, 14, 0.88);
  backdrop-filter: blur(6px);
  border: 3px dashed var(--acento);
  font: 600 1.25rem var(--fuente-display);
  letter-spacing: 0.01em;
  pointer-events: none;
  text-align: center;
  padding: 24px;
}

body.arastrando .zona-arrastre { display: grid; }

.zona-arrastre strong { color: var(--acento); }

/* Epígrafes (kicker) */
.epigrafe {
  font: 600 0.7rem var(--fuente-texto);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--acento);
}

/* Notas al pie de diálogos */
.nota {
  font-size: 0.82rem;
  color: var(--texto-3);
  line-height: 1.55;
}

/* Barra de progreso durante la carga */
.linea-progreso {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(230, 180, 80, 0.12);
  z-index: 5;
}

.linea-progreso span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--acento);
  transition: width 0.2s ease;
}

/* ========================== 04. BARRAS SUPERIORES ======================== */
.barra {
  flex: 0 0 auto;
  height: var(--alto-barra);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(14px, 3vw, 26px);
  background: rgba(12, 14, 19, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--borde);
  z-index: 60;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.marca__logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--acento-tenue);
  color: var(--acento);
}

.marca__texto {
  font: 600 0.95rem var(--fuente-texto);
  letter-spacing: 0.02em;
}

.marca__texto em {
  font-style: normal;
  color: var(--texto-3);
  font-weight: 400;
  margin-left: 5px;
}

/* Buscador (solo barra de biblioteca) */
.buscador {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 420px;
  max-width: 460px;
  margin-inline: auto;
  color: var(--texto-3);
}

.buscador .icono {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  pointer-events: none;
}

.buscador input { width: 100%; padding-left: 38px; }

.buscador input:focus {
  border-color: var(--acento);
  box-shadow: 0 0 0 3px var(--acento-tenue);
}

/* Título de la edición (barra del lector) */
.edicion {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  line-height: 1.15;
}

.edicion__kicker {
  display: block;
  font: 600 0.62rem var(--fuente-texto);
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--acento);
}

.edicion__titulo {
  font-size: 1.25rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acciones {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

/* ==================== 05. CONTENIDO DEL SITIO ============================ */
.sitio {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.web {
  max-width: 1220px;
  margin: 0 auto;
  padding: clamp(26px, 4.5vh, 54px) clamp(18px, 4vw, 56px) 70px;
  animation: aparecer 0.5s var(--curva) backwards;
}

.biblioteca__cabecera {
  max-width: 1220px;
  margin: 0 auto 30px;
  animation: aparecer 0.5s var(--curva) backwards;
}

.biblioteca__cabecera h2 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  margin: 8px 0 10px;
}

.biblioteca__lema {
  max-width: 560px;
  color: var(--texto-2);
  font-size: 0.95rem;
}

/* Chips de categorías */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.chip {
  font: 600 0.76rem var(--fuente-texto);
  letter-spacing: 0.04em;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--borde);
  background: var(--superficie);
  color: var(--texto-2);
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover { border-color: var(--borde-fuerte); color: var(--texto); }

.chip[aria-selected="true"] {
  background: var(--acento);
  border-color: transparent;
  color: #14161c;
}

/* --- Estantería (grid de fichas) --- */
.estanteria {
  max-width: 1220px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: clamp(20px, 3vw, 36px) clamp(18px, 2.5vw, 30px);
  align-items: start;
}

/* Ficha individual */
.ficha {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  position: relative;
  animation: aparecer 0.55s var(--curva) backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}

/* Portada tipo libro con lomo */
.ficha__portada-wrap {
  position: relative;
  aspect-ratio: 480 / 672;
  border-radius: 4px 10px 10px 4px;
  overflow: hidden;
  background: var(--superficie-2);
  box-shadow: var(--sombra-libro), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s var(--curva), box-shadow 0.3s;
}

.ficha__portada {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--curva);
}

/* Lomo del libro */
.ficha__portada-wrap::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  z-index: 2;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.07) 55%, transparent);
  pointer-events: none;
}

.ficha:hover .ficha__portada-wrap,
.ficha:focus-visible .ficha__portada-wrap {
  transform: translateY(-8px) rotate(-0.4deg);
  box-shadow: 0 30px 62px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(230, 180, 80, 0.35);
}

.ficha:hover .ficha__portada { transform: scale(1.045); }

/* Etiqueta de categoría sobre la portada */
.ficha__cat {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font: 600 0.62rem var(--fuente-texto);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--acento);
  background: rgba(10, 12, 18, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(230, 180, 80, 0.3);
  border-radius: 999px;
  padding: 4px 9px;
}

/* Pie de ficha */
.ficha__titulo {
  font-family: var(--fuente-display);
  font-size: 1.12rem;
  font-weight: 600;
  margin-top: 14px;
}

.ficha__meta {
  font-size: 0.76rem;
  color: var(--texto-3);
  margin-top: 3px;
}

/* Publicaciones propias: sello "Tu publicación" + quitar */
.ficha--propia .ficha__portada-wrap {
  box-shadow: var(--sombra-libro), 0 0 0 2px rgba(111, 155, 255, 0.4);
}

.ficha__sello {
  position: absolute;
  left: 24px;
  bottom: 10px;
  z-index: 2;
  font: 600 0.6rem var(--fuente-texto);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #cfe0ff;
  background: rgba(20, 30, 56, 0.85);
  border: 1px solid rgba(111, 155, 255, 0.45);
  border-radius: 999px;
  padding: 3px 9px;
}

.ficha__quitar {
  position: absolute;
  top: 8px;
  left: 24px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(224, 104, 92, 0.5);
  background: rgba(16, 10, 10, 0.82);
  color: var(--peligro);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}

.ficha:hover .ficha__quitar,
.ficha__quitar:focus-visible { opacity: 1; }

.ficha__quitar:hover { background: rgba(60, 20, 16, 0.9); }

.ficha__quitar .icono { width: 15px; height: 15px; }

/* Ficha "publicar": recuadro punteado */
.ficha--nueva .ficha__portada-wrap {
  display: grid;
  place-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 2px dashed var(--borde-fuerte);
  border-radius: 4px 10px 10px 4px;
  box-shadow: none;
  color: var(--texto-3);
  text-align: center;
  padding: 18px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.ficha--nueva:hover .ficha__portada-wrap {
  border-color: var(--acento);
  color: var(--acento);
  background: var(--acento-tenue);
  transform: translateY(-6px);
}

.ficha--nueva .icono { width: 30px; height: 30px; }

.ficha--nueva .ficha__portada-texto {
  font: 600 0.8rem var(--fuente-texto);
  line-height: 1.4;
}

/* Estado vacío (sin resultados de búsqueda) */
.biblioteca__vacio {
  max-width: 1220px;
  margin: 60px auto 0;
  text-align: center;
}

.biblioteca__vacio-texto {
  color: var(--texto-2);
  margin-bottom: 18px;
}

/* ========================== 06. VISOR Y LIBRO ============================ */
.visor {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Zona centrada donde StPageFlip monta el libro */
.zona-libro {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 26px 26px 0;
  overflow: hidden;
}

.contenedor-libro {
  position: relative;
  z-index: 1;
  box-shadow: var(--sombra-libro);
}

/* Páginas del flipbook */
.pagina {
  background: #ffffff;
  overflow: hidden;
}

.pagina img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

/* ========================== 07. CONTROLES FLOTANTES ====================== */
.dock {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(16, 19, 25, 0.82);
  backdrop-filter: blur(14px);
  border: 1px solid var(--borde);
  border-radius: 999px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.5);
}

.dock__sep {
  width: 1px;
  height: 24px;
  background: var(--borde);
  margin: 0 2px;
}

.dock__paginas {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.indicador {
  font: 600 0.78rem var(--fuente-texto);
  color: var(--texto-2);
  min-width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Deslizador de páginas */
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 150px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, var(--acento) var(--relleno, 0%), var(--superficie-3) var(--relleno, 0%));
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--acento);
  border: 2px solid var(--fondo);
  cursor: grab;
  transition: transform 0.12s;
}

.slider::-webkit-slider-thumb:hover { transform: scale(1.2); }

.slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--acento);
  border: 2px solid var(--fondo);
  cursor: grab;
}

.slider:disabled { opacity: 0.4; cursor: not-allowed; }

/* Riel de miniaturas */
.rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(12, 14, 19, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--borde);
  padding: 12px 14px 14px;
  transform: translateY(100%);
  transition: transform 0.28s var(--curva);
}

.rail.visible { transform: translateY(0); }

.rail__lista {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--borde-fuerte) transparent;
}

.rail__lista::-webkit-scrollbar { height: 6px; }

.rail__lista::-webkit-scrollbar-thumb {
  background: var(--borde-fuerte);
  border-radius: 999px;
}

.miniatura {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--texto-3);
  font: 600 0.65rem var(--fuente-texto);
}

.miniatura img {
  width: 56px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
}

.miniatura:hover img { transform: translateY(-3px); }

.miniatura[aria-selected="true"] { color: var(--acento); }

.miniatura[aria-selected="true"] img {
  box-shadow: 0 0 0 2px var(--acento), 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* ========================== 08. PANEL LATERAL ============================ */
.fondo-panel {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(5, 7, 10, 0.55);
  backdrop-filter: blur(3px);
}

.panel-info {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  width: min(400px, 92vw);
  background: var(--superficie);
  border-left: 1px solid var(--borde);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.5);
  transform: translateX(102%);
  transition: transform 0.32s var(--curva);
  display: flex;
  flex-direction: column;
}

.panel-info.abierto { transform: translateX(0); }

.panel-info__cabecera {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--borde);
}

.panel-info__cabecera h2 { font-size: 1.4rem; margin-top: 3px; }

.panel-info__cuerpo {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px;
  display: grid;
  gap: 28px;
  align-content: start;
}

.panel-info__cuerpo h3 {
  font-size: 0.72rem;
  font-family: var(--fuente-texto);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--texto-3);
  margin-bottom: 10px;
}

/* Texto editable de la descripción */
.texto-editable {
  min-height: 140px;
  padding: 14px;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  font: 400 0.92rem var(--fuente-texto);
  line-height: 1.65;
  color: var(--texto);
  white-space: pre-wrap;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.texto-editable:focus {
  border-color: var(--acento);
  box-shadow: 0 0 0 3px var(--acento-tenue);
}

.texto-editable b { font-weight: 700; }

.fila-botones { margin-top: 10px; }

/* Lista de datos (dl) */
.datos {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 0.88rem;
}

.datos dt { color: var(--texto-3); }

.datos dd {
  color: var(--texto);
  text-align: right;
  overflow-wrap: anywhere;
}

/* ========================== 09. PANTALLA COMPLETA ======================== */
/* Aprovechamos el gesto "safe area" de móviles en pantalla completa */
body:fullscreen .dock {
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

body:fullscreen .barra--lector {
  opacity: 0.35;
  transition: opacity 0.3s;
}

body:fullscreen .barra--lector:hover,
body:fullscreen .barra--lector:focus-within { opacity: 1; }

/* Ocultar ratón en pantalla completa tras 2,5 s de inactividad */
body.pantalla-completa-oculta,
body.pantalla-completa-oculta * { cursor: none !important; }

/* Animación de entrada de fichas */
@keyframes aparecer {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes girar {
  to { transform: rotate(360deg); }
}

/* ========================== 10. RESPONSIVE =============================== */

/* Pantallas medianas */
@media (max-width: 900px) {
  .estanteria { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .slider { width: 110px; }
  .boton__texto { display: none; }         /* en barra: solo iconos */
  .barra .boton { width: 40px; padding: 0; }
}

/* Móviles */
@media (max-width: 560px) {
  :root { --alto-barra: 56px; }

  .barra { gap: 10px; }

  .marca__texto { display: none; }

  .buscador { flex: 1 1 auto; }

  .edicion__titulo { font-size: 1.05rem; }

  .estanteria { grid-template-columns: repeat(2, 1fr); gap: 20px 16px; }

  .ficha__titulo { font-size: 0.98rem; }

  .zona-libro { padding: 10px 10px 0; }

  .dock {
    bottom: 12px;
    gap: 5px;
    padding: 6px 9px;
  }

  .indicador { min-width: 52px; font-size: 0.7rem; }

  .slider { width: 78px; }

  .dock__sep { display: none; }
}

/* Muy angostos */
@media (max-width: 360px) {
  .estanteria { grid-template-columns: 1fr; }
  .slider { display: none; }
}

/* Sin movimiento: quitamos transiciones y animaciones */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* ==================== FOCO VISIBLE Y SELECCIÓN ========================== */
:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--acento);
  color: #14161c;
}

/* Barra de desplazamiento discreta */
::-webkit-scrollbar { width: 10px; height: 10px; }

::-webkit-scrollbar-thumb {
  background: var(--superficie-3);
  border-radius: 999px;
  border: 2px solid var(--fondo);
}

::-webkit-scrollbar-thumb:hover { background: var(--borde-fuerte); }

/* ==================== 10. CABECERA Y MENÚ DEL SITIO ====================== */
.barra--sitio { position: relative; gap: 10px; }

.menu {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.menu::-webkit-scrollbar { display: none; }

.menu a {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--texto-3);
  text-decoration: none;
  font: 500 0.88rem var(--fuente-texto);
  white-space: nowrap;
  transition: color 0.2s var(--curva), background 0.2s var(--curva);
}

.menu a:hover { color: var(--texto); background: var(--superficie-2); }

.menu a[aria-current="page"] {
  color: var(--acento);
  background: var(--acento-tenue);
}

.menu__biblioteca { margin-left: auto; }

.menu-toggle { display: none; }

.barra--sitio .acciones { flex: 0 0 auto; }

/* ==================== 11. CONTENIDO WEB ================================= */
.web__cabecera {
  max-width: 800px;
  margin-bottom: clamp(24px, 4vw, 44px);
}

.web__cabecera h1 {
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  margin: 6px 0 14px;
}

.web__lema {
  color: var(--texto-2);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.65;
}

.texto-guia { color: var(--texto-2); line-height: 1.7; }

.hero {
  display: grid;
  grid-template-columns: minmax(240px, 380px) 1fr;
  gap: clamp(20px, 4vw, 48px);
  align-items: center;
  margin-bottom: clamp(28px, 5vw, 56px);
}

.hero__texto h1 {
  font-size: clamp(2.2rem, 6vw, 3.8rem);
  margin: 8px 0 16px;
}

.hero__lema { font-size: clamp(1rem, 1.8vw, 1.2rem); }

.bloques {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  margin-bottom: clamp(28px, 5vw, 48px);
}

.bloque {
  position: relative;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: clamp(18px, 3vw, 30px);
}

.bloque h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  margin-bottom: 10px;
}

.rejilla-testimonios {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
}

.testimonio {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--superficie);
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: clamp(18px, 3vw, 26px);
}

.testimonio blockquote {
  font-family: var(--fuente-display);
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--texto);
}

.testimonio__autor {
  margin-top: auto;
  color: var(--texto-3);
  font-size: 0.9rem;
}

.llamada {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(120deg, rgba(230, 180, 80, 0.10), rgba(230, 180, 80, 0.02));
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  padding: clamp(20px, 3.5vw, 34px);
}

.llamada h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin-bottom: 8px;
}

.lista-redes {
  list-style: none;
  display: grid;
  gap: 10px;
}

.lista-redes a {
  color: var(--texto-2);
  text-decoration: none;
  border-bottom: 1px dashed var(--borde-fuerte);
}

.lista-redes a:hover { color: var(--acento); }

/* ==================== 12. FOTOS CON HUECO =============================== */
.foto {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  border-radius: var(--radio-lg);
  overflow: hidden;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
}

.foto--hero { aspect-ratio: 4 / 5; }
.foto--retrato { aspect-ratio: 1 / 1; }
.foto--paisaje {
  aspect-ratio: 21 / 9;
  margin-bottom: clamp(24px, 4vw, 40px);
}

.foto__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.foto__hueco {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--texto-3);
  font: 400 0.85rem var(--fuente-texto);
  background:
    radial-gradient(120% 100% at 30% 0%, rgba(230, 180, 80, 0.08), transparent 60%),
    linear-gradient(160deg, var(--superficie-2), var(--superficie));
}

.foto__hueco .icono { width: 34px; height: 34px; opacity: 0.6; }

.foto__hueco em {
  font-style: normal;
  text-align: center;
  padding: 0 14px;
}

.foto__cambiar {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: none;
  padding: 6px 12px;
  font-size: 0.8rem;
}

body.modo-edicion .foto__cambiar { display: inline-flex; }

/* ==================== 13. PIE DEL SITIO ================================= */
.pie {
  flex: 0 0 auto;
  padding: 18px clamp(14px, 3vw, 26px);
  border-top: 1px solid var(--borde);
  color: var(--texto-3);
  font-size: 0.85rem;
  text-align: center;
  z-index: 1;
}

/* ==================== 14. MODO EDICIÓN DEL SITIO ======================== */
body.modo-edicion .sitio { padding-bottom: 96px; }

body.modo-edicion [data-editable] {
  outline: 1px dashed rgba(230, 180, 80, 0.55);
  outline-offset: 3px;
  border-radius: 6px;
  cursor: text;
  transition: background 0.15s var(--curva);
}

body.modo-edicion [data-editable]:hover { background: rgba(230, 180, 80, 0.06); }

body.modo-edicion [data-editable]:focus {
  outline: 2px solid var(--acento);
  background: rgba(230, 180, 80, 0.08);
}

.bloque__ocultar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--superficie-2);
  color: var(--texto-2);
  cursor: pointer;
}

.bloque__ocultar:hover {
  color: var(--peligro);
  border-color: var(--peligro);
}

.bloque__ocultar .icono { width: 15px; height: 15px; }

body.modo-edicion [data-bloque] .bloque__ocultar { display: grid; }

.barra-edicion,
.barra-capas {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 24px);
  padding: 10px 14px;
  background: rgba(12, 14, 19, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid var(--borde);
  border-radius: var(--radio-lg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.barra-edicion { bottom: 14px; }

.barra-edicion__ayuda {
  color: var(--texto-3);
  font-size: 0.78rem;
  max-width: 340px;
  line-height: 1.45;
}

.barra-edicion__ayuda strong { color: var(--texto-2); }

.barra-edicion__botones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.barra-edicion .peligro {
  background: rgba(224, 104, 92, 0.16);
  border-color: var(--peligro);
  color: var(--peligro);
}

/* ==================== 15. EDITOR DE TEXTO (CAPAS) ======================= */
.barra-capas {
  top: calc(var(--alto-barra) + 12px);
  bottom: auto;
  gap: 6px;
  padding: 8px 10px;
}

.capas__fuente {
  background: var(--superficie-2);
  color: var(--texto);
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 7px 8px;
  font: 500 0.82rem var(--fuente-texto);
}

.capas__tamano {
  min-width: 52px;
  text-align: center;
  color: var(--texto-3);
  font: 500 0.78rem var(--fuente-texto);
}

.capas__color {
  width: 34px;
  height: 34px;
  padding: 2px;
  background: var(--superficie-2);
  border: 1px solid var(--borde);
  border-radius: 8px;
  cursor: pointer;
}

.capas__sep {
  width: 1px;
  height: 22px;
  background: var(--borde);
  margin: 0 4px;
}

.pagina { position: relative; }

.capa {
  position: absolute;
  z-index: 5;
  cursor: move;
  touch-action: none;
}

.capa__texto {
  min-height: 1em;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
  outline: none;
}

.capa:hover .capa__texto,
.capa--seleccionada .capa__texto {
  outline: 1px dashed rgba(230, 180, 80, 0.75);
  outline-offset: 4px;
}

.capa__etiqueta {
  position: absolute;
  top: -14px;
  left: 0;
  display: none;
  font: 600 9px var(--fuente-texto);
  letter-spacing: 0.06em;
  color: #14161c;
  background: var(--acento);
  border-radius: 4px;
  padding: 2px 5px;
  pointer-events: none;
}

.capa--seleccionada .capa__etiqueta { display: block; }

body.modo-texto .zona-libro { cursor: crosshair; }
body.modo-texto .capa { cursor: move; }
body.modo-texto .capa__texto { cursor: text; }

.chip-modo {
  position: fixed;
  top: calc(var(--alto-barra) + 66px);
  right: 16px;
  z-index: 70;
  padding: 8px 14px;
  background: var(--acento);
  color: #14161c;
  font: 600 0.8rem var(--fuente-texto);
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.4);
}

.chip-modo kbd {
  background: rgba(20, 22, 28, 0.15);
  border: none;
  color: inherit;
  padding: 0 4px;
}

/* ==================== 16. RESPONSIVE DEL SITIO ========================== */
@media (max-width: 940px) {
  .menu-toggle { display: inline-flex; order: 3; }
  .barra--sitio .acciones { order: 2; margin-left: auto; }

  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 10px 14px 14px;
    background: rgba(12, 14, 19, 0.97);
    border-bottom: 1px solid var(--borde);
    display: none;
  }

  .menu.menu--abierto { display: flex; }
  .menu a { padding: 11px 14px; }
  .menu__biblioteca { margin-left: 0; }

  .hero { grid-template-columns: 1fr; }
  .foto--hero { max-width: 420px; }

  .barra-edicion__ayuda { max-width: none; }
}
