/* Bloque de catálogos de la home y visor de páginas */

.gd-catalogos { box-sizing: border-box; width: 100%; padding: 0 clamp(16px, 4.5vw, 90px) 48px; color: #1c1d21; text-align: center; scroll-margin-top: 130px; }
.gd-catalogos *, .gd-visor * { box-sizing: border-box; }
.gd-catalogos [hidden], .gd-visor[hidden], .gd-visor [hidden] { display: none !important; }

.gd-catalogos__cabecera { margin-bottom: 32px; }
.gd-catalogos__titulo { margin: 0; color: #1c1d21; font-size: inherit; font-weight: inherit; text-transform: none; }
.gd-catalogos__nombre { display: block; font-size: clamp(38px, 6vw, 64px); font-weight: 500; line-height: 1.1; }
.gd-catalogos__subtitulo { margin: 16px 0 0; color: #000; font-size: 1.2rem; line-height: 1.3; }

/* Filtro por sección: en móvil se desliza en horizontal */
.gd-catalogos__filtros { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 32px; }
.gd-catalogos__filtro { padding: 8px 18px; border: 1px solid #d5d6da; border-radius: 30px; background: #fff; color: #1c1d21; font-family: inherit; font-size: 14px; font-weight: 500; line-height: 1.3; cursor: pointer; transition: background-color .2s, border-color .2s, color .2s; }
.gd-catalogos__filtro:hover { border-color: #f75900; color: #f75900; }
.gd-catalogos__filtro.is-activo { border-color: #f75900; background: #f75900; color: #fff; }
.gd-catalogos__filtro:focus-visible, .gd-catalogos__vermas:focus-visible, .gd-catalogos__boton:focus-visible, .gd-catalogos__portada:focus-visible { outline: 2px solid #1c1d21; outline-offset: 2px; }

.gd-catalogos__rejilla { position: relative; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px clamp(16px, 3vw, 60px); align-items: start; }
.gd-catalogos__rejilla.is-animando { overflow: hidden; transition: height .45s ease; }
.gd-catalogos__item { display: flex; flex-direction: column; align-items: center; min-width: 0; height: 100%; }
.gd-catalogos__portada { display: block; width: 100%; transition: transform .25s ease, box-shadow .25s ease; }
.gd-catalogos__portada img { display: block; width: 100%; height: auto; }
.gd-catalogos__portada:hover { transform: translateY(-4px); box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.gd-catalogos__nombre-item { display: flex; align-items: center; justify-content: center; min-height: 50px; margin: 10px 0; color: #000; font-size: 1.2rem; font-weight: 400; line-height: 1.3; text-transform: none; }
.gd-catalogos__boton { display: inline-block; margin-top: auto; padding: 10px 30px; border-radius: 30px; background: #f75900; color: #fff !important; font-size: 13px; font-weight: 500; line-height: 1.4; text-decoration: none !important; transition: background-color .2s; }
.gd-catalogos__boton:hover { background: #d94e00; }

.gd-catalogos__mas { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 32px; }
.gd-catalogos__vermas { padding: 10px 30px; border: 1px solid #f75900; border-radius: 30px; background: #fff; color: #f75900; font-family: inherit; font-size: 15px; font-weight: 500; cursor: pointer; transition: background-color .2s, color .2s; }
.gd-catalogos__vermas:hover { background: #f75900; color: #fff; }

@media (max-width: 1100px) { .gd-catalogos__rejilla { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 860px) { .gd-catalogos__rejilla { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .gd-catalogos__rejilla { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gd-catalogos__filtros { flex-wrap: nowrap; justify-content: flex-start; margin-right: -16px; margin-left: -16px; padding: 0 16px 4px; overflow-x: auto; scrollbar-width: none; }
  .gd-catalogos__filtro { flex: none; white-space: nowrap; }
  .gd-catalogos__nombre-item { font-size: 1rem; }
  .gd-catalogos__boton { padding: 10px 20px; }
}

/* Visor: lo demás se oculta mientras está abierto, también los botones flotantes
   como «Contáctanos», que traen su propio z-index máximo. */
html.gd-visor-abierto, html.gd-visor-abierto body { overflow: hidden !important; }
html.gd-visor-abierto body > *:not(.gd-visor) { visibility: hidden !important; }
.gd-visor { position: fixed; inset: 0; z-index: 2147483647; display: flex; flex-direction: column; background: #26272b; color: #fff; font-family: inherit; text-align: left; }

.gd-visor__barra { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 8px 16px; background: #1c1d21; }
.gd-visor__titulo { overflow: hidden; margin: 0; color: #fff !important; font-size: 17px; font-weight: 500; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; text-transform: none; }
.gd-visor__acciones { display: flex; flex: none; align-items: center; gap: 8px; }
.gd-visor__accion { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 30px; background: transparent; color: #fff !important; font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1; text-decoration: none !important; cursor: pointer; transition: background-color .2s, border-color .2s; }
.gd-visor__accion:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, .1); }
.gd-visor__accion:disabled { opacity: .45; cursor: default; }
.gd-visor__accion[aria-pressed="true"] { border-color: #fff; background: #fff; color: #1c1d21 !important; }
.gd-visor__accion--naranja { border-color: #f75900; background: #f75900; }
.gd-visor__accion--naranja:hover:not(:disabled) { border-color: #d94e00; background: #d94e00; }
.gd-visor__cerrar, .gd-visor__flecha { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; cursor: pointer; transition: background-color .2s; }
.gd-visor__cerrar:hover, .gd-visor__flecha:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.gd-visor__flecha:disabled { opacity: .3; cursor: default; }
.gd-visor button:focus-visible, .gd-visor a:focus-visible, .gd-visor__zoom:focus-visible { outline: 2px solid #fa9b66; outline-offset: 2px; }

.gd-visor__escenario { position: relative; display: flex; flex: 1 1 auto; align-items: center; justify-content: center; min-height: 0; padding: 16px; overflow: hidden; }
.gd-visor__libro { position: relative; flex: none; transition: transform .45s ease; }
.gd-visor__pagina { overflow: hidden; background: #fff; }
.gd-visor__contenido { position: absolute; }
.gd-visor__contenido canvas { display: block; width: 100%; height: 100%; }
.gd-visor__enlace { position: absolute; display: block; }
.gd-visor__enlace:hover { background: rgba(247, 89, 0, .14); outline: 1px solid rgba(247, 89, 0, .55); }
.gd-visor__pagina:not(.is-pintada)::after { content: ""; position: absolute; top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border: 3px solid #e4e5e9; border-top-color: #f75900; border-radius: 50%; animation: gd-visor-giro .8s linear infinite; }
@keyframes gd-visor-giro { to { transform: rotate(360deg); } }

.gd-visor__estado { position: absolute; top: 50%; left: 50%; width: min(320px, calc(100% - 32px)); transform: translate(-50%, -50%); text-align: center; }
.gd-visor__estado p { margin: 12px 0 0; color: #fff; font-size: 15px; line-height: 1.4; }
.gd-visor__barra-carga { height: 4px; overflow: hidden; border-radius: 2px; background: rgba(255, 255, 255, .2); }
.gd-visor__barra-carga span { display: block; width: 0; height: 100%; background: #f75900; transition: width .2s; }
.gd-visor__estado.is-error .gd-visor__barra-carga { display: none; }

.gd-visor__zoom { position: absolute; inset: 0; z-index: 2; overflow: auto; padding: 16px; background: #26272b; cursor: grab; scrollbar-gutter: stable; scrollbar-color: rgba(255, 255, 255, .35) transparent; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.gd-visor__zoom.is-arrastrando { cursor: grabbing; user-select: none; }
.gd-visor__zoom-pagina { display: block; margin: 0 auto 16px; background: #fff; }

.gd-visor__pie { display: flex; flex: none; align-items: center; justify-content: center; gap: 12px; min-height: 56px; padding: 4px 16px; background: #1c1d21; }
.gd-visor__contador { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 110px; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gd-visor__detalle { display: block; margin-top: 10px; color: rgba(255, 255, 255, .55); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.gd-visor__ir::placeholder { color: rgba(255, 255, 255, .55); opacity: 1; }
.gd-visor__ir { width: 6ch; height: 30px; padding: 0 4px; border: 1px solid rgba(255, 255, 255, .28); border-radius: 8px; background: rgba(255, 255, 255, .08); color: #fff; font: inherit; text-align: center; transition: background-color .2s, border-color .2s; }
.gd-visor__ir:hover { border-color: rgba(255, 255, 255, .6); }
.gd-visor__ir:focus { border-color: #fa9b66; outline: 0; background: rgba(255, 255, 255, .16); }

/* En pantallas grandes, sin barra inferior: flechas a los lados y contador arriba,
   para que el libro aproveche toda la altura. */
@media (min-width: 1100px) {
  .gd-visor__barra { height: 56px; min-height: 0; }
  .gd-visor__titulo { max-width: calc(50vw - 100px); }
  .gd-visor__escenario { padding: 8px 64px; }
  .gd-visor__pie { position: absolute; inset: 56px 0 0; z-index: 3; justify-content: space-between; min-height: 0; padding: 0 12px; background: transparent; pointer-events: none; }
  .gd-visor__flecha { width: 44px; height: 44px; background: rgba(0, 0, 0, .45); pointer-events: auto; }
  .gd-visor__flecha:hover:not(:disabled) { background: rgba(0, 0, 0, .75); }
  .gd-visor__contador { position: absolute; top: -56px; left: 50%; height: 56px; transform: translateX(-50%); pointer-events: auto; }
}

@media (max-width: 760px) {
  .gd-visor__barra { min-height: 54px; padding: 6px 8px 6px 14px; gap: 8px; }
  .gd-visor__titulo { font-size: 15px; }
  .gd-visor__acciones { gap: 4px; }
  .gd-visor__accion { justify-content: center; width: 38px; padding: 0; }
  .gd-visor__accion span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .gd-visor__escenario { padding: 8px; }
  /* Con menos de 16 px, el iPhone acerca la página al escribir. */
  .gd-visor__ir { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .gd-catalogos__rejilla.is-animando, .gd-catalogos__portada, .gd-visor__libro { transition: none; }
}
