/* Ventana «¿Nos ayudas a sostener la memoria?» al descargar un PDF (21 nov 2026, paquete 265; assets/js/apoyo-pdf.js).
   Marco igual a las demás ventanas del sitio (modales-hp.css: tarjeta blanca, borde #e3dded, radio 18 px, relleno 24 px,
   telón rgba(21,18,43,.5), X de 44×44; en celular, hoja pegada abajo). Botón de VELA (vida.css §10-§11): crema #ffeaa6,
   amarillo #ffcf63 y ámbar #f9b137, texto #3b1d00; nada de dorado metálico. Corazón rosa mexicano de «Apoya» (#d6246e).
   Sin colores de partido. Con «reducir movimiento» no hay animaciones. */
html body dialog.ad-modal {
  --ad-tinta: #211a2c; --ad-gris: #5f5870; --ad-linea: #e3dded; --ad-crema: #fff6e3; --ad-ambar: #f2a541; --ad-marron: #8a4a00;
  background: #fff !important; color: var(--ad-tinta) !important;
  border: 1px solid var(--ad-linea) !important; border-radius: 18px !important;
  box-shadow: 0 24px 48px -12px rgba(21, 18, 43, .35) !important;
  width: min(32rem, calc(100vw - 2rem)) !important; max-width: none !important;
  max-height: min(92dvh, 46rem) !important; margin: auto; padding: 0 !important; overflow: auto; overscroll-behavior: contain;
}
html body dialog.ad-modal:not([open]) { display: none; }
.ad-modal, .ad-modal *, .ad-modal *::before, .ad-modal *::after { box-sizing: border-box; }
html body dialog.ad-modal::backdrop { background: rgba(21, 18, 43, .5) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
@keyframes ad-entra { from { opacity: 0; } to { opacity: 1; } }
html body dialog.ad-modal[open] { animation: ad-entra .12s ease-out both; }

.ad-modal .ad-cuerpo { position: relative; padding: 1.5rem; outline: none; }
.ad-modal .ad-x {
  position: absolute; top: .5rem; right: .5rem; z-index: 3; display: grid; place-items: center; width: 44px; height: 44px;
  margin: 0; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--ad-gris); font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.ad-modal .ad-x[hidden] { display: none; }
.ad-modal .ad-x:hover, .ad-modal .ad-x:focus-visible { background: #f4effb; color: var(--ad-tinta); }
.ad-modal .ad-x:focus-visible { outline: 3px solid #a96413; outline-offset: -3px; }

/* Avance del PDF: una tira discreta arriba */
.ad-modal .ad-estado {
  display: flex; align-items: center; gap: .65rem; margin: 0 2.75rem 1rem 0; padding: .55rem .75rem;
  border-radius: 12px; background: #f4f8f2; border: 1px solid #d7e8d2; color: var(--ad-tinta);
}
.ad-modal .ad-estado-icono { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: #fff; color: #2f7a3a; font-size: .95rem; }
.ad-modal .ad-estado-texto { display: grid; line-height: 1.25; min-width: 0; }
.ad-modal .ad-estado-texto strong { font-size: .95rem; }
.ad-modal .ad-estado-texto small { color: var(--ad-gris); font-size: .82rem; }
.ad-modal .ad-estado[data-ad-estado="tarda"] { background: #fff8ec; border-color: #f1d7a8; }
.ad-modal .ad-estado[data-ad-estado="tarda"] .ad-estado-icono { color: var(--ad-marron); }
.ad-modal .ad-estado a { color: var(--ad-marron); font-weight: 700; }

.ad-modal h2 {
  font-family: var(--mr-serif, "Source Serif 4", Georgia, serif); font-weight: 650; font-size: 1.45rem; line-height: 1.2;
  color: var(--ad-tinta); margin: 0 0 .6rem; padding-right: 0;
}
.ad-modal h2 .ap-corazon { color: #d6246e !important; font-size: .9em; margin-right: .15rem; }
.ad-modal .ad-texto { color: var(--ad-gris); margin: 0 0 1rem; line-height: 1.5; }

/* Datos para transferir: la misma caja crema con borde ámbar de /apoya */
.ad-modal .ad-datos {
  display: grid; gap: .6rem; margin: 0 0 .5rem; padding: .9rem 1rem; border-radius: 12px;
  border: 2px solid var(--ad-ambar); background: linear-gradient(180deg, var(--ad-crema), #fff 70%);
}
.ad-modal .ad-datos[hidden] { display: none; }
.ad-modal .ad-datos dt { font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ad-gris); }
.ad-modal .ad-datos dd { margin: .1rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; color: var(--ad-tinta); font-size: 1rem; overflow-wrap: anywhere; }
.ad-modal .ad-logo { width: 1.75rem; height: 1.75rem; object-fit: contain; flex: none; }
.ad-modal .ad-numero { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(1.05rem, 4.2vw, 1.25rem); font-weight: 700; letter-spacing: .03em; }
.ad-modal .ad-copiar {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: .25rem .7rem; border-radius: 999px;
  border: 1px solid #e59a1f; background: #fff; color: var(--ad-marron); font-size: .85rem; font-weight: 700; cursor: pointer;
}
.ad-modal .ad-copiar:hover, .ad-modal .ad-copiar:focus-visible { background: #fff1bd; }
.ad-modal .ad-copiado { min-height: 1.2em; margin: 0 0 .5rem; font-size: .85rem; color: #2f7a3a; font-weight: 600; }
.ad-modal .ad-copiado:empty { min-height: 0; margin: 0; }
.ad-modal .ad-nota { display: flex; gap: .45rem; align-items: flex-start; margin: .25rem 0 1.1rem; font-size: .85rem; color: var(--ad-gris); line-height: 1.4; }
.ad-modal .ad-nota i { margin-top: .15rem; color: var(--ad-gris); }

/* Acciones: la principal a la derecha */
.ad-modal .ad-acciones { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .6rem; }
.ad-modal .ad-no {
  min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--ad-linea); background: #fff;
  color: var(--ad-tinta); font-weight: 600; cursor: pointer; font-variant-numeric: tabular-nums;
}
.ad-modal .ad-no:hover:not(:disabled), .ad-modal .ad-no:focus-visible { background: #f4effb; }
.ad-modal .ad-no:disabled { cursor: not-allowed; color: var(--ad-gris); background: #f7f5fa; border-style: dashed; }
html body .ad-modal .btn-vela.ad-ir {
  position: relative; overflow: hidden; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: .55rem 1.15rem; border-radius: 10px; text-decoration: none;
  background: linear-gradient(165deg, #ffeaa6 0%, #ffcf63 48%, #f9b137 100%); border: 1px solid #e59a1f; color: #3b1d00; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 214, 120, .55), 0 6px 18px -6px rgba(245, 150, 30, .8), inset 0 1px 0 rgba(255, 255, 255, .7);
}
html body .ad-modal .btn-vela.ad-ir::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: radial-gradient(70% 120% at 50% -10%, rgba(255, 255, 255, .75) 0%, rgba(255, 244, 200, .35) 45%, rgba(255, 244, 200, 0) 75%);
  opacity: .55; animation: ad-vela 4.2s ease-in-out infinite;
}
html body .ad-modal .btn-vela.ad-ir:hover, html body .ad-modal .btn-vela.ad-ir:focus-visible {
  background: linear-gradient(165deg, #fff1bd 0%, #ffd873 48%, #ffbd47 100%); color: #3b1d00; border-color: #d98a12;
}
html body .ad-modal .btn-vela.ad-ir:focus-visible { outline: 3px solid #15122b; outline-offset: 2px; }
html body .ad-modal .btn-vela.ad-ir .ap-corazon { color: #d6246e !important; }
@keyframes ad-vela { 0%, 100% { opacity: .5; } 12% { opacity: .85; } 24% { opacity: .55; } 41% { opacity: .95; } 57% { opacity: .6; } 78% { opacity: .8; } }

/* Celular: hoja pegada abajo, botones a lo ancho (la principal arriba) */
@media (max-width: 575.98px) {
  html body dialog.ad-modal {
    box-sizing: border-box; width: 100% !important; max-width: 100% !important; max-height: 94dvh !important; margin: auto 0 0 !important;
    border-radius: 18px 18px 0 0 !important; border-left: 0 !important; border-right: 0 !important; border-bottom: 0 !important; overflow-x: hidden;
  }
  .ad-modal .ad-cuerpo { padding: 1rem 1rem calc(.9rem + env(safe-area-inset-bottom, 0px)); }
  .ad-modal h2 { font-size: 1.2rem; margin-bottom: .45rem; }
  .ad-modal .ad-texto { font-size: .92rem; line-height: 1.42; margin-bottom: .7rem; }
  .ad-modal .ad-estado { margin-bottom: .7rem; padding: .4rem .6rem; }
  .ad-modal .ad-estado-icono { width: 1.7rem; height: 1.7rem; }
  .ad-modal .ad-datos { gap: .45rem; padding: .7rem .8rem; }
  .ad-modal .ad-datos dd { font-size: .95rem; }
  .ad-modal .ad-copiar { min-height: 34px; padding: .2rem .6rem; }
  .ad-modal .ad-nota { margin: .2rem 0 .8rem; font-size: .8rem; }
  .ad-modal .ad-acciones { gap: .5rem; }
  .ad-modal .ad-acciones { flex-direction: column-reverse; align-items: stretch; }
  .ad-modal .ad-acciones > * { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html body dialog.ad-modal[open] { animation: none; }
  html body .ad-modal .btn-vela.ad-ir::after { animation: none; opacity: .6; }
  .ad-modal .fa-spin { animation: none; }
}
@media print { html body dialog.ad-modal { display: none !important; } }
