/* Bitácora de Taberna — libro sobre la mesa de la taberna */
:root {
  /* escritorio (madera) */
  --desk: #1a120c;
  --desk-2: #120c07;
  --leather: #3a2314;
  --leather-2: #24150c;

  /* papel */
  --paper: #ece0c4;
  --paper-2: #e3d5b4;
  --paper-edge: #cdba92;

  /* tinta */
  --ink: #2c1e12;
  --ink-2: #4d3a26;
  --ink-3: #7d674c;
  --rule: #c6b28b;
  --gold: #8a6626;
  --gold-2: #a98842;
  --gold-lite: #c4a05a;
  --focus: #8a6626;

  --serif: "Fraunces", "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "IBM Plex Mono", "SF Mono", Menlo, monospace;

  --topbar-h: 3rem;
  --botbar-h: 3.1rem;
  --turn-ms: 900ms;
  --ease-page: cubic-bezier(0.28, 0.72, 0.24, 1);
}

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

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  background-color: var(--desk);
  background-image:
    repeating-linear-gradient(92deg,
      rgba(255, 255, 255, 0.012) 0 2px,
      transparent 2px 7px,
      rgba(0, 0, 0, 0.06) 7px 9px),
    radial-gradient(80% 65% at 50% 42%, #14100c 0%, #0c0806 55%, #060403 100%);
  overflow: hidden;
}

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

a { color: var(--gold); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 0.75rem; top: -3rem;
  background: var(--gold-lite); color: #1a120c;
  padding: 0.4rem 0.7rem; z-index: 90;
}
.skip:focus { top: 0.6rem; }

/* ——— barra superior ——— */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem;
  background: linear-gradient(180deg, rgba(10, 7, 4, 0.9), rgba(10, 7, 4, 0.5));
  border-bottom: 1px solid rgba(196, 160, 90, 0.22);
}
.brand {
  font-family: var(--serif);
  font-weight: 620;
  font-size: 0.98rem;
  color: #e9dcc0;
  text-decoration: none;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.brand:hover { color: var(--gold-lite); }
.chapters {
  display: flex; gap: 1rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.chapters::-webkit-scrollbar { display: none; }
.chapters a {
  color: #b09b78;
  text-decoration: none;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 0.3rem 0;
  border-bottom: 1px solid transparent;
  cursor: pointer;
}
.chapters a:hover { color: var(--gold-lite); }
.chapters a.is-current {
  color: #f0e3c6;
  border-bottom-color: var(--gold-lite);
}

.langs {
  display: flex;
  gap: 0.45rem;
  flex: 0 0 auto;
  margin-left: 0.75rem;
}
.langs button {
  appearance: none;
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  color: #c4a05a;
  font-family: inherit;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.45;
  cursor: pointer;
  padding: 0.3rem 0.1rem;
}
.langs button:hover { opacity: 0.8; }
.langs button.on {
  opacity: 1;
  border-bottom-color: var(--gold-lite);
}

html[lang="en"] [data-lang="es"],
html[lang="es"] [data-lang="en"] { display: none !important; }

/* ——— escenario ——— */
.stage {
  height: calc(100% - var(--topbar-h) - var(--botbar-h));
  display: grid;
  place-items: center;
  padding: 1.1rem 1rem;
  position: relative;
}
.stage::after {
  /* sombra del libro sobre la mesa */
  content: "";
  position: absolute;
  left: 50%; bottom: 0.4rem;
  width: min(78%, 60rem); height: 3.5rem;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(0, 0, 0, 0.55), transparent 70%);
  pointer-events: none;
}

/* ——— libro ——— */
.book {
  --ar: 1.42;
  --fs: 15px;
  position: relative;
  width: min(100%, calc((100dvh - var(--topbar-h) - var(--botbar-h) - 2.2rem) * var(--ar)), 66rem);
  aspect-ratio: var(--ar);
  perspective: 2800px;
  perspective-origin: 50% 42%;
  transition: transform 700ms var(--ease-page);
  z-index: 1;
}
@supports not (height: 100dvh) {
  .book { width: min(100%, calc((100vh - var(--topbar-h) - var(--botbar-h) - 2.2rem) * var(--ar)), 66rem); }
}
.book.at-start { transform: translateX(-25%); }
.book.at-end { transform: translateX(25%); }

/* tapas */
.board {
  position: absolute;
  top: -0.55%;
  height: 101.1%;
  width: 50.9%;
  background:
    repeating-linear-gradient(115deg, rgba(0,0,0,0.06) 0 3px, transparent 3px 8px),
    linear-gradient(160deg, #4a2e1a 0%, #2a1a0e 100%);
  box-shadow:
    0 26px 60px rgba(0, 0, 0, 0.75),
    0 4px 14px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(196, 160, 90, 0.22);
  transition: opacity 320ms ease;
}
.board-right { left: 49.6%; border-radius: 0 0.5rem 0.5rem 0; }
.board-left { left: -0.5%; border-radius: 0.5rem 0 0 0.5rem; }
.book.at-start .board-left { opacity: 0; }
.book.at-end .board-right { opacity: 0; }

/* canto de las hojas: se ve cómo se acumulan a un lado y se vacían del otro */
.edge {
  position: absolute;
  top: 1.4%;
  height: 97.2%;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(90, 66, 34, 0.28), transparent 12%, transparent 88%, rgba(90, 66, 34, 0.3)),
    repeating-linear-gradient(90deg,
      #f0e5c9 0 1px,
      #dccaa4 1px 2px,
      #c6b189 2px 3px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.5);
  transition: width 420ms var(--ease-page);
}
.edge-right {
  left: 100%;
  width: var(--edge-r, 0px);
  border-radius: 0 0.22em 0.22em 0;
}
.edge-left {
  right: 100%;
  width: var(--edge-l, 0px);
  border-radius: 0.22em 0 0 0.22em;
}

.leaves { position: absolute; inset: 0; z-index: 1; }

/* ——— hojas ——— */
.leaf {
  position: absolute;
  top: 0; left: 50%;
  width: 50%; height: 100%;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform var(--turn-ms) var(--ease-page);
  will-change: transform;
}
.leaf.is-flipped { transform: rotateY(-179.9deg); }

.face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255, 252, 240, 0.5), transparent 55%),
    repeating-linear-gradient(97deg, rgba(122, 96, 58, 0.035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(3deg, rgba(122, 96, 58, 0.03) 0 1px, transparent 1px 6px),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  box-shadow: inset 0 0 3.5rem rgba(120, 92, 52, 0.18);
}
.face-back { transform: rotateY(180deg); }

/* sombra del lomo: la cara delantera es la página derecha */
.face::before {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 9%;
  pointer-events: none;
  z-index: 3;
}
.face-front::before {
  left: 0;
  background: linear-gradient(90deg,
    rgba(46, 28, 10, 0.55) 0,
    rgba(60, 40, 18, 0.22) 22%,
    rgba(60, 40, 18, 0.05) 55%,
    transparent);
  border-left: 1px solid rgba(72, 46, 20, 0.6);
}
.face-back::before {
  right: 0;
  background: linear-gradient(270deg,
    rgba(46, 28, 10, 0.55) 0,
    rgba(60, 40, 18, 0.22) 22%,
    rgba(60, 40, 18, 0.05) 55%,
    transparent);
  border-right: 1px solid rgba(72, 46, 20, 0.6);
}
/* borde exterior del papel */
.face::after {
  content: "";
  position: absolute; top: 0; bottom: 0;
  width: 0.5%;
  background: linear-gradient(90deg, transparent, var(--paper-edge));
  pointer-events: none;
  z-index: 3;
}
.face-front::after { right: 0; }
.face-back::after { left: 0; transform: scaleX(-1); }

/* brillo del giro */
.gloss {
  position: absolute; inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(255, 250, 235, 0.55), rgba(120, 90, 50, 0.12) 45%, rgba(40, 24, 10, 0.5));
}
.face-back .gloss { background: linear-gradient(270deg, rgba(255, 250, 235, 0.55), rgba(120, 90, 50, 0.12) 45%, rgba(40, 24, 10, 0.5)); }
/* el giro: la hoja se despega del libro, sube y vuelve a posarse */
.leaf.is-turning {
  transition: none;
  animation-duration: var(--turn-ms);
  animation-timing-function: linear;
  animation-fill-mode: both;
}
.leaf.turn-fwd { animation-name: leafFwd; }
.leaf.turn-back { animation-name: leafBack; }

@keyframes leafFwd {
  0%   { transform: rotateY(0deg); }
  12%  { transform: translateZ(10px) rotateY(-14deg); }
  30%  { transform: translateZ(26px) rotateY(-48deg); }
  50%  { transform: translateZ(32px) rotateY(-90deg); }
  70%  { transform: translateZ(26px) rotateY(-132deg); }
  88%  { transform: translateZ(10px) rotateY(-166deg); }
  100% { transform: rotateY(-179.9deg); }
}
@keyframes leafBack {
  0%   { transform: rotateY(-179.9deg); }
  12%  { transform: translateZ(10px) rotateY(-166deg); }
  30%  { transform: translateZ(26px) rotateY(-132deg); }
  50%  { transform: translateZ(32px) rotateY(-90deg); }
  70%  { transform: translateZ(26px) rotateY(-48deg); }
  88%  { transform: translateZ(10px) rotateY(-14deg); }
  100% { transform: rotateY(0deg); }
}

/* sombra que la hoja proyecta sobre las de debajo */
.leaf.is-turning .face {
  box-shadow:
    inset 0 0 3.5rem rgba(120, 92, 52, 0.18),
    0 0 3.5rem rgba(0, 0, 0, 0.55);
}
.leaf.is-turning .gloss { animation: glossPass var(--turn-ms) linear; }
@keyframes glossPass {
  0%   { opacity: 0; }
  22%  { opacity: 0.34; }
  50%  { opacity: 0.68; }
  78%  { opacity: 0.34; }
  100% { opacity: 0; }
}
/* la portada no lleva canto de papel ni textura de pergamino */
.face-cover { background: none; box-shadow: none; }
.face-cover::after { display: none; }

/* ——— zonas de paso ——— */
.turn {
  position: absolute;
  top: 0; bottom: 0;
  width: 8%;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 30;
  padding: 0;
}
.turn-next { right: 0; }
.turn-prev { left: 0; }
.book.at-start .turn-prev,
.book.at-end .turn-next { pointer-events: none; }
.book.at-start .turn-prev .curl,
.book.at-end .turn-next .curl { display: none; }
.curl {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 0;
  padding-bottom: 100%;
  max-height: 26%;
  opacity: 0;
  transition: opacity 200ms ease, transform 260ms var(--ease-page);
}
.turn-next .curl {
  right: 0;
  background: linear-gradient(225deg, rgba(255, 251, 238, 0.95) 0 48%, rgba(178, 152, 108, 0.85) 50%, transparent 52%);
  transform: translate(6%, 6%);
}
.turn-prev .curl {
  left: 0;
  background: linear-gradient(135deg, rgba(255, 251, 238, 0.95) 0 48%, rgba(178, 152, 108, 0.85) 50%, transparent 52%);
  transform: translate(-6%, 6%);
}
.turn:hover .curl, .turn:focus-visible .curl { opacity: 0.9; transform: translate(0, 0); }

/* ——— página ——— */
.page {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  font-size: var(--fs);
  color: var(--ink-2);
  z-index: 2;
}
.page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2.6em 2.4em 1.2em 2.9em;
  scrollbar-width: thin;
  scrollbar-color: var(--paper-edge) transparent;
}
.face-back .page-body { padding: 2.6em 2.9em 1.2em 2.4em; }
.page-body::-webkit-scrollbar { width: 6px; }
.page-body::-webkit-scrollbar-thumb { background: var(--paper-edge); border-radius: 3px; }
.page-center { display: flex; flex-direction: column; justify-content: center; }

/* folio y titulillo */
.page-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.8em;
  padding: 0 2.4em 1.5em 2.9em;
  font-size: 0.68em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.face-back .page-foot { padding: 0 2.9em 1.5em 2.4em; flex-direction: row-reverse; }
.page-foot .rule { flex: 1 1 auto; align-self: center; height: 1px; background: var(--rule); }
.page-cover .page-foot { display: none; }

/* ——— tipografía de página ——— */
.page h2, .page h3 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.018em;
  line-height: 1.12;
  color: var(--ink);
  margin: 0 0 0.5em;
}
.page h2 { font-size: 2.05em; }
.page h2.big { font-size: 2.5em; }
.page h3 { font-size: 1.2em; }
.page-sub { font-size: 1.45em !important; margin-bottom: 0.8em; }
.page p { margin: 0 0 0.85em; }
.kicker {
  font-size: 0.7em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.7em;
}
.lead { font-size: 1.08em; color: var(--ink-2); }
.meta { font-size: 0.84em; color: var(--ink-3); }
.pull {
  font-family: var(--serif);
  font-size: 1.65em;
  line-height: 1.24;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 0.5em;
}
.rule-short {
  width: 4em; height: 2px; border: 0;
  background: var(--gold); opacity: 0.75;
  margin: 1em 0 1.2em;
}
.sha { font-family: var(--mono); font-size: 0.88em; color: var(--gold); }
code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(120, 92, 52, 0.12);
  padding: 0.08em 0.3em;
}

/* ——— portada / contraportada ——— */
.page-cover .face,
.page-cover { color: #e8d9b6; }
.page-cover {
  background:
    repeating-linear-gradient(118deg, rgba(0,0,0,0.05) 0 3px, transparent 3px 9px),
    radial-gradient(120% 100% at 30% 10%, #4a2f1b 0%, #33200f 55%, #1d1108 100%);
}
.cover-body {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 1.9em;
  overflow: hidden;
}
.cover-frame {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(196, 160, 90, 0.5);
  outline: 1px solid rgba(196, 160, 90, 0.22);
  outline-offset: 0.45em;
  padding: 1.7em 1.5em 1.5em;
  width: 100%;
}

/* lámina encartada en la tapa */
.cover-plate,
.cover-strip {
  flex: 1 1 auto;
  min-height: 3em;
  margin: 0.2em 0 1.2em;
}
.cover-plate {
  display: flex;
  padding: 0.5em;
  background: linear-gradient(180deg, #f4ead2, #e4d5b2);
  box-shadow:
    0 0 0 1px rgba(196, 160, 90, 0.55),
    0 14px 30px rgba(0, 0, 0, 0.55),
    0 3px 8px rgba(0, 0, 0, 0.4);
}
.cover-plate img {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 37%;
  box-shadow: 0 0 0 1px rgba(24, 14, 6, 0.9);
  filter: saturate(0.96) contrast(1.05);
}
/* tres viñetas en la contratapa, sin estirar el retrato */
.cover-strip {
  display: flex;
  gap: 0.55em;
  align-items: center;
  justify-content: center;
}
.cover-chip {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: 720 / 1280;
  max-height: 100%;
  display: flex;
  padding: 0.32em;
  background: linear-gradient(180deg, #f4ead2, #e4d5b2);
  box-shadow:
    0 0 0 1px rgba(196, 160, 90, 0.45),
    0 8px 18px rgba(0, 0, 0, 0.5);
}
.cover-chip img {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  box-shadow: 0 0 0 1px rgba(24, 14, 6, 0.85);
  filter: saturate(0.94) contrast(1.04);
}
.cover-kicker {
  font-size: 0.66em;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b7975c;
  margin: 0 0 1em;
}
/* .page h2 es más específico que .cover-title y le metía tinta oscura */
.page .cover-title {
  font-family: var(--serif);
  font-weight: 620;
  font-size: 2.65em;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #f3e6c6;
  margin: 0;
  flex: 0 0 auto;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 0 1.4em rgba(196, 160, 90, 0.18);
}
.page .cover-title.small { font-size: 2.2em; }
.page .cover-title span { color: var(--gold-lite); }
.cover-rule {
  flex: 0 0 auto;
  width: 3.4em; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-lite), transparent);
  margin: 0.9em auto;
}
.cover-kicker, .cover-sub, .cover-foot { flex: 0 0 auto; }
.cover-sub { color: #d8c69f; margin: 0 0 0.5em; font-size: 0.95em; }
.cover-foot { color: #9d855f; font-size: 0.75em; letter-spacing: 0.08em; margin: 0; }
.cover-hint {
  flex: 0 0 auto;
  margin: 0.9em 0 0;
  font-size: 0.72em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8d7548;
  animation: hintPulse 2.6s ease-in-out infinite;
}
@keyframes hintPulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.book:not(.at-start) .cover-hint { animation: none; opacity: 0.35; }

/* ——— cifras ——— */
.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em;
  margin-top: 1.6em;
}
.fact {
  border: 1px solid var(--rule);
  background: rgba(255, 250, 235, 0.4);
  padding: 0.7em 0.75em 0.8em;
}
.fact b {
  display: block;
  font-family: var(--serif);
  font-size: 1.6em;
  color: var(--ink);
  font-weight: 620;
  line-height: 1;
}
.fact span {
  display: block;
  margin-top: 0.35em;
  font-size: 0.76em;
  color: var(--ink-3);
  line-height: 1.35;
}

/* ——— índice ——— */
.toc { list-style: none; margin: 1.4em 0 0; padding: 0; }
.toc li { margin: 0 0 0.15em; }
.toc a {
  display: flex;
  align-items: baseline;
  gap: 0.5em;
  text-decoration: none;
  color: var(--ink-2);
  padding: 0.42em 0;
  border-bottom: 1px solid rgba(198, 178, 139, 0.5);
  cursor: pointer;
  font-family: var(--serif);
  font-size: 1.02em;
}
.toc a:hover { color: var(--gold); }
.toc a i { flex: 1 1 auto; border-bottom: 1px dotted var(--rule); transform: translateY(-0.18em); }
.toc a em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--ink-3);
}
.toc-note { margin-top: 1.6em; }

/* ——— línea de tiempo ——— */
.filters { display: flex; gap: 0.4em; margin: 1em 0 1.3em; }
.filters button {
  appearance: none;
  border: 1px solid var(--gold-2);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 0.72em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.36em 0.7em;
  cursor: pointer;
}
.filters button[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #f6ecd4;
}

.timeline { position: relative; margin: 0; padding: 0 0 0 1.3em; list-style: none; }
.timeline::before {
  content: "";
  position: absolute;
  left: 0.32em; top: 0.3em; bottom: 0.3em;
  width: 1px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 45%, var(--rule) 100%);
}
.tl-item, .tl-gap { position: relative; margin: 0 0 0.5em; }
.tl-item {
  display: block;
  background: rgba(255, 250, 235, 0.45);
  border: 1px solid var(--rule);
  padding: 0.7em 0.85em 0.75em 0.9em;
  text-decoration: none;
  color: inherit;
}
.tl-item.has-photo { border-left: 3px solid var(--gold); cursor: pointer; }
.tl-item.has-photo:hover { background: rgba(255, 250, 235, 0.9); border-color: var(--gold-2); }
.tl-item.muted { opacity: 0.68; background: transparent; }
body.filter-photo .tl-item.muted,
body.filter-photo .tl-gap { display: none; }

.tl-item::before, .tl-gap::before {
  content: "";
  position: absolute;
  left: -1.07em; top: 0.95em;
  width: 0.55em; height: 0.55em;
  border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--gold-2);
}
.tl-item.has-photo::before { background: var(--gold); border-color: var(--gold); }
.tl-gap::before { display: none; }

.tl-top {
  display: flex; flex-wrap: wrap;
  gap: 0.25em 0.7em;
  align-items: baseline;
  margin-bottom: 0.15em;
}
.tl-date { font-family: var(--serif); font-size: 1.02em; color: var(--ink); font-weight: 560; }
.tl-item .sha { color: var(--gold-2); }
.tl-item.has-photo .sha { color: var(--gold); }
.tl-commits { font-size: 0.76em; color: var(--ink-3); }
.tl-title { margin: 0 !important; font-size: 0.9em; color: var(--ink-2); }
.chip {
  display: inline-block;
  font-size: 0.64em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  padding: 0.1em 0.4em;
  margin-left: auto;
}
.tl-gap {
  min-height: 1.9em;
  padding: 0.45em 0 0.45em 0.9em;
  color: var(--ink-3);
  font-size: 0.76em;
  letter-spacing: 0.03em;
  font-style: italic;
}
.tl-gap::after {
  content: "";
  position: absolute;
  left: 0; top: 0.1em; bottom: 0.1em;
  border-left: 1px dashed var(--rule);
}

/* ——— pares ——— */
.pair { margin: 1.2em 0 0; }
.pair-head {
  display: flex; flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.3em 1em;
  margin-bottom: 0.6em;
}
.pair-head h3 { margin: 0; }
.pair-labels {
  display: flex; gap: 1em;
  font-size: 0.68em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 !important;
}
.pair-labels b { color: var(--gold); font-weight: 500; }
.pair-frame img { width: 100%; max-height: 19em; object-fit: contain; }
.caption {
  margin: 0.6em 0 0 !important;
  font-size: 0.86em;
  color: var(--ink-2);
}

/* ——— láminas: la foto va montada en el papel, no flotando ——— */
.shot-phone, .pair-frame {
  position: relative;
  background: linear-gradient(180deg, #f7eed9 0%, #ebdec0 100%);
  padding: 0.55em 0.55em 0.5em;
  cursor: zoom-in;
  box-shadow:
    0 0 0 1px rgba(120, 92, 52, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 9px 20px rgba(52, 34, 14, 0.3),
    0 2px 5px rgba(52, 34, 14, 0.22);
  transition: transform 220ms var(--ease-page), box-shadow 220ms var(--ease-page);
}
.shot-phone:hover, .pair-frame:hover,
.shot-phone:focus-visible, .pair-frame:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(120, 92, 52, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.65) inset,
    0 15px 30px rgba(52, 34, 14, 0.36),
    0 3px 7px rgba(52, 34, 14, 0.25);
}
/* filete de tinta alrededor de la imagen */
.shot-phone img, .pair-frame img {
  border-radius: 0;
  box-shadow: 0 0 0 1px rgba(38, 24, 12, 0.85);
  filter: saturate(0.93) contrast(1.04);
}
/* trama de impresión y caída de tinta hacia los bordes */
.shot-phone::after, .pair-frame::after {
  content: "";
  position: absolute;
  inset: 0.55em 0.55em 0.5em;
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.55;
  background:
    repeating-linear-gradient(0deg, rgba(58, 38, 16, 0.13) 0 1px, transparent 1px 3px),
    radial-gradient(115% 95% at 50% 42%, transparent 58%, rgba(58, 38, 16, 0.45));
}

/* ——— láminas ——— */
.shots { display: flex; gap: 1em; margin: 1.1em 0 0.4em; align-items: flex-start; }
.shots-1 { justify-content: center; }
.shot { flex: 1 1 0; min-width: 0; margin: 0; }
.shots-1 .shot { max-width: 52%; }
.shots-2 .shot { max-width: 48%; }
.shot-phone {
  background: #0c0806;
  border-radius: 0.9em;
  padding: 0.35em;
  box-shadow:
    0 0 0 1px rgba(60, 40, 18, 0.5),
    0 10px 24px rgba(60, 40, 18, 0.32);
  cursor: zoom-in;
}
.shot-phone img {
  width: 100%;
  aspect-ratio: 720 / 1280;
  object-fit: cover;
  border-radius: 0.55em;
}
.shot figcaption {
  margin-top: 0.5em;
  font-size: 0.76em;
  color: var(--ink-3);
  line-height: 1.35;
}
/* pie de lámina, como en un libro ilustrado */
.plate-num {
  display: block;
  font-family: var(--sans);
  font-size: 0.88em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.3em;
  padding-bottom: 0.28em;
  border-bottom: 1px solid var(--rule);
}
.caption .plate-num { font-size: 0.76em; }

/* ——— episodios ——— */
.ep-note {
  border-left: 2px solid var(--gold-2);
  padding: 0.15em 0 0.15em 0.85em;
  color: var(--ink-2);
}

/* ——— barras de coste ——— */
.bars { display: grid; gap: 0.5em; margin: 1.1em 0 1.3em; }
.bar-row {
  display: grid;
  grid-template-columns: 8.5em 1fr 2em;
  gap: 0.55em;
  align-items: center;
}
.bar-row span:first-child { font-size: 0.82em; color: var(--ink-2); }
.bar-row span:last-child {
  font-family: var(--serif);
  font-size: 0.95em;
  color: var(--ink);
  text-align: right;
}
.bar { height: 0.5em; background: rgba(120, 92, 52, 0.18); position: relative; }
.bar i {
  position: absolute; inset: 0 auto 0 0;
  background: var(--gold);
  width: var(--w);
}
.bar.cheap i { background: var(--ink-3); opacity: 0.7; }
.cost-note { font-size: 0.88em; }

/* ——— barra inferior ——— */
.bottombar {
  height: var(--botbar-h);
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0 1rem;
  background: linear-gradient(0deg, rgba(10, 7, 4, 0.9), rgba(10, 7, 4, 0.35));
  border-top: 1px solid rgba(196, 160, 90, 0.18);
}
.ctrl {
  appearance: none;
  width: 2.1rem; height: 2.1rem;
  flex: 0 0 auto;
  border: 1px solid rgba(196, 160, 90, 0.45);
  border-radius: 50%;
  background: transparent;
  color: #e9dcc0;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}
.ctrl:hover:not(:disabled) { background: var(--gold-lite); color: #1a120c; }
.ctrl:disabled { opacity: 0.28; cursor: default; }
.progress { flex: 1 1 auto; min-width: 0; }
.progress-track {
  height: 2px;
  background: rgba(196, 160, 90, 0.22);
  position: relative;
}
.progress-track i {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  background: var(--gold-lite);
  transition: width 420ms var(--ease-page);
}
.folio-read {
  margin: 0.45rem 0 0;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a08a66;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ——— lightbox ——— */
.lb {
  position: fixed; inset: 0;
  background: rgba(8, 5, 3, 0.94);
  display: none;
  z-index: 80;
  padding: 1.2rem;
  align-items: center;
  justify-content: center;
}
.lb.is-open { display: flex; flex-direction: column; }
.lb img {
  max-width: min(96vw, 1100px);
  max-height: 80vh;
  width: auto; height: auto;
  object-fit: contain;
  box-shadow: 0 0 0 1px rgba(196, 160, 90, 0.4);
}
.lb p {
  margin: 0.8rem 0 0;
  color: #c9b89a;
  font-size: 0.88rem;
  max-width: 46rem;
  text-align: center;
}
.lb-close {
  position: absolute; top: 0.7rem; right: 0.8rem;
  appearance: none;
  border: 1px solid rgba(196, 160, 90, 0.5);
  background: transparent;
  color: #e9dcc0;
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

/* ——— una sola página (móvil / vertical) ——— */
.book.is-single { --ar: 0.64; }
.book.is-single .leaf { left: 0; width: 100%; }
.book.is-single .board-right { left: 0; width: 100.9%; border-radius: 0.5rem; }
.book.is-single .board-left { display: none; }
.book.is-single.at-start,
.book.is-single.at-end { transform: none; }
.book.is-single .face-front::before { width: 5%; background: linear-gradient(90deg, rgba(60, 40, 18, 0.22), transparent); }
.book.is-single .page-body { padding: 2.2em 1.9em 1em 2.1em; }
.book.is-single .page-foot { padding: 0 1.9em 1.2em 2.1em; }
.book.is-single .facts { grid-template-columns: 1fr 1fr; }
.book.is-single .shots { gap: 0.7em; }
.book.is-single .shots-1 .shot { max-width: 58%; }
.book.is-single .shots-2 .shot { max-width: 50%; }

@media (max-width: 640px) {
  .topbar { padding: 0 0.7rem; gap: 0.6rem; }
  .brand { font-size: 0.85rem; }
  .langs { margin-left: 0.4rem; }
  .chapters { gap: 0.8rem; }
  .stage { padding: 0.7rem 0.6rem; }
  .bottombar { padding: 0 0.7rem; }
  .bar-row { grid-template-columns: 7em 1fr 1.8em; }
}

/* ——— sin JS: documento normal ——— */
html:not(.js) body { overflow: auto; }
html:not(.js) .stage { height: auto; display: block; padding: 0; }
html:not(.js) .book { width: min(100%, 46rem); margin: 0 auto; aspect-ratio: auto; transform: none; }
html:not(.js) .board, html:not(.js) .turn, html:not(.js) .bottombar { display: none; }
html:not(.js) .page {
  position: static;
  background: var(--paper);
  margin: 0 0 1.5rem;
  font-size: 16px;
}
html:not(.js) .page-body { overflow: visible; padding: 2rem; }

@media (prefers-reduced-motion: reduce) {
  .leaf { transition-duration: 1ms; }
  .book { transition-duration: 1ms; }
  .leaf.is-turning .gloss { animation: none; }
  .cover-hint { animation: none; }
}
