/* 3D Book Page-Flip Transition Styles */

/* Dimmed background overlay */
#book-transition-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  z-index: 100000;
  transition: opacity 0.4s ease;
  perspective: 2000px;
}

#book-transition-overlay.active {
  opacity: 1;
  pointer-events: all;
}

/* The Book Cover Container */
.book-cover {
  position: relative;
  width: 620px;
  height: 420px;
  background: #3e271a; /* deep leather brown */
  border-radius: 12px;
  box-shadow: 0 35px 70px rgba(0, 0, 0, 0.7), 
              inset 0 0 30px rgba(0, 0, 0, 0.6);
  padding: 10px;
  display: flex;
  transform: rotateX(12deg) rotateY(-5deg);
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

/* The Book Pages Area */
.book {
  position: relative;
  width: 100%;
  height: 100%;
  background: #fdfaf2; /* cover base */
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  transform-style: preserve-3d;
}

/* Page Base Styling */
.book-page {
  position: absolute;
  top: 0;
  width: 295px;
  height: 400px;
  background: #f5eedc; /* aged parchment color */
  box-shadow: inset 0 0 20px rgba(184, 155, 117, 0.2);
  transform-style: preserve-3d;
  overflow: hidden;
}

/* Texture overlays for pages */
.book-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.05) 100%),
              linear-gradient(to right, rgba(0,0,0,0.08) 0%, transparent 5%, transparent 95%, rgba(0,0,0,0.08) 100%);
  pointer-events: none;
}

/* Left Static Page */
.book-page.left {
  left: 5px;
  border-radius: 5px 0 0 5px;
  transform-origin: right center;
  border-right: 1px solid rgba(0, 0, 0, 0.15);
}

/* Right Static Page */
.book-page.right {
  right: 5px;
  border-radius: 0 5px 5px 0;
  transform-origin: left center;
  border-left: 1px solid rgba(0, 0, 0, 0.15);
}

/* Spine Shadow Overlay (the fold of the book) */
.book-spine {
  position: absolute;
  left: 295px;
  top: 0;
  width: 20px;
  height: 400px;
  background: linear-gradient(to right, 
    rgba(0, 0, 0, 0.25) 0%, 
    rgba(0, 0, 0, 0.05) 30%, 
    rgba(0, 0, 0, 0.0) 50%, 
    rgba(0, 0, 0, 0.05) 70%, 
    rgba(0, 0, 0, 0.25) 100%);
  z-index: 20;
  pointer-events: none;
}

/* Middle Flipping Pages (initially stacked on the left, turning to the right) */
.book-page.flipping {
  left: 5px;
  transform-origin: 295px center; /* rotating around the spine edge (X = 295px) */
  border-radius: 5px 0 0 5px;
  z-index: 10;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  backface-visibility: visible;
}

/* Keyframes for turning backwards (left page flips to right: 0deg to -180deg) */
@keyframes flip-backward-animation {
  0% {
    transform: rotateY(0deg);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  30% {
    /* lift page up, shadows change */
    box-shadow: 15px 0 30px rgba(0,0,0,0.25);
  }
  100% {
    transform: rotateY(-180deg);
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
  }
}

/* Sequential delay for flipping pages */
.book-exit-active .book-page.flipping-1 {
  animation: flip-backward-animation 0.7s cubic-bezier(0.5, 0, 0.25, 1) forwards;
  animation-delay: 0.1s;
}

.book-exit-active .book-page.flipping-2 {
  animation: flip-backward-animation 0.7s cubic-bezier(0.5, 0, 0.25, 1) forwards;
  animation-delay: 0.35s;
}

.book-exit-active .book-page.flipping-3 {
  animation: flip-backward-animation 0.7s cubic-bezier(0.5, 0, 0.25, 1) forwards;
  animation-delay: 0.6s;
}

/* Page inner contents */
.page-content {
  padding: 35px 25px;
  font-family: 'Georgia', serif;
  color: #4a2e1b;
  font-size: 13.5px;
  line-height: 1.6;
}

/* Year indicator in flipping pages */
.year-display {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 40px;
  color: rgba(74, 46, 27, 0.25);
  text-shadow: 1px 1px 1px rgba(255,255,255,0.6);
}

.year-sub {
  font-size: 14px;
  font-family: 'Georgia', serif;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: rgba(74, 46, 27, 0.35);
}

/* White flash overlay */
#portal-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  z-index: 100005;
}

/* Flash burst animation */
.flash-active {
  animation: flash-burst-animation 0.8s cubic-bezier(0.7, 0, 0.3, 1) forwards;
  animation-delay: 0.85s; /* Fires right as the 3rd page finishes flipping */
  pointer-events: all;
}

@keyframes flash-burst-animation {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.15;
  }
  100% {
    opacity: 1;
  }
}

/* Flash fade-out on new page load */
.flash-out-active {
  animation: flash-out-animation 0.8s ease-out forwards;
}

@keyframes flash-out-animation {
  0% {
    opacity: 1;
    pointer-events: all;
  }
  100% {
    opacity: 0;
    pointer-events: none;
  }
}

/* Page pop-up reveal animation for old_events.html */
.page-reveal-active {
  animation: page-reveal-animation 0.9s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes page-reveal-animation {
  0% {
    transform: scale(0.95);
    filter: blur(5px);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    filter: blur(0px);
    opacity: 1;
  }
}

/* Button styles for portal redirection */
.btn-portal-archive {
  background-color: #e65c00 !important; /* solid saffron/orange */
  border: 2px solid #e65c00 !important;
  color: #ffffff !important;
  border-radius: 30px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px rgba(230, 92, 0, 0.3) !important;
  transition: all 0.3s ease !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
}

.btn-portal-archive:hover {
  background-color: #cc5200 !important;
  border-color: #cc5200 !important;
  box-shadow: 0 6px 20px rgba(230, 92, 0, 0.5) !important;
  transform: translateY(-2px) !important;
}

.btn-portal-idy {
  background-color: transparent !important;
  border: 2px solid #e65c00 !important;
  color: #e65c00 !important;
  border-radius: 30px !important;
  font-weight: 600 !important;
  transition: all 0.3s ease !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
}

.btn-portal-idy:hover {
  background-color: rgba(230, 92, 0, 0.08) !important;
  box-shadow: 0 6px 20px rgba(230, 92, 0, 0.25) !important;
  transform: translateY(-2px) !important;
}

