/* src/public/css/main.css */
body { 
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; 
  background: linear-gradient(to right, #FFEE12 50%, #FFFFFF 50%); /* Vatican flag-inspired background */
}
.prose h2 { color: #1f2937; }
.prose h2::before { content: ""; display: block; width: 50px; height: 4px; background: #fbbf24; margin-bottom: 1rem; } /* Yellow accent */
a { color: #dc2626; } /* Deep red links */
a:hover { color: #b91c1c; }
button { background: #dc2626; color: white; }
button:hover { background: #b91c1c; }

.btn-yellow {
	display: inline-block;
	background: linear-gradient(180deg, #fbbf24 0%, #f59e00 100%);
	color: #7c2d12;
	font-weight: 600;
	border-radius: 9999px;
	box-shadow: 0 4px 16px 0 rgba(0,0,0,0.08);
	padding: 0.75rem 2rem;
	text-align: center;
	transition: box-shadow 0.2s, transform 0.2s, background 0.2s;
}
.btn-yellow:hover {
	background: linear-gradient(180deg, #f59e00 0%, #fbbf24 100%);
	box-shadow: 0 8px 24px 0 rgba(0,0,0,0.12);
	transform: translateY(-2px) scale(1.04);
}
.animate-fadein {
	animation: fadein 1.2s cubic-bezier(.4,0,.2,1);
}
@keyframes fadein {
	from { opacity: 0; transform: translateY(20px); }
	to { opacity: 1; transform: none; }
}

/* Flipbook styles */
.flipbook-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  perspective: 1500px;
  margin-bottom: 2rem;
}
.book-viewport {
  position: relative;
  display: flex;
  width: 900px;
  height: 600px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  transform-style: preserve-3d;
}
.page-wrapper {
  width: 50%;
  height: 100%;
  background: #fff;
  border: 1px solid #eee;
  position: relative;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  z-index: 2; /* ensure pages sit above the idle flipping layer */
}
.page-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.flipping-effect {
  position: absolute;
  top: 0; left: 50%;
  width: 50%; height: 100%;
  z-index: 0; /* idle: keep behind page canvases */
  transform-origin: left center;
  transition: transform 0.6s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.flipping-back-side {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transform: rotateY(180deg);
  backface-visibility: hidden;
}
.flipping-effect.is-flipping-forward {
  transform: rotateY(-180deg);
  z-index: 40; /* bring forward during animation */
}
.flipping-effect.is-flipping-backward {
  transform: rotateY(0deg);
  z-index: 40; /* bring forward during animation */
}
.nav-button {
  background: #fbbf24;
  color: #7c2d12;
  font-weight: bold;
  border: none;
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  margin: 0 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.nav-button:disabled {
  background: #eee;
  color: #bbb;
  cursor: not-allowed;
}
.nav-button:hover:not(:disabled) {
  background: #f59e00;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* Flipbook navigation button styles */
.flipbook-nav-btn {
  background: #7b1e22; /* dark maroon red */
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.2s, box-shadow 0.2s;
  cursor: pointer;
  margin: 0 8px;
}
.flipbook-nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.flipbook-nav-btn:hover {
  background: #a32c2e;
  box-shadow: 0 4px 16px rgba(123,30,34,0.15);
}
.flipbook-arrow {
  display: block;
  width: 20px;
  height: 20px;
}

/* Side navigation buttons for flipbook */
.flipbook-nav-btn-side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  box-shadow: 0 4px 16px rgba(123,30,34,0.15);
  background: #7b1e22;
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.18s;
}
.flipbook-nav-btn-side:active {
  transform: translateY(-50%) scale(0.96);
}
.flipbook-nav-btn-left {
  left: -32px;
}
.flipbook-nav-btn-right {
  right: -32px;
}
.flipbook-arrow {
  width: 28px;
  height: 28px;
  display: block;
}

/* Header link color */
.header-link {
  color: #7b1e22; /* dark maroon red */
}
.header-link:hover {
  color: #a32c2e; /* slightly lighter on hover */
}

/* Mobile PDF viewer */
.mobile-pdf {
  display: none;
}
@media (max-width: 1024px) {
  .flipbook-container {
    display: none;
  }
  .mobile-pdf {
    display: block;
  }
}

/* HD screen optimizations */
@media (min-width: 1200px) {
  .book-viewport {
    width: 1000px;
    height: 700px;
  }
  .page-canvas {
    width: 100%;
    height: 100%;
  }
}

/* Flipbook timeline styles */
.flipbook-timeline-container {
  margin-top: 1rem;
}
.flipbook-timeline-row {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  z-index: 20;
  pointer-events: auto;
}
.flipbook-timeline {
  flex: 1 1 auto;
  min-width: 0;
  background: #f3f4f6;
  border-radius: 9999px;
  height: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 8px;
  overflow-x: auto;
  white-space: nowrap;
  position: relative;
}
.flipbook-timeline-marker {
  width: 12px;
  height: 12px;
  background: #9ca3af; /* darker gray for visibility */
  border-radius: 50%;
  margin: 0 4px;
  transition: background 0.2s, box-shadow 0.2s;
  position: relative;
  cursor: pointer;
}
.flipbook-timeline-marker::after {
  /* small badge showing page(s) from data-pages - always visible */
  content: attr(data-pages);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #ffffffcc; /* slightly translucent */
  color: #374151;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  white-space: nowrap;
  opacity: 1;
  pointer-events: none;
  transition: transform 0.12s, opacity 0.12s;
}
.flipbook-timeline-marker.current {
  background: #7b1e22;
  box-shadow: 0 0 0 2px #fbbf24;
}
.flipbook-timeline-flag {
  position: absolute;
  top: -34px;
  left: 0;
  transform: translateX(-50%);
  background: #fff;
  color: #7b1e22;
  font-weight: bold;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  white-space: nowrap;
  z-index: 30;
}
.flipbook-timeline-flag.visible {
  display: block !important;
  opacity: 1;
}
.flipbook-timeline-flag {
  transition: opacity 0.18s ease, transform 0.18s ease;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
}
.flipbook-timeline-flag.visible {
  opacity: 1;
  transform: translateY(-10px) scale(1);
}
/* add a small arrow/pointer under the flag */
.flipbook-timeline-flag::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.06));
}
#flipbook-jump-form {
  flex: 0 0 auto;
  margin-left: 16px;
}
#flipbook-jump-form input[type="number"] {
  width: 56px;
}
#flipbook-jump-form button {
  min-width: 40px;
}
