/* ══════════════════════════════════════════════════════════
   LECTOR · páginas iniciales e introducción
   El doblez de la hoja lo calcula StPageFlip (MIT, autoalojado).
   Aquí: papel, tipografía de libro, pliegue central y tapas.
   ══════════════════════════════════════════════════════════ */

.lr {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background:
    radial-gradient(90% 70% at 50% 45%, #2a241d 0%, #18140F 70%);
  color: var(--cream);
  overflow: hidden;
}
.lr::backdrop { background: rgba(24,20,15,.7); }
.lr[open] { display: grid; grid-template-rows: auto 1fr auto; }

.lr-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
}
.lr-ed {
  margin: 0; font-family: var(--ff-u); font-size: .64rem; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold3);
}
.lr-close {
  appearance: none; cursor: pointer; background: none; border: 1px solid rgba(245,240,230,.28);
  color: var(--cream); border-radius: 999px; padding: .5rem 1.1rem;
  font-family: var(--ff-u); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
}
.lr-close:hover { border-color: var(--gold); color: var(--gold3); }

.lr-stage {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 0; padding: 0 clamp(.5rem, 3vw, 3rem);
}
.lr-book { position: relative; width: 100%; max-width: 1240px; }
.lr-book::after {                 /* sombra del libro sobre la mesa */
  content: ''; position: absolute; left: 6%; right: 6%; bottom: -26px; height: 36px; z-index: -1;
  background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent);
}

.lr-bar {
  display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 1rem 1rem 1.4rem;
  font-family: var(--ff-u); font-size: .66rem; letter-spacing: .16em; color: rgba(245,240,230,.7);
}
.lr-nav {
  appearance: none; cursor: pointer; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  border: 1px solid rgba(245,240,230,.28); background: transparent; color: var(--cream);
  font-size: 1rem; line-height: 1; transition: border-color .2s, color .2s, opacity .2s;
}
.lr-nav:hover { border-color: var(--gold); color: var(--gold3); }
.lr-nav:disabled { opacity: .25; cursor: default; }
.lr-close:focus-visible, .lr-nav:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.lr-loading { font-family: var(--ff-s); font-style: italic; font-size: 1.2rem; color: rgba(245,240,230,.6); }

/* ── Hojas ── */
.lp {
  background-color: #FBF7EE;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  overflow: hidden;
  color: #2b2620;
}
/* Pliegue central: oscurece el borde que da al lomo */
.lp.--left  { box-shadow: inset -26px 0 30px -18px rgba(60,45,25,.35), inset -2px 0 0 rgba(60,45,25,.12); }
.lp.--right { box-shadow: inset 26px 0 30px -18px rgba(60,45,25,.35), inset 2px 0 0 rgba(60,45,25,.12); }
/* Canto de hojas apiladas en el borde exterior */
.lp.--left::before, .lp.--right::before {
  content: ''; position: absolute; top: 0; bottom: 0; width: 5px; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(to right, rgba(0,0,0,.05) 0 1px, transparent 1px 2px);
}
.lp.--left::before  { left: 0; }
.lp.--right::before { right: 0; }

/* Contenido a tamaño fijo, escalado a la hoja */
.lp-in {
  position: absolute; left: 0; top: 0; width: var(--pw, 420px); height: var(--ph, 630px);
  transform-origin: 0 0; transform: scale(var(--ps, 1));
  padding: 52px 46px 58px;
  font-family: var(--ff-s); font-size: 17px; line-height: 1.42; font-weight: 400;
  text-align: justify; hyphens: auto; -webkit-hyphens: auto;
}
.lp-in p { margin: 0; text-indent: 1.3em; }
.lp-in p.lp-first, .lp-in p.lp-cont, .lp-in .lp-c, .lp-in .lp-r, .lp-in h2 + p { text-indent: 0; }
.lp-in p.lp-cont { text-indent: 0; }
.lp-in .lp-c { text-align: center; }
.lp-in .lp-r { text-align: right; }
.lp-in .lp-gap { height: .9em; }
.lp-in em { font-style: italic; }
.lp-in strong { font-weight: 600; }
.lp-in a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(181,83,38,.35); }

.lp-in .lp-h {
  margin: 34px 0 30px; text-align: center; text-indent: 0;
  font-family: var(--ff-s); font-weight: 600; font-size: 19px; letter-spacing: .2em; color: var(--ink);
}
.lp-in .lp-sub { margin: -18px 0 26px; text-align: center; font-family: var(--ff-u); font-weight: 400; font-size: 10px; letter-spacing: .2em; color: var(--ink3); }
.lp-in h2:not(.lp-sub) { margin: 0 0 16px; font-family: var(--ff-s); font-style: italic; font-weight: 500; font-size: 19px; text-align: center; }

/* Portadilla */
.lp-title .lp-in, .lp-in.is-title { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.lp-in .lp-btitle { margin: 0 0 22px; font-family: var(--ff-m); font-weight: 800; font-size: 25px; line-height: 1.15; letter-spacing: .04em; color: var(--gold2); }
.lp-in.is-title h2 { font-family: var(--ff-u); font-style: normal; font-weight: 500; font-size: 12px; letter-spacing: .26em; color: var(--ink2); }
/* Créditos: letra chica */
.lp-in.is-credits { font-size: 12.5px; line-height: 1.5; display: flex; flex-direction: column; justify-content: flex-end; }
.lp-in.is-dedication { display: flex; flex-direction: column; justify-content: center; }
.lp-in.is-fugit { font-size: 16px; }
.lp-in.is-fugit img { display: block; max-width: 100%; height: auto; margin: 0 auto 18px; }
/* Índice */
.lp-in.is-toc { font-family: var(--ff-u); font-size: 11.5px; line-height: 1.5; text-align: left; }
.lp-in .lp-toc-t { text-indent: 0; margin-top: 5px; font-weight: 500; letter-spacing: .02em; }
.lp-in .lp-toc-s { text-indent: 0; padding-left: 1.2em; color: #5a5148; }
.lp-in .lp-toc-part .lp-toc-t { margin-top: 10px; font-family: var(--ff-u); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold2); }

.lp-folio {
  position: absolute; bottom: 24px; left: 0; right: 0; text-align: center;
  font-family: var(--ff-u); font-size: 9px; letter-spacing: .18em; color: #8a7f72;
}
.lp-head {
  position: absolute; top: 24px; left: 0; right: 0; text-align: center;
  font-family: var(--ff-u); font-size: 8px; letter-spacing: .24em; text-transform: uppercase; color: #9a8f82;
}

/* Tapas rígidas */
.lp.lp-cover { background: #1b1712; }
.lp.lp-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lp.lp-cover::after {             /* brillo del laminado + bisagra */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, rgba(0,0,0,.28), rgba(255,255,255,.08) 2.2%, rgba(0,0,0,0) 4%),
    linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.14) 48%, rgba(255,255,255,0) 60%);
}
.lp.lp-cover.lp-back::after { transform: scaleX(-1); }
.lp.lp-endpaper { background-color: #EDE6D4; box-shadow: none; }

/* Hoja final */
.lp-in.is-end { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; text-align: center; }
.lp-in.is-end .lp-end-mark { width: 26px; height: auto; opacity: .85; }
.lp-in.is-end blockquote { margin: 0; font-family: var(--ff-s); font-style: italic; font-size: 21px; line-height: 1.4; color: var(--ink2); }
.lp-in.is-end .btn { font-size: 12px; padding: 14px 26px; border-radius: 999px; }

@media (max-width: 700px) {
  .lr-top { padding: .7rem 1rem; }
  .lr-bar { padding: .6rem 1rem 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .lr * { transition: none !important; }
}

/* ── Llegada: el objeto elegido viaja hasta aquí y se abre ── */
.lr .lr-book, .lr .lr-bar { transition: opacity .35s ease; }
.lr.is-intro .lr-book, .lr.is-intro .lr-bar { opacity: 0; }
.lr-ghost { position: fixed; left: 0; top: 0; z-index: 5; perspective: 1400px; transform-origin: 50% 50%; pointer-events: none; }
.lr-ghost .rk-obj { transform: none; }

/* Tamaño de hoja por versión */
.lp--soft, .lp--hard { --pw: 420px; --ph: 630px; }
.lp--ipad   { --pw: 450px; --ph: 600px; }
.lp--kindle { --pw: 420px; --ph: 560px; }
.lp--phone  { --pw: 330px; --ph: 640px; }

/* Tapa blanda: la tapa es fina y se dobla con la hoja */
.lp-cover--soft::after {
  background:
    linear-gradient(to right, rgba(0,0,0,.18), rgba(255,255,255,.10) 1.6%, rgba(0,0,0,0) 3%),
    linear-gradient(115deg, rgba(255,255,255,0) 35%, rgba(255,255,255,.12) 48%, rgba(255,255,255,0) 60%) !important;
}
.lp.lp-endpaper--soft { background-color: #F7F3EA; }
/* Tapa dura: guardas de color y cartón con bisagra */
.lp.lp-endpaper--hard {
  background-color: #8B3A15;
  background-image: linear-gradient(to right, rgba(0,0,0,.25), rgba(0,0,0,0) 8%, rgba(0,0,0,0) 92%, rgba(0,0,0,.25));
}
.lp-cover--hard { outline: 3px solid #241f19; outline-offset: -3px; }

/* ── Dispositivos ── */
.lr-dev { position: relative; margin: 0 auto; box-sizing: border-box; }
.lr-dev .lr-screen {
  position: relative; width: var(--sw); height: var(--sh); overflow: hidden; background: #fff;
}
.lr-dev .lr-screen > div { transform-origin: 0 0; }
.lr-dev .lp { position: absolute; left: 0; top: 0; width: var(--pw); height: var(--ph); }
.lr-dev .lp-in { transform: none; }
.lr-dev .lr-screen .lp { transform-origin: 0 0; }
.lr-dev--ipad {
  padding: 16px; border-radius: 30px; background: #0e0e10;
  box-shadow: 0 0 0 2px #8d9195, 0 0 0 4px #c9ccce, 0 40px 80px rgba(0,0,0,.5);
}
.lr-dev--ipad .lr-screen { border-radius: 8px; }
.lr-dev--kindle {
  padding: 22px; border-radius: 16px; background: #121214;
  box-shadow: 0 0 0 1px #2c2c30, 0 40px 80px rgba(0,0,0,.5);
}
.lr-dev--kindle .lr-screen { background: #f2f1ec; filter: grayscale(1) contrast(1.04); border-radius: 2px; }
.lr-dev--kindle .lp, .lr-dev--phone .lp { background: transparent; box-shadow: none; }
.lr-dev--kindle .lr-screen::after {
  content: ''; position: absolute; inset: 0; background: #111; opacity: 0; pointer-events: none;
}
.lr-dev--kindle .lr-screen.is-flash::after { opacity: 1; }
.lr-dev--phone {
  padding: 9px; border-radius: 46px; background: #0b0b0c;
  box-shadow: 0 0 0 2px #3a3a3d, 0 40px 80px rgba(0,0,0,.5);
}
.lr-dev--phone .lr-screen { border-radius: 38px; background: #FBF7EE; }
.lr-dev--phone::after { content: ''; position: absolute; top: 20px; left: 50%; width: 92px; height: 26px; margin-left: -46px; border-radius: 99px; background: #000; z-index: 3; }
.lp--phone .lp-in { padding: 64px 28px 48px; font-size: 17.5px; }

/* Tira de páginas (Kindle y celular) */
.lr-strip { position: absolute; inset: 0; display: flex; transform-origin: 0 0; }
.lr-dev .lr-strip .lp { position: relative; flex: 0 0 100%; width: 100%; height: 100%; }
.lr-dev .lr-strip .lp .lp-in { transform: scale(var(--ps)); transform-origin: 0 0; }
.lr-dev--kindle .lr-strip { display: block; }
.lr-dev--kindle .lr-strip .lp { position: absolute; inset: 0; }
.lr-dev--kindle .lr-strip .lp[hidden] { display: none; }
.lp--kindle .lp-in { font-family: var(--ff-s); color: #111; font-size: 18px; }
.lp--ipad .lp-in { font-size: 18px; padding: 48px 44px 52px; }
.lp--ipad .lp-in.is-toc, .lp--kindle .lp-in.is-toc, .lp--phone .lp-in.is-toc { font-size: 13.5px; }
.lr-dev .lp-in { overflow: hidden; }
.lr-dev--kindle .lp-in .lp-btitle { color: #111; }
.lr-dev .lr-screen { touch-action: pan-y; cursor: pointer; }
.lr-dev--ipad .lr-screen { cursor: default; }
.lr-dev--ipad .lp { background-color: #fff; background-image: none; box-shadow: none; }

/* Páginas centradas o al pie: el excedente baja (y el paginador lo detecta), nunca se corta arriba */
.lp-in.is-title, .lp-in.is-dedication, .lp-in.is-end, .lp-in.is-credits, .lp-title .lp-in { justify-content: flex-start !important; }
.lp-in.is-title > :first-child, .lp-in.is-dedication > :first-child, .lp-in.is-end > :first-child, .lp-in.is-credits > :first-child { margin-top: auto; }
.lp-in.is-title > :last-child, .lp-in.is-dedication > :last-child, .lp-in.is-end > :last-child { margin-bottom: auto; }
.lp-in.is-credits { line-height: 1.45; }

/* Índice: una línea por capítulo, entradas inseparables */
.lp-in.is-toc .lp-h { margin: 18px 0 18px; }
.lp-in .lp-toc-item, .lp-in .lp-toc-part { display: flex; gap: .7em; align-items: baseline; text-indent: 0; }
.lp-in .lp-toc-item { margin-top: .32em; }
.lp-in .lp-toc-item .lp-toc-t { flex: none; min-width: 6.4em; font-weight: 500; color: var(--ink2); }
.lp-in .lp-toc-item .lp-toc-s { flex: 1; padding: 0; color: #4a4239; }
.lp-in .lp-toc-part { margin-top: .9em; flex-direction: column; gap: .05em; }
.lp-in .lp-toc-part .lp-toc-t { font-size: .86em; letter-spacing: .18em; text-transform: uppercase; color: var(--gold2); margin: 0; }
.lp-in .lp-toc-part .lp-toc-s { padding: 0; font-weight: 500; color: var(--ink); }
.lr-stage { overflow: hidden; }

/* Texto del libro: Literata, serif pensada para leer largo en pantalla (OFL, autoalojada) */
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/literata-400.woff2') format('woff2'); }
@font-face { font-family: 'Literata'; font-style: italic; font-weight: 400; font-display: swap; src: url('../fonts/literata-400italic.woff2') format('woff2'); }
@font-face { font-family: 'Literata'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/literata-600.woff2') format('woff2'); }
.lp-in { font-family: 'Literata', Georgia, serif; font-size: 15.2px; line-height: 1.5; }
.lp--ipad .lp-in, .lp--kindle .lp-in { font-family: 'Literata', Georgia, serif; font-size: 16px; }
.lp--phone .lp-in { font-family: 'Literata', Georgia, serif; font-size: 15.6px; }
.lp-in.is-credits { font-size: 11.5px; }
.lp-in.is-toc { font-family: var(--ff-u); }
.lp-in .lp-h, .lp-in h2:not(.lp-sub) { font-family: var(--ff-s); }
.lr-ed { font-size: .75rem; }
.lr-bar { font-size: .78rem; color: rgba(245,240,230,.85); }
.lp.lp-endpaper--soft, .lp:not(.lp-cover) { background-image: none; }
.lp { background-color: #FBF7EE; }
.lr-dev .lr-screen { -webkit-user-select: none; user-select: none; }
