/*
 * Páginas de libros v1 (TASK-0003): catálogo, colección, ficha y compra.
 * Referencia: https://preview.kelgu.com/marthaalles/libros/v1/
 *
 * La encola inc/libros.php sólo en esas cuatro plantillas, después de v4.css: reutiliza sus
 * piezas (ma4-wrap, ma4-section, ma4-h2, ma4-head, ma4-more, ma4-pill, las tarjetas ma4-book de la
 * biblioteca de la home y la cita ma4-quote) y agrega las propias con el prefijo «ma4l-». Sólo usa
 * variables de tokens.css (ningún color escrito).
 *
 * Dirección: la biblioteca de la home convertida en sala de lectura. Lo memorable son las
 * colecciones del catálogo como estantes, con sus tapas apoyadas en un borde que se abren apenas
 * al pasar el mouse. Las entradas son las de la home (data-ma4-rv y data-ma4-group, con
 * «ma4-anima»): una sola vez, con transform y opacity; sin script o con prefers-reduced-motion no
 * se oculta ni se mueve nada.
 */

/* ------------------------------------------------------------------------------------------
 * Base (como main.ma4-home)
 * --------------------------------------------------------------------------------------- */

/* GeneratePress pone .site-content en flex; style.css baja todo <main> 26 px. */
main.ma4l { flex: 1 1 auto; display: block; width: 100%; min-width: 0; margin: 0 !important; padding: 0; font-family: var(--font-text); color: var(--ink); background: var(--bg); font-size: 17px; line-height: 1.6; }
:where(.ma4l) a { color: var(--accent-strong); }
:where(.ma4l) a:hover { color: var(--ink); }
:where(.ma4l) :is(h1, h2, h3, p, ul, ol, li, dl, dd, figure, blockquote) { margin: 0; padding: 0; }
:where(.ma4l) *, :where(.ma4l) *::before, :where(.ma4l) *::after { box-sizing: border-box; }
:where(.ma4l) img { height: auto; }

.ma4l-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ma4l-h1 { font-family: var(--font-display); font-weight: var(--weight-medium); font-size: clamp(56px, 8.4vw, 120px); line-height: .98; letter-spacing: -.03em; text-wrap: balance; }
.ma4l-h3 { font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 22px; line-height: 1.25; letter-spacing: -.017em; }
.ma4l-lead { font-size: 19px; line-height: 1.6; color: var(--ink-soft); max-width: 60ch; }

/* Migas: dónde está la página dentro de los libros. */
.ma4l-crumbs { padding-top: 28px; font-size: 14px; color: var(--ink-mute); }
.ma4l-crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; }
.ma4l-crumbs li { margin: 0; }
.ma4l-crumbs li + li::before { content: "/"; margin: 0 10px; color: var(--line); }
.ma4l-crumbs a { text-decoration: none; padding: 8px 0; }
.ma4l-crumbs a:hover { text-decoration: underline; }
.ma4l-crumbs a:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.ma4l-crumbs [aria-current] { color: var(--ink); }
.ma4l-crumbs--dark { color: var(--on-dark-mute); }
.ma4l .ma4l-crumbs--dark a { color: var(--accent); }
.ma4l .ma4l-crumbs--dark a:hover { color: var(--on-dark); }
.ma4l-crumbs--dark li + li::before { color: var(--line-on-dark-soft); }
.ma4l-crumbs--dark [aria-current] { color: var(--on-dark); }
.ma4l-crumbs--dark a:focus-visible { outline-color: var(--on-dark); }

/* Píldoras de colección (las ma4-pill de la home), en fila. */
.ma4l-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.ma4l .ma4-pill[aria-current] { background: var(--ink); color: var(--surface); }
.ma4l-pill-sub { color: var(--ink-mute); margin-right: 6px; }
.ma4-pill[aria-current] .ma4l-pill-sub { color: inherit; }

/* Botones: los de la home (lavanda y fantasma sobre oscuro, tinta y línea sobre claro). */
.ma4l-btn, .ma4l-btn:focus { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 30px; border-radius: 999px; border: 1px solid transparent; font: inherit; font-size: 15px; font-weight: var(--weight-semibold); line-height: 1; text-decoration: none; cursor: pointer; }
.ma4l .ma4l-btn--lav, .ma4l .ma4l-btn--lav:visited { background: var(--accent); color: var(--on-accent); }
.ma4l .ma4l-btn--lav:hover { background: var(--on-dark); color: var(--on-accent); }
.ma4l .ma4l-btn--ghost, .ma4l .ma4l-btn--ghost:visited { color: var(--on-dark); border-color: var(--line-on-dark-strong); }
.ma4l .ma4l-btn--ghost:hover { background: var(--on-dark-faint); color: var(--on-dark); }
.ma4l-btn--lav:focus-visible, .ma4l-btn--ghost:focus-visible { outline: 2px solid var(--on-dark); outline-offset: 3px; }
.ma4l .ma4l-btn--ink, .ma4l .ma4l-btn--ink:visited { background: var(--ink); color: var(--surface); }
.ma4l .ma4l-btn--ink:hover { background: var(--accent-strong); color: var(--surface); }
.ma4l .ma4l-btn--line, .ma4l .ma4l-btn--line:visited { color: var(--ink); border-color: var(--line); background: var(--surface); }
.ma4l .ma4l-btn--line:hover { border-color: var(--accent-strong); color: var(--accent-strong); }
.ma4l-btn--ink:focus-visible, .ma4l-btn--line:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

/* Tapas en grilla: las tarjetas ma4-book de la biblioteca de la home (caja blanca, sombra
   ciruela, la tapa que se saca del estante), en filas en vez de un estante desplazable. */
.ma4l-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 48px 28px; }
.ma4l-grid .ma4-book { margin: 0; }
.ma4l-grid .ma4-book h2 { font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 17px; line-height: 1.3; letter-spacing: -.011em; }
.ma4l .ma4-book-links a:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

@media (max-width: 760px) {
  .ma4l-lead { font-size: 17px; }
  .ma4l-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 16px; }
  .ma4l .ma4-book-cover { height: 230px; padding: 14px; }
  .ma4l .ma4-book-links { flex-direction: column; gap: 0; }
  .ma4l .ma4-book-links a { padding: 6px 0; }
}

/* ------------------------------------------------------------------------------------------
 * Catálogo
 * --------------------------------------------------------------------------------------- */

.ma4l-cat-hero { padding: 80px 0 88px; }
.ma4l-cat-hero .ma4-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 32px 64px; align-items: end; }
.ma4l-cat-intro { display: flex; flex-direction: column; gap: 28px; }
.ma4l-cat-jump .ma4-pill { border: 1px solid var(--line-soft); }

/* Novedades: las tapas sobre el ciruela de la home, con el halo de las slides de libros. */
.ma4l-nov-sec { background: var(--bg-plum); color: var(--on-dark); }
.ma4l-nov-sec .ma4-wrap { display: flex; flex-direction: column; gap: 48px; }
.ma4l-nov-sec .ma4-h2 { color: var(--on-dark); }
.ma4l-nov-sec .ma4-head p { color: var(--on-dark-soft); }
.ma4l-nov-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 32px; }
.ma4l-nov { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.ma4l-nov-cover { position: relative; display: flex; align-items: center; justify-content: center; height: 320px; margin-bottom: 8px; }
.ma4l-nov-cover::before { content: ""; position: absolute; width: 260px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--on-dark-ghost); }
.ma4l-nov-cover img { position: relative; height: 280px; max-width: 100%; width: auto; object-fit: contain; border-radius: 3px; box-shadow: var(--shadow-slide-cover); transform-origin: 50% 100%; }
.ma4l-nov h3 { font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 18px; line-height: 1.3; letter-spacing: -.011em; color: var(--on-dark); }
.ma4l-nov p { font-size: 15px; line-height: 1.5; color: var(--on-dark-mute); }
.ma4l .ma4l-nov .ma4-book-links a { color: var(--accent); }
.ma4l .ma4l-nov .ma4-book-links a + a { color: var(--on-dark); }
.ma4l .ma4l-nov .ma4-book-links a:hover { color: var(--on-dark); text-decoration: underline; }
.ma4l .ma4l-nov .ma4-book-links a:focus-visible { outline-color: var(--on-dark); }

/* Colecciones: cada una es un estante, con hasta tres tapas apoyadas en una tabla arena. */
.ma4l-cols-sec { background: var(--bg-sand); }
.ma4l-cols-sec .ma4-wrap { display: flex; flex-direction: column; gap: 40px; }
.ma4l-cols { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 40px 28px; }
.ma4l-col { margin: 0; scroll-margin-top: 104px; }
.ma4l .ma4l-col-link { display: flex; flex-direction: column; gap: 16px; height: 100%; color: var(--ink); text-decoration: none; border-radius: 14px; }
.ma4l-col-link:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }
.ma4l-shelf { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 236px; padding: 24px 24px 30px; border-radius: 14px; background: var(--surface); }
.ma4l-shelf::after { content: ""; position: absolute; left: 16px; right: 16px; bottom: 18px; height: 12px; border-radius: 3px; background: var(--bg-sand); }
.ma4l-shelf img { position: relative; z-index: 1; height: 160px; width: auto; max-width: 42%; object-fit: contain; border-radius: 3px; box-shadow: var(--shadow-cover); transform-origin: 50% 100%; }
.ma4l-shelf img + img { margin-left: -22px; }
.ma4l-shelf img:nth-child(1) { transform: rotate(-4deg); }
.ma4l-shelf img:nth-child(2) { z-index: 2; height: 176px; transform: none; }
.ma4l-shelf img:nth-child(3) { transform: rotate(4deg); }
.ma4l-shelf img:only-child { transform: none; }
.ma4l-shelf--empty { align-items: center; padding-bottom: 40px; }
.ma4l-shelf-empty { position: relative; z-index: 1; max-width: 16ch; text-align: center; font-family: var(--font-display); font-style: italic; font-size: 22px; line-height: 1.3; color: var(--ink-mute); }
.ma4l-col-text { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.ma4l-col-name { font-weight: var(--weight-semibold); font-size: 18px; line-height: 1.3; letter-spacing: -.011em; }
.ma4l-col-parent { font-weight: var(--weight-regular); color: var(--ink-mute); }
.ma4l-col-count { font-size: 14px; color: var(--ink-mute); font-variant-numeric: tabular-nums; }
.ma4l-col-link:hover .ma4l-col-name, .ma4l-col-link:focus-visible .ma4l-col-name { color: var(--accent-strong); }

/* Las colecciones padre (Narrativa), con sus hijas (Ficción, No ficción) adentro. */
.ma4l-col-group { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 28px; margin: 0; padding-top: 32px; border-top: 1px solid var(--line); scroll-margin-top: 104px; }
.ma4l-col-group-head { grid-column: span 2; display: flex; flex-direction: column; gap: 8px; }
.ma4l-col-group-name { font-family: var(--font-display); font-weight: var(--weight-medium); font-size: clamp(30px, 3vw, 40px); line-height: 1.1; letter-spacing: -.018em; }
.ma4l .ma4l-col-group-name a { color: var(--ink); text-decoration: none; }
.ma4l .ma4l-col-group-name a:hover { color: var(--accent-strong); }
.ma4l-col-group-name a:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.ma4l-col-group-head p { color: var(--ink-soft); }
.ma4l-col-group-list { display: contents; list-style: none; }

@media (max-width: 1100px) {
  .ma4l-nov-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ma4l-cat-hero { padding: 48px 0 56px; }
  .ma4l-cat-hero .ma4-wrap { grid-template-columns: minmax(0, 1fr); }
  .ma4l-cat-jump .ma4l-pills { gap: 8px; }
  .ma4l-cat-jump .ma4-pill { height: 38px; padding: 0 14px; font-size: 14px; }
  .ma4l-nov-list { gap: 40px 16px; }
  .ma4l-nov-cover { height: 240px; }
  .ma4l-nov-cover::before { width: 180px; }
  .ma4l-nov-cover img { height: 210px; }
  .ma4l-nov h3 { font-size: 16px; }
  .ma4l .ma4l-nov .ma4-book-links { flex-direction: column; gap: 0; }
  .ma4l .ma4l-nov .ma4-book-links a { padding: 6px 0; }
  .ma4l-col-group-head { grid-column: auto; }
}

/* ------------------------------------------------------------------------------------------
 * Colección
 * --------------------------------------------------------------------------------------- */

.ma4l-col-hero { padding-bottom: 72px; }
.ma4l-col-hero-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px 72px; align-items: end; padding-top: 56px; }
.ma4l-col-hero-row--solo { grid-template-columns: minmax(0, 1fr); }
.ma4l-col-hero-title { display: flex; flex-direction: column; gap: 18px; }
.ma4l-col-hero-count { font-size: 17px; color: var(--ink-mute); }
.ma4l-epi { display: flex; flex-direction: column; gap: 12px; padding-left: 28px; border-left: 2px solid var(--ornament); }
.ma4l-epi blockquote { border: 0; font-family: var(--font-display); font-style: italic; font-size: clamp(22px, 2.1vw, 28px); line-height: 1.35; letter-spacing: -.008em; color: var(--ink-soft); text-wrap: pretty; }
.ma4l-epi figcaption { font-size: 15px; color: var(--ink-mute); }

.ma4l-col-books { background: var(--bg-sand); }
.ma4l-col-books .ma4-wrap { display: flex; flex-direction: column; gap: 64px; }

/* Paginación: la de WordPress (paginate_links) con el estilo de la maqueta. */
.ma4l-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; padding-top: 32px; border-top: 1px solid var(--line); }
.ma4l-pager .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 46px; height: 46px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: var(--weight-semibold); line-height: 1; text-decoration: none; }
.ma4l-pager a.page-numbers:hover { border-color: var(--ink); color: var(--ink); }
.ma4l-pager .page-numbers.current { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.ma4l-pager .page-numbers.dots { border-color: transparent; background: none; }
.ma4l-pager .page-numbers[aria-disabled="true"] { opacity: .4; }
.ma4l-pager .page-numbers svg { display: block; }
.ma4l-pager a.page-numbers:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.ma4l-pager-info { margin-left: 12px; font-size: 14px; color: var(--ink-mute); }

.ma4l-col-more { background: var(--bg); }
.ma4l-col-more-cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 48px 72px; align-items: center; }
.ma4l-col-more-cols--solo { grid-template-columns: minmax(0, 1fr); }
.ma4l-col-more .ma4-head { max-width: none; gap: 20px; }
.ma4l-col-more .ma4-more { align-self: flex-start; }
.ma4l .ma4-more:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
/* El último libro, en el sombra de su slide de la home. */
.ma4l .ma4l-feat { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: center; padding: 36px; border-radius: 20px; background: var(--bg-umber); color: var(--on-dark); text-decoration: none; }
.ma4l-feat img { height: 210px; width: auto; border-radius: 3px; box-shadow: var(--shadow-slide-cover); transform-origin: 50% 100%; }
.ma4l-feat-text { display: flex; flex-direction: column; gap: 10px; }
.ma4l-feat-kicker { font-size: 14px; color: var(--accent); }
.ma4l-feat-title { font-family: var(--font-display); font-weight: var(--weight-medium); font-size: 36px; line-height: 1.05; letter-spacing: -.02em; }
.ma4l-feat-sub { font-size: 15px; line-height: 1.5; color: var(--on-dark-soft); }
.ma4l-feat-cta { align-self: flex-start; display: inline-flex; align-items: center; height: 44px; margin-top: 6px; padding: 0 22px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 15px; font-weight: var(--weight-semibold); }
.ma4l .ma4l-feat:hover { color: var(--on-dark); }
.ma4l-feat:hover .ma4l-feat-cta { background: var(--on-dark); }
.ma4l-feat:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }

@media (max-width: 900px) {
  .ma4l-col-hero-row, .ma4l-col-more-cols { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .ma4l-col-hero { padding-bottom: 56px; }
  .ma4l-col-hero-row { padding-top: 32px; }
  .ma4l-epi { padding-left: 20px; }
  .ma4l .ma4l-feat { grid-template-columns: minmax(0, 1fr); justify-items: start; padding: 28px; }
  .ma4l-feat img { height: 190px; }
  .ma4l-pager-info { flex-basis: 100%; margin: 4px 0 0; text-align: center; }
}

/* ------------------------------------------------------------------------------------------
 * Ficha: el hero en el sombra de las slides de libros de la home, con su halo detrás de la tapa.
 * --------------------------------------------------------------------------------------- */

.ma4l-bk-hero { background: var(--bg-umber); color: var(--on-dark); padding-bottom: 96px; }
.ma4l-bk-hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 48px 80px; align-items: center; padding-top: 48px; }
.ma4l-bk-hero-grid--solo { grid-template-columns: minmax(0, 1fr); }
.ma4l-bk-cover { position: relative; min-width: 0; display: flex; align-items: center; justify-content: center; min-height: 560px; }
.ma4l-bk-cover::before { content: ""; position: absolute; width: 520px; max-width: 100%; aspect-ratio: 1; border-radius: 50%; background: var(--on-dark-ghost); }
.ma4l-bk-cover img { position: relative; height: 500px; width: auto; max-width: 100%; object-fit: contain; border-radius: 3px; box-shadow: var(--shadow-slide-cover); }
.ma4l-bk-hero-text { display: flex; flex-direction: column; gap: 22px; }
.ma4l .ma4l-bk-cols .ma4-pill { height: 36px; padding: 0 14px; background: var(--on-dark-ghost); color: var(--on-dark); border: 1px solid var(--line-on-dark-soft); font-size: 14px; }
.ma4l-bk-cols .ma4-pill::before { border-color: var(--accent); }
.ma4l .ma4l-bk-cols .ma4-pill:hover { color: var(--accent); }
.ma4l-bk-cols .ma4-pill:focus-visible { outline-color: var(--on-dark); }
.ma4l-bk-cols .ma4l-pill-sub { color: var(--on-dark-mute); }
.ma4l .ma4l-bk-title { font-family: var(--font-display); font-weight: var(--weight-medium); font-size: clamp(56px, 7vw, 104px); line-height: .98; letter-spacing: -.03em; color: var(--on-dark); text-wrap: balance; }
.ma4l-bk-sub { max-width: 32ch; font-family: var(--font-display); font-style: italic; font-size: clamp(22px, 2.2vw, 30px); line-height: 1.3; color: var(--on-dark-soft); text-wrap: pretty; }
.ma4l-bk-actions { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 10px; }

.ma4l-bk-body { scroll-margin-top: 72px; }
.ma4l-bk-body .ma4-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 48px 96px; align-items: start; }
.ma4l-bk-body .ma4-h2 { margin-bottom: 12px; }

/* Descripción: el contenido del libro tal como está en la base. */
.ma4l-prose { max-width: 66ch; min-width: 0; }
.ma4l-prose-lead { margin-bottom: 18px; font-size: 20px; color: var(--ink); }
.ma4l-prose :is(p, ul, ol) { margin: 0 0 18px; color: var(--ink-soft); }
.ma4l-prose :is(ul, ol) { padding-left: 22px; }
.ma4l-prose li { margin-bottom: 6px; }
.ma4l-prose li::marker { color: var(--accent-strong); }
.ma4l-prose :is(h2, h3, h4) { margin: 32px 0 12px; font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 20px; line-height: 1.3; letter-spacing: -.014em; color: var(--ink); }
.ma4l-prose > .ma4-h2 { margin: 0 0 12px; font-family: var(--font-display); font-weight: var(--weight-medium); font-size: clamp(32px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.018em; }
.ma4l-prose img { max-width: 100%; height: auto; }
.ma4l-prose strong, .ma4l-prose b { color: var(--ink); font-weight: var(--weight-semibold); }

.ma4l-other-covers, .ma4l-sala { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line-soft); }
.ma4l-prose .ma4l-h3 { margin: 0; font-size: 22px; }
.ma4l-other-covers-grid { display: flex; flex-wrap: wrap; gap: 20px; }
.ma4l-other-covers-grid img { height: 200px; width: auto; border-radius: 3px; box-shadow: var(--shadow-cover); }
.ma4l-sala p { margin: 0; }
.ma4l-sala .ma4l-btn { align-self: flex-start; }

.ma4l-facts { position: sticky; top: 104px; display: flex; flex-direction: column; gap: 22px; padding: 32px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-card); }
.ma4l-facts-title { font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 20px; line-height: 1.25; letter-spacing: -.017em; }
.ma4l-facts dl { display: flex; flex-direction: column; }
.ma4l-facts dl > div { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.ma4l-facts dt { font-size: 13px; font-weight: var(--weight-regular); color: var(--ink-mute); }
.ma4l-facts dd { margin: 4px 0 0; font-size: 16px; }
.ma4l-facts dd a { text-decoration: none; }
.ma4l-facts dd a:hover { text-decoration: underline; }
.ma4l-facts dd a:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

.ma4l-bk-more { background: var(--bg-sand); }
.ma4l-bk-more .ma4-wrap { display: flex; flex-direction: column; gap: 40px; }

@media (max-width: 1100px) {
  .ma4l-bk-hero-grid { gap: 40px 48px; }
  .ma4l-bk-cover { min-height: 460px; }
  .ma4l-bk-cover img { height: 420px; }
  .ma4l-bk-body .ma4-wrap { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
}
@media (max-width: 760px) {
  .ma4l-bk-hero { padding-bottom: 64px; }
  .ma4l-bk-hero-grid { grid-template-columns: minmax(0, 1fr); padding-top: 16px; gap: 24px; }
  .ma4l-bk-cover { min-height: 340px; }
  .ma4l-bk-cover::before { width: 300px; }
  .ma4l-bk-cover img { height: 300px; }
  .ma4l-bk-actions .ma4l-btn { flex: 1 1 auto; }
  .ma4l-bk-body .ma4-wrap { grid-template-columns: minmax(0, 1fr); }
  .ma4l-prose-lead { font-size: 18px; }
  .ma4l-facts { position: static; padding: 28px; }
  .ma4l .ma4-quote-sec { padding: 80px 0; }
  .ma4l-other-covers-grid img { height: 160px; }
}

/* ------------------------------------------------------------------------------------------
 * Compra: una tarjeta de enlaces, pensada primero para el celular.
 * --------------------------------------------------------------------------------------- */

.ma4l-buy { background: var(--bg-sand); padding: 0 0 88px; }
.ma4l-buy-in { width: 100%; max-width: 520px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; gap: 20px; }
.ma4l-buy-in .ma4l-crumbs { padding-bottom: 8px; }
.ma4l-buy-card { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 28px 24px 32px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-card); }
.ma4l-buy-author { align-self: stretch; display: flex; align-items: center; gap: 16px; }
.ma4l .ma4l-buy-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 12%; background: var(--bg-lilac); }
.ma4l .ma4l-buy-name { font-family: var(--font-text); font-weight: var(--weight-semibold); font-size: 18px; line-height: 1.25; letter-spacing: -.011em; }
.ma4l-buy-book { margin: 2px 0 0; font-family: var(--font-display); font-weight: var(--weight-medium); font-size: 30px; line-height: 1.1; letter-spacing: -.018em; }
.ma4l-buy-cover { min-width: 0; display: flex; justify-content: center; align-self: stretch; padding: 28px 0 8px; border-radius: 14px; background: var(--bg); }
.ma4l .ma4l-buy-cover img { min-width: 0; height: 300px; width: auto; max-width: 100%; object-fit: contain; border-radius: 3px; box-shadow: var(--shadow-cover-lift); }
.ma4l-buy-review { align-self: stretch; height: 48px; }
.ma4l-buy-h { margin-top: 16px; font-family: var(--font-display); font-weight: var(--weight-medium); font-size: 28px; line-height: 1.15; letter-spacing: -.016em; text-align: center; }
.ma4l-buy-none { text-align: center; color: var(--ink-mute); }
.ma4l-stores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ma4l-stores li { margin: 0; }
.ma4l .ma4l-store, .ma4l .ma4l-store:visited { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; padding: 0 24px; border-radius: 999px; background: var(--ink); color: var(--surface); text-decoration: none; }
.ma4l-store-name { font-size: 16px; font-weight: var(--weight-semibold); }
.ma4l-store svg { flex: none; color: var(--accent); }
.ma4l .ma4l-store:hover { background: var(--accent-strong); color: var(--surface); }
.ma4l-store:hover svg { color: var(--surface); }
.ma4l-store:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.ma4l-buy-other { align-self: center; margin-top: 8px; }

@media (min-width: 761px) {
  .ma4l-buy { padding-top: 16px; }
  .ma4l .ma4l-buy-cover img { height: 340px; }
}

/* ------------------------------------------------------------------------------------------
 * Movimiento de respuesta (hover y foco); las entradas son las de v4.css.
 * --------------------------------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .ma4l .ma4-pill { transition: color .2s, transform .35s cubic-bezier(.2, .7, .2, 1); }
  .ma4l-btn { transition: background .2s, border-color .2s, color .2s; }

  /* Al pasar el mouse, las tapas del estante se abren apenas, como al buscar un libro. */
  .ma4l-shelf img { transition: transform .5s cubic-bezier(.2, .7, .2, 1), box-shadow .5s cubic-bezier(.2, .7, .2, 1); }
  .ma4l-col-link:hover .ma4l-shelf img:nth-child(1), .ma4l-col-link:focus-visible .ma4l-shelf img:nth-child(1) { transform: translateX(-14px) rotate(-7deg); }
  .ma4l-col-link:hover .ma4l-shelf img:nth-child(2), .ma4l-col-link:focus-visible .ma4l-shelf img:nth-child(2) { transform: translateY(-10px); box-shadow: var(--shadow-cover-lift); }
  .ma4l-col-link:hover .ma4l-shelf img:nth-child(3), .ma4l-col-link:focus-visible .ma4l-shelf img:nth-child(3) { transform: translateX(14px) rotate(7deg); }
  .ma4l-col-link:hover .ma4l-shelf img:only-child, .ma4l-col-link:focus-visible .ma4l-shelf img:only-child { transform: translateY(-10px) rotate(-2deg); }
  .ma4l-col-name, .ma4l-col-group-name a { transition: color .2s; }

  /* Novedades y el último libro: la tapa se levanta como en la biblioteca. */
  .ma4l-nov-cover img, .ma4l-feat img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
  .ma4l-nov:hover .ma4l-nov-cover img { transform: translateY(-10px) rotate(-2deg); }
  .ma4l-feat:hover img, .ma4l-feat:focus-visible img { transform: translateY(-8px) rotate(-2deg); }
  .ma4l-feat-cta { transition: background .2s; }
  .ma4l .ma4l-nov .ma4-book-links a { transition: color .2s; }

  .ma4l-pager .page-numbers { transition: border-color .2s, color .2s; }

  /* Tiendas: la flecha sale hacia la tienda. */
  .ma4l-store { transition: background .2s; }
  .ma4l-store svg { transition: color .2s, transform .35s cubic-bezier(.2, .7, .2, 1); }
  .ma4l-store:hover svg, .ma4l-store:focus-visible svg { transform: translate(3px, -3px); }
}
