/* ==========================================================
   Diccionario Visual de Montaña y Senderismo — estilos
   ========================================================== */

:root {
  --paper: #fbfaf7;
  --paper-alt: #f3f1ec;
  --ink: #23272c;
  --ink-soft: #4c5259;
  --blue: #6da9cf;
  --blue-deep: #38708f;
  --blue-wash: #e3eef5;
  --terra: #a3492a;
  --hairline: #e2ded6;
  --shadow: 0 18px 40px -18px rgba(35, 39, 44, .25);
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-ui: "Barlow", system-ui, sans-serif;
  --font-serif: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

/* Los enlaces del menu tienen que dejar el borde de la seccion JUSTO debajo
   de la cabecera fija: donde cambia el color de fondo. Los 88px de antes eran
   a ojo y sobraban, asi que asomaba una franja de la seccion anterior.
   `--alto-barra` la mide main.js con la barra ya pintada (y la vuelve a medir
   si cambia de alto: al girar el movil o cuando entran las tipografias).
   Se queda siempre un pelin CORTA a proposito: si se pasa, vuelve a asomar. */
section[id], #comprar { scroll-margin-top: var(--alto-barra, 62px); }

:focus-visible {
  outline: 3px solid var(--blue-deep);
  outline-offset: 2px;
  border-radius: 4px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Equivalente al modo Multiplicar de Photoshop: el blanco del papel se integra
   con el fondo de cada sección en todas las imágenes, presentes y futuras. */
img { max-width: 100%; display: block; mix-blend-mode: multiply; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- botones ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  padding: .8em 1.6em;
  border-radius: 999px;
  border: 2px solid var(--blue-deep);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-solid { background: var(--blue-deep); color: #fff; }
.btn-solid:hover { background: #346886; box-shadow: 0 10px 22px -10px rgba(62, 122, 156, .65); }
.btn-outline { background: transparent; color: var(--blue-deep); }
.btn-outline:hover { background: var(--blue-wash); }
.btn-small { font-size: .85rem; padding: .55em 1.2em; }

/* ==========================================================
   CABECERA
   ========================================================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 22px;
  background: rgba(251, 250, 247, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.05rem; line-height: 1.05; letter-spacing: .01em;
  margin-right: auto;
}
.brand svg { width: 40px; flex: none; color: var(--blue-deep); }
.brand em { display: block; font-style: normal; font-weight: 500; color: var(--ink-soft); font-size: .82em; }
.topnav { display: flex; gap: 4px; }
.topnav a {
  text-decoration: none; color: var(--ink-soft);
  font-size: .92rem; font-weight: 500;
  padding: .45em .8em; border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.topnav a:hover { color: var(--ink); background: var(--blue-wash); }
.nav-burger {
  display: none;
  flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-burger span { width: 24px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }

/* ==========================================================
   HERO
   ========================================================== */
.hero { border-bottom: 1px solid var(--hairline); overflow: hidden; }
.hero-grid {
  display: grid; grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 60px; align-items: center;
  padding-top: 64px; padding-bottom: 40px;
}
.hero-book {
  position: relative;
  display: grid; place-items: center; min-width: 0;
  padding: clamp(28px, 3.4vw, 44px) clamp(28px, 4vw, 44px) clamp(44px, 5vw, 64px);
  perspective: 1500px;
  perspective-origin: 50% 26%;
}

/* ----------------------------------------------------------
   EL LIBRO EN 3D
   Cuatro caras de verdad colocadas en el espacio con
   preserve-3d: tapa, lomo (cara izquierda), canto superior
   (bloque de paginas visto desde arriba) y contratapa.
   Antes era la tapa plana con dos pseudoelementos encima y
   fallaba en tres cosas:
     - el "lomo" se pintaba SOBRE la propia tapa y se comia la
       D de "Diccionario", que en la portada real ya va pegada
       al borde;
     - ese mismo lomo asomaba por encima del canto de arriba;
     - y con la regla global img { mix-blend-mode: multiply }
       el bloque de paginas de detras se transparentaba a
       traves de la portada blanca, asi que la tapa salia
       sucia y el conjunto, plano.
   La tapa lleva por eso mix-blend-mode: normal.
   ---------------------------------------------------------- */
.book-visual {
  --grosor: 23px;                 /* 192 paginas en 16,5 x 22 cm = ~1,1 cm de lomo (340 px / 16,5 cm) */
  position: relative;
  width: min(100%, 340px);
  transform-style: preserve-3d;
  transform: rotateX(4deg) rotateY(18deg) rotateZ(-.4deg);
  transition: transform .55s cubic-bezier(.22, .7, .3, 1);
}

/* Tapa: la unica cara con imagen; manda en el alto del conjunto. */
.book-cover {
  position: relative; z-index: 2;
  width: 100%;
  mix-blend-mode: normal;
  border-radius: 1px 3px 3px 1px;
  transform: translateZ(calc(var(--grosor) / 2));
  box-shadow:
    0 0 0 1px rgba(35, 39, 44, .10),
    0 28px 44px -26px rgba(35, 39, 44, .55),
    0 60px 80px -55px rgba(35, 39, 44, .45);
}

.book-face { position: absolute; display: block; pointer-events: none; }

/* Lomo: cara izquierda, del fondo (izq.) al filo de la tapa (der.). */
.book-spine {
  top: 0; bottom: 0; left: 0;
  width: var(--grosor);
  transform-origin: left center;
  transform: translateZ(calc(var(--grosor) / -2)) rotateY(-90deg);
  background: linear-gradient(90deg,
    #a9a293 0%, #c9c2b2 6%, #e3ddd0 30%, #f6f3ec 70%, #fdfcfa 95%, #d6cfc0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}

/* Canto superior: los cortes de las paginas vistos desde arriba. */
.book-head {
  top: 0; left: 0; right: 0;
  height: var(--grosor);
  transform-origin: center top;
  transform: translateZ(calc(var(--grosor) / 2)) rotateX(-90deg);
  background:
    linear-gradient(to bottom, rgba(35, 39, 44, .30) 0 1px, rgba(35, 39, 44, 0) 1px),
    linear-gradient(90deg, rgba(35, 39, 44, .28), rgba(35, 39, 44, 0) 10%,
                            rgba(35, 39, 44, 0) 90%, rgba(35, 39, 44, .16)),
    repeating-linear-gradient(to bottom,
      rgba(116, 102, 72, .26) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
    linear-gradient(to bottom, #d9cfb6, #ece3cd 55%, #f7f1e2);
}

/* Contratapa: cierra el volumen por detras (apenas se ve). */
.book-back {
  inset: 0;
  transform: translateZ(calc(var(--grosor) / -2));
  border-radius: 1px 3px 3px 1px;
  background: linear-gradient(90deg, #d7d0c1, #efebe2);
}

/* Sombra de apoyo: da suelo al libro y evita el efecto "pegatina".
   Va en ::before para que pinte por debajo de .book-visual sin z-index
   negativo (que se colaria detras del fondo de la seccion). */
.hero-book::before {
  content: "";
  position: absolute;
  left: 50%; bottom: clamp(24px, 3vw, 36px);
  width: min(78%, 300px); height: 26px;
  transform: translateX(-46%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(35, 39, 44, .30), rgba(35, 39, 44, 0) 78%);
  filter: blur(5px);
}

@media (hover: hover) {
  .book-visual:hover { transform: rotateX(2deg) rotateY(11deg) rotateZ(-.15deg) translateY(-5px); }
}
.kicker {
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--terra); font-weight: 600; margin-bottom: 16px;
}
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 4.6vw, 3.6rem);
  font-weight: 700; line-height: 1.04;
  margin-bottom: 18px;
}
.hero-copy .hl { color: var(--blue-deep); }
.hero-sub {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.22rem; color: var(--ink-soft);
  max-width: 46ch; margin-bottom: 34px;
}
.buy-head {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px;
}
.buy-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.buy-note { font-size: .85rem; color: var(--ink-soft); }
.hero-peek {
  display: inline-block; margin-top: 26px;
  color: var(--blue-deep); font-weight: 500; text-decoration: none;
  border-bottom: 1px dashed var(--blue); padding-bottom: 2px;
}
.hero-peek:hover { color: var(--ink); }
.hero-participa {
  margin-top: 26px; padding: 14px 18px;
  border-left: 3px solid var(--terra);
  background: var(--paper-alt);
  border-radius: 0 10px 10px 0;
  font-size: .95rem; color: var(--ink-soft); max-width: 52ch;
}
.hero-participa strong { color: var(--ink); font-weight: 600; }
.hero-participa a { color: var(--blue-deep); font-weight: 600; word-break: break-word; }

.hero-panorama {
  height: clamp(220px, 28vw, 360px);
  margin-top: 18px; overflow: hidden;
  background: var(--paper); isolation: isolate;
}
.hero-panorama img {
  width: 100%; height: 100%; max-height: none;
  object-fit: cover; object-position: 50% 8%;
}

/* ==========================================================
   SECCIONES
   ========================================================== */
.section { padding: 90px 0; }
.section-alt { background: var(--paper-alt); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.section-kicker {
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--terra); font-weight: 600; margin-bottom: 10px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
  font-weight: 700; line-height: 1.08;
  margin-bottom: 18px;
}
.section-lead { color: var(--ink-soft); max-width: 62ch; margin-bottom: 34px; }

/* ---------- El libro ---------- */
.libro-grid {
  display: grid; grid-template-columns: 5fr 6fr;
  gap: 48px; margin: 30px 0 60px; align-items: start;
}
.libro-quote {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.5rem; line-height: 1.5;
  color: var(--blue-deep);
  border-left: 3px solid var(--blue);
  padding-left: 26px;
}
.libro-quote strong { font-weight: 500; color: var(--terra); font-style: normal; }
.libro-text p { margin-bottom: 16px; }
.libro-lema {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.15rem; color: var(--terra);
}
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; margin-bottom: 60px; }
.feature {
  background: #fff; border: 1px solid var(--hairline); border-radius: 14px;
  padding: 28px 26px;
  transition: transform .2s ease, box-shadow .2s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature svg { width: 44px; color: var(--blue-deep); margin-bottom: 14px; }
.feature h3 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; margin-bottom: 8px; }
.feature p { font-size: .95rem; color: var(--ink-soft); }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline);
  padding: 30px 0;
}
.stat { text-align: center; }
.stat-num {
  display: block; font-family: var(--font-display);
  font-size: 2.6rem; font-weight: 700; color: var(--blue-deep); line-height: 1;
}
.stat-label { font-size: .85rem; color: var(--ink-soft); }
/* "16,5 x 22" es mas largo que una cifra: un poco mas pequeno para que quepa
   en su columna tambien en movil (dos columnas de ~175 px). */
.stat-num--ancho { font-size: 2.05rem; padding-top: .3rem; }

/* ---------- Galería ---------- */
.gallery-shell { position: relative; margin-top: 10px; }
.gallery {
  display: flex; gap: 22px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 24px 32px 30px;
  scrollbar-width: thin; scrollbar-color: var(--blue) transparent;
}
.gal-item {
  flex: 0 0 min(78vw, 560px);
  scroll-snap-align: center;
  background: var(--paper-alt); border: 1px solid var(--hairline); border-radius: 10px;
  padding: 12px 12px 14px;
  cursor: zoom-in;
  transition: transform .2s ease, box-shadow .2s ease;
}
.gal-item:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.gal-item img { border-radius: 4px; }
.gal-item figcaption {
  font-size: .85rem; color: var(--ink-soft);
  padding: 10px 6px 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
}
.gal-item figcaption b { color: var(--terra); font-weight: 600; }
.gal-item figcaption span { text-align: right; }
.gal-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 5;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--hairline); background: #fff; color: var(--ink);
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(35,39,44,.4);
  transition: background .15s ease, transform .15s ease;
}
.gal-arrow:hover { background: var(--blue-wash); transform: translateY(-50%) scale(1.06); }
.gal-prev { left: 10px; }
.gal-next { right: 10px; }
.gallery-hint { text-align: center; font-size: .85rem; color: var(--ink-soft); }

/* ---------- Índices ---------- */
.tabs { display: flex; gap: 10px; margin-bottom: 26px; }
.tab {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 600;
  letter-spacing: .03em;
  padding: .55em 1.4em; border-radius: 999px;
  border: 2px solid var(--hairline); background: transparent; color: var(--ink-soft);
  cursor: pointer; transition: all .15s ease;
}
.tab:hover { border-color: var(--blue); color: var(--ink); }
.tab.is-active { background: var(--blue-deep); border-color: var(--blue-deep); color: #fff; }
.index-legend {
  font-size: .88rem; color: var(--ink-soft);
  background: var(--blue-wash); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 22px;
}
.acc { border: 1px solid var(--hairline); border-radius: 12px; background: #fff; margin-bottom: 12px; overflow: hidden; }
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 14px;
  background: none; border: 0; cursor: pointer;
  padding: 16px 20px; text-align: left;
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
  color: var(--ink);
}
.acc-head:hover { color: var(--blue-deep); }
.acc-num {
  flex: none; font-size: .8rem; font-family: var(--font-ui); font-weight: 600;
  color: var(--blue-deep); background: var(--blue-wash);
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.acc-chevron { margin-left: auto; transition: transform .2s ease; color: var(--ink-soft); flex: none; }
.acc.is-open .acc-chevron { transform: rotate(180deg); }
.acc-body { display: none; padding: 4px 22px 20px; border-top: 1px dashed var(--hairline); }
.acc.is-open .acc-body { display: block; }
.acc-sub { margin-top: 16px; }
.acc-sub h4 {
  font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--terra); margin-bottom: 8px; font-weight: 600;
}
.term-list { display: flex; flex-wrap: wrap; gap: 8px; }
.term {
  font-size: .88rem; color: var(--ink);
  background: var(--paper); border: 1px solid var(--hairline);
  padding: .3em .8em; border-radius: 999px;
}
.alpha-search { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.alpha-search input {
  flex: 1; max-width: 420px;
  font: inherit; padding: .7em 1.2em;
  border: 2px solid #b9b4a9; border-radius: 999px;
  background: #fff; transition: border-color .15s ease;
}
.alpha-search input:focus { border-color: var(--blue-deep); }
.alpha-count { font-size: .85rem; color: var(--ink-soft); }
.alpha-grid { columns: 4 200px; column-gap: 34px; }
.alpha-letter { break-inside: avoid; margin-bottom: 24px; }
.alpha-letter h4 {
  font-family: var(--font-display); font-size: 1.7rem; font-weight: 700;
  color: var(--blue-deep);
  border-bottom: 2px solid var(--blue-wash);
  margin-bottom: 8px;
}
.alpha-letter ul { list-style: none; }
.alpha-letter li { font-size: .92rem; padding: 2px 0; color: var(--ink-soft); }
.alpha-letter li mark { background: #ffe9a8; border-radius: 3px; padding: 0 1px; }
.alpha-empty { color: var(--ink-soft); font-style: italic; }
.alpha-empty a { color: var(--blue-deep); }

/* ---------- Test ---------- */
.quiz-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 22px; }
.quiz-card {
  background: #fff; border: 1px solid var(--hairline); border-radius: 14px;
  padding: 26px 24px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  transition: transform .2s ease, box-shadow .2s ease;
}
.quiz-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.quiz-card h3 { font-family: var(--font-display); font-size: 1.35rem; font-weight: 600; line-height: 1.15; }
.quiz-card p { font-size: .9rem; color: var(--ink-soft); flex: 1; }
.quiz-level {
  font-size: .68rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: .3em .9em; border-radius: 999px;
}
.quiz-level-easy { background: #e3efe3; color: #3c6e40; }
.quiz-level-hard { background: #f6e3dc; color: var(--terra); }
.quiz-play { max-width: 760px; margin: 0 auto; }
.quiz-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.quiz-quit { background: none; border: 0; color: var(--ink-soft); cursor: pointer; font: inherit; font-size: .9rem; }
.quiz-quit:hover { color: var(--terra); }
.quiz-progress { font-size: .9rem; color: var(--ink-soft); }
.quiz-bar { height: 6px; border-radius: 999px; background: var(--hairline); overflow: hidden; margin-bottom: 30px; }
.quiz-bar-fill { height: 100%; width: 0; background: var(--blue-deep); border-radius: 999px; transition: width .3s ease; }
.quiz-question {
  font-family: var(--font-serif);
  font-size: 1.45rem; font-weight: 500; line-height: 1.4;
  margin-bottom: 26px;
}
.quiz-options { display: grid; gap: 12px; }
.quiz-option {
  text-align: left; font: inherit; font-size: 1rem;
  background: #fff; color: var(--ink);
  border: 2px solid var(--hairline); border-radius: 12px;
  padding: 14px 18px; cursor: pointer;
  display: flex; gap: 12px; align-items: baseline;
  transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.quiz-option:not(:disabled):hover { border-color: var(--blue); transform: translateX(3px); }
.quiz-option .opt-letter { font-weight: 700; color: var(--blue-deep); flex: none; }
.quiz-option.is-correct { border-color: #3c6e40; background: #e3efe3; }
.quiz-option.is-correct .opt-letter { color: #3c6e40; }
.quiz-option.is-wrong { border-color: var(--terra); background: #f6e3dc; }
.quiz-option.is-wrong .opt-letter { color: var(--terra); }
.quiz-option:disabled { cursor: default; opacity: .85; }
.quiz-option.is-correct:disabled, .quiz-option.is-wrong:disabled { opacity: 1; }
.quiz-next { margin-top: 18px; }
.quiz-feedback {
  min-height: 1.4em;
  margin-top: 18px;
  font-weight: 600;
}
.quiz-feedback.is-ok { color: #3c6e40; }
.quiz-feedback.is-ko { color: var(--terra); }
.quiz-result { text-align: center; max-width: 560px; margin: 0 auto; padding: 30px 0; }
.quiz-score-label {
  font-size: .8rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--terra); font-weight: 600;
}
.quiz-score {
  font-family: var(--font-display);
  font-size: 4.4rem; font-weight: 700; color: var(--blue-deep); line-height: 1.1;
}
.quiz-rank {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.3rem; color: var(--ink-soft);
  margin: 10px 0 30px;
}
.quiz-result-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Autor ---------- */
.autor-grid {
  display: grid; grid-template-columns: minmax(240px, 380px) 1fr;
  gap: 60px; align-items: center;
}
.autor-figure img { border-radius: 8px; }
.autor-cargo { color: var(--blue-deep); font-weight: 600; margin-bottom: 18px; }
.autor-copy p { margin-bottom: 14px; }
.autor-quote {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.3rem; line-height: 1.5; color: var(--terra);
  border-left: 3px solid var(--terra);
  padding-left: 22px; margin-top: 24px;
}

/* ---------- Participa ---------- */
.section-participa { background: var(--blue-wash); border-top: 1px solid var(--hairline); }
.participa-card { text-align: center; max-width: 640px; }
.participa-card .section-lead { margin-left: auto; margin-right: auto; }
.participa-cairn { width: 60px; color: var(--blue-deep); margin: 0 auto 14px; }
.participa-mail { margin-top: 14px; font-size: .9rem; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.footer { background: var(--ink); color: #cfd4d9; padding: 50px 0 30px; }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; color: #fff; margin-bottom: 8px; }
.footer-line { font-size: .88rem; }
.footer-line a { color: var(--blue); text-decoration: none; }
.footer-line a:hover { text-decoration: underline; }
.footer-right { text-align: right; }
.footer-quote { font-family: var(--font-serif); font-style: italic; font-size: 1rem; margin-bottom: 10px; }
.footer-beta {
  text-align: center; font-size: .75rem; color: #8a9199;
  margin-top: 36px; padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(243, 241, 236, .97);
  display: flex; align-items: center; justify-content: center;
}
.lightbox figure {
  max-width: min(1100px, 92vw); max-height: 88vh;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.lightbox img {
  max-height: 80vh; width: auto; max-width: 100%;
  border-radius: 6px; box-shadow: 0 30px 80px rgba(35,39,44,.25);
}
.lightbox figcaption { color: var(--ink-soft); font-size: .95rem; text-align: center; }
.lb-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: 0; color: var(--ink);
  font-size: 2.4rem; line-height: 1; cursor: pointer; opacity: .8;
}
.lb-close:hover { opacity: 1; }
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(251,250,247,.82); border: 1px solid var(--hairline);
  color: var(--ink); width: 52px; height: 52px; border-radius: 50%;
  font-size: 1.8rem; line-height: 1; cursor: pointer;
  transition: background .15s ease;
}
.lb-arrow:hover { background: var(--blue-wash); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  z-index: 95;
  background: var(--ink); color: #fff;
  font-size: .92rem;
  padding: .9em 1.6em; border-radius: 999px;
  box-shadow: 0 14px 30px -10px rgba(0,0,0,.4);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } }

/* ---------- Animación de aparición ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; padding-top: 44px; }
  .hero-book { width: 100%; max-width: none; margin: 0 auto; padding: 24px 24px 16px; }
  .book-visual { width: min(72vw, 300px); }
  .hero-copy { text-align: center; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .buy-buttons { justify-content: center; }
  .libro-grid { grid-template-columns: 1fr; gap: 30px; }
  .features { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .autor-grid { grid-template-columns: 1fr; gap: 30px; }
  .autor-figure { max-width: 340px; margin: 0 auto; }
  .footer-grid, .footer-right { text-align: center; justify-content: center; }
}

/* la cabecera completa (marca + 6 enlaces + botón) necesita ~1000px:
   por debajo se pasa al menú hamburguesa para que no se parta en dos líneas */
@media (max-width: 1000px) {
  .topnav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--hairline);
    padding: 10px 18px 16px;
    box-shadow: 0 20px 30px -20px rgba(35,39,44,.25);
  }
  .topnav.is-open { display: flex; }
  .topnav a { padding: .8em .6em; border-radius: 8px; }
  .topbar-cta { display: none; }
  .nav-burger { display: flex; }
}

@media (max-width: 820px) {
  .section { padding: 64px 0; }
  .hero-panorama { height: auto; }
  .hero-panorama img { height: auto; object-fit: contain; }
  .quiz-question { font-size: 1.25rem; }
  .alpha-grid { columns: 2 150px; }
  .gal-arrow { display: none; }
  .gallery { padding: 18px 18px 24px; }
  .lb-arrow { width: 42px; height: 42px; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

@media (max-width: 480px) {
  .hero-book { padding: 20px 20px 30px; }
  .book-visual { --grosor: 17px; width: min(76vw, 260px); transform: rotateX(3deg) rotateY(13deg) rotateZ(-.3deg); }
  .hero-book::before { bottom: 14px; height: 20px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 26px 10px; }
  .quiz-result-actions .btn { width: 100%; }
  .buy-buttons { flex-direction: column; width: 100%; }
  .buy-buttons .btn { width: 100%; }
}
