@import url('https://fonts.googleapis.com/css2?family=Dancing+Script:wght@700&display=swap');

/* Reset default styles */
html, body {
  height: 100%;
  margin: 0;
  background-color: transparent;
}

#album-wrapper {
    width: 1100px;
    height: 733px;
    margin: 50px auto;
    position: relative;
}

#album-container {
    width: 1100px; /* Double page width from the start */
    height: 733px;
    position: relative;
    perspective: 2500px;
    left: 50%;
    transform: translateX(-50%);
}

#book {
  width: 100%;
  height: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  transform-style: preserve-3d;
  transform: rotateX(50deg) rotateY(0deg) rotateZ(-30deg);
  transition: transform 1s ease-in-out;
  transform-origin: right center;
}

#book.straightened {
    transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}

/* --- Album Section --- */
.photo-album-section {
    padding: 60px 0;
    background: transparent; /* Match the main background */
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-title {
    text-align: center;
    color: var(--text-color);
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    margin-bottom: 10px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-color);
    font-family: 'Heebo', sans-serif;
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.8;
}

/* --- Close Button Styles --- */
#close-album-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001; /* Above the particles */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, background-color 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#close-album-btn:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

#close-album-btn span {
    position: relative;
    top: -2px;
}

/* --- Page Content Styles --- */
.page {
  background-color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.page-content {
    position: relative; /* For blurred background and titles */
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.page-content::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(20px) brightness(0.8);
  animation: pulse 2s infinite ease-in-out;
}

/* Hide the blurred background for the cover page specifically */
.stf__item--cover .page-content::before {
    display: none;
}

.page-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: relative; /* Establish stacking context */
    z-index: 1; /* Base layer */
}

.cover-title-top,
.cover-title-bottom {
    position: absolute;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'Dancing Script', cursive;
    color: white;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
    pointer-events: none; /* Make text non-interactive */
    z-index: 2; /* Ensure titles are above the image */
}

.cover-title-top {
    top: 50px;
    font-size: 3.5em;
}

.cover-title-bottom {
    bottom: 50px;
    font-size: 2.5em;
}

/* --- End Page Styles --- */
.end-page .page-content img {
    filter: brightness(0.4); /* Darken the last image to make text pop */
}

.end-page .page-content::before {
    display: none; /* Hide the pulsating blur on the last page */
}

.end-page-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Dancing Script', cursive;
    font-size: 5em;
    color: white;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 3; /* Ensure it's on top */
}

#close-album-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 24px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out, transform 0.3s ease;
}



#close-album-btn:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.9);
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(0.95);
  }
}

.cover-back .page-content {
    background: linear-gradient(45deg, #a986d9, #6a5acd);
    color: white;
    font-family: 'Amatic SC', cursive;
}

.cover-back h2 {
    font-size: 3rem;
}

#book .page--left {
  border-right: 1px solid #ddd;
}

#book .page--right {
  border-left: 1px solid #ddd;
}

#book .page img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* Show the whole image */
  position: relative; /* Place it above the blurred background */
  z-index: 2;
}

#book .page-content {
    width: 100%;
    height: 100%;
    background-color: var(--page-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden; /* Contain the blurred pseudo-element */
}

#book .page-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    filter: blur(15px) brightness(0.8);
    z-index: 1; /* Behind the main image */
}

/* --- Transition Styles --- */
.album-3d-cover {
    transition: opacity 0.6s ease-in-out;
}

#book-container {
    /* Take up the whole screen */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;

    /* Start hidden and non-interactive */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out 0.2s; /* Delay the fade-in slightly */
    z-index: 9999; /* Ensure it's above other content */
}

/* Elegant Cover Style for the flipbook itself */
#book .cover-front .page-content, 
#book .cover-back .page-content {
    background-color: #5d4037; /* Dark brown base */
    background-image: linear-gradient(rgba(255,255,255,0.05) 2px, transparent 2px),
                      linear-gradient(90deg, rgba(255,255,255,0.05) 2px, transparent 2px);
    background-size: 100px 100px, 100px 100px;
}

#book .cover-front .page-content h2, 
#book .cover-back .page-content h2 {
    color: rgba(0, 0, 0, 0.4);
    font-family: 'Amatic SC', cursive;
    font-size: 4.5rem;
    font-weight: 700;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.15);
    position: static;
}
