/* ============================================================
   GASP PDF Flipbook Viewer
   Turns any PDF (Impact Report, newsletters, policies, etc.)
   into an interactive page-turning book, rendered entirely in
   the browser from the PDF itself — no pre-processing needed.
   ============================================================ */

.gasp-flipbook-launcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ── Modal shell ─────────────────────────────────────────── */
.gasp-flipbook-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(17, 24, 39, 0.88);
  padding: 1.5rem;
}
.gasp-flipbook-modal.is-open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
body.gasp-flipbook-lock { overflow: hidden; }

.gasp-flipbook-modal-inner {
  width: 100%;
  max-width: 1100px;
  height: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--gasp-navy);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.gasp-flipbook-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--gasp-purple);
  color: var(--gasp-white);
  flex: 0 0 auto;
}
.gasp-flipbook-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gasp-flipbook-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.gasp-flipbook-controls button,
.gasp-flipbook-controls a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: var(--gasp-white);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}
.gasp-flipbook-controls button:hover,
.gasp-flipbook-controls a:hover {
  background: var(--gasp-teal);
  border-color: var(--gasp-teal);
  color: var(--gasp-navy);
}
.gasp-flipbook-controls button:disabled {
  opacity: 0.35;
  cursor: default;
  background: rgba(255,255,255,0.08) !important;
  color: var(--gasp-white) !important;
  border-color: rgba(255,255,255,0.35) !important;
}
.gasp-flipbook-page-indicator {
  font-size: 0.82rem;
  min-width: 78px;
  text-align: center;
  opacity: 0.9;
}

.gasp-flipbook-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--gasp-navy);
  padding: 1rem;
}

.gasp-flipbook-loading {
  color: var(--gasp-white);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: center;
  opacity: 0.85;
}
.gasp-flipbook-loading::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: var(--gasp-teal);
  animation: gasp-flipbook-spin 0.9s linear infinite;
}
@keyframes gasp-flipbook-spin { to { transform: rotate(360deg); } }

.gasp-flipbook-book {
  display: none;
  width: 100%;
  height: 100%;
}
.gasp-flipbook-book canvas,
.gasp-flipbook-book img {
  max-width: 100%;
}

.gasp-flipbook-error {
  color: var(--gasp-white);
  text-align: center;
  max-width: 420px;
  font-size: 0.9rem;
  line-height: 1.6;
}
.gasp-flipbook-error a { color: var(--gasp-teal); text-decoration: underline; }

/* St.PageFlip renders its own page canvases; keep the book itself
   from spilling out of our rounded, dark stage */
.stf__parent { margin: 0 auto; }

@media (max-width: 640px) {
  .gasp-flipbook-modal { padding: 0; }
  .gasp-flipbook-modal-inner { max-height: 100vh; border-radius: 0; }
  .gasp-flipbook-title { font-size: 0.8rem; }
  .gasp-flipbook-controls button, .gasp-flipbook-controls a { width: 32px; height: 32px; font-size: 1rem; }
}
