/* ================= 1. GLOBAL RESET ================= */
* { margin: 0; padding: 0; box-sizing: border-box; }

body, html {
    width: 100%; height: 100%;
    font-family: 'Lora', serif; /* Classy reading font */
    background-color: #F5E6CA; /* Base Beige */
    color: #3E2723; /* Deep Coffee Brown */
    overflow: hidden;
}

/* ================= 2. ATMOSPHERE (THE SOUL) ================= */
.paper-texture {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image: url('https://www.transparenttextures.com/patterns/cream-paper.png');
    opacity: 0.6; pointer-events: none; z-index: 1;
}

.vignette-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, transparent 60%, rgba(62, 39, 35, 0.4) 100%);
    pointer-events: none; z-index: 2;
}

/* ================= 3. PAGE SYSTEM ================= */
.page {
    position: absolute; width: 100%; height: 100%;
    display: flex; /* Flexbox alignment */
    flex-direction: column;
    justify-content: center; /* Vertical Center */
    align-items: center; /* Horizontal Center */
    opacity: 0; pointer-events: none;
    transition: opacity 1.5s ease-in-out;
    z-index: 10;
}

.visible-page { opacity: 1; pointer-events: all; }
.hidden-page { opacity: 0; pointer-events: none; }

/* ================= 4. PAGE 1 STYLING ================= */
.content-box {
    text-align: center;
    position: relative; 
    z-index: 20; /* Above the texture */
    padding: 20px;
    border: 1px solid rgba(184, 134, 11, 0.3); /* Very subtle gold border frame */
    padding: 3rem;
    max-width: 90%;
}

.main-title {
    font-family: 'Playfair Display', serif;
    font-size: 3.5rem; /* Big and Bold */
    font-weight: 700;
    color: #3E2723;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
    /* Animation: Slide Up */
    opacity: 0; animation: slideUp 1.5s ease forwards 0.5s;
}

.year-gold {
    color: #B8860B; /* Dark Gold Color */
    font-style: italic;
}

.divider-small {
    height: 2px; width: 50px; background: #B8860B;
    margin: 1rem auto;
    opacity: 0; animation: growLine 1.5s ease forwards 1s;
}

.subtitle {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    color: #6D4C41; /* Lighter Brown */
    letter-spacing: 1px;
    margin-bottom: 3rem;
    text-transform: uppercase;
    font-size: 0.8rem;
    opacity: 0; animation: fadeIn 1.5s ease forwards 1.5s;
}

/* ================= 5. THE BUTTON ================= */
.gold-btn {
    background: transparent;
    border: 1px solid #3E2723;
    color: #3E2723;
    padding: 15px 40px;
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.4s ease;
    opacity: 0; animation: fadeIn 1.5s ease forwards 2s;
}

.gold-btn:hover {
    background: #3E2723;
    color: #F5E6CA;
    border-color: #3E2723;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(62,39,35,0.2);
}

/* ================= 6. ANIMATIONS ================= */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes growLine { from { width: 0; opacity: 0; } to { width: 50px; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================= GOLDEN DUST EFFECT (SOFT & REALISTIC) ================= */

.dust-layer-1, .dust-layer-2 {
    position: fixed; 
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; 
    z-index: 3; 
    
    /* 1. The Particle: 2.5px size (Visible but not giant) */
    background-image: 
        radial-gradient(rgba(184, 134, 11, 0.8) 2px, transparent 2.5px), 
        radial-gradient(rgba(184, 134, 11, 0.8) 2px, transparent 2.5px);
    
    background-size: 100px 100px; /* Scattered widely */
    
    /* 2. THE SECRET INGREDIENT: Blur */
    filter: blur(1px); /* Makes them look like soft dust, not sharp dots */
    opacity: 0.6; 
}

/* Layer 1: Floating diagonally */
.dust-layer-1 {
    background-position: 0 0, 50px 50px;
    animation: dustFloat 60s linear infinite; /* Very slow float */
}

/* Layer 2: Floating differently for depth */
.dust-layer-2 {
    background-size: 150px 150px; 
    opacity: 0.4;
    animation: dustFloat 90s linear infinite reverse;
}

@keyframes dustFloat {
    0% { background-position: 0 0, 50px 50px; }
    100% { background-position: 50px 600px, 100px 650px; }
}

/* ================= PAGE 2: FIREWORKS & MIDNIGHT ================= */

/* 1. The Canvas (Covers screen) */
#fireworks-canvas {
    position: absolute; top: 0; left: 0; 
    width: 100%; height: 100%;
    z-index: 1; /* Behind the text */
    cursor: crosshair;
}

/* 2. Content Container */
.firework-content {
    position: relative; 
    z-index: 10; /* In front of fireworks */
    text-align: center;
    display: flex; flex-direction: column; align-items: center;
}

/* 3. The Image Styling */
/* ================= BIGGER IMAGE FIX ================= */
.hny-img {
    /* Was 300px, now 600px (Twice as big) */
    width: 500px; 
    
    /* Ensure it fits on mobile screens */
    max-width: 90%; 
    
    margin-bottom: 20px;
    filter: drop-shadow(0 0 15px rgba(184, 134, 11, 0.6));
    animation: floatImg 3s ease-in-out infinite;
}

/* 4. Tiny Instruction Text */
.instruction-text {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-bottom: 30px;
    letter-spacing: 1px;
}

/* 5. The Button (Bright for Dark Mode) */
.btn-glow {
    border-color: #fff;
    color: #fff;
    background: rgba(0,0,0,0.3);
}
.btn-glow:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes floatImg {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ================= PAGE 3: THE PAPER SCROLL ================= */

/* Allow Scrolling on this page */
.scroll-mode { 
    display: block !important; /* Overrides flex */
    overflow-y: auto; 
    padding-top: 50px; 
}

/* The "Paper" Sheet Container */
.paper-container {
    max-width: 700px; 
    width: 90%;
    margin: 0 auto; 
    padding: 40px;
    background: rgba(255,255,255,0.4); /* Slight white tint over the beige */
    border: 1px solid rgba(184, 134, 11, 0.3);
    box-shadow: 0 10px 30px rgba(62,39,35,0.05);
    margin-bottom: 50px;
}

/* Letter Typography */
.letter-head {
    font-family: 'Playfair Display', serif; 
    font-size: 2.5rem;
    margin-bottom: 2rem; 
    color: #3E2723;
    text-align: center;
}

.letter-body p {
    font-family: 'Lora', serif;
    font-size: 1.1rem; 
    line-height: 1.8; 
    margin-bottom: 1.5rem; 
    color: #4E342E;
    text-align: center; /* Center aligned for poem/letter feel */
}

/* Gold Divider Line */
.divider-gold {
    height: 1px; width: 100px; 
    background: #B8860B;
    margin: 3rem auto; /* Center it */
}

/* ================= THE COOLER POLAROID GRID (Scrapbook Style) ================= */
.grid-container {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 35px; /* More space between cards */
}

/* ================= MEMORIES HEADING ================= */
.memories-heading {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: #3E2723;
    text-align: center;
    margin-bottom: 50px; /* Space between text and photos */
    font-weight: 400; /* Keeps it elegant, not too bold */
    font-style: italic; /* Adds that "handwritten title" feel */
}

.photo-frame {
    /* Aged paper background instead of flat white */
    background: linear-gradient(to bottom right, #fffdf9, #f4f0e6);
    padding: 12px 12px 50px 12px; /* Thicker bottom rim */
    
    /* Deeper, softer shadow for realism */
    box-shadow: 2px 10px 25px rgba(62,39,35,0.15);
    
    width: 45%; max-width: 220px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy transition */
    cursor: default;
    position: relative; /* Needed for the tape */
    transform: rotate(-3deg);
}

/* THE WASHI TAPE EFFECT (Top Left Corner) */
.photo-frame::before {
    content: '';
    position: absolute;
    top: -12px; left: 15px;
    width: 70px; height: 25px;
    /* Semi-transparent Gold Tape look */
    background: rgba(184, 134, 11, 0.5);
    transform: rotate(-30deg);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    /* Makes it look like frosted tape */
    backdrop-filter: blur(1px); 
    z-index: 5;
}

/* Rotate alternate cards differently */
.photo-frame:nth-child(even) { 
    transform: rotate(2deg) translateY(10px); /* Slight offset */
}
.photo-frame:nth-child(even)::before {
    left: auto; right: 15px; /* Put tape on right side for variety */
    transform: rotate(30deg);
}

/* HOVER EFFECT: Lifts up and straightens */
.photo-frame:hover { 
    transform: rotate(0) scale(1.08) translateY(-10px); 
    box-shadow: 5px 20px 40px rgba(62,39,35,0.3);
    z-index: 20;
}

/* IMAGE STYLE */
.photo-frame img { 
    width: 100%; height: 200px; 
    object-fit: cover; 
    /* Slight sepia + vignette for vintage look */
    filter: sepia(0.2) contrast(0.9);
    border: 1px solid rgba(0,0,0,0.05);
}

/* TEXT CARD STYLE */
.text-card-content {
    width: 100%; height: 200px;
    display: flex; align-items: center; justify-content: center;
    background: #f9f5f0; color: #888;
    font-family: 'Playfair Display', serif;
    font-style: italic; font-size: 1rem; text-align: center;
    padding: 15px; border: 1px dashed #ccc;
}

/* CAPTION STYLE */
.caption {
    font-family: 'Playfair Display', serif;
    color: #3E2723;
    margin-top: 15px;
    text-align: center;
    font-weight: bold; letter-spacing: 1px;
}

/* ================= FIX: PAGE 3 BUTTON ALIGNMENT ================= */
#btn-page-3 {
    display: block; /* Allows centering */
    margin-left: auto;
    margin-right: auto;
    margin-top: 4rem; /* Keeps the spacing you liked */
}

/* ================= PAGE 4 STYLING ================= */
#page-4 .content-box {
    border: none; /* No border for the end, just text floating */
}

.final-text {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    color: #3E2723;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInUp 2s ease forwards 0.5s;
}

.signature {
    font-family: 'Lora', serif;
    font-style: italic;
    font-size: 1.2rem;
    color: #888;
    opacity: 0;
    animation: fadeInUp 2s ease forwards 1.5s; /* Appears later */
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================= MOBILE FIXES (Add to bottom) ================= */
@media (max-width: 768px) {
    
    /* 1. Make the Grid stack vertically instead of side-by-side */
    .grid-container {
        flex-direction: column; /* Stack them */
        align-items: center;    /* Center them */
        gap: 50px;              /* More space between the stacked photos */
    }

    /* 2. Make the cards WIDER so text fits */
    .photo-frame {
        width: 70%;       /* Takes up most of the phone screen */
        max-width: 300px; /* Don't get too huge */
        transform: rotate(-2deg); /* Keep the tilt */
    }
    
    /* Rotate every second one the other way for variety */
    .photo-frame:nth-child(even) {
        transform: rotate(2deg);
    }

    /* 3. Fix the Text Card font size */
    .text-card-content {
        font-size: 1rem; /* Readable size */
        padding: 15px;
    }
    
    /* 4. Adjust the Heading size */
    .memories-heading {
        font-size: 1.5rem;
    }
    
    /* 5. Fix Letter Width */
    .paper-container {
        width: 95%; /* Use full screen width */
        padding: 20px;
    }
}