:root {
    --soft-pink: #fce4ec;
    --deep-pink: #f06292;
    --unicorn-purple: #f3e5f5;
    --cloud-white: #ffffff;
    --sky-blue: #e3f2fd;
}

/* Remove default browser gaps */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--soft-pink);
    font-family: 'Quicksand', sans-serif;
    color: #444;
    line-height: 1.6;
    min-height: 100vh;
    position: relative; 
    overflow-x: hidden;
}

/* Fixed Background Layer */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    
    /* Desktop Opacity: 0.7 */
    background-image: linear-gradient(rgba(252, 228, 236, 0.7), rgba(252, 228, 236, 0.7)), url('images/castle.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    
    z-index: -1; 
    will-change: transform;
}

/* Mobile Background Adjustment */
@media (max-width: 768px) {
    body::before {
        /* Increased Opacity for Mobile: 0.85 
           This tones down the castle image so text and photo cards are clearer on small screens */
        background-image: linear-gradient(rgba(252, 228, 236, 0.85), rgba(252, 228, 236, 0.85)), url('images/castle.jpg');
    }
}

header {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0.7) 0%, rgba(252,228,236,0) 100%);
    position: relative;
    overflow: hidden;
}

/* Ensure header content stays above background decor */
header h1, 
header .subtitle, 
header .profile-container, 
header #countdown-container,
header p {
    position: relative;
    z-index: 10;
}

.decor {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.3;
    animation: bounce 3s infinite ease-in-out;
    pointer-events: none;
    z-index: 1;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Final safety for mobile width */
html, body {
    width: 100%;
    overflow-x: hidden;
}

/* --- Profile Photo --- */
.profile-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.profile-main {
    width: 180px;
    height: 180px;
    background: var(--cloud-white);
    border: 5px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(240, 98, 146, 0.3);
    overflow: hidden;
    position: relative;
    border: 3px solid var(--unicorn-purple);
}

.profile-main span {
    font-size: 0.9rem;
    color: var(--deep-pink);
    font-weight: bold;
    position: absolute;
    z-index: 1;
}

.profile-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    z-index: 2;
}

h1 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(3.5rem, 12vw, 5.5rem);
    color: var(--deep-pink);
    margin: 0;
    text-shadow: 2px 2px 8px rgba(255,255,255,0.8);
}

.subtitle {
    /* Fluid font size: min 1.1rem, preferred 4vw, max 1.6rem */
    font-size: clamp(1.1rem, 4vw, 1.6rem); 
    color: #a1887f;
    margin: 0 auto 25px auto;
    max-width: 80%; /* Keeps the long sentence from hitting the screen edges */
    text-shadow: 1px 1px 4px white;
    line-height: 1.4;
    font-weight: 500;
}

/* Mobile specific tweak for the header area */
@media (max-width: 600px) {
    .subtitle {
        max-width: 90%; /* Allows more room on narrow phone screens */
        margin-bottom: 20px;
    }
}

/* --- Countdown --- */
#countdown-container {
    display: flex;
    justify-content: center;
    gap: 8px; /* Slightly tighter gap for mobile */
    margin: 30px 0;
    width: 100%;
}

.countdown-box {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--deep-pink);
    border-radius: 18px; 
    box-shadow: 0 4px 10px rgba(240, 98, 146, 0.2);
    
    aspect-ratio: 1 / 1; 
    flex: 1; 
    max-width: 100px;
    min-width: 65px; /* Allows it to fit on even smaller phones */
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2px; /* Minimal padding to maximize text space */
}

.countdown-box span {
    display: block;
    /* Increased minimum to 1.6rem and scaling to 6vw */
    font-size: clamp(1.6rem, 6vw, 2.2rem); 
    font-weight: bold;
    color: var(--deep-pink);
    line-height: 1;
}

.countdown-box p {
    margin: 2px 0 0 0;
    /* Increased label size slightly for readability */
    font-size: clamp(0.65rem, 2.5vw, 0.85rem); 
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Specific fix for very small screens (iPhone SE size) */
@media (max-width: 360px) {
    #countdown-container {
        gap: 5px;
    }
    .countdown-box {
        border-width: 1px;
    }
}

/* --- Sections --- */
.container {
    max-width: 900px;
    margin: auto;
    padding: 20px;
}

section {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(5px);
    margin-bottom: 40px;
    padding: 40px 30px;
    border-radius: 40px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    text-align: center;
    border: 3px solid var(--unicorn-purple);
    position: relative;
    z-index: 5;
}

h2 {
    font-family: 'Dancing Script', cursive;
    color: var(--deep-pink);
    /* clamp(minimum, preferred, maximum) */
    font-size: clamp(2rem, 8vw, 3rem); 
    margin-bottom: 20px;
    line-height: 1.2;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.photo-placeholder {
    aspect-ratio: 1;
    background: var(--unicorn-purple);
    border: 2px dashed var(--deep-pink);
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    overflow: hidden;
    position: relative;
}

.photo-placeholder:hover {
    transform: scale(1.05);
}

.photo-placeholder img, .qr-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

.photo-placeholder span, .qr-placeholder span {
    position: relative;
    z-index: 1;
}

@media (max-width: 600px) {
    .gift-item {
        display: block !important; /* Force out of flex mode */
        text-align: center !important;
        padding: 30px 20px;
        margin: 15px 0;
    }

    .gift-text {
        display: block !important; /* Standard block for reliable centering */
        width: 100% !important;
        margin: 0 0 15px 0 !important; /* Bottom margin creates the symmetrical gap */
        padding: 0 !important;
        text-align: center !important;
    }

    .gift-text strong {
        display: block !important;
        width: 100%;
        font-size: 1.1rem;
        margin-bottom: 5px !important;
        line-height: 1.3;
        text-align: center !important;
    }

    .gift-text span {
        display: block !important;
        width: 100%;
        text-align: center !important;
        font-size: 0.85rem;
    }

    .gift-link {
        display: flex !important; /* Keep flex ONLY for text inside button */
        margin: 0 auto !important; /* Centers the button itself */
        width: 100%;
        max-width: 220px;
        height: 48px;
    }
}

/* Original styles (modified slightly for better stacking) */
.gift-list {
    list-style: none;
    padding: 0;
}

.gift-item {
    background: #fff9fb;
    border: 1px solid var(--soft-pink);
    margin: 12px 0;
    padding: 15px 20px;
    border-radius: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.gift-text {
    text-align: left;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.gift-text strong {
    color: var(--deep-pink);
    font-size: 1.1rem;
    line-height: 1.2;
}

.gift-text span {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gift-link {
    text-decoration: none;
    background: var(--deep-pink);
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    height: 45px;
    min-width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25px;
    transition: background 0.3s, transform 0.2s;
    white-space: nowrap;
}

/* --- Cash Gifts Section --- */
.cash-gifts {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: white;
    border: 3px solid var(--unicorn-purple);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(240, 98, 146, 0.1);
    
    /* This makes the container the 'anchor' for the image */
    position: relative !important; 
    overflow: hidden;
}

.qr-placeholder img {
    /* This forces the image to the exact center of the anchor */
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    
    /* Sizing constraints */
    max-width: 85% !important;
    max-height: 85% !important;
    width: auto !important;
    height: auto !important;
    
    /* Reset any other shifting properties */
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.bank-label {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid var(--soft-pink);
}

.bank-label i {
    font-size: 1.2rem;
}

.bank-label p {
    margin: 0;
    font-weight: bold;
    color: #444;
}

/* Mobile Tweak */
@media (max-width: 600px) {
    .qr-placeholder {
        width: 170px;
        height: 170px;
    }
}

/* --- Animation --- */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

footer {
    padding: 50px;
    text-align: center;
    color: var(--deep-pink);
    font-size: 1.1rem;
    background: rgba(255,255,255,0.5);
}

.event-info h3 {
    margin-top: 20px;
    color: #6a1b9a;
}

.event-date {
    display: inline-block;
    background: rgba(255, 255, 255, 0.6);
    padding: 10px 25px;
    border-radius: 30px;
    border: 1px solid var(--unicorn-purple);
    color: var(--deep-pink);
    font-size: 1.4rem;
    font-weight: bold;
    letter-spacing: 1px;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(240, 98, 146, 0.1);
    position: relative;
    z-index: 10;
}

.event-date span {
    font-size: 1.1rem;
    vertical-align: middle;
    margin: 0 5px;
    opacity: 0.8;
}

/* Mobile size for the date */
@media (max-width: 600px) {
    .event-date {
        font-size: 1.1rem;
        padding: 8px 20px;
    }
}

/* --- Map --- */
.map-wrapper {
    margin: 20px 0;
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid var(--unicorn-purple);
    line-height: 0;
}

.map-link {
    display: inline-block;
    color: var(--deep-pink);
    font-weight: bold;
    text-decoration: none;
    margin-top: 5px;
}

/* --- RSVP Section (Base Styles) --- */
.rsvp-section p {
    margin-bottom: 25px;
    font-size: 1.1rem;
    color: #7d5260;
    padding: 0 10px;
}

.rsvp-button {
    display: inline-flex; /* Use flex for perfect text centering */
    align-items: center;
    justify-content: center;
    background-color: var(--deep-pink);
    color: white;
    text-decoration: none;
    
    /* Heights and widths made consistent with gift buttons */
    height: 55px; 
    min-width: 200px;
    padding: 0 30px;
    
    font-size: 1.3rem;
    font-family: 'Quicksand', sans-serif;
    font-weight: bold;
    border-radius: 50px;
    box-shadow: 0 6px 20px rgba(240, 98, 146, 0.4);
    transition: all 0.3s ease;
    border: 2px solid white;
}

.rsvp-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(240, 98, 146, 0.5);
    background-color: #e91e63;
}

/* --- Responsive Fixes --- */
@media (max-width: 600px) {
    .rsvp-section p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .rsvp-button {
        /* Consistent with gift buttons on mobile */
        width: 100%;
        max-width: 240px; 
        height: 50px; 
        font-size: 1.1rem;
        padding: 0; /* Let width handle the size */
    }
}

/* --- Gratitude Message --- */
.gratitude-message {
    padding: 40px;
    line-height: 1.8;
}

.gratitude-message p {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #5d4037; /* A soft earthy brown for a warm feel */
}

.gratitude-message strong {
    color: var(--deep-pink);
    font-weight: 500;
}

.heart-icon {
    font-size: 2rem;
    margin-bottom: 15px;
    display: block;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .gratitude-message {
        padding: 30px 20px;
    }
    
    .gratitude-message p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
}

.account-name {
    font-size: 0.9rem;
    color: #666;
    margin: 10px 0 0 0; /* Adds space above the name */
    text-align: center;
}

.account-name strong {
    color: var(--deep-pink);
    font-weight: 600;
}

/* Ensure the copy-box has a little extra margin now */
.copy-box {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 2px solid var(--soft-pink);
    padding: 6px 6px 6px 15px;
    border-radius: 12px;
    margin-top: 8px; /* Slightly closer to the name */
    box-shadow: 0 4px 10px rgba(240, 98, 146, 0.05);
}

.copy-box span {
    font-family: 'Quicksand', sans-serif; /* Matching your theme font */
    font-size: 1rem;
    font-weight: bold;
    color: var(--deep-pink);
    margin-right: 15px;
    letter-spacing: 0.5px;
}

.copy-box button {
    background: var(--deep-pink); /* Brighter, more prominent color */
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(233, 30, 99, 0.3);
}

/* Hover effect for desktop */
.copy-box button:hover {
    background: #d81b60;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(233, 30, 99, 0.4);
}

/* Active effect for mobile tap */
.copy-box button:active {
    transform: scale(0.95);
    background: #ad1457;
}

.copy-box button.copied {
    background: #27ae60 !important; /* A nicer Emerald green */
    box-shadow: 0 2px 6px rgba(39, 174, 96, 0.3);
}

.calendar-container {
    text-align: center;
    margin: 30px 0;
}

.calendar-btn {
    /* Font Matching */
    font-family: 'Quicksand', sans-serif; /* Replace with your specific theme font if different */
    font-size: 1rem;
    font-weight: 600; /* Semi-bold for a cleaner look */
    letter-spacing: 0.5px;
    
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    color: var(--deep-pink);
    border: 2px solid var(--soft-pink);
    padding: 12px 30px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(240, 98, 146, 0.1);
    
    /* Ensures smooth text rendering */
    -webkit-font-smoothing: antialiased;
}

.calendar-btn i {
    font-size: 1.1rem;
    color: var(--deep-pink);
    transition: color 0.3s ease;
}

.calendar-btn:hover {
    background: var(--soft-pink);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(240, 98, 146, 0.2);
}

/* Changes icon color to white on hover to match text */
.calendar-btn:hover i {
    color: white;
}

.calendar-btn:active {
    transform: scale(0.98);
}

/* --- Final Thank You Styling --- */
.thank-you-section {
    padding: 40px 30px; /* Match your global section padding */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 40px; /* Ensure this matches global section too */
    border: 3px solid var(--unicorn-purple); /* Ensure consistency */
}

.thank-you-section h2 {
    /* Uses the same Dancing Script style as your other H2s */
    margin-top: 10px;
    margin-bottom: 15px;
}

.thank-you-section p {
    font-family: 'Quicksand', sans-serif;
    color: #5d4037; /* Matching your gratitude-message text color */
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 25px auto;
}

.signature-block {
    margin-top: 30px;
}

.signature-block p {
    margin-bottom: 5px;
    font-style: italic;
    opacity: 0.8;
}

.family-name {
    font-family: 'Dancing Script', cursive;
    /* UPDATE THIS TO CLAMP */
    font-size: clamp(1.8rem, 8vw, 2.5rem); 
    color: var(--deep-pink);
    display: block;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.8);
}

/* Heart animation matching your decor bounce but faster */
.thank-you-section .heart-icon i {
    animation: heartBeat 2s infinite ease-in-out;
    display: inline-block;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@media (max-width: 600px) {
    .thank-you-section h2 {
        font-size: 2rem;
    }
    .family-name {
        font-size: 1.8rem;
    }
}

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--deep-pink);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: none; /* Hidden by default */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 1000;
}

.profile-main {
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0% { box-shadow: 0 0 0 0 rgba(240, 98, 146, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(240, 98, 146, 0); }
    100% { box-shadow: 0 0 0 0 rgba(240, 98, 146, 0); }
}

#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 5px;
    background: linear-gradient(to right, var(--deep-pink), var(--unicorn-purple));
    z-index: 1000;
}

