/* =========================================================
   RIDER7 · estilos
   Los colores y tipografías se toman de config.txt
   ========================================================= */

:root {
  --bg-dark: #0f0f12;
  --bg-light: #f6f3ee;
  --fg-dark: #f2efe9;
  --fg-light: #1b1a18;
  --accent: #e8b04a;
  --on-accent: #111;
  --page: #ffffff;
  --blur: 40px;
  --font-title: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --logo-h: 48px;
  --par-k: 1;
  --title-scale: 1;
  --title-weight: 600;
  --header-h: 72px;
  --radius: 18px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bg: var(--bg-dark);
  --fg: var(--fg-dark);
  color-scheme: dark;
}
:root[data-theme="light"] { --bg: var(--bg-light); --fg: var(--fg-light); color-scheme: light; }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] { --bg: var(--bg-light); --fg: var(--fg-light); color-scheme: light; }
}
:root {
  --muted: color-mix(in srgb, var(--fg) 62%, var(--bg));
  --line: color-mix(in srgb, var(--fg) 14%, transparent);
  --card: color-mix(in srgb, var(--fg) 5%, var(--bg));
  --glass: color-mix(in srgb, var(--bg) 72%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s, color .35s;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 {
  font-family: var(--font-title); font-weight: var(--title-weight); line-height: 1.15; margin: 0;
  font-synthesis: none; text-rendering: optimizeLegibility;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.noscript { text-align: center; padding: 40px 20px; color: var(--muted); }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

/* ---------- Fondo desenfocado (libro) ---------- */
.bg-blur {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  opacity: 0; transition: opacity .6s var(--ease);
  pointer-events: none;
}
.bg-blur img {
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(var(--blur)) saturate(1.25);
  transform: scale(1.25);
}
.bg-blur::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 0%, color-mix(in srgb, var(--bg) 55%, transparent) 75%),
    color-mix(in srgb, var(--bg) 38%, transparent);
}
body.is-book .bg-blur.ready { opacity: 1; }

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  margin: 0 auto;
  padding: 8px clamp(16px, 3vw, 40px);
  display: flex; align-items: center; gap: 16px;
  position: relative;
}
.brand { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; }
.brand-logo { height: var(--logo-h); width: auto; max-width: 260px; object-fit: contain; }
.brand-text { font-family: var(--font-title); font-size: calc(1.5rem * var(--title-scale)); font-weight: var(--title-weight); letter-spacing: .02em; font-synthesis: none; }
.brand.has-logo .brand-text { display: none; }

.site-nav { margin-left: auto; }
.hdr-left, .hdr-right { display: flex; align-items: center; gap: 4px; }
.nav-list.nav-split { display: none; }
.head-contact {
  display: none; width: 40px; height: 40px; border-radius: 50%; place-items: center; flex-shrink: 0;
  color: var(--muted); transition: color .2s, background-color .2s;
}
.head-contact:hover { color: var(--fg); background: var(--line); }

/* Cabecera lateral: logo a la izquierda, menú a la derecha */
body:not(.header-centered) .brand { order: 0; }
body:not(.header-centered) .site-nav { order: 1; }
body:not(.header-centered) .hdr-left { order: 2; }
body:not(.header-centered) .hdr-right { order: 3; }
.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: nowrap; gap: 4px; }
.nav-list a {
  display: block; padding: 8px 14px; border-radius: 999px;
  text-decoration: none; font-size: .95rem; white-space: nowrap;
  color: var(--muted); transition: color .2s, background-color .2s;
}
.nav-list a:hover { color: var(--fg); background: var(--line); }
.nav-list a.active { color: var(--on-accent); background: var(--accent); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  color: var(--muted); transition: color .2s, background-color .2s;
}
.theme-toggle:hover { color: var(--fg); background: var(--line); }
.theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }

.menu-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  margin-left: auto;
}
.menu-toggle span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s, opacity .3s; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Cabecera centrada: logo al medio y las secciones repartidas a los costados */
.header-centered .header-inner { display: grid; grid-template-columns: 1fr auto 1fr; column-gap: 12px; }
.header-centered .hdr-left { grid-column: 1; grid-row: 1; justify-content: flex-end; }
.header-centered .brand { grid-column: 2; grid-row: 1; justify-self: center; }
.header-centered .hdr-right { grid-column: 3; grid-row: 1; justify-content: flex-start; }
.header-centered .nav-list.nav-split { display: flex; }
.header-centered .site-nav { display: none; }
.header-centered .theme-toggle { margin-left: auto; }
.header-centered .menu-toggle { margin-left: 0; }
/* En celular (o si no entra): ☰ a la izquierda, logo al medio, contacto y modo a la derecha */
body.header-centered.nav-compact .nav-list.nav-split { display: none; }
body.header-centered.nav-compact .site-nav { display: block; }
body.header-centered.nav-compact .header-inner { grid-template-columns: 88px minmax(0, 1fr) 88px; }
body.header-centered.nav-compact .brand { min-width: 0; max-width: 100%; }
body.header-centered.nav-compact .brand-logo { max-width: 100%; }
body.header-centered.nav-compact .hdr-left { justify-content: flex-start; }
body.header-centered.nav-compact .hdr-right { justify-content: flex-end; }
body.header-centered.nav-compact .head-contact { display: grid; }
body.header-centered.nav-compact .theme-toggle { margin-left: 0; }

/* Menú compacto (celular o muchos elementos) */
body.nav-compact:not(.header-centered) .header-inner { display: flex; flex-direction: row; }
.nav-compact .menu-toggle { display: flex; }
.nav-compact .theme-toggle { order: 3; }
.nav-compact .menu-toggle { order: 2; }
.nav-compact .site-nav {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(0,0,0,.25);
  max-height: 0; overflow: hidden;
  transition: max-height .4s var(--ease);
  margin: 0;
}
.nav-compact .site-nav.open { max-height: 80vh; overflow-y: auto; }
.nav-compact .nav-list { flex-direction: column; padding: 10px 14px 18px; gap: 2px; }
.nav-compact .nav-list a { padding: 13px 16px; border-radius: 12px; font-size: 1.05rem; }
.nav-measure .nav-list { visibility: hidden; }

/* Submenús (grupos) */
.has-sub { position: relative; }
.nav-group { display: flex; align-items: center; }
.nav-group > a { padding-right: 4px; }
.sub-toggle {
  width: 26px; height: 34px; border-radius: 999px; display: grid; place-items: center;
  color: var(--muted); margin-left: -2px; transition: color .2s, transform .3s;
}
.sub-toggle svg { width: 16px; height: 16px; transition: transform .3s; }
.sub-toggle:hover { color: var(--fg); }
.has-sub.open > .nav-group .sub-toggle svg { transform: rotate(180deg); }
.has-sub::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.sub {
  list-style: none; margin: 0; padding: 6px;
  position: absolute; top: calc(100% + 8px); left: 50%; z-index: 60;
  min-width: 210px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
  opacity: 0; visibility: hidden; transform: translate(-50%, -6px);
  transition: opacity .2s, transform .25s var(--ease), visibility .2s;
}
@media (hover: hover) {
  .has-sub:hover > .sub { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
}
.has-sub.open > .sub { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.has-sub.hover-off:not(.open) > .sub { opacity: 0; visibility: hidden; transform: translate(-50%, -6px); }
.sub a { border-radius: 10px; padding: 9px 14px; }
.sub .nav-group > a { flex: 1; }
.sub .sub {
  position: static; transform: none; opacity: 1; visibility: visible;
  min-width: 0; box-shadow: none; border: 0; background: none;
  padding: 0 0 0 12px; margin: 0;
}
.sub .sub-toggle { display: none; }
.sub .has-sub::after { display: none; }
.nav-list a.in-path { color: var(--fg); background: var(--line); }
.sub a.active { color: var(--on-accent); }

.nav-compact .has-sub::after { display: none; }
.nav-compact .nav-group > a { flex: 1; }
.nav-compact .sub-toggle { width: 48px; height: 48px; }
.nav-compact .sub {
  position: static; transform: none; min-width: 0;
  background: none; border: 0; box-shadow: none;
  padding: 0 0 4px 16px; margin: 0;
  opacity: 1; visibility: visible; display: none;
}
.nav-compact .has-sub.open > .sub { display: block; transform: none; }
.nav-compact .sub a { padding: 11px 16px; font-size: 1rem; }

/* ---------- Vistas ---------- */
main { min-height: calc(100vh - var(--header-h)); }
.view { animation: fadeIn .5s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-msg { display: grid; place-items: center; min-height: 60vh; padding: 40px 20px; text-align: center; }
.msg { max-width: 560px; color: var(--muted); }
.msg h2 { color: var(--fg); margin-bottom: 10px; font-size: 1.6rem; }
.msg code { background: var(--line); padding: 2px 6px; border-radius: 6px; font-size: .9em; }
.spinner {
  width: 38px; height: 38px; margin: 0 auto 16px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inicio ---------- */
.view-home { padding: 0; }
.intro { text-align: center; max-width: 680px; margin: 0 auto; padding: 40px 20px 32px; }
.intro:empty { display: none; }
.intro h1 { font-size: calc(clamp(2rem, 5vw, 3.4rem) * var(--title-scale)); margin-bottom: 12px; }
.intro p { color: var(--muted); font-size: 1.1rem; margin: 0; }
.intro.is-group { padding: 22px 20px 24px; }
.intro.is-group h1 { font-size: calc(clamp(1.6rem, 3.6vw, 2.4rem) * var(--title-scale)); margin-bottom: 6px; }
.list-back {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px;
  color: var(--muted); text-decoration: none; font-size: .9rem;
  padding: 4px 10px 4px 4px; border-radius: 999px; transition: color .2s, background-color .2s;
}
.list-back svg { width: 18px; height: 18px; transform: rotate(90deg); }
.list-back:hover { color: var(--fg); background: var(--line); }

.covers { display: flex; flex-direction: column; }
.cover {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  align-items: center; gap: clamp(24px, 5vw, 72px);
  padding: clamp(40px, 6vw, 88px) max(24px, calc((100% - 1180px) / 2));
  text-decoration: none; color: #fff;
  background: #222;
}
/* Aparición al hacer scroll (slide up) */
.cover.reveal { opacity: 0; transform: translateY(56px); transition: opacity .8s var(--ease), transform 1s var(--ease); }
.cover.reveal .cover-info { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease) .15s, transform 1s var(--ease) .15s; }
.cover.reveal.in, .cover.reveal.in .cover-info { opacity: 1; transform: none; }
.cover:nth-child(even) { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }
.cover:nth-child(even) .cover-art { order: 2; }
.cover-bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  filter: blur(36px) saturate(1.3); transform: scale(1.3);
  transition: transform 1.2s var(--ease);
}
.cover::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, rgba(0,0,0,.55), rgba(0,0,0,.25));
}
.cover-art { perspective: 1400px; display: flex; justify-content: center; }
.cover-book {
  position: relative; width: 100%; max-width: 360px;
  transform: rotateY(-14deg) rotateX(2deg);
  transform-origin: left center;
  transition: transform .8s var(--ease);
  box-shadow: 24px 30px 50px rgba(0,0,0,.45), 4px 4px 10px rgba(0,0,0,.3);
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  background: var(--page);
}
.cover:nth-child(even) .cover-book { transform: rotateY(14deg) rotateX(2deg); transform-origin: right center; }
.cover-book img { width: 100%; height: auto; aspect-ratio: var(--ratio, 3/4); object-fit: cover; }
.cover-book::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 9%; z-index: 1;
  background: linear-gradient(90deg, rgba(0,0,0,.35), rgba(255,255,255,.18) 40%, rgba(0,0,0,.08) 70%, transparent);
}
.cover:hover .cover-book, .cover:focus-visible .cover-book { transform: rotateY(-4deg); }
.cover:nth-child(even):hover .cover-book { transform: rotateY(4deg); }
.cover:hover .cover-bg { transform: scale(1.4); }

.cover-group .cover-book {
  overflow: visible;
  box-shadow:
    10px -10px 0 -1px rgba(255,255,255,.55), 10px -10px 0 0 rgba(0,0,0,.25),
    20px -20px 0 -2px rgba(255,255,255,.3), 20px -20px 0 -1px rgba(0,0,0,.2),
    24px 30px 50px rgba(0,0,0,.45);
}
.cover-group .cover-book img { border-radius: 3px 8px 8px 3px; }
.cover-info { min-width: 0; }
.cover-kicker {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .85rem; font-weight: 600; opacity: .8; margin-bottom: 10px;
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.14);
}
.cover-kicker svg { width: 16px; height: 16px; }
.cover-info h2 { font-size: calc(clamp(1.8rem, 4vw, 3rem) * var(--title-scale)); margin-bottom: 14px; overflow-wrap: anywhere; }
.cover-info p { margin: 0 0 24px; opacity: .85; font-size: 1.05rem; max-width: 46ch; }
.cover-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  transition: gap .3s var(--ease), transform .3s var(--ease);
}
.cover-btn svg { width: 18px; height: 18px; stroke-width: 2.2; }
.cover:hover .cover-btn { gap: 16px; }

/* Parallax: cada capa se desplaza distinto según --p (lo calcula app.js al hacer scroll).
   Usa la propiedad translate para no pisar los giros y escalas de arriba. */
.parallax .cover { --p: 0; --par-bg: 9%; --par-art: 56px; --par-info: 22px; }
/* --par-k = parallax_intensidad / 100. Con más intensidad el fondo se amplía un poco para que no se vean sus bordes */
.parallax .cover-bg {
  translate: 0 calc(var(--p) * var(--par-bg) * var(--par-k) * -1);
  scale: max(1, calc(1 + (var(--par-k) - 1) * .14));
  will-change: translate;
}
.parallax .cover-art { translate: 0 calc(var(--p) * var(--par-art) * var(--par-k)); will-change: translate; }
.parallax .cover-info { translate: 0 calc(var(--p) * var(--par-info) * var(--par-k)); }

/* ---------- Libro ---------- */
body.is-book .site-header { background: color-mix(in srgb, var(--bg) 35%, transparent); }
body.is-book main { min-height: auto; }
.view-book {
  display: flex; flex-direction: column;
  overflow: hidden;
  padding: 8px 16px 10px;
}
@supports (overflow: clip) { .view-book { overflow: visible; overflow-x: clip; } }
.book-stage { touch-action: pan-y; }
.vh-probe { position: fixed; top: 0; left: 0; width: 1px; height: 100vh; height: 100svh; visibility: hidden; pointer-events: none; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 38px; min-width: 38px; padding: 0 8px; border-radius: 999px;
  text-decoration: none; font-size: .9rem;
  color: var(--fg); background: transparent; border: 0;
  transition: background-color .2s, opacity .2s;
}
.btn-ghost:hover { background: color-mix(in srgb, var(--fg) 12%, transparent); }
.btn-ghost svg { width: 20px; height: 20px; }
.book-back span { padding-right: 6px; max-width: 26vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.book-stage {
  flex: none; position: relative; min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.book-holder {
  position: relative;
  transition: transform .7s var(--ease);
  filter: drop-shadow(0 24px 40px rgba(0,0,0,.45));
}
.book-holder.shift-right { transform: translateX(-25%); }
.book-holder.shift-left { transform: translateX(25%); }
.book-holder .stf__parent { margin: 0 auto; }

.page {
  background: var(--page);
  overflow: hidden;
}
.page-inner {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.page img {
  width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity .4s;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.page img.loaded { opacity: 1; }
/* ajuste: llenar -> todas las páginas del mismo tamaño, recortando lo que sobra */
.book-holder.fill .page img { object-fit: cover; object-position: center; }
.page .page-loader {
  position: absolute; width: 28px; height: 28px;
  border: 3px solid rgba(0,0,0,.1); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .9s linear infinite;
}
.page img.loaded + .page-loader { display: none; }
/* Sombra del lomo */
.page.--left .page-inner::after, .page.--right .page-inner::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none;
}
.page.--left .page-inner::after { right: 0; background: linear-gradient(270deg, rgba(0,0,0,.22), transparent); }
.page.--right .page-inner::after { left: 0; background: linear-gradient(90deg, rgba(0,0,0,.22), transparent); }
.stf__wrapper.--portrait .page-inner::after { display: none; }

.book-arrow {
  position: absolute; top: 50%; z-index: 5;
  width: 52px; height: 52px; margin-top: -26px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--fg); background: color-mix(in srgb, var(--bg) 45%, transparent);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: .16;
  transition: opacity .6s, transform .2s, background-color .2s;
}
.book-stage.arrows-awake .book-arrow, .book-arrow.touched, .book-arrow:focus-visible { opacity: 1; transition-duration: .2s; }
@media (hover: hover) {
  .book-arrow:hover { opacity: 1; transition-duration: .2s; background: color-mix(in srgb, var(--bg) 75%, transparent); transform: scale(1.06); }
}
.book-arrow.prev { left: 4px; }
.book-arrow.next { right: 4px; }
.book-arrow:disabled, .book-stage.arrows-awake .book-arrow:disabled, .book-arrow.touched:disabled { opacity: 0; pointer-events: none; }
.book-arrow svg { width: 24px; height: 24px; stroke-width: 2.2; }

/* Barra inferior del libro: discreta, las imágenes son lo principal */
.book-ui {
  width: 100%; max-width: 760px; margin: 6px auto 0;
  opacity: .72; transition: opacity .3s;
}
.book-ui:hover, .book-ui:focus-within { opacity: 1; }
.book-bar { display: flex; align-items: center; gap: 8px; }
.book-meta {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
}
.book-title {
  font-family: var(--font-body); font-weight: 500; font-size: .92rem;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.book-count { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.book-tools { display: flex; gap: 2px; }

.book-range {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: 18px; margin: 0 0 2px;
  background: transparent; cursor: pointer;
  --progress: 0%;
}
.book-range::-webkit-slider-runnable-track {
  height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) var(--progress), color-mix(in srgb, var(--fg) 20%, transparent) var(--progress));
}
.book-range::-moz-range-track { height: 3px; border-radius: 3px; background: color-mix(in srgb, var(--fg) 20%, transparent); }
.book-range::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
.book-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%;
  background: var(--accent); border: 0; transition: transform .2s;
}
.book-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; }
.book-range:hover::-webkit-slider-thumb { transform: scale(1.25); }

/* ---------- Zoom ---------- */
.zoom {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.92);
  animation: fadeIn .3s;
}
.zoom-scroll {
  width: 100%; height: 100%; overflow: auto;
  display: flex; gap: 0; align-items: flex-start; justify-content: safe center;
  -webkit-overflow-scrolling: touch;
  cursor: zoom-out;
}
.zoom-scroll img { max-width: none; width: auto; height: auto; max-height: none; flex-shrink: 0; }
.zoom-scroll.fit { align-items: center; }
.zoom-scroll.fit img { max-width: min(100vw, 1600px); max-height: 100vh; width: auto; object-fit: contain; }
.zoom-scroll.fit.two img { max-width: 50vw; }
.zoom-scroll.fit { cursor: zoom-in; }
.zoom-close {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 14px; z-index: 2;
  width: 46px; height: 46px; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; font-size: 30px; line-height: 1;
}

/* ---------- WhatsApp ---------- */
.wa-float {
  position: fixed; z-index: 70;
  right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: #25d366; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0; transform: translateY(16px) scale(.7); pointer-events: none;
  transition: opacity .45s var(--ease), transform .55s var(--ease);
}
body.wa-ready .wa-float { opacity: 1; transform: none; pointer-events: auto; }
body.wa-ready .wa-float:hover { transform: scale(1.07); }
.wa-float svg { width: 30px; height: 30px; stroke-width: 1.7; }
.wa-inline { display: none; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 56px 20px 28px;
}
body.is-book .site-footer { background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.footer-inner { max-width: 1120px; margin: 0 auto; text-align: center; }
.footer-inner h2 { font-size: calc(clamp(1.6rem, 3.5vw, 2.4rem) * var(--title-scale)); margin-bottom: 10px; }
.footer-text { color: var(--muted); margin: 0 auto 28px; max-width: 560px; }
.contact-list { list-style: none; padding: 0; margin: 0 auto 36px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.contact-list a {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px;
  border: 1px solid var(--line); text-decoration: none;
  transition: border-color .2s, background-color .2s, color .2s;
  font-size: .95rem; overflow-wrap: anywhere;
}
.contact-list a:hover { border-color: var(--accent); color: var(--accent); }
.contact-list svg { width: 19px; height: 19px; flex-shrink: 0; }
.footer-legal { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; border-top: 1px solid var(--line); padding-top: 22px; }
.footer-legal a { color: var(--muted); }
.footer-legal .pie { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.footer-legal img { display: inline-block; max-height: 40px; width: auto; vertical-align: middle; }
.site-footer address { font-style: normal; }
.sitemap-box {
  width: 100%; min-height: 260px; margin-top: 18px; padding: 14px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 12px; resize: vertical;
}
.msg .cover-btn { text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .intro { padding: 28px 16px 22px; }
  .cover, .cover:nth-child(even) {
    grid-template-columns: 1fr; text-align: center; gap: 22px; padding: 36px 20px 40px;
  }
  .cover:nth-child(even) .cover-art { order: 0; }
  .cover-book, .cover:nth-child(even) .cover-book { max-width: 62vw; transform: rotateY(-8deg); transform-origin: left center; }
  .cover-info p { margin-left: auto; margin-right: auto; }
  .parallax .cover { --par-art: 26px; --par-info: 12px; }
  .view-book { padding: 4px 6px 8px; }
  .book-back span { display: none; }
  .book-ui { opacity: 1; }
  .book-meta { justify-content: flex-start; flex-direction: column; gap: 0; align-items: flex-start; }
  .book-arrow { width: 40px; height: 40px; margin-top: -20px; }
  .book-arrow.prev { left: -2px; }
  .book-arrow.next { right: -2px; }
  .tool-full { display: none; }
  /* WhatsApp en celular: chico, y dentro del libro va al lado del zoom */
  .wa-float { width: 40px; height: 40px; right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
  .wa-float svg { width: 22px; height: 22px; }
  body.is-book .wa-float { display: none; }
  body.is-book .wa-inline {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; min-width: 34px; padding: 0; margin-right: 4px; border-radius: 50%;
    background: #25d366; color: #fff;
    opacity: 0; transform: scale(.7); transition: opacity .45s var(--ease), transform .55s var(--ease);
  }
  body.is-book.wa-ready .wa-inline { opacity: 1; transform: none; }
  .wa-inline svg { width: 19px; height: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
