/* Scoped styles for CDP Flipbook Reader */
.cdp-reader,
.cdp-reader * { box-sizing: border-box; }

.cdp-reader {
  --cdp-accent: #216b57;
  --cdp-ink: #17392f;
  --cdp-muted: #647a71;
  --cdp-border: #dde7df;
  --cdp-surface: #ffffff;
  --cdp-stage-bg: linear-gradient(180deg, #fbfcfa 0%, #f5f7f3 100%);
  font-family: inherit;
  color: var(--cdp-ink);
  width: 100%;
  max-width: 1440px;
  margin: 24px auto 38px;
  background: #fff;
  border: 1px solid var(--cdp-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(19, 55, 45, 0.06);
}

.cdp-reader:focus { outline: none; }
.cdp-reader:focus-visible { outline: 3px solid var(--cdp-accent); outline-offset: 3px; }
.cdp-reader button,
.cdp-reader input { font: inherit; }
.cdp-reader button { cursor: pointer; }
.cdp-reader button:disabled { opacity: .32; cursor: default; }
.cdp-reader [hidden] { display: none !important; }

.cdp-reader-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 22px 26px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbf8 100%);
  border-bottom: 1px solid var(--cdp-border);
}

.cdp-reader-brand { display: flex; align-items: center; gap: 15px; min-width: 0; }
.cdp-brand-mark {
  display: flex;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cadfcd;
  border-radius: 50%;
  font-size: 27px;
  color: var(--cdp-accent);
  background: #eef8ef;
}
.cdp-eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cdp-accent);
  margin-bottom: 5px;
}
.cdp-reader .cdp-title {
  font-family: Georgia, 'Times New Roman', serif !important;
  font-size: clamp(20px, 2.4vw, 29px) !important;
  line-height: 1.17 !important;
  letter-spacing: -.015em;
  margin: 0 !important;
  color: var(--cdp-ink) !important;
  font-weight: 600 !important;
}
.cdp-reader .cdp-issue { margin: 5px 0 0; font-size: 12px; color: var(--cdp-muted); }
.cdp-heading-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cdp-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid #c7d7cb;
  border-radius: 12px;
  background: #fff;
  color: var(--cdp-accent) !important;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 600;
  transition: .2s ease;
}
.cdp-text-action:hover { border-color: var(--cdp-accent); background: #f6faf7; }

.cdp-book-stage {
  position: relative;
  min-height: 360px;
  width: 100%;
  background: #f7f8f6;
  overflow: hidden;
}
.cdp-book-surface {
  position: absolute;
  inset: 14px 16px;
  display: block;
  overflow: visible;
}
/* IMPORTANT: no pseudo-element overlay and no position/display overrides on
   StPageFlip's own .stf__parent / .stf__block elements. The library manages
   these elements, and overriding them can make every PDF page disappear. */

.cdp-reader .cdp-sheet {
  position: relative;
  display: block;
  background: #fff;
  border: 0;
  overflow: hidden;
  box-shadow: none;
}
.cdp-reader .cdp-pdf-page {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  background: #fff;
}
.cdp-reader .cdp-sheet-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #74877e;
  font-size: 14px;
  letter-spacing: .04em;
  background: #fafbf9;
  pointer-events: none;
}

.cdp-book-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--cdp-muted);
  background: rgba(247, 248, 246, 0.98);
}
.cdp-loader {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d3ddd6;
  border-top-color: var(--cdp-accent);
  animation: cdp-spin .85s linear infinite;
}
@keyframes cdp-spin { to { transform: rotate(360deg); } }

.cdp-reader-error {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  top: 50%;
  width: min(92%, 540px);
  z-index: 9;
  background: #fff2eb;
  border: 1px solid #f1d0b0;
  color: #703c0e;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
}

.cdp-reader-error a { display: block; margin-top: 8px; color: #175a47 !important; font-weight: 700; }
.cdp-reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  min-height: 72px;
  background: #fff;
  border-top: 1px solid var(--cdp-border);
}
.cdp-tool {
  width: 38px;
  min-width: 38px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--cdp-accent);
  font-size: 30px;
  line-height: 1;
  border-radius: 10px;
}
.cdp-tool:hover:not(:disabled) { background: #f4f8f5; }
.cdp-first, .cdp-last { font-size: 18px; }
.cdp-progress-wrap {
  min-width: min(52vw, 520px);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 8px;
}
.cdp-page-slider {
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--cdp-accent) 0, var(--cdp-accent) var(--cdp-progress,0%), #dde8df var(--cdp-progress,0%), #dde8df 100%);
  outline: none;
}
.cdp-page-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cdp-accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--cdp-accent);
}
.cdp-page-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cdp-accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cdp-accent);
}
.cdp-page-count {
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #305747;
  font-size: 12px;
}
.cdp-toolbar-divider { height: 24px; width: 1px; background: #dce8df; margin: 0 5px; }
.cdp-reader .cdp-zoom { font-size: 26px; }
.cdp-reader .cdp-fullscreen { font-size: 22px; }
.cdp-reading-tip,
.cdp-reader-fallback {
  padding: 0 22px;
  text-align: center;
  font-size: 12px;
  color: var(--cdp-muted);
  line-height: 1.5;
  margin: 12px auto 5px;
}
.cdp-reader-fallback { margin: 0 auto 17px; }
.cdp-reader-fallback a {
  font-size: 12px;
  color: var(--cdp-accent) !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
}
.cdp-reader-warning {
  background: #fff2eb;
  border: 1px solid #f4d6bd;
  padding: 18px;
  border-radius: 8px;
}

.cdp-video-only {
  background: #f7f9f7;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cdp-video-only video {
  display: block;
  background: #000;
  width: 100%;
  max-height: min(75vh, 790px);
  border-radius: 7px;
  aspect-ratio: 16 / 9;
}

body.cdp-modal-active { overflow: hidden; }
.cdp-reader .cdp-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(10, 19, 14, 0.94);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cdp-modal-head {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 10px max(16px, calc((100vw - 1200px) / 2));
  background: #1c2c23;
  border-bottom: 1px solid #3c5746;
}
.cdp-modal-head strong { font-weight: 600; font-size: 15px; color: #fff; }
.cdp-zoom-counter { margin-left: auto; color: #e7eee7; font-size: 13px; }
.cdp-modal-tools { margin-left: auto; display: flex; align-items: center; gap: 7px; }
.cdp-modal-head .cdp-zoom-counter + .cdp-modal-tools { margin-left: 0; }
.cdp-reader .cdp-modal button {
  color: #fff;
  background: #2d4737;
  border: 1px solid #56715e;
  border-radius: 8px;
  min-width: 42px;
  min-height: 40px;
  font-size: 18px;
}
.cdp-reader .cdp-modal button:hover:not(:disabled) { background: #3f694e; }
.cdp-zoom-scroll {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: safe center;
  align-items: flex-start;
  padding: 22px 10px;
  overscroll-behavior: contain;
}
.cdp-zoom-canvas {
  display: block;
  height: auto;
  max-width: none;
  background: #fff;
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  align-self: flex-start;
  margin: 0 auto;
}
.cdp-modal-foot {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  padding: 12px;
  background: #192a20;
  border-top: 1px solid #3c5746;
}
.cdp-reader .cdp-modal-foot button { padding: 8px 20px; font-size: 13px; }
.cdp-embedded-video {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
}
.cdp-embedded-video video { max-width: min(1100px, 100%); max-height: 78vh; background: #000; }
.cdp-reader:fullscreen {
  max-width: none;
  height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.cdp-reader:fullscreen .cdp-book-stage { flex: 1; min-height: 0 !important; height: auto !important; }
.cdp-reader:fullscreen .cdp-reader-heading { padding-top: 12px; padding-bottom: 12px; }
.cdp-reader:fullscreen .cdp-reading-tip,
.cdp-reader:fullscreen .cdp-reader-fallback { display: none; }

@media (max-width: 740px) {
  .cdp-reader { border-radius: 12px; margin: 14px auto 25px; }
  .cdp-reader-heading { padding: 15px; display: block; }
  .cdp-reader-brand { gap: 10px; }
  .cdp-brand-mark { width: 37px; height: 37px; font-size: 22px; }
  .cdp-reader .cdp-title { font-size: 19px !important; }
  .cdp-eyebrow { font-size: 9px; letter-spacing: .12em; }
  .cdp-heading-actions { margin: 13px 0 0 47px; gap: 7px; }
  .cdp-reader .cdp-text-action { padding: 7px 10px; font-size: 11px; min-height: 36px; }
  .cdp-book-surface { inset: 10px; }
  .cdp-reader-error a { display: block; margin-top: 8px; color: #175a47 !important; font-weight: 700; }
.cdp-reader-toolbar { gap: 0; padding: 9px 5px; min-height: 55px; }
  .cdp-reader .cdp-tool { width: 32px; min-width: 32px; height: 39px; font-size: 26px; }
  .cdp-reader .cdp-first, .cdp-reader .cdp-last { font-size: 17px; }
  .cdp-reader .cdp-fullscreen { font-size: 19px; }
  .cdp-reader .cdp-zoom { font-size: 21px; }
  .cdp-toolbar-divider { margin: 0 2px; }
  .cdp-progress-wrap { padding: 0 3px; gap: 5px; min-width: 62px; }
  .cdp-page-count { min-width: 45px; font-size: 10px; }
  .cdp-reading-tip { font-size: 11px; padding: 0 13px; }
  .cdp-modal-head { padding: 8px 10px; gap: 8px; min-height: 55px; }
  .cdp-modal-head strong { font-size: 12px; }
  .cdp-zoom-counter { font-size: 11px; }
  .cdp-modal-tools { gap: 5px; }
  .cdp-reader .cdp-modal button { min-width: 36px; min-height: 36px; }
  .cdp-zoom-scroll { padding: 10px 6px; }
}

@media (max-width: 355px) {
  .cdp-reader .cdp-tool { width: 28px; min-width: 28px; }
  .cdp-page-count { min-width: 40px; }
  .cdp-reader .cdp-title { font-size: 17px !important; }
  .cdp-brand-mark { display: none; }
  .cdp-heading-actions { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cdp-loader { animation-duration: 1.5s; }
}
