/* ============================================
   BULLETIN — Page Styles
   ============================================ */

.bulletin-wrapper {
  max-width: 700px;
  margin: calc(var(--nav-height) + 2rem) auto 0;
  padding: 0 1.5rem 2rem;
  position: relative;
}

.bulletin-wrapper--book {
  max-width: 960px;
}

/* --- Page Base --- */
.bulletin-page {
  display: none;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
  padding: 2.5rem 2rem;
  aspect-ratio: 8.5 / 11;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  animation: fadePageIn 0.4s ease;
  margin: 0 auto;
}

.bulletin-page--active {
  display: block;
}

@keyframes fadePageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Flipbook Layout (arrows on sides) --- */
.flipbook-outer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
}

.flip-arrow {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--color-dark);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  color: var(--color-white);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  z-index: 5;
}

.flip-arrow:hover {
  background: var(--color-accent);
  transform: scale(1.1);
}

.flip-arrow:disabled {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
  transform: none;
}

/* --- Book Views (hide all by default) --- */
.book-view {
  display: none !important;
}

.book-view.bulletin-page--active {
  display: block !important;
}

/* --- Book Spread (pages 2+3 side by side) --- */
.bulletin-spread {
  gap: 0;
}

.bulletin-spread.bulletin-page--active {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
}

.bulletin-spread .bulletin-page {
  display: block;
  border-radius: 0;
  box-shadow: none;
  aspect-ratio: 8.5 / 11;
  max-width: none;
  width: auto;
  margin: 0;
  overflow: hidden;
}

.bulletin-spread .bulletin-page:first-child {
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: 1px solid var(--color-light-gray);
}

.bulletin-spread .bulletin-page:last-child {
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.bulletin-spread {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

@media (max-width: 900px) {
  /* Spread becomes a transparent container; its children are individually navigable */
  .bulletin-spread {
    display: block !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    overflow: visible !important;
    grid-template-columns: 1fr !important;
  }

  .bulletin-spread.book-view {
    display: block !important;
  }

  .bulletin-spread .bulletin-page {
    display: none;
    border-right: none !important;
    border-bottom: none !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.08) !important;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    aspect-ratio: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
  }

  .bulletin-spread .bulletin-page.bulletin-page--active {
    display: block;
  }
}

.flip-fullscreen {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-gray);
  font-size: 0.75rem;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.flip-fullscreen:hover {
  background: var(--color-dark);
  color: var(--color-white);
}

/* Flip animation */
.book-view.flip-out-left,
.book-view.flip-out-right {
  display: block !important;
}
.bulletin-spread.flip-out-left,
.bulletin-spread.flip-out-right {
  display: grid !important;
}

.bulletin-page.flip-out-left,
  animation: flipOutLeft 0.4s ease forwards;
}
.bulletin-page.flip-in-right {
  animation: flipInRight 0.4s ease forwards;
}
.bulletin-page.flip-out-right {
  animation: flipOutRight 0.4s ease forwards;
}
.bulletin-page.flip-in-left {
  animation: flipInLeft 0.4s ease forwards;
}

@keyframes flipOutLeft {
  from { opacity: 1; transform: rotateY(0deg); }
  to   { opacity: 0; transform: rotateY(-15deg) scale(0.95); }
}
@keyframes flipInRight {
  from { opacity: 0; transform: rotateY(15deg) scale(0.95); }
  to   { opacity: 1; transform: rotateY(0deg) scale(1); }
}
@keyframes flipOutRight {
  from { opacity: 1; transform: rotateY(0deg); }
  to   { opacity: 0; transform: rotateY(15deg) scale(0.95); }
}
@keyframes flipInLeft {
  from { opacity: 0; transform: rotateY(-15deg) scale(0.95); }
  to   { opacity: 1; transform: rotateY(0deg) scale(1); }
}

/* Fullscreen mode */
.bulletin-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  background: rgba(0, 0, 0, 0.85) !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 2rem !important;
  max-width: none !important;
}

.bulletin-fullscreen .bulletin-wrapper {
  max-width: 900px;
  width: 100%;
  max-height: 92vh;
}

.bulletin-fullscreen .book-view:not(.bulletin-spread) {
  max-width: 450px;
  max-height: 92vh;
  margin: 0 auto;
  aspect-ratio: 8.5 / 11;
  overflow: hidden;
}

.bulletin-fullscreen .bulletin-spread {
  max-width: 900px;
  max-height: 92vh;
  margin: 0 auto;
}

.bulletin-fullscreen .bulletin-spread .bulletin-page {
  max-height: 92vh;
}

.bulletin-fullscreen .flip-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
}

.bulletin-fullscreen .flip-arrow-prev {
  left: 1.5rem;
}

.bulletin-fullscreen .flip-arrow-next {
  right: 1.5rem;
}

.bulletin-fullscreen .flip-fullscreen {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.bulletin-fullscreen .flip-fullscreen:hover {
  background: white;
  color: var(--color-dark);
}

/* Bulletin Control Bar */
.bulletin-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem auto 0;
  flex-wrap: wrap;
}

.bulletin-control-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-white);
  border-radius: 50px;
  padding: 0.4rem 0.6rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.bulletin-ctrl-btn {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--color-dark);
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.bulletin-ctrl-btn:hover {
  background: var(--color-off-white);
  color: var(--color-accent);
}

.bulletin-zoom-level {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-gray);
  letter-spacing: 0.5px;
  min-width: 42px;
  text-align: center;
  user-select: none;
}

/* Page counter */
.flip-page-counter {
  font-family: var(--font-body);
  font-size: 0.7rem;
  color: var(--color-gray);
  text-align: center;
  margin-top: 0.8rem;
  letter-spacing: 1px;
}

.bulletin-fullscreen .flip-page-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.5);
}

/* --- Page Navigation Dots --- */
.bulletin-page-nav {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem 0 2rem;
}

.page-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--color-light-gray);
  background: var(--color-white);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-gray);
  cursor: pointer;
  transition: all 0.3s ease;
}

.page-dot:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.page-dot.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-white);
}

/* ============================================
   PAGE 1: COVER
   ============================================ */
.cover-page {
  text-align: center;
  background: var(--color-white);
  padding: 2rem 2rem 1.5rem;
  flex-direction: column;
}

.cover-page.bulletin-page--active {
  display: flex;
}

.cover-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.cover-date {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--color-dark);
  margin-bottom: 0.3rem;
}

.cover-ward {
  font-family: 'PT Serif', Georgia, serif;
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--color-dark);
  margin-bottom: 0;
  line-height: 1.1;
}

.cover-title {
  font-family: var(--font-body);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--color-dark);
  margin-bottom: 1.2rem;
  line-height: 1;
}

.cover-scripture-box {
  border: 2px dotted #999;
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem 1rem;
  max-width: 340px;
  margin-bottom: 1rem;
}

.scripture-text {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.7;
  color: var(--color-dark);
  text-transform: uppercase;
}

.scripture-ref {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--color-gray);
  margin-top: 0.6rem;
}

.cover-hero-image {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.cover-logo {
  margin-top: auto;
  padding-top: 0;
  padding-bottom: 0.5rem;
}

.cover-logo img {
  width: 150px;
  height: auto;
  margin: 0 auto;
}

/* ============================================
   PAGE 2: SACRAMENT MEETING
   ============================================ */
.meeting-page {
  padding: 1.5rem 2rem;
}

.page-heading {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-dark);
  margin-bottom: 0.4rem;
}

.section-heading {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-dark);
  margin: 0.5rem 0 0.2rem;
}

.section-heading-large {
  font-family: 'PT Serif', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-dark);
  margin: 0.5rem 0 0.15rem;
}

.divider-thick {
  height: 2px;
  background: var(--color-dark);
  margin: 0.5rem 0 0.6rem;
}

.divider-thin {
  height: 1px;
  background: var(--color-dark);
  margin: 0.4rem 0 0.8rem;
}

.divider-accent {
  height: 2px;
  background: var(--color-dark);
  margin: 0.4rem 0;
}

.meeting-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.25rem 0;
  gap: 1rem;
}

.meeting-label {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-dark);
}

.meeting-value {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-dark);
  text-align: right;
}

.meeting-centered {
  text-align: center;
  padding: 1.5rem 0;
}

.program-item {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 0.3rem;
}

.meeting-row-bottom {
  margin-top: auto;
  padding-top: 2rem;
}

/* ============================================
   PAGE 3: ANNOUNCEMENTS
   ============================================ */
.announcements-page {
  padding: 1.5rem 2rem;
}

.announcements-list {
  padding: 0.5rem 0;
}

.announcement-entry {
  margin-bottom: 0.8rem;
}

.announcement-entry p {
  font-family: var(--font-body);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--color-dark);
}

.announcement-entry strong {
  font-weight: 700;
}

.cleaning-section {
  margin-top: 2rem;
}

.cleaning-entry {
  font-family: var(--font-body);
  font-size: 0.72rem;
  color: var(--color-dark);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* ============================================
   PAGE 4: CONTACTS & MISSIONARIES
   ============================================ */
.contacts-page {
  padding: 0.7rem 1rem;
}

.contacts-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.2rem 0;
  table-layout: fixed;
}

.contacts-table td {
  font-family: var(--font-body);
  font-size: 0.72rem;
  padding: 0.15rem 0.15rem;
  vertical-align: middle;
  line-height: 1.4;
}

.contact-role {
  font-weight: 700;
  color: var(--color-dark);
  width: 44%;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-name {
  text-align: right;
  color: var(--color-dark);
  width: 30%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contact-phone {
  text-align: right;
  color: var(--color-dark);
  width: 26%;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.missionaries-heading {
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

.missionaries-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 0.5rem;
  margin: 0.4rem 0;
}

.missionary-card {
  text-align: center;
  padding: 0.15rem 0.1rem;
  line-height: 1.3;
}

.missionary-card h4 {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-dark);
  margin-bottom: 0.05rem;
}

.mission-location {
  font-family: var(--font-body);
  font-size: 0.62rem;
  color: var(--color-gray);
  margin-bottom: 0.05rem;
}

.mission-email {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: var(--color-dark);
  word-break: break-all;
  line-height: 1.2;
}

.missionaries-footer-note {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--color-dark);
  margin-top: 0.5rem;
  font-style: italic;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
  .bulletin-wrapper--book {
    max-width: 100%;
    padding: 0 0.5rem;
  }

  .flip-fullscreen {
    top: 0.5rem;
    right: 0.5rem;
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 768px) {
  /* Arrows become floating overlay inside bulletin on mobile */
  .flipbook-outer {
    position: relative;
  }

  .flipbook-outer .flip-arrow,
  .pdf-flipbook .flip-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    font-size: 1rem;
    z-index: 10;
  }

  .flipbook-outer .flip-arrow-prev,
  .pdf-flipbook .flip-arrow-prev {
    left: 0.5rem;
  }

  .flipbook-outer .flip-arrow-next,
  .pdf-flipbook .flip-arrow-next {
    right: 0.5rem;
  }

  /* Bulletin controls shrink */
  .bulletin-controls {
    gap: 0.4rem;
    padding: 0 0.5rem;
  }

  .bulletin-control-group {
    padding: 0.3rem 0.4rem;
    gap: 0.2rem;
  }

  .bulletin-ctrl-btn {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .bulletin-zoom-level {
    font-size: 0.65rem;
    min-width: 36px;
  }
}

@media (max-width: 900px) {
  /* All bulletin pages flow naturally on mobile — no paper aspect-ratio lock */
  .bulletin-page {
    aspect-ratio: auto !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    min-height: 0 !important;
  }
}

@media (max-width: 600px) {
  .bulletin-page {
    padding: 1.5rem 1.2rem;
    min-height: auto;
    border-radius: var(--radius);
  }

  .bulletin-wrapper {
    padding: 0 0.5rem;
  }

  .cover-ward {
    letter-spacing: 3px;
  }

  .cover-scripture-box {
    padding: 1.2rem 0.8rem 0.8rem;
  }

  .cover-logo img {
    width: 120px;
  }

  .missionaries-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 0.4rem;
  }

  .contacts-table td {
    font-size: 0.62rem;
    padding: 0.15rem 0.1rem;
  }

  .page-heading {
    font-size: 1rem;
  }

  .section-heading {
    font-size: 0.8rem;
  }

  /* Flip arrows smaller on small phones */
  .flipbook-outer .flip-arrow,
  .pdf-flipbook .flip-arrow {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  /* Keep control pads side-by-side, just shrink them */
  .bulletin-controls {
    flex-direction: row;
    gap: 0.4rem;
    flex-wrap: nowrap;
  }

  .bulletin-control-group {
    padding: 0.3rem 0.35rem;
    gap: 0.15rem;
  }

  .bulletin-ctrl-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .bulletin-zoom-level {
    font-size: 0.6rem;
    min-width: 30px;
  }

  .flip-page-counter {
    font-size: 0.65rem;
  }
}

@media (max-width: 420px) {
  .bulletin-page {
    padding: 1.2rem 1rem;
  }

  .flipbook-outer .flip-arrow-prev,
  .pdf-flipbook .flip-arrow-prev {
    left: 0.2rem;
  }

  .flipbook-outer .flip-arrow-next,
  .pdf-flipbook .flip-arrow-next {
    right: 0.2rem;
  }

  .flip-fullscreen {
    width: 32px;
    height: 32px;
    font-size: 0.7rem;
  }

  .bulletin-ctrl-btn {
    width: 26px;
    height: 26px;
    font-size: 0.7rem;
  }

  .bulletin-zoom-level {
    min-width: 28px;
    font-size: 0.55rem;
  }
}

/* ============================================
   PRINT STYLES — Booklet Mode
   When printed, all 4 pages show in order.
   For booklet folding (half-letter/A5):
   Sheet 1 front: Page 4 (left) + Page 1 (right)
   Sheet 1 back:  Page 2 (left) + Page 3 (right)
   Use browser "Booklet" option or the .print-booklet
   class which reorders pages for manual duplex.
   ============================================ */

/* Slideshow nav (prev/next arrows around dots) */
.bulletin-slideshow-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 1rem 1rem 0.5rem;
}

.slide-arrow {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--color-dark);
  color: var(--color-white);
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.slide-arrow:hover {
  background: var(--color-accent, #8b6f3f);
  transform: scale(1.05);
}

.slide-arrow:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

/* Print button bar */
.print-btn-bar {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 0 1rem 0.75rem;
  flex-wrap: wrap;
}

.print-btn-bar button,
.print-btn-bar .btn-primary-export {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border: 1.5px solid var(--color-dark);
  border-radius: 50px;
  background: var(--color-white);
  color: var(--color-dark);
  cursor: pointer;
  transition: all 0.3s ease;
}

.print-btn-bar button:hover {
  background: var(--color-dark);
  color: var(--color-white);
}

.print-btn-bar .btn-primary-export {
  background: var(--color-accent, #8b6f3f);
  border-color: var(--color-accent, #8b6f3f);
  color: var(--color-white);
}

.print-btn-bar .btn-primary-export:hover {
  background: var(--color-dark);
  border-color: var(--color-dark);
  color: var(--color-white);
}

.print-btn-bar .btn-primary-export:disabled {
  opacity: 0.75;
  cursor: wait;
}

.export-hint {
  text-align: center;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: var(--color-gray);
  max-width: 640px;
  margin: 0 auto 2rem;
  padding: 0 1rem;
  line-height: 1.5;
}

.export-hint code {
  background: var(--color-off-white, #f2ece1);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

.pdf-export-root {
  max-width: none !important;
  width: 8.5in !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #fff !important;
}

.pdf-export-root .pdf-export-page {
  display: block !important;
  width: 8.5in !important;
  height: 11in !important;
  max-width: none !important;
  max-height: 11in !important;
  min-height: 11in !important;
  aspect-ratio: auto !important;
  padding: 0.4in 0.5in !important;
  margin: 0 !important;
  box-shadow: none !important;
  border: none !important;
  border-radius: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box;
  page-break-inside: avoid;
  break-inside: avoid;
  background: #fff;
}

.pdf-export-root .pdf-export-page + .pdf-export-page {
  page-break-before: always;
  break-before: page;
}

.pdf-export-root .pdf-export-page.cover-page {
  display: flex !important;
  justify-content: center;
  align-items: center;
}

/* Typography for PDF export — matches on-screen readability at 8.5x11 letter */
.pdf-export-root,
.pdf-export-root * {
  color: #000 !important;
}

.pdf-export-root .divider-thick,
.pdf-export-root .divider-thin,
.pdf-export-root .divider-accent {
  background: #000 !important;
}

.pdf-export-root .cover-ward  { font-size: 3.4rem !important; line-height: 1.1; }
.pdf-export-root .cover-title { font-size: 4.4rem !important; line-height: 1; margin-bottom: 3rem !important; }
.pdf-export-root .cover-date  { font-size: 1.15rem !important; letter-spacing: 4px !important; }
.pdf-export-root #cover-media { margin-top: 1rem !important; }
.pdf-export-root .cover-scripture-box { padding: 1.8rem 2rem !important; }
.pdf-export-root .scripture-text { font-size: 1.4rem !important; line-height: 1.5; }
.pdf-export-root .scripture-ref  { font-size: 1rem !important; }
.pdf-export-root .cover-logo { margin-top: 2rem !important; }
.pdf-export-root .cover-logo img { width: 210px !important; }

.pdf-export-root .page-heading {
  font-size: 2.6rem !important;
  font-weight: 700 !important;
  margin-bottom: 1rem !important;
}

.pdf-export-root .section-heading {
  font-size: 1.6rem !important;
  font-weight: 700 !important;
  margin: 1.5rem 0 0.8rem !important;
}

.pdf-export-root .section-heading-large {
  font-size: 1.9rem !important;
  font-weight: 700 !important;
  margin: 1.4rem 0 0.7rem !important;
}

.pdf-export-root .meeting-label,
.pdf-export-root .meeting-value {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
}

.pdf-export-root .meeting-row {
  padding: 0.5rem 0 !important;
}

.pdf-export-root .program-item {
  font-size: 1.4rem !important;
  font-weight: 700 !important;
}

.pdf-export-root .announcement-entry p {
  font-size: 1.2rem !important;
  line-height: 1.6 !important;
  margin-bottom: 0.85rem;
}

.pdf-export-root .cleaning-entry { font-size: 1.2rem !important; }

/* Dividers — more breathing room between text and the horizontal rules */
.pdf-export-root .divider-thick {
  height: 2.5px !important;
  margin: 1.1rem 0 !important;
}

.pdf-export-root .divider-thin {
  height: 1px !important;
  margin: 1rem 0 !important;
}

.pdf-export-root .divider-accent {
  height: 2px !important;
  margin: 1.25rem 0 !important;
}

/* Contacts table — give every row a generous fixed height so nothing clips */
.pdf-export-root .contacts-table { table-layout: fixed; width: 100%; }
.pdf-export-root .contacts-table td {
  font-size: 1.1rem !important;
  padding: 0.35rem 0.3rem !important;
  line-height: 1.35 !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  overflow: visible !important;
  height: auto !important;
}
.pdf-export-root .contact-role { font-weight: 700 !important; }

.pdf-export-root .missionaries-heading { font-size: 2rem !important; margin-top: 0.8rem !important; }
.pdf-export-root .missionary-card h4 { font-size: 1.1rem !important; font-weight: 700 !important; }
.pdf-export-root .mission-location { font-size: 0.95rem !important; }
.pdf-export-root .mission-email    { font-size: 0.88rem !important; }
.pdf-export-root .missionaries-footer-note { font-size: 1.05rem !important; margin-top: 0.8rem !important; }
.pdf-export-root .missionaries-grid { gap: 0.6rem 1rem !important; }

@media print {
  /* Hide everything except bulletin pages */
  .site-nav,
  .site-footer,
  .bulletin-page-nav,
  .bulletin-slideshow-nav,
  .print-btn-bar,
  .export-hint,
  .bulletin-controls,
  .flip-arrow,
  .flip-fullscreen,
  .flip-page-counter,
  .feature-cards,
  .quote-section {
    display: none !important;
  }

  /* Show all book views when printing */
  .book-view {
    display: block !important;
  }

  /* Spread becomes 2 separate pages when printing */
  .bulletin-spread {
    display: block !important;
    grid-template-columns: none !important;
  }

  body {
    background: white !important;
    margin: 0;
    padding: 0;
    transform: none !important;
  }

  .bulletin-wrapper {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    display: block !important;
  }

  .flipbook-outer {
    display: block !important;
  }

  /* Each bulletin page prints on its own sheet */
  .bulletin-page {
    display: block !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border: none !important;
    page-break-after: always !important;
    page-break-inside: avoid !important;
    break-after: page;
    break-inside: avoid;
    min-height: auto;
    max-height: none !important;
    aspect-ratio: auto !important;
    width: 100% !important;
    max-width: none !important;
    padding: 0.4in 0.5in !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  .bulletin-page:last-child {
    page-break-after: auto !important;
    break-after: auto;
  }

  /* Cover page — fill the page */
  .cover-page {
    min-height: 95vh;
    display: flex !important;
    justify-content: center;
    align-items: center;
  }

  /* Scale up content for print since we're not constrained by screen */
  .cover-ward { font-size: 3rem !important; }
  .cover-title { font-size: 4rem !important; }
  .cover-date { font-size: 1rem !important; letter-spacing: 4px !important; }
  .scripture-text { font-size: 1.2rem !important; }
  .scripture-ref { font-size: 0.9rem !important; }
  .cover-logo img { width: 200px !important; }

  .page-heading { font-size: 1.8rem !important; margin-bottom: 0.8rem !important; }
  .section-heading { font-size: 1.3rem !important; margin: 1rem 0 0.5rem !important; }
  .section-heading-large { font-size: 1.4rem !important; margin: 1rem 0 0.3rem !important; }

  .meeting-label, .meeting-value { font-size: 1rem !important; }
  .program-item { font-size: 1.05rem !important; }

  .announcement-entry p { font-size: 0.95rem !important; line-height: 1.6 !important; }
  .cleaning-entry { font-size: 0.9rem !important; }

  .contacts-table td { font-size: 0.85rem !important; padding: 0.2rem 0.3rem !important; }
  .missionary-card h4 { font-size: 0.9rem !important; }
  .mission-location { font-size: 0.78rem !important; }
  .mission-email { font-size: 0.72rem !important; }
  .missionaries-footer-note { font-size: 0.9rem !important; }

  .divider-thick { height: 2px !important; margin: 0.8rem 0 !important; }

  .cover-logo img {
    width: 160px;
  }

  /* Meeting page — fill the page */
  .meeting-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  /* Contacts — tighter spacing for print */
  .contacts-table td {
    font-size: 0.75rem;
    padding: 0.25rem 0.2rem;
  }

  .missionaries-grid {
    gap: 0.8rem;
  }

  .missionary-card {
    padding: 0.5rem 0.3rem;
  }

  /* Ensure black text */
  * {
    color: black !important;
  }

  .divider-thick,
  .divider-thin,
  .divider-accent {
    background: black !important;
  }
}

/* ============================================
   BOOKLET PRINT MODE
   JS wraps every 2 panels in a .booklet-sheet which becomes one landscape sheet.
   Fold order is set in JS: contacts | cover, then meeting | announcements.
   ============================================ */
@media print {
  @page booklet {
    size: letter landscape;
    margin: 0;
  }
  body.printing-booklet {
    page: booklet;
  }

  html:has(body.printing-booklet),
  body.printing-booklet {
    height: 200vh !important;
    min-height: 0 !important;
    max-height: 200vh !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .bulletin-wrapper.print-booklet {
    position: relative !important;
    display: block !important;
    width: 100vw !important;
    height: 200vh !important;
    max-height: 200vh !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  .bulletin-wrapper.print-booklet .booklet-sheet {
    position: absolute !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: row !important;
  }

  .bulletin-wrapper.print-booklet .booklet-sheet:nth-child(1) { top: 0 !important; }
  .bulletin-wrapper.print-booklet .booklet-sheet:nth-child(2) { top: 100vh !important; }

  .bulletin-wrapper.print-booklet .pdf-export-page {
    position: relative !important;
    flex: 0 0 50vw !important;
    width: 50vw !important;
    height: 100vh !important;
    min-height: 0 !important;
    max-height: 100vh !important;
    padding: 0.3in 0.35in !important;
    overflow: hidden !important;
  }

  /* Cancel the adjacent-sibling page-break from pdf-export-root — sheets handle layout */
  .bulletin-wrapper.print-booklet .pdf-export-page + .pdf-export-page {
    page-break-before: auto !important;
    break-before: auto !important;
  }

  /* Typography scaled to ~65% for half-letter panels */
  .bulletin-wrapper.print-booklet .cover-ward  { font-size: 2.4rem !important; }
  .bulletin-wrapper.print-booklet .cover-title { font-size: 3rem !important; margin-bottom: 1.5rem !important; }
  .bulletin-wrapper.print-booklet .cover-date  { font-size: 0.85rem !important; }
  .bulletin-wrapper.print-booklet .scripture-text { font-size: 1rem !important; }
  .bulletin-wrapper.print-booklet .scripture-ref  { font-size: 0.78rem !important; }
  .bulletin-wrapper.print-booklet .cover-logo img { width: 140px !important; }

  .bulletin-wrapper.print-booklet .page-heading         { font-size: 1.8rem !important; margin-bottom: 0.6rem !important; }
  .bulletin-wrapper.print-booklet .section-heading      { font-size: 1.1rem !important; margin: 0.9rem 0 0.45rem !important; }
  .bulletin-wrapper.print-booklet .section-heading-large{ font-size: 1.3rem !important; margin: 0.85rem 0 0.4rem !important; }

  .bulletin-wrapper.print-booklet .meeting-label,
  .bulletin-wrapper.print-booklet .meeting-value { font-size: 0.88rem !important; }
  .bulletin-wrapper.print-booklet .meeting-row   { padding: 0.25rem 0 !important; }
  .bulletin-wrapper.print-booklet .program-item  { font-size: 1rem !important; }

  .bulletin-wrapper.print-booklet .announcement-entry p { font-size: 0.85rem !important; margin-bottom: 0.5rem !important; line-height: 1.5 !important; }
  .bulletin-wrapper.print-booklet .cleaning-entry       { font-size: 0.85rem !important; }

  .bulletin-wrapper.print-booklet .divider-thick  { margin: 0.7rem 0 !important; }
  .bulletin-wrapper.print-booklet .divider-thin   { margin: 0.65rem 0 !important; }
  .bulletin-wrapper.print-booklet .divider-accent { margin: 0.8rem 0 !important; }

  .bulletin-wrapper.print-booklet .contacts-table td { font-size: 0.75rem !important; padding: 0.2rem 0.2rem !important; }
  .bulletin-wrapper.print-booklet .missionaries-heading { font-size: 1.4rem !important; margin-top: 0.6rem !important; }
  .bulletin-wrapper.print-booklet .missionary-card h4   { font-size: 0.78rem !important; }
  .bulletin-wrapper.print-booklet .mission-location     { font-size: 0.68rem !important; }
  .bulletin-wrapper.print-booklet .mission-email        { font-size: 0.62rem !important; }
  .bulletin-wrapper.print-booklet .missionaries-footer-note { font-size: 0.78rem !important; }
  .bulletin-wrapper.print-booklet .missionaries-grid    { gap: 0.35rem 0.7rem !important; }
}

/* ============================================
   PDF BULLETIN VIEWER
   ============================================ */

.bulletin-pdf-section {
  padding-top: calc(var(--nav-height) + 1.25rem);
  padding-left: 0;
  padding-right: 0;
}

.pdf-viewer-outer {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

.pdf-viewer-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  background-image:
    linear-gradient(180deg, rgba(12, 10, 8, 0.62), rgba(12, 10, 8, 0.72)),
    url('../images/20240505_120410.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: var(--radius-lg);
  padding: 2rem 1rem 2.25rem;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 12px 40px rgba(10, 6, 0, 0.25);
  overflow: hidden;
}

.pdf-flipbook {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
}

.pdf-pages {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  min-height: 200px;
}

.pdf-page-wrap {
  display: none;
  background: #fff;
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 8px 28px rgba(30, 20, 10, 0.14);
  overflow: hidden;
  max-width: 100%;
  position: relative;
}

.pdf-page-wrap.is-active {
  display: block;
  animation: pdfPageFade 0.4s ease both;
}

.pdf-page-wrap.is-active.flip-in-right {
  animation: pdfFlipInRight 0.4s ease both;
}

.pdf-page-wrap.is-active.flip-in-left {
  animation: pdfFlipInLeft 0.4s ease both;
}

.pdf-page-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
  border-radius: inherit;
}

.pdf-page-wrap canvas {
  display: block;
}

@keyframes pdfPageFade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pdfFlipInRight {
  from { opacity: 0; transform: translateX(24px) rotateY(-8deg); }
  to   { opacity: 1; transform: translateX(0) rotateY(0); }
}

@keyframes pdfFlipInLeft {
  from { opacity: 0; transform: translateX(-24px) rotateY(8deg); }
  to   { opacity: 1; transform: translateX(0) rotateY(0); }
}

.pdf-loading {
  text-align: center;
  color: var(--color-gray);
  font-family: var(--font-body);
  padding: 3.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.pdf-loading p {
  font-style: italic;
  letter-spacing: 0.5px;
  margin: 0;
  font-size: 0.95rem;
}

.pdf-loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-accent, #8b6f3f);
  border-radius: 50%;
  animation: pdfSpin 0.8s linear infinite;
}

@keyframes pdfSpin {
  to { transform: rotate(360deg); }
}

.pdf-error {
  text-align: center;
  font-family: var(--font-body);
  color: var(--color-gray);
  padding: 2.5rem 1rem;
}

.pdf-error a {
  color: var(--color-accent, #8b6f3f);
  font-weight: 600;
  text-decoration: underline;
}

/* Anchor rendered as control button */
a.bulletin-ctrl-btn {
  text-decoration: none;
}

/* Nav strip (counter + mobile prev/next) */
.pdf-nav-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 0.9rem auto 0;
  max-width: 360px;
}

.pdf-nav-strip .flip-page-counter {
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.pdf-nav-btn {
  display: none; /* desktop hides — side arrows handle it */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--color-dark);
  color: var(--color-white);
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: all 0.2s ease;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.pdf-nav-btn:hover {
  background: var(--color-accent, #8b6f3f);
}

.pdf-nav-btn:disabled {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}

/* Mobile: swap side arrows for the bottom nav strip */
@media (max-width: 900px) {
  .pdf-side-arrow {
    display: none !important;
  }
  .pdf-nav-btn {
    display: inline-flex;
  }
}

/* Fullscreen PDF viewer */
.pdf-viewer-outer.bulletin-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 14, 8, 0.92);
  margin: 0;
  padding: 1rem;
  max-width: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-viewer-outer.bulletin-fullscreen .pdf-viewer-stage {
  flex: 1;
  overflow-y: auto;
  background: transparent;
  padding: 1.25rem 0.5rem 2rem;
}

.pdf-viewer-outer.bulletin-fullscreen .bulletin-controls {
  margin: 0;
}

/* Mobile */
@media (max-width: 900px) {
  .pdf-viewer-outer {
    padding: 0 0.5rem;
  }

  .pdf-viewer-stage {
    padding: 1rem 0.5rem 1.25rem;
    border-radius: var(--radius-md, 10px);
  }

  .pdf-pages {
    gap: 1rem;
  }

  .pdf-page-wrap {
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.08),
      0 6px 18px rgba(30, 20, 10, 0.12);
  }
}

@media (max-width: 480px) {
  .pdf-viewer-stage {
    padding: 0.75rem 0.35rem 1rem;
  }
}

/* Print */
@media print {
  .pdf-viewer-outer .bulletin-controls,
  .pdf-loading,
  .pdf-error {
    display: none !important;
  }
  .pdf-viewer-stage {
    background: none;
    box-shadow: none;
    padding: 0;
  }
  .pdf-page-wrap {
    box-shadow: none;
    page-break-after: always;
  }
}
