/* =========================================================================
   main.css — Estilos públicos del comparador.

   Las variables `--theme-*` se inyectan en `<style id="theme-vars">` desde
   `src/views/layout.ejs` con los tokens resueltos del preset (cuaderno /
   ticker / patio) + overrides del admin. Aquí sólo declaramos defaults para
   que el sitio renderice incluso si esa inyección fallase, y aliases
   `--color-*` para compatibilidad con `admin.css` existente.

   Convenciones:
   - Densidad: `--theme-density-scale` modifica paddings clave (compact 0.92,
     normal 1, airy 1.08).
   - Acento decorativo: `[data-theme="cuaderno"]` añade textura papel,
     `[data-theme="ticker"]` rejilla y `[data-theme="patio"]` esquinas suaves.
   - Móvil-first; breakpoints en 640 / 720 / 980 / 1080px.
   ========================================================================= */

:root {
  /* Fallbacks (preset Cuaderno) por si la inyección de tema fallase. */
  /* Fallbacks (preset Planeta) por si la inyección de tema fallase. */
  --theme-bg: #ffffff;
  --theme-surface: #ffffff;
  --theme-surface-alt: #f4f7fa;
  --theme-ink: #1d1d1d;
  --theme-ink-soft: #464646;
  --theme-ink-muted: #79808a;
  --theme-border: #e3e7ec;
  --theme-accent: #1488c8;
  --theme-accent-soft: #e7f2fb;
  --theme-success: #1e874b;
  --theme-danger: #d8382b;
  --theme-radius: 4px;
  --theme-radius-lg: 8px;
  --theme-shadow: 0 1px 2px rgba(17, 34, 68, 0.06), 0 10px 28px rgba(17, 34, 68, 0.08);
  --theme-shadow-sm: 0 1px 2px rgba(17, 34, 68, 0.06);
  --theme-font-heading: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --theme-font-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --theme-font-mono: "JetBrains Mono", "Menlo", monospace;
  --theme-density-scale: 1;

  /* Aliases hacia atrás para que `admin.css` siga funcionando sin tocar
     todos sus tokens. */
  --color-bg: var(--theme-bg);
  --color-surface: var(--theme-surface);
  --color-border: var(--theme-border);
  --color-text: var(--theme-ink);
  --color-muted: var(--theme-ink-muted);
  --color-accent: var(--theme-accent);
  --color-accent-hover: var(--theme-accent);
  --color-success: var(--theme-success);
  --color-danger: var(--theme-danger);
  --radius: var(--theme-radius);
  --shadow-sm: var(--theme-shadow-sm);
  --shadow-md: var(--theme-shadow);
  --font-sans: var(--theme-font-body);

  /* Espaciado escalable por densidad. */
  --pad-xs: calc(0.25rem * var(--theme-density-scale));
  --pad-sm: calc(0.5rem * var(--theme-density-scale));
  --pad-md: calc(1rem * var(--theme-density-scale));
  --pad-lg: calc(1.5rem * var(--theme-density-scale));
  --pad-xl: calc(2.5rem * var(--theme-density-scale));

  /* ---- Tokens derivados para la capa visual "pro" (inspirada en el
     directorio de gasolineras pero en azul). Se construyen a partir de los
     `--theme-*` para respetar el sistema de temas y los overrides del admin. */
  --ui-accent: var(--theme-accent);
  --ui-accent-strong: color-mix(in srgb, var(--theme-accent) 82%, #000 18%);
  --ui-accent-soft: var(--theme-accent-soft);
  --ui-accent-tint: color-mix(in srgb, var(--theme-accent) 22%, #fff);
  --ui-accent-ring: color-mix(in srgb, var(--theme-accent) 30%, transparent);

  --ui-radius-md: 12px;
  --ui-radius-lg: 18px;
  --ui-radius-xl: 24px;
  --ui-radius-pill: 999px;

  --ui-shadow-sm: 0 1px 2px rgba(17, 34, 68, 0.05), 0 1px 3px rgba(17, 34, 68, 0.04);
  --ui-shadow-md: 0 6px 22px rgba(17, 34, 68, 0.08), 0 2px 6px rgba(17, 34, 68, 0.05);
  --ui-shadow-lg: 0 22px 50px rgba(17, 34, 68, 0.14), 0 4px 12px rgba(17, 34, 68, 0.06);
  --ui-shadow-accent: 0 12px 30px color-mix(in srgb, var(--theme-accent) 32%, transparent);

  /* Icono de lupa (data-uri) para máscaras CSS en el buscador del hero. */
  --ui-search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--theme-font-body);
  color: var(--theme-ink);
  background-color: var(--theme-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Decoración de fondo según tema. */
body.theme-cuaderno {
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.025) 1px, transparent 1px);
  background-size: 6px 6px;
}
body.theme-ticker {
  background-image:
    linear-gradient(var(--theme-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--theme-border) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  background-position: -1px -1px;
}
body.theme-patio {
  background-image:
    radial-gradient(circle at 100% 0%, rgba(232, 90, 60, 0.06), transparent 40%),
    radial-gradient(circle at 0% 80%, rgba(31, 63, 138, 0.06), transparent 40%);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--theme-font-heading);
  color: var(--theme-ink);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

p { margin: 0 0 0.85rem; }

a {
  color: var(--theme-accent);
  text-decoration: none;
}
a:hover, a:focus { text-decoration: underline; }

code, pre, .mono { font-family: var(--theme-font-mono); }

::selection {
  background: var(--theme-accent);
  color: var(--theme-surface);
}

/* ----------------------------- Layout shell ----------------------------- */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  padding-top: var(--pad-lg);
  padding-bottom: var(--pad-xl);
  min-height: 60vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -------------------------------- Header -------------------------------- */

.site-header {
  background: var(--theme-surface);
  border-bottom: 1px solid var(--theme-border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(140%) blur(6px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  flex-wrap: wrap;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--theme-font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--theme-ink);
  letter-spacing: -0.01em;
}
.site-header__brand:hover, .site-header__brand:focus {
  text-decoration: none;
  color: var(--theme-ink);
}

.site-header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--theme-radius);
  background: var(--theme-accent-soft);
  font-size: 1.1rem;
}
.site-header__logo-mark { width: 1.35rem; height: 1.35rem; }
.site-footer__logo-mark { width: 1.3rem; height: 1.3rem; color: #fff; }

.site-header__brand-tagline {
  color: var(--theme-ink-muted);
  font-size: 0.78rem;
  font-weight: 400;
  font-family: var(--theme-font-body);
  letter-spacing: 0.01em;
}

.site-header__nav {
  display: none;
  gap: 1.1rem;
  margin-left: auto;
  font-size: 0.92rem;
}
.site-header__nav a {
  color: var(--theme-ink-soft);
  font-weight: 500;
}
.site-header__nav a:hover { color: var(--theme-accent); text-decoration: none; }
@media (min-width: 720px) { .site-header__nav { display: inline-flex; } }

/* ---- Menú hamburguesa (móvil < 720px). CSS-only por la CSP estricta: un
   checkbox oculto controla el desplegable; el <label> es el botón. ---- */
.site-header__nav-toggle { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.site-header__burger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-surface);
  color: var(--theme-ink);
  cursor: pointer;
}
.site-header__burger:hover { border-color: var(--theme-accent); color: var(--theme-accent); }
.site-header__burger-icon { width: 1.4rem; height: 1.4rem; }
.site-header__burger-icon--close { display: none; }
.site-header__nav-toggle:checked ~ .site-header__burger .site-header__burger-icon--open { display: none; }
.site-header__nav-toggle:checked ~ .site-header__burger .site-header__burger-icon--close { display: inline; }
/* Panel desplegable a todo el ancho, justo bajo la cabecera (sticky = posicionada). */
.site-header__nav-toggle:checked ~ .site-header__nav {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  gap: 0.1rem;
  padding: 0.5rem 1rem 0.9rem;
  background: var(--theme-surface);
  border-bottom: 1px solid var(--theme-border);
  box-shadow: 0 14px 22px rgba(17, 34, 68, 0.12);
}
.site-header__nav-toggle:checked ~ .site-header__nav a { padding: 0.65rem 0.5rem; border-radius: var(--theme-radius); }
.site-header__nav-toggle:checked ~ .site-header__nav a:hover { background: var(--theme-accent-soft); }
@media (min-width: 720px) {
  .site-header__burger { display: none; }
  /* En escritorio el nav vuelve a su sitio aunque el checkbox quedara marcado. */
  .site-header__nav-toggle:checked ~ .site-header__nav {
    position: static; flex-direction: row; padding: 0; gap: 1.1rem;
    background: none; border: 0; box-shadow: none;
  }
}

/* CTA "Comparar lista": único llamado a la acción del header. En móvil queda
   pegado a la derecha (la marca a la izquierda); en >=720px va tras el nav. */
.site-header__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  padding: 0.5rem 1rem;
  border-radius: var(--theme-radius);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font-family: var(--theme-font-body);
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  line-height: 1.3;
}
.site-header__cta:hover, .site-header__cta:focus {
  filter: brightness(0.93);
  color: var(--theme-surface);
  text-decoration: none;
}
.site-header__cta svg { width: 1rem; height: 1rem; }
@media (min-width: 720px) { .site-header__cta { margin-left: 0.75rem; } }
.site-header__cta-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  font-size: 0.8rem;
  font-weight: 800;
}

/* --------------------------------- Buttons ------------------------------ */

.button {
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: var(--theme-radius);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font-family: var(--theme-font-body);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
  line-height: 1.5;
  transition: filter 0.12s ease;
}
.button:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }

.button--ghost {
  background: transparent;
  color: var(--theme-ink);
  border: 1px solid var(--theme-border);
}
.button--ghost:hover { color: var(--theme-accent); border-color: var(--theme-accent); }

.button--soft {
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}

.button--dark {
  background: var(--theme-ink);
  color: var(--theme-surface);
}

/* --------------------------------- Hero --------------------------------- */

.hero {
  position: relative;
  text-align: center;
  padding: clamp(2rem, 6vw, 3.75rem) 0 clamp(1.5rem, 4vw, 2.5rem);
}
.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0.5rem;
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: var(--theme-accent);
  transform: translateX(-50%);
  opacity: 0.85;
}
body.theme-ticker .hero::before { display: none; }

.hero__eyebrow {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero__title {
  font-family: var(--theme-font-heading);
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  margin: 0 0 0.85rem;
  line-height: 1.05;
  letter-spacing: -0.025em;
}
.hero__title strong { color: var(--theme-accent); font-weight: 700; }

.hero__lead {
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  color: var(--theme-ink-soft);
  max-width: 640px;
  margin: 0 auto 1.6rem;
}

.hero__search {
  display: flex;
  gap: 0.5rem;
  max-width: 660px;
  margin: 0 auto;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 0.4rem;
  box-shadow: var(--theme-shadow);
}

.hero__search input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: var(--theme-radius);
  font: inherit;
  font-size: 1rem;
  background: transparent;
  color: var(--theme-ink);
}
.hero__search input:focus { outline: none; }

.hero__search button {
  padding: 0.85rem 1.4rem;
  border: 0;
  border-radius: var(--theme-radius);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}
.hero__search button:hover { filter: brightness(0.93); }

.hero__hint {
  margin: 0.85rem auto 0;
  color: var(--theme-ink-muted);
  font-size: 0.85rem;
  max-width: 660px;
}
.hero__hint a { color: var(--theme-ink-soft); border-bottom: 1px dashed currentColor; }

/* ------------------- Enlazado interno por categorías -------------------- */
/* Nubes de chips en la home (curso / asignatura / editorial) y cabeceras de
   los hubs (/cursos, /asignaturas, /editoriales). Comparten .category-cloud
   y .category-chip para un look consistente. */

.home-categories {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 0.5rem 0 2.5rem;
}

.home-categories__group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1.6rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}

.home-categories__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.home-categories__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: clamp(1.1rem, 1.8vw, 1.3rem);
  font-weight: 700;
}

.home-categories__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 10px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}
.home-categories__icon svg { width: 1.1rem; height: 1.1rem; }

.home-categories__all {
  font-weight: 600;
  white-space: nowrap;
  color: var(--theme-accent);
}

.category-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem 0.5rem 0.95rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-pill);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.2;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.category-chip:hover,
.category-chip:focus-visible {
  border-color: var(--theme-accent);
  color: var(--theme-accent);
  background: var(--theme-accent-soft);
  text-decoration: none;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--theme-accent) 18%, transparent);
  transform: translateY(-1px);
}

.category-chip__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.6rem;
  height: 1.45rem;
  padding: 0 0.45rem;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.category-chip:hover .category-chip__count,
.category-chip:focus-visible .category-chip__count {
  background: var(--theme-accent);
  color: #fff;
}

/* ------------------------------- Hubs ----------------------------------- */
/* Páginas índice de taxonomía (/cursos, /asignaturas, /editoriales). */

.hub {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 0.5rem 0 2.5rem;
}

.hub__intro {
  max-width: 68ch;
  color: var(--theme-ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hub__intro h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  color: var(--theme-ink);
}

.hub__intro p { margin: 0; }

.hub__group {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

/* --------------------- Prosa SEO de colección/hub ----------------------- */
/* Bloque de texto largo (descripciones generadas) con ancho de lectura
   cómodo. Estiliza los hijos directos para no exigir clases por nodo. */

.collection-seo-body {
  max-width: 68ch;
  color: var(--theme-ink-soft);
  line-height: 1.7;
  font-size: 1rem;
}

.collection-seo-body > * + * { margin-top: 0.9rem; }

.collection-seo-body h2 {
  margin: 1.6rem 0 0.6rem;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  color: var(--theme-ink);
}

.collection-seo-body h2:first-child { margin-top: 0; }

.collection-seo-body p { margin: 0; }

.collection-seo-body ul {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.collection-seo-body li { padding-left: 0.15rem; }

.collection-seo-body a {
  color: var(--theme-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.collection-seo-body a:hover { text-decoration: none; }

.features {
  padding: 1.5rem 0 2.5rem;
}

.features__title {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  margin: 0 0 1.25rem;
  text-align: center;
}

.features__grid {
  list-style: none;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin: 0;
  padding: 0;
}

.features__item {
  position: relative;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.25rem 1.25rem 1.4rem;
  box-shadow: var(--theme-shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.features__item:hover {
  transform: translateY(-2px);
  box-shadow: var(--theme-shadow);
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
}

.features__item h3 {
  margin: 0;
  font-size: 1.08rem;
}

.features__item p {
  margin: 0;
  color: var(--theme-ink-soft);
  font-size: 0.95rem;
}

.features__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--theme-radius);
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

/* ------------------------------ How it works ---------------------------- */

.how-it-works {
  margin: 2.5rem 0;
  padding: 1.75rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  box-shadow: var(--theme-shadow-sm);
}
.how-it-works h2 { margin: 0 0 1.25rem; font-size: 1.35rem; }
.how-it-works__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.how-it-works__step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.how-it-works__num {
  flex: 0 0 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--theme-accent);
  color: var(--theme-surface);
  font-family: var(--theme-font-heading);
  font-weight: 700;
  font-size: 0.95rem;
}
.how-it-works__step h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.how-it-works__step p { margin: 0; color: var(--theme-ink-soft); font-size: 0.92rem; }

/* ----------------------------- Book detail ------------------------------ */

.book-detail__header {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: 1fr;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  box-shadow: var(--theme-shadow-sm);
}
@media (min-width: 720px) {
  .book-detail__header {
    grid-template-columns: 300px 1fr;
    padding: 2rem;
  }
}

.book-detail__cover {
  position: relative;
  min-width: 0;
}
/* min-width:0 deja que las columnas del grid encojan: sin esto, la fila de
   chips (que no envuelve) ensancha la columna y desborda la ficha en móvil,
   empujando la portada fuera del viewport. */
.book-detail__meta {
  min-width: 0;
}
.book-detail__cover img {
  width: 100%;
  max-width: 300px;
  height: auto;
  /* Reserve the box before the remote Amazon cover loads — without a fixed
     ratio the browser can't, and the LCP image shifts title/price/offers down
     on load (CLS). Matches the fallback's 2/3 below. */
  aspect-ratio: 2 / 3;
  object-fit: contain;
  border-radius: var(--theme-radius);
  box-shadow: var(--theme-shadow);
  display: block;
  background: var(--theme-bg);
}
.book-detail__cover::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px dashed var(--theme-border);
  border-radius: calc(var(--theme-radius) + 6px);
  pointer-events: none;
  opacity: 0.5;
}
body.theme-ticker .book-detail__cover::after { display: none; }

.book-detail__cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 2 / 3;
  width: 100%;
  max-width: 300px;
  font-size: 3.5rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  color: var(--theme-ink-muted);
}

.book-detail__title {
  font-size: clamp(1.55rem, 3.2vw, 2.15rem);
  margin: 0 0 0.3rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.book-detail__subtitle {
  color: var(--theme-ink-soft);
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.book-detail__authors {
  margin: 0 0 0.5rem;
  color: var(--theme-ink-soft);
  font-size: 0.98rem;
}

.book-detail__publisher {
  margin: 0 0 1rem;
  font-size: 0.92rem;
}
.book-detail__publisher a {
  color: var(--theme-ink-soft);
  font-weight: 600;
  border-bottom: 1px solid transparent;
}
.book-detail__publisher a:hover { color: var(--theme-accent); border-bottom-color: currentColor; text-decoration: none; }

.book-chips {
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0 0 1.25rem;
  padding: 0 0 0.15rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.book-chips::-webkit-scrollbar { display: none; }
.book-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.65rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--theme-ink-soft);
  white-space: nowrap;
}
.book-chip--isbn {
  font-family: var(--theme-font-mono);
  font-weight: 500;
  color: var(--theme-ink-muted);
}

/* --------------------------------- Offers ------------------------------- */

.offers {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--theme-shadow-sm);
}

.offers__title {
  margin: 0 0 1.1rem;
  font-size: 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.offers__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--theme-border);
  margin-left: 0.4rem;
}

.offers__empty {
  color: var(--theme-ink-soft);
  margin: 0;
  padding: 1.5rem;
  background: var(--theme-bg);
  border-radius: var(--theme-radius);
  border: 1px dashed var(--theme-border);
  text-align: center;
}

.offers__savings {
  margin: 0 0 1rem;
  padding: 0.7rem 1rem;
  background: color-mix(in srgb, var(--theme-success) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--theme-success) 28%, transparent);
  border-radius: var(--theme-radius);
  color: color-mix(in srgb, var(--theme-success) 75%, #000 25%);
  font-size: 0.9rem;
}
.offers__savings strong { font-weight: 700; }

.offers__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.offer {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: 1fr;
  padding: 1rem 1.1rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-bg);
  align-items: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.offer:hover { border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border)); }

@media (min-width: 640px) {
  .offer {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  }
}
/* Móvil (<640px): compacta cada oferta — librería arriba a todo el ancho,
   precio y total en dos columnas, y el botón de comprar a todo el ancho. Y
   centramos la portada, que en una sola columna quedaba descolgada. */
@media (max-width: 639px) {
  .offer { grid-template-columns: 1fr 1fr; align-items: start; }
  .offer__merchant { grid-column: 1 / -1; }
  .offer__cta { grid-column: 1 / -1; }
  .offer__button { display: block; text-align: center; }
  .book-detail__cover { display: flex; justify-content: center; }
}

.offer--best {
  border-color: var(--theme-accent);
  background: var(--theme-accent-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent) 12%, transparent);
}

.offer__merchant {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.offer__swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}
.offer__logo {
  width: 1.5rem;
  height: 1.5rem;
  object-fit: contain;
  border-radius: 4px;
  flex: none;
}

.offer__merchant-name {
  font-weight: 600;
  font-size: 0.98rem;
}

.offer__badge {
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.offer__pricing {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.offer__price {
  font-size: 1.05rem;
  font-weight: 600;
  font-family: var(--theme-font-mono);
  letter-spacing: -0.01em;
}

.offer__price-original {
  text-decoration: line-through;
  color: var(--theme-ink-muted);
  font-size: 0.85rem;
  font-family: var(--theme-font-mono);
}

.offer__shipping {
  font-size: 0.82rem;
  color: var(--theme-ink-muted);
}

.offer__totals {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.offer__total-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-ink-muted);
}

.offer__total {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--theme-ink);
  font-family: var(--theme-font-mono);
  letter-spacing: -0.02em;
}

.offer__delta {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--theme-danger);
  font-family: var(--theme-font-mono);
}
.offer__delta--best { color: var(--theme-success); }

.offer__delivery {
  font-size: 0.78rem;
  color: var(--theme-ink-muted);
}

.offer__cta {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
}

.offer__button {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: var(--theme-radius);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  font-size: 0.92rem;
}
.offer__button:hover, .offer__button:focus { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }

.offer__condition {
  font-size: 0.72rem;
  color: var(--theme-ink-muted);
  text-align: center;
}

.offers__disclaimer {
  margin: 1.1rem 0 0;
  color: var(--theme-ink-muted);
  font-size: 0.82rem;
}

/* ---------------------------- Book description -------------------------- */

.book-description {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--theme-shadow-sm);
}
.book-description h2 { margin: 0 0 0.75rem; font-size: 1.2rem; }
.book-description p { margin: 0 0 0.85rem; color: var(--theme-ink-soft); }

/* ------------------------------ Breadcrumbs ----------------------------- */

.breadcrumbs { margin: 0 0 1rem; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
  color: var(--theme-ink-muted);
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 0.4rem; min-width: 0; }
.breadcrumbs a { color: var(--theme-ink-soft); }
.breadcrumbs a:hover { color: var(--theme-accent); text-decoration: none; }
.breadcrumbs__sep { color: var(--theme-ink-muted); }
.breadcrumbs [aria-current="page"] {
  color: var(--theme-ink-muted);
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------- Ficha técnica ---------------------------- */

.book-specs {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--theme-shadow-sm);
}
.book-specs__title { margin: 0 0 1rem; font-size: 1.2rem; }
.book-specs__grid {
  display: grid;
  gap: 0.85rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin: 0;
}
.book-specs__grid > div { display: flex; flex-direction: column; }
.book-specs__grid dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-ink-muted);
  margin: 0;
  font-weight: 500;
}
.book-specs__grid dd {
  margin: 0.15rem 0 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--theme-ink);
}
.book-specs__grid dd a { color: var(--theme-accent); }
.book-specs__cat { grid-column: 1 / -1; }

/* --------------------- Cross-sell: comparar lista entera ---------------- */

.cross-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  justify-content: space-between;
  background: var(--theme-accent-soft);
  border: 1px solid color-mix(in srgb, var(--theme-accent) 22%, transparent);
  border-radius: var(--theme-radius-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1.5rem;
}
.cross-compare__text { color: var(--theme-ink-soft); font-size: 0.95rem; max-width: 46ch; }
.cross-compare__text strong { display: block; color: var(--theme-ink); font-size: 1.02rem; margin-bottom: 0.1rem; }
.cross-compare__cta {
  flex: none;
  padding: 0.65rem 1.2rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: var(--ui-radius-pill);
  font-weight: 700;
  white-space: nowrap;
}
.cross-compare__cta:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }

/* Añadir a la comparativa (carrito de la ficha) */
.add-compare {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.1rem 1.4rem;
  margin-bottom: 1rem;
}
.add-compare__text { color: var(--theme-ink-soft); font-size: 0.95rem; }
.add-compare__text strong { display: block; color: var(--theme-ink); font-size: 1.02rem; margin-bottom: 0.1rem; }
.add-compare__form { flex: none; margin: 0; }
.add-compare__btn {
  padding: 0.65rem 1.3rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border: 0;
  border-radius: var(--ui-radius-pill);
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.add-compare__btn:hover { filter: brightness(0.93); }
.add-compare--ok .add-compare__btn { background: #16a34a; }

/* --------------------------- Related books ------------------------------ */

.related { margin: 0 0 1.5rem; }
.related__title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.related__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--theme-border);
}

/* ------------------- Sticky buy bar (mobile only) ----------------------- */

.buybar { display: none; }
@media (max-width: 719px) {
  .buybar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
    background: var(--theme-surface);
    border-top: 1px solid var(--theme-border);
    box-shadow: 0 -6px 20px rgba(17, 34, 68, 0.12);
  }
  .buybar__info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
  .buybar__label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--theme-ink-muted); }
  .buybar__price { font-family: var(--theme-font-mono); font-weight: 700; font-size: 1.2rem; color: var(--theme-accent); }
  .buybar__merchant { font-size: 0.74rem; color: var(--theme-ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .buybar__cta {
    margin-left: auto;
    flex: none;
    padding: 0.7rem 1.4rem;
    background: var(--theme-accent);
    color: var(--theme-surface);
    border-radius: var(--ui-radius-pill);
    font-weight: 700;
  }
  .buybar__cta:hover, .buybar__cta:focus { color: var(--theme-surface); text-decoration: none; }
  /* Hueco para que la barra fija no tape el último contenido del artículo. */
  .book-detail { padding-bottom: 4.5rem; }
}

/* ---------------------------- Status pages ------------------------------ */

.status-page {
  text-align: center;
  padding: 4rem 1rem;
}
.status-page__code {
  font-family: var(--theme-font-mono);
  font-size: 5rem;
  font-weight: 700;
  margin: 0;
  color: var(--theme-accent);
  letter-spacing: -0.04em;
  line-height: 1;
}
.status-page__title { margin: 0.5rem 0 0.75rem; font-size: 1.6rem; }
.status-page__message { color: var(--theme-ink-soft); max-width: 540px; margin: 0 auto 1.5rem; }
.status-page__actions { margin: 0; }

/* -------------------------------- Footer -------------------------------- */

.site-footer {
  background: var(--theme-surface);
  border-top: 1px solid var(--theme-border);
  margin-top: 3rem;
}

.site-footer__inner {
  padding: 2.5rem 1rem 2rem;
  display: grid;
  gap: 1.75rem 2rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
  .site-footer__brandcol { grid-column: 1 / -1; }
}
@media (min-width: 860px) {
  .site-footer__inner { grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr; }
  .site-footer__brandcol { grid-column: auto; }
}

.site-footer__brand-row { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 0.6rem; }
.site-footer__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: var(--theme-accent-soft);
  font-size: 1.1rem;
}
.site-footer__brand { margin: 0; font-family: var(--theme-font-heading); font-weight: 800; color: var(--theme-ink); }
.site-footer__tagline { margin: 0 0 0.6rem; color: var(--theme-ink-soft); max-width: 340px; }
.site-footer__compare { margin: 0; color: var(--theme-ink-muted); font-size: 0.82rem; max-width: 340px; }

.site-footer__col { display: flex; flex-direction: column; gap: 0.55rem; }
.site-footer__heading {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-ink-muted);
}
.site-footer__col a { color: var(--theme-ink-soft); font-size: 0.92rem; }
.site-footer__col a:hover { color: var(--theme-accent); text-decoration: none; }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1rem 1.6rem;
  border-top: 1px solid var(--theme-border);
}
.site-footer__meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--theme-ink-muted);
  max-width: 720px;
}
.site-footer__made { margin: 0; font-size: 0.78rem; color: var(--theme-ink-muted); white-space: nowrap; }

/* --------------------------- Search results UI -------------------------- */

.search-header {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  box-shadow: var(--theme-shadow-sm);
}
.search-header__form {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.search-header__form input {
  flex: 1;
  padding: 0.7rem 0.95rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  font: inherit;
  background: var(--theme-bg);
  color: var(--theme-ink);
}
.search-header__form button {
  padding: 0.7rem 1.2rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border: 0;
  border-radius: var(--theme-radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.search-header__meta { margin: 0; color: var(--theme-ink-soft); font-size: 0.92rem; }

/* Desplegable de búsqueda en vivo (as-you-type), poblado por live-search.js. */
.live-search-root { position: relative; }
.live-search__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg, 12px);
  box-shadow: var(--ui-shadow-lg, 0 16px 40px rgba(8, 30, 60, 0.16));
  max-height: min(70vh, 28rem);
  overflow-y: auto;
  padding: 0.35rem;
}
.live-search__item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  color: var(--theme-ink);
  text-decoration: none;
}
.live-search__item:hover,
.live-search__item.is-active {
  background: var(--theme-accent-soft);
  text-decoration: none;
}
.live-search__cover {
  width: 32px;
  height: 44px;
  object-fit: contain;
  border-radius: 3px;
  flex-shrink: 0;
  background: var(--theme-surface-alt);
}
.live-search__cover--ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.live-search__text { display: flex; flex-direction: column; min-width: 0; }
.live-search__title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-search__authors {
  font-size: 0.8rem;
  color: var(--theme-ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-search__empty { padding: 0.7rem 0.6rem; color: var(--theme-ink-muted); font-size: 0.9rem; }

.search-layout {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 980px) { .search-layout { grid-template-columns: 240px 1fr; } }

.search-facets {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.25rem;
  align-self: start;
  box-shadow: var(--theme-shadow-sm);
}
.search-facets section { margin-bottom: 1.25rem; }
.search-facets section:last-child { margin-bottom: 0; }
.search-facets h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-ink-muted);
  font-family: var(--theme-font-body);
}
.search-facets ul { list-style: none; margin: 0; padding: 0; }
.search-facets li { margin: 0.2rem 0; font-size: 0.92rem; }
.search-facets li a { color: var(--theme-ink-soft); }
.search-facets li a:hover { color: var(--theme-accent); }
.search-facets__stock p { margin: 0; }
.facet-count { color: var(--theme-ink-muted); font-size: 0.82rem; margin-left: 0.25rem; }

.search-results__empty {
  padding: 2rem;
  background: var(--theme-surface);
  border: 1px dashed var(--theme-border);
  border-radius: var(--theme-radius-lg);
  text-align: center;
}
.search-results__empty p { color: var(--theme-ink-soft); }

.book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) {
  .book-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .book-grid { grid-template-columns: repeat(2, 1fr); }
}

.book-card {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  overflow: hidden;
  box-shadow: var(--theme-shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--theme-shadow);
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
}

.book-card__link { display: flex; flex-direction: column; flex: 1 1 auto; color: inherit; }
.book-card__link:hover { text-decoration: none; color: inherit; }

.book-card__cover {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--theme-surface-alt);
}
.book-card__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--theme-ink-muted);
}

.book-card__body { padding: 0.85rem 0.9rem 0.95rem; text-align: center; display: flex; flex-direction: column; flex: 1 1 auto; }
.book-card__title {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  line-height: 1.3;
  font-family: var(--theme-font-heading);
  color: var(--theme-ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: calc(0.95rem * 1.3 * 3);
}
.book-card__authors { margin: 0 0 0.15rem; color: var(--theme-ink-soft); font-size: 0.82rem; }
.book-card__publisher { margin: 0 0 0.5rem; color: var(--theme-ink-muted); font-size: 0.78rem; }
.book-card__price { margin: auto 0 0.55rem; font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.book-card__price strong { font-family: var(--theme-font-body); font-weight: 700; }
.book-card__price--empty { display: block; margin: 0; color: var(--theme-ink-muted); font-size: 0.85rem; font-weight: 500; }
/* Botón verde "N precios" — señal de comparativa (estilo comparador). */
.book-card__prices {
  display: block;
  padding: 0.55rem 0.75rem;
  background: var(--theme-accent);
  color: #fff;
  border-radius: var(--theme-radius);
  font-weight: 700;
  font-size: 0.92rem;
  text-align: center;
}
.book-card:hover .book-card__prices { filter: brightness(0.93); }
.book-card__merchant {
  margin: 0.55rem 0 0;
  color: var(--theme-ink-soft);
  font-size: 0.76rem;
  font-style: italic;
  line-height: 1.3;
}

.pagination {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  font-size: 0.92rem;
}
.pagination a {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  color: var(--theme-ink);
  background: var(--theme-surface);
}
.pagination a:hover { color: var(--theme-accent); border-color: var(--theme-accent); text-decoration: none; }
.pagination__status { color: var(--theme-ink-muted); }

/* ------------------------------- List page ------------------------------ */

.list-detail__header {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  box-shadow: var(--theme-shadow-sm);
}
.list-detail__header h1 { margin: 0 0 0.4rem; font-size: clamp(1.4rem, 3vw, 1.85rem); }
.list-detail__meta { margin: 0; color: var(--theme-ink-soft); font-size: 0.92rem; }

.list-cdl-highlight, .list-mix, .list-buys, .list-matrix, .list-items {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--theme-shadow-sm);
}
.list-cdl-highlight h2, .list-mix h2, .list-buys h2, .list-matrix h2, .list-items h2 {
  margin: 0 0 0.85rem;
  font-size: 1.2rem;
}
.list-cdl-highlight__meta, .list-mix__lead, .list-buys__lead {
  margin: 0 0 1rem;
  color: var(--theme-ink-soft);
  font-size: 0.95rem;
}
.list-cdl-highlight__cta {
  display: inline-block;
  padding: 0.65rem 1.2rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: var(--theme-radius);
  font-weight: 600;
}
.list-cdl-highlight__cta:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }
.list-cdl-highlight__missing, .list-mix__unassigned {
  margin: 0.85rem 0 0;
  color: var(--theme-ink-muted);
  font-size: 0.85rem;
}

/* Mix óptimo como desplegable: cabecera-resumen clicable (compra libro a libro). */
.list-mix > summary.list-mix__summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 1.05rem;
}
.list-mix > summary.list-mix__summary::-webkit-details-marker { display: none; }
.list-mix__summary-label { color: var(--theme-ink); }
.list-mix__summary-total { margin-left: auto; color: var(--theme-ink-soft); font-family: var(--theme-font-mono); font-size: 0.95rem; font-weight: 600; }
.list-mix__summary-total strong { color: var(--theme-accent); }
.list-mix > summary.list-mix__summary::after {
  content: "";
  flex-shrink: 0;
  width: 0.6rem;
  height: 0.6rem;
  margin-left: 0.5rem;
  border-right: 2px solid var(--theme-ink-muted);
  border-bottom: 2px solid var(--theme-ink-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.list-mix[open] > summary.list-mix__summary::after { transform: rotate(-135deg); }
.list-mix[open] > .list-mix__groups { margin-top: 1.1rem; }

.list-mix__groups { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.list-mix-group {
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  padding: 0.85rem 1rem;
  background: var(--theme-bg);
}
.list-mix-group__head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}
.list-mix-group__swatch {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
}
.list-mix-group__name { font-weight: 600; }
.list-mix-group__count { color: var(--theme-ink-muted); font-size: 0.85rem; }
.list-mix-group__total { margin-left: auto; color: var(--theme-ink-soft); font-size: 0.92rem; font-family: var(--theme-font-mono); }
.list-mix-group__total strong { color: var(--theme-ink); }
.list-mix-group__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.9rem; }
.list-mix-group__items a { color: var(--theme-ink-soft); }
.list-mix-group__items a:hover { color: var(--theme-accent); }

/* ---- Quick-wins de /lista: ahorro, compartir, mix legible, buybar ------- */

/* Banner de ahorro cuantificado (el "gancho" de la lista). */
.list-savings {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--theme-success) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--theme-success) 28%, transparent);
  border-radius: var(--theme-radius);
}
.list-savings__headline {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.55rem;
  font-size: 1.05rem;
  color: color-mix(in srgb, var(--theme-success) 78%, #000 22%);
}
.list-savings__lead { font-weight: 600; }
.list-savings__amount {
  font-family: var(--theme-font-mono);
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--theme-success);
}
.list-savings__pct {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--theme-success) 18%, #fff);
}
.list-savings__detail { color: color-mix(in srgb, var(--theme-success) 55%, var(--theme-ink) 45%); font-size: 0.95rem; }
.list-savings__detail strong { font-weight: 700; }
.list-savings__mix { margin: 0.5rem 0 0; font-size: 0.92rem; color: color-mix(in srgb, var(--theme-success) 65%, var(--theme-ink) 35%); }
.list-savings__mix strong { font-weight: 800; color: var(--theme-success); }

/* Acciones de la cabecera: botones de compartir. */
.list-detail__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.list-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: var(--ui-radius-pill, 999px);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
}
.list-share-btn:hover { border-color: var(--theme-accent); color: var(--theme-accent); text-decoration: none; }
.list-share-btn__icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.list-detail__share-label { font-size: 0.85rem; font-weight: 600; color: var(--theme-ink-muted); margin-right: 0.15rem; }
/* Botones de compartir con color de marca; el hover solo oscurece un poco. */
.list-share-btn--wa { background: #25d366; border-color: #25d366; color: #fff; }
.list-share-btn--wa:hover { filter: brightness(0.95); color: #fff; border-color: #25d366; }
.list-share-btn--tg { background: #229ed9; border-color: #229ed9; color: #fff; }
.list-share-btn--tg:hover { filter: brightness(0.95); color: #fff; border-color: #229ed9; }
.list-share-btn--x { background: #000; border-color: #000; color: #fff; }
.list-share-btn--x:hover { filter: brightness(1.25); color: #fff; border-color: #000; }
.list-share-btn--fb { background: #1877f2; border-color: #1877f2; color: #fff; }
.list-share-btn--fb:hover { filter: brightness(0.95); color: #fff; border-color: #1877f2; }
.list-share-btn--copy.is-copied { background: var(--theme-success); border-color: var(--theme-success); color: #fff; }

/* Panel "Guarda o comparte tu lista": propósito + copiar-enlace prominente +
   redes como acción secundaria. El copiar lo maneja list-share.js vía
   [data-copy-url] (sin JS inline, CSP-safe). */
.list-share {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 1.1rem;
  padding: 1.1rem 1.2rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-md);
}
.list-share__intro { display: flex; gap: 0.7rem; align-items: flex-start; }
.list-share__intro-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}
.list-share__intro-icon svg { width: 1.15rem; height: 1.15rem; }
.list-share__title { margin: 0; font-weight: 700; color: var(--theme-ink); font-size: 1rem; }
.list-share__hint { margin: 0.15rem 0 0; color: var(--theme-ink-soft); font-size: 0.88rem; line-height: 1.5; }
.list-share__copy { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.list-share__url {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-pill);
  background: var(--theme-surface);
  color: var(--theme-ink-soft);
  font-family: var(--theme-font-mono);
  font-size: 0.85rem;
}
.list-share__url:focus { outline: 2px solid var(--ui-accent-ring); outline-offset: 1px; }
.list-share__copy-btn {
  flex: 0 0 auto;
  padding: 0.62rem 1.3rem;
  border: 0;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.list-share__copy-btn:hover { filter: brightness(1.07); }
.list-share__copy-btn.is-copied { background: var(--theme-success); }
.list-share__socials { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.list-share__socials-label { font-size: 0.82rem; font-weight: 600; color: var(--theme-ink-muted); margin-right: 0.1rem; }

/* Mix óptimo legible: miniatura + título en lugar del ISBN crudo. */
.list-mix-item { display: flex; align-items: center; gap: 0.6rem; }
.list-mix-item__cover {
  flex: none;
  width: 30px;
  height: 42px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--theme-bg);
}
.list-mix-item__cover--ph { display: inline-flex; align-items: center; justify-content: center; font-size: 1rem; }
.list-mix-group__items .list-mix-item__title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--theme-ink);
  font-weight: 500;
}
.list-mix-group__items .list-mix-item__title:hover { color: var(--theme-accent); }
.list-mix-item__price { flex: none; font-family: var(--theme-font-mono); font-weight: 600; color: var(--theme-ink); }
.list-mix-group__items .list-mix-item__buy {
  flex: none;
  padding: 0.35rem 0.8rem;
  border-radius: var(--ui-radius-pill, 999px);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font-size: 0.82rem;
  font-weight: 700;
}
.list-mix-group__items .list-mix-item__buy:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }

/* Campo opcional "nombre de la lista" en /comparar. */
.compare-form__name {
  display: block;
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font: inherit;
  font-size: 0.95rem;
}
.compare-form__name:focus { outline: 2px solid color-mix(in srgb, var(--theme-accent) 45%, transparent); outline-offset: 1px; border-color: var(--theme-accent); }

/* Hueco para que la buybar fija no tape el final de la lista en móvil. */
@media (max-width: 719px) {
  .list-detail { padding-bottom: 4.5rem; }
}

/* ---- Editar lista: añadir libro, quitar, y "los añadiremos pronto". ----- */
.list-add {
  margin: 0 0 1.5rem;
  padding: 0.9rem 1.1rem;
  border: 1px dashed var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-bg);
}
.list-add__label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
.list-add__row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.list-add__input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font: inherit;
}
.list-add__input:focus { outline: 2px solid color-mix(in srgb, var(--theme-accent) 45%, transparent); outline-offset: 1px; border-color: var(--theme-accent); }
.list-add__submit {
  flex: none;
  padding: 0.6rem 1.3rem;
  border: 0;
  border-radius: var(--ui-radius-pill, 999px);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.list-add__submit:hover { filter: brightness(0.93); }

/* Botón quitar (esquina del item; el item es un grid, así que va absoluto). */
.list-item { position: relative; }
.list-item__title { padding-right: 1.6rem; }
.list-item__remove { position: absolute; top: 0.4rem; right: 0.4rem; margin: 0; }
.list-item__remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0;
  border: 1px solid var(--theme-border);
  border-radius: 50%;
  background: var(--theme-surface);
  color: var(--theme-ink-muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.list-item__remove-btn:hover { border-color: #d23; color: #d23; background: color-mix(in srgb, #d23 8%, #fff); }

.list-contents { margin: 1.25rem 0; }
.list-contents__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 0.6rem;
}
.list-contents__title { font-size: 1.05rem; margin: 0; }
.list-contents__clear { margin: 0; }
.list-contents__clear-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--ui-radius-pill);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-ink-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.list-contents__clear-btn:hover {
  border-color: #d23b3b;
  color: #d23b3b;
  background: #fdf1f1;
}
.list-contents__clear-btn svg { width: 0.95rem; height: 0.95rem; }
.list-contents__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.list-contents__item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
}
.list-contents__cover { width: 36px; height: 50px; object-fit: cover; border-radius: 3px; flex: none; }
.list-contents__cover--ph { display: inline-flex; align-items: center; justify-content: center; background: var(--theme-accent-soft); font-size: 1.1rem; }
.list-contents__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.list-contents__name { color: var(--theme-ink); font-size: 0.92rem; font-weight: 600; }
.list-contents__name:hover { color: var(--theme-accent); text-decoration: none; }
.list-contents__isbn {
  align-self: flex-start;
  padding: 0.12rem 0.5rem;
  border-radius: 5px;
  background: #f1f8fc;
  color: var(--theme-ink-soft);
  font-weight: 700;
  font-size: 0.82rem;
  font-family: var(--theme-font-mono);
  letter-spacing: 0.04em;
}
.list-contents__remove { flex: none; margin: 0; }

.list-missing { margin-top: 1.5rem; }
.list-missing__lead { color: var(--theme-ink-muted); font-size: 0.9rem; margin: 0 0 0.75rem; }
.list-missing__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.list-missing__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--theme-border);
  border-radius: var(--theme-radius);
}
.list-missing__item form { margin: 0; }
.list-missing__isbn { font-family: var(--theme-font-mono); font-size: 0.88rem; }

.list-buys__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.list-buy-card {
  flex: 1 1 240px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  padding: 1rem 1.1rem;
  background: var(--theme-bg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.list-buy-card--best {
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent) 12%, transparent);
}
.list-buy-card--cdl { border-style: dashed; }
/* La opción "comprar todo de una vez" destaca: la librería más barata ocupa
   todo el ancho como tarjeta-héroe; el resto fluyen en la rejilla debajo. */
.list-buys__grid .list-buy-card--best {
  flex-basis: 100%;
  background: color-mix(in srgb, var(--theme-accent) 6%, var(--theme-surface));
}
.list-buys__grid .list-buy-card--best .list-buy-card__total dd { font-size: 1.4rem; }
.list-buys__grid .list-buy-card--best .list-buy-card__cta { padding: 0.8rem 1.2rem; font-size: 1rem; }
.list-buy-card__head { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.list-buy-card__swatch { display: inline-block; width: 0.85rem; height: 0.85rem; border-radius: 3px; }
.list-buy-card__logo { width: 22px; height: 22px; object-fit: contain; flex: none; border-radius: 4px; }
.list-buy-card__merchant { font-weight: 600; }
.list-buy-card__badge {
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.list-buy-card__stats { margin: 0; display: grid; gap: 0.35rem 0.75rem; grid-template-columns: 1fr 1fr; }
.list-buy-card__stats > div { display: flex; flex-direction: column; }
.list-buy-card__stats dt {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-ink-muted);
  margin: 0;
}
.list-buy-card__stats dd { margin: 0; font-weight: 600; font-family: var(--theme-font-mono); }
.list-buy-card__total dd { color: var(--theme-accent); font-size: 1.15rem; }
.list-buy-card__cta {
  display: inline-block;
  padding: 0.55rem 0.95rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  border-radius: var(--theme-radius);
  font-weight: 600;
  font-size: 0.9rem;
  text-align: center;
}
.list-buy-card__cta:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }
.list-buy-card__missing { font-size: 0.85rem; color: var(--theme-ink-muted); }
.list-buy-card__missing summary { cursor: pointer; }
.list-buy-card__missing ul { margin: 0.4rem 0 0; padding-left: 1.25rem; }

/* Librerías sin cesta multi-ítem (Awin): el CTA es un <summary> que despliega
   los N libros, cada uno con su enlace afiliado. CSP-safe (sin JS). */
.list-buy-card__shop, .list-cdl-highlight__shop { display: flex; flex-direction: column; gap: 0.6rem; }
.list-buy-card__cta--shop { cursor: pointer; list-style: none; }
.list-buy-card__cta--shop::-webkit-details-marker { display: none; }
.list-cdl-highlight__shop > summary.list-cdl-highlight__cta { cursor: pointer; list-style: none; }
.list-cdl-highlight__shop > summary.list-cdl-highlight__cta::-webkit-details-marker { display: none; }
.list-buy-card__shop-note, .list-cdl-highlight__shop-note {
  font-size: 0.82rem;
  color: var(--theme-ink-muted);
  margin: 0;
}
.list-buy-card__items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.list-buy-card__item { display: flex; align-items: center; gap: 0.6rem; font-size: 0.9rem; }
.list-buy-card__item-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--theme-ink);
  font-weight: 500;
}
.list-buy-card__item-title:hover { color: var(--theme-accent); }
.list-buy-card__item-price { flex: none; font-family: var(--theme-font-mono); font-weight: 600; color: var(--theme-ink); }
.list-buy-card__item-buy {
  flex: none;
  padding: 0.35rem 0.8rem;
  border-radius: var(--ui-radius-pill, 999px);
  background: var(--theme-accent);
  color: var(--theme-surface);
  font-size: 0.82rem;
  font-weight: 700;
}
.list-buy-card__item-buy:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }

.list-matrix__scroll { overflow-x: auto; }
.list-matrix__table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.list-matrix__table th, .list-matrix__table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--theme-border);
  text-align: left;
}
.list-matrix__table thead th {
  background: var(--theme-bg);
  color: var(--theme-ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.list-matrix__cell { font-family: var(--theme-font-mono); }
.list-matrix__cell--empty { color: var(--theme-ink-muted); }
.list-matrix__book { font-weight: 500; }

.list-items__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.list-item {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 80px 1fr;
  padding: 0.85rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-bg);
}
.list-item--pending { opacity: 0.7; }
.list-item__cover {
  width: 80px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  background: var(--theme-surface-alt);
}
.list-item__cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  color: var(--theme-ink-muted);
}
.list-item__title { margin: 0 0 0.2rem; font-size: 0.98rem; }
.list-item__authors, .list-item__isbn { margin: 0; color: var(--theme-ink-muted); font-size: 0.82rem; }
.list-item__offers { list-style: none; margin: 0.5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.list-item__offer { display: flex; gap: 0.5rem; align-items: center; font-size: 0.85rem; }
.list-item__offer-merchant { color: var(--theme-ink-soft); }
.list-item__offer-price { font-family: var(--theme-font-mono); font-weight: 600; margin-left: auto; }
.list-item__offer-link { color: var(--theme-accent); font-size: 0.82rem; }
.list-item__empty { color: var(--theme-ink-muted); font-size: 0.85rem; margin: 0.4rem 0 0; }

/* ------------------------- Best price card (ISBN) ----------------------- */

.best-price-card {
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-accent);
  border-radius: var(--theme-radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--theme-accent) 10%, transparent);
}
.best-price-card__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-ink-muted);
}
.best-price-card__price {
  font-family: var(--theme-font-mono);
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--theme-accent);
  margin: 0;
}
.best-price-card__merchant { color: var(--theme-ink-soft); font-size: 0.95rem; margin: 0; }
.best-price-card__savings {
  margin: 0;
  font-size: 0.88rem;
  color: color-mix(in srgb, var(--theme-success) 78%, #000 22%);
  font-weight: 600;
}
.best-price-card__savings strong { font-weight: 800; }
.best-price-card__cta {
  margin-top: 0.5rem;
  padding: 0.7rem 1rem;
  background: var(--theme-accent);
  color: var(--theme-surface);
  text-align: center;
  border-radius: var(--theme-radius);
  font-weight: 600;
}
.best-price-card__cta:hover { filter: brightness(0.93); color: var(--theme-surface); text-decoration: none; }
.best-price-card__foot { margin: 0; text-align: center; font-size: 0.82rem; }
.best-price-card__foot a { color: var(--theme-ink-soft); }
.best-price-card__foot a:hover { color: var(--theme-accent); }
.best-price-card--empty { border-color: var(--theme-border); box-shadow: none; }
.best-price-card--empty .best-price-card__merchant { color: var(--theme-ink-muted); }

/* =========================================================================
   CAPA UI "PRO" — componentes reutilizables (eyebrow, section-head, botones
   pill, chips, banda de estadísticas, hero-pill, landing del comparador).
   Inspirada en el directorio de gasolineras pero construida sobre los tokens
   `--theme-*` del proyecto. Es transversal a todos los presets; la capa
   `body.theme-planeta` de más abajo la refina para el look azul por defecto.
   ========================================================================= */

/* Eyebrow: etiqueta superior en mayúsculas con tracking amplio. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--theme-font-body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--theme-accent);
}

/* Section head: eyebrow + título + (opcional) descripción + CTA a la derecha. */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 0 0 1.5rem;
}
.section-head__text { min-width: 0; }
.section-head__title {
  font-family: var(--theme-font-heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0.35rem 0 0;
  color: var(--theme-ink);
}
.section-head__title em { font-style: normal; color: var(--theme-accent); }
.section-head__desc {
  margin: 0.6rem 0 0;
  color: var(--theme-ink-soft);
  font-size: 0.98rem;
  max-width: 42rem;
  line-height: 1.55;
}
.section-head--center { justify-content: center; text-align: center; }
.section-head--center .section-head__text { display: flex; flex-direction: column; align-items: center; }
.section-head--center .section-head__desc { margin-inline: auto; }

/* Botones pill (estilo directorio). */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.72rem 1.4rem;
  border-radius: var(--ui-radius-pill);
  font-family: var(--theme-font-body);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-pill svg { width: 1.05em; height: 1.05em; }
.btn-pill--accent {
  background: var(--theme-accent);
  color: #fff;
  box-shadow: var(--ui-shadow-accent);
}
.btn-pill--accent:hover,
.btn-pill--accent:focus {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--theme-accent) 38%, transparent);
}
.btn-pill--outline {
  background: var(--theme-surface);
  color: var(--theme-ink);
  border-color: var(--theme-border);
  box-shadow: var(--ui-shadow-sm);
}
.btn-pill--outline:hover,
.btn-pill--outline:focus {
  color: var(--theme-accent);
  border-color: var(--theme-accent);
  text-decoration: none;
  transform: translateY(-1px);
}
.btn-pill--ghost-light {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
  backdrop-filter: blur(4px);
}
.btn-pill--ghost-light:hover,
.btn-pill--ghost-light:focus {
  background: rgba(255, 255, 255, 0.26);
  color: #fff;
  text-decoration: none;
}

/* Chips / pills informativas pequeñas. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--ui-radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--theme-surface-alt);
  color: var(--theme-ink-soft);
  border: 1px solid var(--theme-border);
}
.chip--accent { background: var(--theme-accent-soft); color: var(--theme-accent); border-color: transparent; }
.chip--success { background: color-mix(in srgb, var(--theme-success) 14%, #fff); color: var(--theme-success); border-color: transparent; }

/* Banda oscura de estadísticas (números clave) — equivalente al "averages
   strip" del directorio. */
.stats-band {
  position: relative;
  overflow: hidden;
  background: var(--theme-ink);
  color: #fff;
  border-radius: var(--ui-radius-xl);
  padding: 1.6rem 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.25rem;
}
.stats-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}
.stats-band__item { position: relative; display: flex; flex-direction: column; gap: 0.25rem; }
.stats-band__value {
  font-family: var(--theme-font-heading);
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.stats-band__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}
.stats-band__meta { font-size: 0.78rem; color: rgba(255, 255, 255, 0.5); }

/* =========================================================================
   COMPARADOR DE LISTA — landing `/comparar`.
   El textarea es el protagonista: hero amplio, tarjeta blanca elevada.
   ========================================================================= */
.compare-landing {
  margin: 0;
}
.compare-landing__eyebrow {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}
.compare-landing__title {
  font-family: var(--theme-font-heading);
  font-weight: 600;
  font-size: clamp(1.8rem, 4.5vw, 2.9rem);
  line-height: 1.06;
  letter-spacing: -0.025em;
  margin: 0 0 0.6rem;
  text-align: center;
}
.compare-landing__lead {
  text-align: center;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--theme-ink-soft);
  max-width: 46rem;
  margin: 0 auto 1.75rem;
}
.compare-landing__error {
  max-width: 44rem;
  margin: 0 auto 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--ui-radius-md);
  background: color-mix(in srgb, var(--theme-danger) 10%, #fff);
  border: 1px solid color-mix(in srgb, var(--theme-danger) 35%, transparent);
  color: var(--theme-danger);
  font-weight: 600;
  text-align: center;
}
.compare-card {
  max-width: 48rem;
  margin: 0 auto;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-xl);
  box-shadow: var(--ui-shadow-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
}
.compare-card__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  color: var(--theme-ink-muted);
}
.compare-card__steps li { display: inline-flex; align-items: center; gap: 0.4rem; }
.compare-card__steps b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  font-size: 0.75rem;
  font-weight: 800;
}
.compare-form { display: flex; flex-direction: column; gap: 0.9rem; }
.compare-form__label {
  font-size: 0.92rem;
  color: var(--theme-ink-soft);
  line-height: 1.5;
}
.compare-form__textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  padding: 1rem 1.1rem;
  border: 1.5px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
  background: var(--theme-bg);
  color: var(--theme-ink);
  font-family: var(--theme-font-mono);
  font-size: 0.98rem;
  line-height: 1.7;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.compare-form__textarea::placeholder { color: var(--theme-ink-muted); }
.compare-form__textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 4px var(--ui-accent-ring);
}
.compare-form__submit {
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.95rem 1.6rem;
  border: 0;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-accent);
  color: #fff;
  font-family: var(--theme-font-body);
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: var(--ui-shadow-accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.compare-form__submit-icon { width: 1.2rem; height: 1.2rem; flex-shrink: 0; }
.compare-form__submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 38px color-mix(in srgb, var(--theme-accent) 38%, transparent);
}
.compare-landing__alt {
  text-align: center;
  margin: 1.5rem auto 0;
  color: var(--theme-ink-soft);
  font-size: 0.95rem;
}

/* Tira de confianza / "trust" debajo de un hero o landing. */
.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.4rem;
  margin: 1.5rem auto 0;
  padding: 0;
  list-style: none;
  max-width: 52rem;
}
.trust-row li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--theme-ink-soft);
  font-weight: 600;
}
.trust-row svg { width: 1.05rem; height: 1.05rem; color: var(--theme-accent); flex-shrink: 0; }

/* =========================================================================
   Página "Cómo funciona" (/como-funciona): hero centrado + 4 pasos + CTA.
   ========================================================================= */
/* Botón blanco para usar sobre fondos de marca (hero/CTA azules). */
.btn-pill--light {
  background: #fff;
  color: var(--theme-accent);
  box-shadow: 0 10px 28px rgba(8, 30, 60, 0.22);
}
.btn-pill--light:hover,
.btn-pill--light:focus {
  color: var(--theme-accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(8, 30, 60, 0.28);
}

/* Hero con degradado de marca (mismo lenguaje que el hero de la home). */
.howto-hero {
  text-align: center;
  margin-top: 0.5rem;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.25rem, 4vw, 2.5rem);
  background: var(--pl-hero, linear-gradient(135deg, #1f97d6 0%, #1488c8 52%, #0e6fa8 100%));
  border-radius: var(--ui-radius-xl);
  color: #fff;
  box-shadow: var(--ui-shadow);
}
.howto-hero__eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  padding: 0.32rem 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
}
.howto-hero__title {
  font-family: var(--theme-font-heading);
  font-weight: 600;
  font-size: clamp(1.8rem, 4.5vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 1rem auto 0.9rem;
  max-width: 22ch;
  color: #fff;
}
.howto-hero__lead {
  font-size: clamp(1.02rem, 1.7vw, 1.18rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  margin: 0 auto;
  max-width: 44rem;
}
.howto-hero__actions { margin-top: 1.6rem; }

.howto-steps {
  list-style: none;
  margin: clamp(2rem, 5vw, 3.25rem) 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) { .howto-steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .howto-steps { grid-template-columns: 1fr; } }
.howto-step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 2rem 1.35rem 1.5rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-xl);
  box-shadow: var(--ui-shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.howto-step:hover {
  transform: translateY(-3px);
  box-shadow: var(--ui-shadow);
  border-color: color-mix(in srgb, var(--theme-accent) 30%, var(--theme-border));
}
.howto-step__num {
  position: absolute;
  top: -0.9rem;
  left: 1.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--theme-accent);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: var(--ui-shadow-accent);
}
.howto-step__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: var(--ui-radius-lg);
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  margin-top: 0.35rem;
}
.howto-step__icon svg { width: 1.7rem; height: 1.7rem; }
.howto-step__title {
  font-family: var(--theme-font-heading);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0.3rem 0 0;
  color: var(--theme-ink);
}
.howto-step__body {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--theme-ink-soft);
}

.howto-benefits {
  list-style: none;
  margin: clamp(2rem, 5vw, 3rem) 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 760px) { .howto-benefits { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .howto-benefits { grid-template-columns: 1fr; } }
.howto-benefit {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 1rem 1.1rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
}
.howto-benefit svg {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  color: var(--theme-accent);
  margin-top: 0.1rem;
}
.howto-benefit span { display: flex; flex-direction: column; font-size: 0.85rem; line-height: 1.4; color: var(--theme-ink-soft); }
.howto-benefit strong { color: var(--theme-ink); font-size: 0.95rem; margin-bottom: 0.1rem; }

.howto-cta {
  text-align: center;
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem);
  background: var(--pl-hero, linear-gradient(135deg, #1f97d6 0%, #1488c8 52%, #0e6fa8 100%));
  border-radius: var(--ui-radius-xl);
  color: #fff;
  box-shadow: var(--ui-shadow);
}
.howto-cta__title {
  font-family: var(--theme-font-heading);
  font-weight: 800;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.2;
  margin: 0 0 0.7rem;
  color: #fff;
}
.howto-cta__lead {
  margin: 0 auto 1.4rem;
  max-width: 38rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.92);
}
.howto-cta__note {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
}

/* =========================================================================
   HOME — bloque destacado del comparador de lista (función estrella) y
   variantes visuales de la home.
   ========================================================================= */
.home-compare {
  position: relative;
  overflow: hidden;
  margin: 2.5rem 0;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  border-radius: var(--ui-radius-xl);
  background: var(--theme-ink);
  color: #fff;
  display: grid;
  gap: 1.5rem 2.5rem;
  grid-template-columns: 1fr;
  align-items: center;
}
@media (min-width: 860px) {
  .home-compare { grid-template-columns: 1.1fr 0.9fr; }
}
.home-compare::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
.home-compare__body { position: relative; }
.home-compare__eyebrow { color: #fff; opacity: 0.85; }
.home-compare__title {
  font-family: var(--theme-font-heading);
  font-weight: 800;
  font-size: clamp(1.55rem, 3vw, 2.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.6rem;
  color: #fff;
}
.home-compare__title em {
  font-style: normal;
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.5);
  text-underline-offset: 5px;
  text-decoration-thickness: 3px;
}
.home-compare__lead {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 32rem;
}
.home-compare__actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.home-compare__visual {
  position: relative;
  background: var(--theme-surface);
  color: var(--theme-ink);
  border-radius: var(--ui-radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--ui-shadow-lg);
}
.home-compare__visual-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--theme-ink-muted);
}
.home-compare__dot { width: 0.6rem; height: 0.6rem; border-radius: 999px; background: var(--theme-accent); }
.home-compare__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--theme-border);
  font-size: 0.92rem;
}
.home-compare__line:last-child { border-bottom: 0; }
.home-compare__isbn { font-family: var(--theme-font-mono); color: var(--theme-ink-soft); }
.home-compare__price { font-family: var(--theme-font-mono); font-weight: 700; color: var(--theme-accent); }
.home-compare__best {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 2px solid var(--theme-border);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.home-compare__best-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--theme-ink-muted); }
.home-compare__best-value { font-family: var(--theme-font-mono); font-weight: 800; font-size: 1.4rem; color: var(--theme-ink); letter-spacing: -0.02em; }

/* =========================================================================
   HOME — hero "comparador": el comparador completo (pestañas + textarea) como
   protagonista del hero. Reutiliza .compare-card y el componente .ctabs__*
   (con ids `hmode-*`). Transversal a todos los presets; planeta lo refina.
   ========================================================================= */
.hero--compare { text-align: center; }
.hero__head { margin: 0 0 1.6rem; }
.hero__head .hero__title { margin-bottom: 0.6rem; }
.hero__head .hero__lead { margin-bottom: 0; }

/* La tarjeta blanca del comparador centrada dentro del hero. */
.hero-compare-card {
  max-width: 44rem;
  text-align: left;
}
.hero-compare-card__pretitle {
  margin: 0 0 0.7rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--theme-ink-muted);
}

/* Explicación plegable "¿No sabes qué es el ISBN?" (sin JS). */
/* "¿Qué es el ISBN?" — modal CSS-only (checkbox-hack, sin JS por la CSP).
   El checkbox oculto controla la visibilidad del overlay vía `:checked ~`. */
.isbn-help__toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}
.isbn-help__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
  width: fit-content;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--theme-accent);
}
.isbn-help__link-icon { width: 1.05rem; height: 1.05rem; flex-shrink: 0; }
.isbn-help__link:hover { text-decoration: underline; }
.isbn-help__overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.isbn-help__toggle:checked ~ .isbn-help__overlay { display: flex; }
.isbn-help__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(8, 30, 60, 0.55);
  cursor: pointer;
}
.isbn-help__dialog {
  position: relative;
  width: min(30rem, 100%);
  padding: 1.7rem 1.5rem 1.5rem;
  background: var(--theme-surface);
  border-radius: var(--ui-radius-md);
  box-shadow: var(--ui-shadow-lg);
  animation: isbn-help-in 0.16s ease-out;
}
@keyframes isbn-help-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.isbn-help__close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: var(--theme-ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.isbn-help__close svg { width: 1.1rem; height: 1.1rem; }
.isbn-help__close:hover { background: var(--theme-surface-alt); color: var(--theme-ink); }
.isbn-help__title {
  margin: 0 1.8rem 0.55rem 0;
  font-family: var(--theme-font-heading);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--theme-ink);
}
.isbn-help__text {
  margin: 0;
  color: var(--theme-ink-soft);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* =========================================================================
   Tema "Planeta" — look inspirado en planetadelibros.com: blanco, Montserrat,
   azul editorial (#1488c8), footer azul marino, bandas azules a sangre,
   tarjetas limpias centradas en la portada. Capa ADITIVA scopeada a
   `body.theme-planeta`: no afecta a los presets cuaderno/ticker/patio.
   ========================================================================= */
body.theme-planeta {
  --pl-navy: #16284b;
  --pl-navy-2: #20335c;
  --pl-accent-strong: #0e6fa8;
  --pl-hero: linear-gradient(135deg, #1f97d6 0%, #1488c8 52%, #0e6fa8 100%);
  background: #ffffff;
  overflow-x: clip;
  font-weight: 400;
}
body.theme-planeta h1, body.theme-planeta h2, body.theme-planeta h3 { letter-spacing: -0.02em; }

/* Header limpio y blanco con marca azul */
body.theme-planeta .site-header { backdrop-filter: none; box-shadow: 0 1px 0 var(--theme-border); }
body.theme-planeta .site-header__logo { background: var(--theme-accent); color: #fff; border-radius: 6px; }
body.theme-planeta .site-header__name { color: var(--theme-accent); font-weight: 800; }
body.theme-planeta .site-header__nav a { font-weight: 600; color: var(--theme-ink); }
body.theme-planeta .site-header__nav a:hover { color: var(--theme-accent); }

/* Hero: banda azul a sangre con buscador blanco tipo "pill" */
body.theme-planeta .hero {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-top: calc(-1 * var(--pad-lg));
  padding: clamp(2.75rem, 6.5vw, 4.75rem) 1rem clamp(2.25rem, 5vw, 3.5rem);
  background: var(--pl-hero);
  color: #fff;
}
body.theme-planeta .hero::before { display: none; }
body.theme-planeta .hero__eyebrow { background: rgba(255, 255, 255, 0.18); color: #fff; }
body.theme-planeta .hero__title { color: #fff; font-weight: 600; }
body.theme-planeta .hero__title strong {
  color: #fff;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.55);
  text-underline-offset: 5px;
  text-decoration-thickness: 3px;
}
body.theme-planeta .hero__lead { color: rgba(255, 255, 255, 0.93); }
body.theme-planeta .hero__search {
  background: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.4rem 0.4rem 0.65rem;
  box-shadow: 0 16px 38px rgba(8, 30, 60, 0.30);
}
body.theme-planeta .hero__search button { border-radius: 999px; background: var(--theme-accent); }
body.theme-planeta .hero__search button:hover { background: var(--pl-accent-strong); filter: none; }
body.theme-planeta .hero__hint { color: rgba(255, 255, 255, 0.92); }
body.theme-planeta .hero__hint a { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.6); }

/* Títulos de sección centrados y en negrita (estilo Planeta) */
body.theme-planeta .features__title,
body.theme-planeta .how-it-works h2,
body.theme-planeta .collection__title,
body.theme-planeta .section-title {
  text-align: center;
  font-weight: 600;
  color: var(--theme-ink);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
}

/* Tarjetas de "por qué usarnos" limpias */
body.theme-planeta .features__item {
  border: 1px solid var(--theme-border);
  border-radius: 10px;
  box-shadow: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}
body.theme-planeta .features__item:hover {
  border-color: var(--theme-accent);
  box-shadow: 0 10px 26px rgba(17, 34, 68, 0.10);
  transform: translateY(-2px);
}
body.theme-planeta .features__icon { background: var(--theme-accent-soft); color: var(--theme-accent); }
body.theme-planeta .how-it-works__num { background: var(--theme-accent); color: #fff; }

/* Tarjetas de libro: limpias, foco en la portada */
body.theme-planeta .book-card { border: 1px solid var(--theme-border); border-radius: 8px; box-shadow: none; }
body.theme-planeta .book-card:hover { box-shadow: 0 12px 28px rgba(17, 34, 68, 0.12); border-color: #cdd6e0; }
body.theme-planeta .book-card__price strong { font-family: var(--theme-font-body); font-weight: 700; }

/* Footer azul marino con columnas (estilo Planeta) */
body.theme-planeta .site-footer {
  background: var(--pl-navy);
  border-top: 0;
  color: rgba(255, 255, 255, 0.80);
  margin-top: 3rem;
  padding-top: 0.5rem;
}
body.theme-planeta .site-footer__inner {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  gap: 1.75rem 2rem;
  align-items: start;
  padding-top: 2.75rem;
  padding-bottom: 1.75rem;
}
body.theme-planeta .site-footer__logo {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
body.theme-planeta .site-footer__brand { color: #fff; font-weight: 800; font-size: 1.15rem; }
body.theme-planeta .site-footer__tagline { color: rgba(255, 255, 255, 0.7); max-width: 320px; }
body.theme-planeta .site-footer__compare { color: rgba(255, 255, 255, 0.46); max-width: 320px; }
body.theme-planeta .site-footer__col { display: flex; flex-direction: column; gap: 0.55rem; }
body.theme-planeta .site-footer__heading {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #7fb4dd;
}
body.theme-planeta .site-footer__col a { color: rgba(255, 255, 255, 0.82); font-size: 0.92rem; }
body.theme-planeta .site-footer__col a:hover { color: #fff; text-decoration: none; }
body.theme-planeta .site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1.2rem 1rem 1.7rem;
}
body.theme-planeta .site-footer__meta { color: rgba(255, 255, 255, 0.52); }
body.theme-planeta .site-footer__made { color: rgba(255, 255, 255, 0.52); }
@media (max-width: 859px) {
  body.theme-planeta .site-footer__inner { grid-template-columns: 1fr 1fr; }
  body.theme-planeta .site-footer__brandcol { grid-column: 1 / -1; }
}
@media (max-width: 460px) {
  body.theme-planeta .site-footer__inner { grid-template-columns: 1fr; }
}

/* =========================================================================
   PLANETA · refinamiento "pro" (rediseño 2026).
   Eleva el preset azul al nivel del directorio de gasolineras: lavado de
   color superior, hero potente con buscador protagonista, header pulido,
   tarjetas con sombras en capas, landing del comparador y home destacando
   la función estrella (pegar la lista de ISBN).
   ========================================================================= */

/* Lavado de color superior + textura de puntos, a sangre y sutil. Imita el
   `body::before` del directorio para dar profundidad al hero sin recargar. */
body.theme-planeta { position: relative; }
body.theme-planeta::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 560px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(20, 136, 200, 0.08) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(180deg, #eef6fc 0%, rgba(238, 246, 252, 0) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
body.theme-planeta main.container,
body.theme-planeta .site-footer { position: relative; z-index: 1; }

/* ---- Header pulido: blanco translúcido, marca con icono en degradado,
   navegación con realce y CTA "Comparar lista" destacado. */
body.theme-planeta .site-header {
  /* Sticky en todas las anchuras: por encima del hero a sangre (que vive en
     main.container con z-index:1), tanto en desktop como en móvil. */
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 1px 0 var(--theme-border);
}
body.theme-planeta .site-header__inner { gap: 1.1rem; }
body.theme-planeta .site-header__logo {
  background: linear-gradient(135deg, #1f97d6 0%, var(--theme-accent) 55%, var(--pl-accent-strong) 100%);
  color: #fff;
  border-radius: 9px;
  box-shadow: 0 4px 12px rgba(20, 136, 200, 0.32);
}
body.theme-planeta .site-header__name { font-weight: 800; letter-spacing: -0.02em; color: var(--theme-ink); }
body.theme-planeta .site-header__nav { gap: 0.25rem; }
body.theme-planeta .site-header__nav a {
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--theme-ink-soft);
  transition: color 0.14s ease, background-color 0.14s ease;
}
body.theme-planeta .site-header__nav a:hover { background: var(--theme-accent-soft); color: var(--theme-accent); text-decoration: none; }

/* CTA destacado del header (Comparar lista) — pill de acento con sombra. */
body.theme-planeta .site-header__cta {
  border-radius: var(--ui-radius-pill);
  padding: 0.55rem 1.1rem;
  font-weight: 700;
  box-shadow: var(--ui-shadow-accent);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
body.theme-planeta .site-header__cta:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  background: var(--pl-accent-strong);
  filter: none;
}

/* ---- Hero protagonista: banda azul a sangre, titular grande, buscador
   pill ancho y elevado, botones secundarios y tira de confianza. */
body.theme-planeta .hero {
  padding: clamp(3rem, 7vw, 5.25rem) 1rem clamp(2.5rem, 5vw, 3.75rem);
  overflow: hidden;
}
body.theme-planeta .hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}
body.theme-planeta .hero > * { position: relative; z-index: 1; }
body.theme-planeta .hero__eyebrow {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0.32rem 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  backdrop-filter: blur(4px);
}
body.theme-planeta .hero__title {
  font-size: clamp(2.1rem, 5.6vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 1.1rem;
}
body.theme-planeta .hero__lead {
  font-size: clamp(1.02rem, 1.7vw, 1.25rem);
  color: rgba(255, 255, 255, 0.94);
  max-width: 40rem;
  margin-bottom: 2rem;
}

/* Buscador del hero: pill blanco grande con icono de lupa. */
body.theme-planeta .hero__search {
  max-width: 720px;
  padding: 0.5rem 0.5rem 0.5rem 1.25rem;
  border-radius: var(--ui-radius-pill);
  box-shadow: 0 22px 50px rgba(8, 30, 60, 0.28), 0 4px 14px rgba(8, 30, 60, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  align-items: center;
  gap: 0.4rem;
}
body.theme-planeta .hero__search::before {
  content: "";
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: var(--theme-ink-muted);
  -webkit-mask: var(--ui-search-icon) center / contain no-repeat;
  mask: var(--ui-search-icon) center / contain no-repeat;
}
body.theme-planeta .hero__search input {
  font-size: 1.08rem;
  padding: 0.95rem 0.5rem;
}
body.theme-planeta .hero__search button {
  padding: 0.95rem 1.85rem;
  border-radius: var(--ui-radius-pill);
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
}
body.theme-planeta .hero__search button:hover { background: var(--pl-accent-strong); filter: none; }

/* Acciones secundarias bajo el buscador del hero. */
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin: 1.5rem auto 0;
}
body.theme-planeta .hero__hint { margin-top: 1.4rem; }

/* La tira de confianza dentro del hero azul: texto e iconos en blanco. */
body.theme-planeta .hero .trust-row li {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0.45rem 0.95rem;
  border-radius: var(--ui-radius-pill);
  backdrop-filter: blur(4px);
}
body.theme-planeta .hero .trust-row svg { color: #fff; }

/* ---- Hero "comparador" (home): tarjeta blanca del comparador sobre la banda
   azul. La tarjeta hereda la sombra fuerte de `.compare-card` en planeta. */
body.theme-planeta .hero--compare .hero__title {
  font-size: clamp(1.9rem, 4.8vw, 3.1rem);
  margin-bottom: 0.7rem;
}
body.theme-planeta .hero--compare .hero__lead {
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  margin-bottom: 0;
}
body.theme-planeta .hero-compare-card {
  box-shadow: 0 30px 60px rgba(8, 30, 60, 0.30), var(--ui-shadow-md);
}
body.theme-planeta .hero-compare-card .compare-form__submit:hover { background: var(--pl-accent-strong); }

/* Tarjetas de libro un punto más suaves y con elevación al hover. */
body.theme-planeta .book-card { border-radius: 12px; box-shadow: var(--ui-shadow-sm); }
body.theme-planeta .book-card:hover {
  box-shadow: var(--ui-shadow-md);
  border-color: var(--ui-accent-tint);
  transform: translateY(-3px);
}
body.theme-planeta .book-card__price strong { color: var(--theme-accent); }

/* "Por qué usarnos": iconos en círculo de acento, tarjetas limpias. */
body.theme-planeta .features { padding-top: 2.5rem; }
body.theme-planeta .features__item { border-radius: 14px; padding: 1.4rem 1.35rem 1.5rem; }
body.theme-planeta .features__icon {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 11px;
  font-size: 1.25rem;
}

/* "Cómo funciona": números en círculo de acento, tarjeta envolvente suave. */
body.theme-planeta .how-it-works {
  border-radius: var(--ui-radius-xl);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: var(--ui-shadow-sm);
  text-align: center;
}
body.theme-planeta .how-it-works > .eyebrow { justify-content: center; margin-bottom: 0.4rem; }
body.theme-planeta .how-it-works__steps { text-align: left; margin-top: 1.5rem; }
body.theme-planeta .how-it-works__num {
  background: linear-gradient(135deg, #1f97d6 0%, var(--theme-accent) 60%, var(--pl-accent-strong) 100%);
  box-shadow: 0 6px 14px rgba(20, 136, 200, 0.28);
}

/* ---- Bloque destacado del comparador de lista en la home (función estrella).
   Ya tiene base transversal en .home-compare; aquí solo afinamos el azul. */
body.theme-planeta .home-compare {
  background: linear-gradient(135deg, var(--pl-navy) 0%, var(--pl-navy-2) 100%);
}
body.theme-planeta .home-compare__title em { text-decoration-color: rgba(127, 180, 221, 0.7); }
body.theme-planeta .home-compare .btn-pill--accent {
  background: #fff;
  color: var(--pl-navy);
  box-shadow: 0 12px 30px rgba(8, 30, 60, 0.3);
}
body.theme-planeta .home-compare .btn-pill--accent:hover { background: #eef6fc; color: var(--pl-navy); }

/* ---- Landing `/comparar`: hero azul a sangre + tarjeta del textarea
   superpuesta. El textarea es el protagonista. */
body.theme-planeta .compare-landing {
  position: relative;
}
body.theme-planeta .compare-landing::before {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  top: calc(-1 * var(--pad-lg));
  width: 100vw;
  height: 320px;
  z-index: 0;
  background: var(--pl-hero);
  -webkit-mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 62%, transparent 100%);
}
body.theme-planeta .compare-landing > * { position: relative; z-index: 1; }
body.theme-planeta .compare-landing__eyebrow { color: #fff; }
body.theme-planeta .compare-landing__title { color: #fff; padding-top: clamp(1rem, 3vw, 2rem); }
body.theme-planeta .compare-landing__lead { color: rgba(255, 255, 255, 0.95); }
body.theme-planeta .compare-card { box-shadow: 0 30px 60px rgba(8, 30, 60, 0.22), var(--ui-shadow-md); }
body.theme-planeta .compare-form__submit:hover { background: var(--pl-accent-strong); }

/* ---- Banda de estadísticas: en planeta usamos el navy editorial. */
body.theme-planeta .stats-band {
  background: linear-gradient(135deg, var(--pl-navy) 0%, var(--pl-navy-2) 100%);
}
body.theme-planeta .stats-band__value { color: #fff; }

/* ---- Página de ficha (ISBN): cabecera con sutil degradado y mejor
   jerarquía del bloque "mejor precio". */
body.theme-planeta .book-detail__header { border-radius: var(--ui-radius-xl); box-shadow: var(--ui-shadow-sm); }
body.theme-planeta .best-price-card {
  border-radius: var(--ui-radius-lg);
  background: linear-gradient(135deg, var(--theme-accent-soft) 0%, #fff 100%);
  box-shadow: var(--ui-shadow-md);
}
body.theme-planeta .best-price-card__cta { border-radius: var(--ui-radius-pill); padding: 0.8rem 1.1rem; font-weight: 700; }
body.theme-planeta .best-price-card__cta:hover { background: var(--pl-accent-strong); filter: none; }

/* ---- Comparativa de ofertas (ISBN): mejor "oferta ganadora". */
body.theme-planeta .offers,
body.theme-planeta .book-description,
body.theme-planeta .book-specs {
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}
body.theme-planeta .offer { border-radius: var(--ui-radius-md); }
body.theme-planeta .offer--best {
  box-shadow: 0 0 0 3px var(--ui-accent-ring), var(--ui-shadow-sm);
}
body.theme-planeta .offer__button { border-radius: var(--ui-radius-pill); font-weight: 700; }
body.theme-planeta .offer__button:hover { background: var(--pl-accent-strong); filter: none; }

/* ---- Cross-sell, related y buybar coherentes con el azul editorial. */
body.theme-planeta .cross-compare {
  border-radius: var(--ui-radius-lg);
  background: linear-gradient(135deg, var(--theme-accent-soft) 0%, #fff 70%);
  border-color: var(--ui-accent-tint);
}
body.theme-planeta .cross-compare__cta:hover { background: var(--pl-accent-strong); filter: none; }
body.theme-planeta .buybar__cta:hover { background: var(--pl-accent-strong); }

/* ---- Página de lista: tarjetas "comprar todo en X" más vendedoras. */
body.theme-planeta .list-detail__header,
body.theme-planeta .list-cdl-highlight,
body.theme-planeta .list-mix,
body.theme-planeta .list-buys,
body.theme-planeta .list-matrix,
body.theme-planeta .list-items {
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}
body.theme-planeta .list-cdl-highlight {
  background: linear-gradient(135deg, var(--theme-accent-soft) 0%, #fff 60%);
  border-color: var(--ui-accent-tint);
}
body.theme-planeta .list-cdl-highlight__cta,
body.theme-planeta .list-buy-card__cta {
  border-radius: var(--ui-radius-pill);
  font-weight: 700;
}
body.theme-planeta .list-cdl-highlight__cta:hover,
body.theme-planeta .list-buy-card__cta:hover { background: var(--pl-accent-strong); filter: none; }
body.theme-planeta .list-buy-card { border-radius: var(--ui-radius-md); }
body.theme-planeta .list-buy-card--best { box-shadow: 0 0 0 3px var(--ui-accent-ring), var(--ui-shadow-sm); }
body.theme-planeta .list-buy-card__cta--cart {
  background: linear-gradient(135deg, #1f97d6 0%, var(--theme-accent) 60%, var(--pl-accent-strong) 100%);
}

/* ---- Búsqueda: cabecera con pill de búsqueda y facetas más limpias. */
body.theme-planeta .search-header { border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm); }
body.theme-planeta .search-header__form {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-pill);
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  gap: 0.4rem;
}
body.theme-planeta .search-header__form:focus-within { border-color: var(--theme-accent); box-shadow: 0 0 0 3px var(--ui-accent-ring); }
body.theme-planeta .search-header__form input { border: 0; background: transparent; }
body.theme-planeta .search-header__form input:focus { outline: none; }
body.theme-planeta .search-header__form button { border-radius: var(--ui-radius-pill); font-weight: 700; }
body.theme-planeta .search-facets { border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm); }

/* ---- Responsive del hero/landing en móvil. */
@media (max-width: 640px) {
  body.theme-planeta .hero__search { padding: 0.4rem 0.4rem 0.4rem 1rem; }
  body.theme-planeta .hero__search input { font-size: 1rem; padding: 0.8rem 0.4rem; }
  body.theme-planeta .hero__search button { padding: 0.8rem 1.2rem; font-size: 0.98rem; }
  body.theme-planeta .hero__search::before { width: 18px; height: 18px; }
}

/* ---------------------------------------------------------------------------
   Pestañas ISBN/Título (CSS-only, sin JS por CSP) + fila de librerías
--------------------------------------------------------------------------- */
.ctabs__radio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  opacity: 0;
  pointer-events: none;
}
.ctabs__bar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.3rem;
  width: 100%;
  margin: 0 0 1.3rem;
  padding: 0.34rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-pill);
}
.ctabs__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.62rem 0.4rem;
  border-radius: var(--ui-radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--theme-ink-soft);
  cursor: pointer;
  user-select: none;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.ctabs__tab-icon { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.ctabs__tab:hover { color: var(--theme-accent); background: var(--theme-accent-soft); }
@media (max-width: 480px) {
  .ctabs__tab { font-size: 0.82rem; gap: 0.3rem; padding: 0.58rem 0.25rem; }
  .ctabs__tab-icon { width: 1rem; height: 1rem; }
}
.ctabs__panel { display: none; }
#cmode-isbn:checked ~ .ctabs__panel--isbn,
#cmode-titulo:checked ~ .ctabs__panel--titulo,
#cmode-foto:checked ~ .ctabs__panel--foto,
#hmode-isbn:checked ~ .ctabs__panel--isbn,
#hmode-titulo:checked ~ .ctabs__panel--titulo,
#hmode-foto:checked ~ .ctabs__panel--foto { display: block; }
#cmode-isbn:checked ~ .ctabs__bar label[for="cmode-isbn"],
#cmode-titulo:checked ~ .ctabs__bar label[for="cmode-titulo"],
#cmode-foto:checked ~ .ctabs__bar label[for="cmode-foto"],
#hmode-isbn:checked ~ .ctabs__bar label[for="hmode-isbn"],
#hmode-titulo:checked ~ .ctabs__bar label[for="hmode-titulo"],
#hmode-foto:checked ~ .ctabs__bar label[for="hmode-foto"] {
  background: var(--theme-accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--theme-accent) 35%, transparent);
}
/* Permite enlazar directamente a la pestaña Foto/PDF con `/comparar#cmode-foto`
   (p. ej. desde la home). `:target` activa el panel sin JS; gana al `:checked`
   por defecto porque aparece después en la cascada. */
#cmode-foto:target ~ .ctabs__panel { display: none; }
#cmode-foto:target ~ .ctabs__panel--foto { display: block; }
#cmode-foto:target ~ .ctabs__bar label[for="cmode-foto"] {
  background: var(--theme-accent);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--theme-accent) 35%, transparent);
}
.ctabs__radio:focus-visible ~ .ctabs__bar label {
  outline: 2px solid var(--ui-accent-ring);
  outline-offset: 2px;
}

.compare-title-form__row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.compare-title-form__input {
  flex: 1 1 240px;
  padding: 0.95rem 1.1rem;
  font-size: 1.05rem;
  border: 1px solid color-mix(in srgb, var(--theme-ink-muted) 30%, #fff);
  border-radius: var(--ui-radius-md);
  background: var(--theme-surface);
}
.compare-title-form__input:focus-visible {
  outline: none;
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 4px var(--ui-accent-ring);
}

/* --- Pestaña Foto/PDF: zona de subida arrastrar-y-soltar --- */
.compare-upload { display: flex; flex-direction: column; gap: 0.9rem; }
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 2.25rem 1.25rem;
  text-align: center;
  border: 2px dashed color-mix(in srgb, var(--theme-accent) 45%, var(--theme-border));
  border-radius: var(--ui-radius-xl);
  background: var(--theme-accent-soft);
  color: var(--theme-ink-soft);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.dropzone:hover {
  border-color: var(--theme-accent);
  background: color-mix(in srgb, var(--theme-accent) 12%, var(--theme-surface));
  box-shadow: var(--ui-shadow-sm);
}
.dropzone__icon {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--theme-accent);
}
.dropzone__title {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--theme-ink);
}
.dropzone__hint { font-size: 0.9rem; color: var(--theme-ink-muted); }
.dropzone__cta {
  margin-top: 0.35rem;
  padding: 0.55rem 1.25rem;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  color: var(--theme-accent);
  font-weight: 700;
  font-size: 0.92rem;
}
/* El <input type=file> real ocupa toda la zona pero invisible: así un clic
   en cualquier punto del dropzone abre el selector, sin necesidad de JS. */
.dropzone__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
/* Mostramos el nombre del fichero elegido vía pseudo-contenido no es posible
   sin JS; el navegador ya indica el archivo bajo el botón nativo si se hace
   visible. Mantenemos foco accesible con teclado sobre la etiqueta. */
.dropzone__input:focus-visible ~ .dropzone__cta,
.dropzone:focus-within {
  outline: 2px solid var(--ui-accent-ring);
  outline-offset: 2px;
}
.compare-upload__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--theme-ink-muted);
  line-height: 1.5;
}

.merchants-strip {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) 1rem;
}
.merchants-strip__label {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-size: clamp(0.84rem, 1.4vw, 0.98rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--theme-ink-muted);
  margin: 0 0 clamp(1.25rem, 2.5vw, 1.75rem);
}
/* Líneas finas a ambos lados del rótulo: lo enmarcan y le dan presencia sin
   robar protagonismo a los logos (que son el foco de la franja). */
.merchants-strip__label::before,
.merchants-strip__label::after {
  content: "";
  width: clamp(1.25rem, 5vw, 3rem);
  height: 1px;
  background: var(--theme-border);
}
.merchants-strip__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.9rem 1.1rem;
  margin: 0;
  padding: 0;
}

/* "Logos" wordmark de cada librería como chips con el color de marca aproximado.
   NO usamos los logos oficiales (copyright): son wordmarks tipográficos sobre
   chip claro con sombra suave, para dar aspecto de fila de partners.
   TODO: sustituir por los assets oficiales del kit de afiliado de cada librería
   (Amazon Associates / Awin: Casa del Libro, Fnac, El Corte Inglés, Agapea…)
   cuando estén disponibles; bastará con cambiar el contenido del <li> por un
   <img> y neutralizar estas reglas de color. */
.merchants-strip__item {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.85rem 1.5rem;
  border-radius: var(--ui-radius-pill, 999px);
  background: #fff;
  border: 1px solid var(--theme-border);
  box-shadow: var(--ui-shadow-md, 0 6px 22px rgba(17, 34, 68, 0.08));
  font-family: var(--theme-font-heading), system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--theme-ink);
  white-space: nowrap;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.merchants-strip__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--ui-shadow-lg, 0 22px 50px rgba(17, 34, 68, 0.14));
  border-color: color-mix(in srgb, var(--theme-accent) 35%, var(--theme-border));
}
/* Logo real de la marca (favicon de alta resolución). El nombre acompaña al
   icono; el texto se tinta con el color de marca para reforzar el reconocimiento. */
.merchants-strip__logo {
  width: 1.85em;
  height: 1.85em;
  object-fit: contain;
  border-radius: 5px;
  flex: none;
}
.merchants-strip__item[data-merchant="amazon"] { color: #131a22; }
.merchants-strip__item[data-merchant="cdl"] { color: #00843d; }
.merchants-strip__item[data-merchant="fnac"] { color: #111; }
.merchants-strip__item[data-merchant="eci"] { color: #1f8a3b; }
.merchants-strip__item[data-merchant="agapea"] { color: #c0228a; }
.merchants-strip__item[data-merchant="imosver"] { color: #0f5ca8; }

/* ── Páginas legales / informativas (aviso legal, privacidad, contacto, about).
   Tarjeta de lectura con ancho de medida cómodo; el cuerpo se inyecta como HTML
   desde el CMS de textos, así que estilamos los hijos genéricos (p/h2/ul/a). ── */
.legal-page {
  max-width: none;
  margin: 2.5rem 0 3.5rem;
  padding: clamp(1.5rem, 4vw, 2.75rem);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg, 16px);
  box-shadow: var(--ui-shadow-sm, 0 1px 2px rgba(17, 34, 68, 0.06));
}
.legal-page__header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--theme-border);
}
.legal-page__title {
  margin: 0;
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  font-weight: 600;
}
.legal-page__body {
  color: var(--theme-ink);
  line-height: 1.7;
}
.legal-page__body > :first-child { margin-top: 0; }
.legal-page__body > :last-child { margin-bottom: 0; }
.legal-page__body h2 {
  margin: 1.85rem 0 0.6rem;
  font-size: 1.18rem;
  font-weight: 700;
}
.legal-page__body p {
  margin: 0 0 1rem;
  color: var(--theme-ink-muted);
}
.legal-page__body strong { color: var(--theme-ink); }
.legal-page__body ul,
.legal-page__body ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
  color: var(--theme-ink-muted);
}
.legal-page__body li { margin: 0 0 0.4rem; }
.legal-page__body a {
  color: var(--theme-accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.legal-page__body a:hover,
.legal-page__body a:focus { color: var(--ui-accent-strong, var(--theme-accent)); }

/* ---- Formulario de contacto (/contacto) ---- */
.contact-form-wrap {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--theme-border);
}
.contact-form__heading { margin: 0 0 1rem; font-size: 1.25rem; }
.contact-form { display: flex; flex-direction: column; gap: 1rem; max-width: 40rem; }
.contact-form__row { display: flex; flex-direction: column; gap: 0.35rem; }
.contact-form__label { font-weight: 600; font-size: 0.92rem; color: var(--theme-ink); }
.contact-form__input,
.contact-form__textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font: inherit;
}
.contact-form__input:focus,
.contact-form__textarea:focus {
  outline: none;
  border-color: var(--theme-accent);
  box-shadow: 0 0 0 3px var(--theme-accent-soft);
}
.contact-form__textarea { resize: vertical; min-height: 7rem; }
.contact-form__submit {
  align-self: flex-start;
  padding: 0.78rem 1.6rem;
  background: var(--theme-accent);
  color: #fff;
  border: 0;
  border-radius: var(--ui-radius-pill);
  font-weight: 700;
  cursor: pointer;
}
.contact-form__submit:hover { filter: brightness(0.93); }
.contact-form__note { margin: 0.85rem 0 0; font-size: 0.82rem; color: var(--theme-ink-muted); }
/* Honeypot anti-spam: fuera de pantalla, no debe verse ni recibir foco. */
.contact-form__hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-form__success {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--theme-success) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--theme-success) 30%, transparent);
  border-radius: var(--theme-radius);
  color: color-mix(in srgb, var(--theme-success) 78%, #000 22%);
  font-weight: 500;
}
.contact-form__error {
  margin: 0 0 1.1rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, #dc2626 10%, #fff);
  border: 1px solid color-mix(in srgb, #dc2626 30%, transparent);
  border-radius: var(--theme-radius);
  color: #b91c1c;
  font-weight: 500;
}

/* ---- Imagen de cabecera del post de blog ---- */
.blog-post__cover {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--ui-radius-lg, 16px);
  margin: 0 0 1.75rem;
  background: var(--theme-surface-alt);
}

/* =========================================================================
   HOME — secciones markenianas del rediseño (propuestas de valor, teaser de
   "cómo funciona", intros de categorías, FAQ y banda CTA final). Estilos base
   transversales a todos los presets; el bloque `body.theme-planeta` de más
   abajo los afina al azul editorial.
   ========================================================================= */

/* ---- Propuestas de valor: rejilla de señales con icono + título + frase. --- */
.home-vprops {
  padding: 2.5rem 0 0.75rem;
}
.home-vprops__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.1rem;
  /* 6 ventajas → 3 columnas (3+3) en escritorio, 2 en tablet, 1 en móvil:
     una rejilla equilibrada en vez del 4+2 que dejaba un hueco. */
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 920px) {
  .home-vprops__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .home-vprops__grid { grid-template-columns: 1fr; }
}
.home-vprops__item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.6rem 1.55rem 1.7rem;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.home-vprops__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--ui-shadow-md);
  border-color: var(--ui-accent-tint);
}
.home-vprops__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.55rem;
  border-radius: 14px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}
.home-vprops__icon svg { width: 1.6rem; height: 1.6rem; }
.home-vprops__title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.home-vprops__body {
  margin: 0;
  color: var(--theme-ink-soft);
  font-size: 0.94rem;
  line-height: 1.55;
}

/* ---- Teaser "cómo funciona": CTA centrada bajo los 3 pasos. ---- */
.how-it-works__cta {
  display: flex;
  justify-content: center;
  margin-top: 1.75rem;
}

/* ---- Intro de la sección de categorías (eyebrow + título + entradilla). ---- */
.home-categories__intro {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 46rem;
}
.home-categories__section-title {
  margin: 0.15rem 0 0;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-categories__section-lead {
  margin: 0.35rem 0 0;
  color: var(--theme-ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}

/* ---- Últimos libros añadidos (rejilla de novedades, 4 columnas). ---- */
.home-latest {
  padding: 1.5rem 0 2.5rem;
}
.home-latest__intro {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-width: 46rem;
  margin: 0 0 1.6rem;
}
.home-latest__title {
  margin: 0.15rem 0 0;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-latest__lead {
  margin: 0.35rem 0 0;
  color: var(--theme-ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}
.home-latest__cta {
  display: flex;
  justify-content: center;
  margin: 1.8rem 0 0;
}
body.theme-planeta .home-latest__title { font-weight: 800; }

/* ---- FAQ honesta (CSS-only con <details>). ---- */
.home-faq {
  padding: 1.5rem 0 2.5rem;
}
.home-faq__intro {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0 0 1.5rem;
}
.home-faq__section-title {
  margin: 0.15rem 0 0;
  font-size: clamp(1.4rem, 2.6vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-faq__list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 52rem;
}
.home-faq__item {
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-md);
  box-shadow: var(--ui-shadow-sm);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-faq__item[open] {
  border-color: var(--ui-accent-tint);
  box-shadow: var(--ui-shadow-md);
}
.home-faq__item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--theme-font-heading);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--theme-ink);
}
.home-faq__item > summary::-webkit-details-marker { display: none; }
.home-faq__item > summary::after {
  content: "";
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  background: currentColor;
  color: var(--theme-accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 0.18s ease;
}
.home-faq__item[open] > summary::after { transform: rotate(180deg); }
.home-faq__item > summary:hover { color: var(--theme-accent); }
.home-faq__item > summary:focus-visible {
  outline: 2px solid var(--ui-accent-ring);
  outline-offset: -2px;
}
.home-faq__item p {
  margin: 0;
  padding: 0 1.25rem 1.15rem;
  color: var(--theme-ink-soft);
  font-size: 0.96rem;
  line-height: 1.65;
}

/* ---- Banda CTA final: cierre sobre fondo de marca. ---- */
.home-cta {
  margin: 2.5rem 0;
  padding: clamp(2rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2.5rem);
  text-align: center;
  border-radius: var(--ui-radius-xl);
  background: linear-gradient(135deg, #1f97d6 0%, var(--theme-accent) 55%, var(--ui-accent-strong) 100%);
  color: #fff;
}
.home-cta__title {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  max-width: 28ch;
  margin-inline: auto;
}
.home-cta__lead {
  margin: 0.75rem auto 0;
  max-width: 40rem;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
}
.home-cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  justify-content: center;
  margin-top: 1.6rem;
}

/* =========================================================================
   PLANETA · refinamiento de las nuevas secciones de la home (azul editorial).
   ========================================================================= */
body.theme-planeta .home-vprops { padding-top: 2.75rem; }
body.theme-planeta .home-vprops__item { border-radius: 14px; }
body.theme-planeta .home-vprops__item:hover {
  border-color: var(--theme-accent);
  box-shadow: 0 12px 28px rgba(17, 34, 68, 0.10);
}
body.theme-planeta .home-vprops__icon {
  background: linear-gradient(135deg, var(--theme-accent-soft) 0%, color-mix(in srgb, var(--theme-accent) 14%, #fff) 100%);
  color: var(--theme-accent);
}

body.theme-planeta .home-categories__section-title,
body.theme-planeta .home-faq__section-title { font-weight: 800; }

body.theme-planeta .how-it-works__steps { text-align: left; }

body.theme-planeta .home-faq__item { border-radius: var(--ui-radius-md); }
body.theme-planeta .home-faq__item[open] { border-color: var(--theme-accent); }

/* CTA final: degradado navy editorial, coherente con el bloque "función
   estrella" y el footer. */
body.theme-planeta .home-cta {
  background: linear-gradient(135deg, var(--pl-navy) 0%, var(--pl-navy-2) 100%);
}
body.theme-planeta .home-cta .btn-pill--light { color: var(--pl-navy); }
body.theme-planeta .home-cta .btn-pill--light:hover,
body.theme-planeta .home-cta .btn-pill--light:focus { color: var(--pl-navy); background: #eef6fc; }

/* =========================================================================
   Colegios por ciudad — índice /ciudades y ficha de ciudad /ciudad/:slug
   ========================================================================= */

.cities-header,
.city-header { padding: 0.5rem 0 1.6rem; }
.cities-header__title,
.city-header__title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.cities-header__meta,
.city-header__meta { margin: 0; color: var(--theme-ink-soft); }

/* /ciudades — rejilla de ciudades */
.city-grid {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.75rem;
}
.city-grid__item { margin: 0; }
.city-grid__link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  height: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
  background: var(--theme-surface);
  color: var(--theme-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.city-grid__link:hover,
.city-grid__link:focus-visible {
  border-color: var(--theme-accent);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--theme-accent) 16%, transparent);
  transform: translateY(-2px);
}
.city-grid__pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  flex: none;
  border-radius: 9px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}
.city-grid__pin svg { width: 1.15rem; height: 1.15rem; }
.city-grid__text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.city-grid__name { font-weight: 700; line-height: 1.2; }
.city-grid__count { font-size: 0.82rem; color: var(--theme-ink-soft); }

/* /ciudad/:slug — rejilla de colegios */
.school-cards {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.9rem;
}
.school-card { margin: 0; }
.school-card__link {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  height: 100%;
  padding: 1.1rem 1.2rem 1.2rem;
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
  background: var(--theme-surface);
  color: var(--theme-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.school-card__link:hover,
.school-card__link:focus-visible {
  border-color: var(--theme-accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--theme-accent) 15%, transparent);
  transform: translateY(-2px);
}
.school-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.school-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--ui-radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--theme-surface-alt);
  color: var(--theme-ink-soft);
}
.school-card__badge[data-type="publico"] { background: #e8f1ff; color: #1c54c4; }
.school-card__badge[data-type="concertado"] { background: #e7f6ec; color: #1f8a4c; }
.school-card__badge[data-type="privado"] { background: #f3ecfc; color: #6b39c9; }
.school-card__arrow {
  display: inline-flex;
  color: var(--theme-ink-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}
.school-card__arrow svg { width: 1.1rem; height: 1.1rem; }
.school-card__link:hover .school-card__arrow {
  color: var(--theme-accent);
  transform: translateX(3px);
}
.school-card__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.school-card__addr {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--theme-ink-soft);
  font-size: 0.85rem;
  line-height: 1.35;
}
.school-card__addr svg {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
  margin-top: 0.12rem;
  color: var(--theme-ink-muted);
}
.school-card__stages {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.25rem;
}
.stage-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-surface-alt);
  color: var(--theme-ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

/* =========================================================================
   Ficha de colegio — /colegio/:slug
   ========================================================================= */

.school__header {
  display: flex;
  gap: 1.1rem;
  padding: 1.5rem 1.6rem;
  margin: 0 0 1.5rem;
  background: var(--theme-surface-alt);
  border: 1px solid var(--theme-border);
  border-radius: var(--ui-radius-lg);
}
.school__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  flex: none;
  border-radius: 12px;
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
}
.school__icon svg { width: 1.6rem; height: 1.6rem; }
.school__head-body { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.school__name {
  margin: 0;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.school__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  color: var(--theme-ink-soft);
  font-size: 0.9rem;
}
.school__addr { display: inline-flex; align-items: center; gap: 0.35rem; }
.school__addr svg { width: 0.95rem; height: 0.95rem; flex: none; color: var(--theme-ink-muted); }
.school__stages { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.school__stats { display: flex; flex-wrap: wrap; gap: 0.55rem; margin-top: 0.15rem; }
.school__stat {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  font-size: 0.84rem;
  color: var(--theme-ink-soft);
}
.school__stat strong { font-size: 1.05rem; font-weight: 800; color: var(--theme-ink); }

/* Badge de tipo (compartido con las tarjetas de /ciudad) */
.school__badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--ui-radius-pill);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--theme-surface-alt);
  color: var(--theme-ink-soft);
}
.school__badge[data-type="publico"] { background: #e8f1ff; color: #1c54c4; }
.school__badge[data-type="concertado"] { background: #e7f6ec; color: #1f8a4c; }
.school__badge[data-type="privado"] { background: #f3ecfc; color: #6b39c9; }

/* Índice de cursos (chips de navegación) */
.school__toc {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}
.school__toc-label { font-weight: 600; color: var(--theme-ink-soft); font-size: 0.9rem; }
.school__toc-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: var(--ui-radius-pill);
  border: 1px solid var(--theme-border);
  background: var(--theme-surface);
  color: var(--theme-ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.school__toc-chip:hover,
.school__toc-chip:focus-visible {
  border-color: var(--theme-accent);
  color: var(--theme-accent);
  background: var(--theme-accent-soft);
}

/* Cabecera de cada curso */
.school-course { scroll-margin-top: 84px; margin-bottom: 2.25rem; }
.school-course__title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 800;
  border-bottom: 2px solid var(--theme-border);
}
.school-course__count {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--ui-radius-pill);
  background: var(--theme-accent-soft);
  color: var(--theme-accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.school__description {
  margin: 0 0 1.5rem;
  color: var(--theme-ink-soft);
  line-height: 1.6;
}
.school__links { margin-top: 2.25rem; }
.school__booklist-source { margin-top: 1.5rem; color: var(--theme-ink-soft); font-size: 0.9rem; }

/* Botón "añadir todo el curso a la comparativa" (tras el detalle por libro) */
.school-course__add { margin-top: 1.25rem; }
.school-course__add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.35rem;
  border-radius: var(--ui-radius-pill);
  border: 1px solid var(--theme-accent);
  background: var(--theme-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.school-course__add-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--theme-accent) 28%, transparent);
  transform: translateY(-1px);
}
