/* ============================================== */
/* --- OUR STORY SECTION (Revised V3) --- */
/* ============================================== */

/* 1. Full Width Background Fix */
.story-section {
    width: 100%;
    background-color: #F0F4F7; /* The blue-ish grey background spans edge to edge */
    padding: 6rem 0; /* Vertical padding only */
    padding: 160px 0 6rem 0;
}

/* 2. Centered Content Container */
.story-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 2rem; /* Horizontal padding to keep content off edges */
    font-family: 'DM Sans', sans-serif;
    color: #35302A; 
}

/* --- HEADERS --- */
.story-header {
    text-align: center;
    margin-bottom: 5rem;
}

.story-header h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(3rem, 5vw, 4rem);
    color: #426A8D; 
    margin: 0;
}

.story-header h3 {
    font-family: 'DM Sans', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.9rem;
    color: #6C8199; 
    margin-bottom: 1rem;
    font-weight: 700;
}

.intro-quote {
    font-family:'Petit Formal Script', cursive;
    font-size: 1.6rem;
    color: #35302A;
    margin-top: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* --- LAYOUTS --- */
.story-chapter {
    display: flex;
    align-items: center; /* Vertically center text with photos */
    justify-content: center;
    gap: 5rem; /* Increased gap for less crowding */
    margin-bottom: 8rem; /* More breathing room between chapters */
}

.reverse-layout {
    flex-direction: row-reverse;
}

.centered-chapter {
    display: block;
    text-align: center;
    margin-bottom: 6rem;
}

/* --- THE "PAPER" CARD STYLE --- */
.paper-card {
    background-color: #FFFFFF;
    padding: 3.5rem; /* More internal spacing */
    border-radius: 4px; 
    box-shadow: 0 15px 35px rgba(66, 106, 141, 0.1); 
    position: relative;
    max-width: 500px;
    flex: 1;
}

.wide-card {
    max-width: 800px;
    margin: 0 auto;
    padding: 4rem;
}

.chapter-date {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #C78D4E; 
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.paper-card h2 {
    font-family: 'DM Serif Display', serif;
    color: #426A8D;
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.paper-card p {
    line-height: 1.8;
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}

/* --- POLAROID SLIDESHOW STYLING (New Structure) --- */
.photo-stack {
    flex: 1;
    display: flex;
    justify-content: center;
    max-width: 400px; /* Don't let photos get too huge */
}

.polaroid-frame {
    width: 100%;
    background-color: #FFFFFF;
    /* Changed padding: Less on top/sides, MORE on bottom for caption */
    padding: 12px 12px 45px 12px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
    position: relative;
}

.polaroid-frame:hover {
    transform: scale(1.02) rotate(0deg) !important;
    z-index: 10;
}

.photo-slideshow {
    position: relative;
    width: 100%;
    /* Aspect ratio for the image area itself */
    aspect-ratio: 1 / 1; 
    background-color: #f0f0f0;
    overflow: hidden;
}

/* The figure tag holds img and caption */
.slide {
    margin: 0; /* Reset browser default figure margin */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.slide.active {
    opacity: 1;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 3. New Caption Styling */
figcaption {
    position: absolute;
    /* Position it below the image area, in the frame padding */
    top: 100%; 
    left: 0;
    width: 100%;
    padding-top: 12px; /* Space between image bottom and text */
    text-align: center;
    font-family: 'DM Serif Display', serif; /* Handwritten feel */
    font-style: italic;
    color: #426A8D;
    font-size: 1.1rem;
}

/* Tilted effects */
.rotate-right .polaroid-frame { transform: rotate(2deg); }
.rotate-left .polaroid-frame { transform: rotate(-2deg); }

/* --- PERSPECTIVES BOXES --- */
.perspectives-container {
    display: flex;
    gap: 3rem; /* More gap */
    margin: 4rem 0 8rem;
}

.perspective-box {
    flex: 1;
    background-color: #FFFFFF; 
    padding: 3rem;
    text-align: left;
    border-radius: 4px;
    border-top: 5px solid #95B8D6;
    box-shadow: 0 10px 30px rgba(66, 106, 141, 0.08);
}

.perspective-box h3 {
    font-family: 'DM Serif Display', serif;
    color: #426A8D;
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* --- FINAL QUOTE --- */
.final-quote {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid #FFD6A6;
    font-family: 'DM Serif Display', serif;
    font-size: 1.3rem;
    color: #426A8D;
    text-align: center;
    line-height: 1.6;
}

/* Ensure the Final Chapter Heading is Serif */
.final-chapter h2 {
    font-family: 'DM Serif Display', serif !important;
}

/* Fix the font for the 'Two Worlds' quote at the bottom */
.final-quote {
    margin-top: 2.5rem;
    padding-top: 2.5rem;
    border-top: 1px solid #FFD6A6;
    font-family: 'DM Serif Display', serif !important; /* Forced Serif */
    font-size: clamp(1.2rem, 2vw, 1.4rem);
    color: #426A8D !important; /* Dark Blue */
    text-align: center;
    line-height: 1.6;
    font-style: italic;
}

/* Ensure all perspective box text is clean */
.perspective-box p {
    font-family: 'DM Sans', sans-serif;
    color: #35302A;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* --- MUSIC PLAYER FLOATING BUTTON --- */
.music-player {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1000;
}

#music-toggle {
    background-color: #FFD6A6; /* Your Gold Color */
    color: #35302A; /* Your Dark Brown/Black */
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

#music-toggle:hover {
    transform: translateY(-3px);
    background-color: #f7c995;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Animation when music is playing */
#music-toggle.playing .icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Mobile Adjustment */
@media (max-width: 600px) {
    .music-player {
        bottom: 20px;
        right: 20px;
    }
    #music-toggle .text {
        display: none; /* Only show the note icon on small phones to save space */
    }
    #music-toggle {
        padding: 12px;
    }
}

/* Styling for the music button icon specifically */
#music-toggle .icon {
    font-size: 1.2rem;
    line-height: 1;
    color: #426A8D; /* Matching your dark blue */
}

/* Optional: Subtle glow when playing */
#music-toggle.playing {
    box-shadow: 0 0 20px rgba(255, 214, 166, 0.6);
    border: 1px solid #FFFFFF;
}

/* --- SCROLL TO TOP BUTTON --- */
#scroll-top {
    position: fixed;
    bottom: 90px; /* Sits above the music button */
    right: 25px;
    width: 45px;
    height: 45px;
    background-color: #ffd5a683; /* White background to pop off the blue-ish bg */
    color: #C78D4E; /* Your Gold color */
    border: 2px solid #FFD6A6;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    opacity: 0; /* Hidden by default */
    visibility: hidden;
    z-index: 999;
}

#scroll-top.show {
    opacity: 1;
    visibility: visible;
}

#scroll-top:hover {
    background-color: #FFD6A6;
    color: #4e3612;
    transform: translateY(-5px);
}

/* Mobile: Move it slightly so it doesn't crowd the screen */
@media (max-width: 600px) {
    #scroll-top {
        bottom: 80px;
        right: 20px;
        width: 40px;
        height: 40px;
    }
}

/* ★ NEW / IMPROVED: Emotional breathing divider */
.story-divider {
    text-align: center;
    font-size: 1.5rem;
    color: #C78D4E;
    opacity: 0.5;
    margin: 4rem 0;
}

/* ============================================== */
/* --- MOBILE FIXES (Addressing overcrowding) --- */
/* ============================================== */
@media (max-width: 850px) {
    .story-section { 
        /* On mobile, the nav bar stacks and gets taller. 
           Increase this value if the text is still hidden. */
        padding-top: 240px; 
        padding-bottom: 4rem; 
    }
    /* Reduce vertical padding on main section */
    .story-section { padding: 4rem 0; }
    
    /* Increase side padding for container so text breathes */
    .story-container { padding: 0 2rem; }
    
    /* Stack chapters */
    .story-chapter, .reverse-layout {
        flex-direction: column;
        gap: 3rem; /* Reduced gap for mobile stacking */
        margin-bottom: 5rem;
    }

    /* Photos on top */
    .photo-stack {
        order: -1; 
        max-width: 100%; /* Allow full width */
        width: 90%; /* But keep slight margins */
        margin-bottom: 1rem;
    }
    
    /* Remove rotation on mobile for cleaner look */
    .rotate-right .polaroid-frame, 
    .rotate-left .polaroid-frame {
        transform: rotate(0deg); 
    }

    /* Make paper cards wider on mobile */
    .paper-card {
        max-width: 100%;
        padding: 2.5rem 2rem;
    }
    
    /* Stack perspective boxes */
    .perspectives-container { 
        flex-direction: column; 
        gap: 2rem;
        margin-bottom: 5rem;
    }
    
    .wide-card { padding: 3rem 2rem; }
}

/* Extra small devices fix */
@media (max-width: 450px) {
     .story-header h1 { font-size: 2.5rem; }
     .story-container { padding: 0 1.5rem; }
     .paper-card { padding: 2rem 1.5rem; }
}