/* Root variables for styling */
:root {
    --bg-cream: #FAF6F0;
    --gold: #B38D4F;
    --gold-hover: #9E7B42;
    --text-dark: #4A3E3D;
    --accent-pink: #F8C3CD;
    --accent-blue: #A1D4E2;
}

/* Reset and basic setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--bg-cream);
    color: var(--text-dark);
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-cream);
}
::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 3px;
}

/* ENVELOPE GATE (Entrance Landing Screen - Exact fit for page 1 image) */
.envelope-gate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-cream);
    z-index: 100;
    transition: transform 1.2s cubic-bezier(0.85, 0, 0.15, 1), opacity 1s ease;
}

.envelope-gate.open {
    transform: translateY(-100vh);
    opacity: 0;
    pointer-events: none;
}

/* Container for Page 1 of PDF (Responsive maintaining 886x1116 aspect ratio) */
.envelope-content {
    position: relative;
    width: 90vw;
    max-width: 440px;
    aspect-ratio: 886 / 1116;
    background-image: url('assets/entry_bg.svg');
    background-size: cover;
    background-position: center;
    box-shadow: 0 15px 40px rgba(142, 111, 62, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

/* Cover Patches to hide static elements in entry_bg.svg */
.cover-patch {
    position: absolute;
    background-color: var(--bg-cream); /* Solid cream color to hide background */
    z-index: 1; /* Sits below interactive elements (z-index 2+) but above background (z-index 0) */
}

/* Cloud Cover Patches (static clouds in entry_bg.svg are still hidden to allow animations on top) */
.cloud-left-cover {
    left: 0%;
    top: 5.8%;
    width: 29.9%;
    height: 16.1%;
}

.cloud-right-cover {
    left: 80.7%;
    top: 16.6%;
    width: 19.3%;
    height: 17.9%;
}

/* Vector Text Layer Overlay (Placed above cover patches, floating elements, and envelope wrapper) */
.text-layer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 12; /* Sits on top of envelope wrapper (z-index 10) and cover patches (z-index 1) */
    pointer-events: none; /* Clicks pass through to the wax seal below */
}

/* Floating elements on the landing screen (Balloons & Clouds) */
.floating-balloon, .floating-cloud {
    position: absolute;
    height: auto;
    pointer-events: none;
    z-index: 2;
}

.pink-balloon {
    left: 29.3%; /* Matches X=260/886 */
    top: 1.8%;   /* Matches Y=20/1116 */
    width: 27.1%; /* Matches W=240/886 */
    animation: floatPink 4.5s infinite ease-in-out;
    filter: drop-shadow(0 8px 15px rgba(142, 111, 62, 0.12));
}

.blue-balloon {
    left: 56.4%; /* Matches X=500/886 */
    top: 3.6%;   /* Matches Y=40/1116 */
    width: 27.1%; /* Matches W=240/886 */
    animation: floatBlue 4s infinite ease-in-out;
    filter: drop-shadow(0 8px 15px rgba(142, 111, 62, 0.12));
}

.cloud-left {
    left: 1.1%;  /* Matches X=10/886 */
    top: 6.3%;   /* Matches Y=70/1116 */
    width: 28.2%; /* Matches W=250/886 */
    opacity: 0.9;
    animation: floatCloudLeft 6s infinite ease-in-out;
}

.cloud-right {
    left: 81.3%; /* Matches X=720/886 */
    top: 17.0%;  /* Matches Y=190/1116 */
    width: 18.7%; /* Matches W=166/886 */
    opacity: 0.9;
    animation: floatCloudRight 5s infinite ease-in-out;
}

/* Floating animations */
@keyframes floatPink {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50% { transform: translateY(-8px) rotate(1.5deg); }
}

@keyframes floatBlue {
    0%, 100% { transform: translateY(0) rotate(1.5deg); }
    50% { transform: translateY(-6px) rotate(-1.5deg); }
}

@keyframes floatCloudLeft {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(4px, -3px); }
}

@keyframes floatCloudRight {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-3px, -2px); }
}

/* Custom CSS Envelope overlaid over clean background area */
.envelope-wrapper {
    position: absolute;
    left: 24.9%; /* Matches X=221/886 */
    top: 58.2%;  /* Shifted down by ~20px on screen to avoid text overlap */
    width: 50.1%; /* Matches W=444/886 */
    height: 26.7%; /* Matches H=298/1116 */
    z-index: 10;
    perspective: 800px;
}

.envelope {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Envelope Flap (Triangle using clip-path) */
.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #EBD9C5;
    clip-path: polygon(0 0, 100% 0, 50% 57%);
    transform-origin: top;
    transform: rotateX(0deg);
    transition: transform 0.6s 0.3s ease;
    z-index: 5;
}

.envelope-gate.opening .envelope-flap {
    transform: rotateX(180deg);
    z-index: 1;
}

/* Envelope Pocket Front (Cover bottom and sides using clip-path) */
.envelope-pocket {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F3E2D3;
    clip-path: polygon(0 0, 50% 57%, 100% 0, 100% 100%, 0 100%);
    z-index: 3;
}

/* Letter Preview that slides up */
.envelope-letter-preview {
    position: absolute;
    bottom: 5%;
    left: 5%;
    width: 90%;
    height: 85%;
    background: #FFFFFF;
    border-radius: 4px;
    z-index: 2;
    transition: transform 0.8s ease;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    padding: 15% 10%;
    display: flex;
    flex-direction: column;
    gap: 12%;
    box-sizing: border-box;
}

.letter-card-line {
    width: 100%;
    height: 4px;
    background-color: rgba(179, 141, 79, 0.15);
    border-radius: 2px;
}

.letter-card-line.short {
    width: 60%;
}

.envelope-gate.opening .envelope-letter-preview {
    transform: translateY(-60%) scale(0.95);
}

/* Wax Seal Button (Cropped directly from PDF) */
.wax-seal-btn {
    position: absolute;
    left: 50%;
    top: 57%;
    transform: translate(-50%, -50%);
    width: 28%;
    height: auto;
    z-index: 6;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.wax-seal-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.wax-seal-img {
    width: 100%;
    height: auto;
    display: block;
}

.envelope-gate.opening .wax-seal-btn {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

/* Instruction Text at Bottom */
.envelope-instruction {
    position: absolute;
    bottom: 4%;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 15;
}

.pulse-text {
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--gold);
    animation: textPulse 2s infinite ease-in-out;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.6; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* MAIN INVITATION CARD CONTAINER */
.invitation-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
    z-index: 5;
}

.invitation-container.hidden {
    display: none;
}

.invitation-card {
    width: 100%;
    max-width: 500px;
    background-color: var(--bg-cream);
    box-shadow: 0 10px 40px rgba(142, 111, 62, 0.12);
    position: relative;
    overflow: hidden;
    animation: slideUpCard 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    
    /* Responsive overlay scaling: 1.8vw on mobile, 9px on desktop (500px width) */
    font-size: 1.8vw;
}

@media (min-width: 500px) {
    .invitation-card {
        font-size: 9px; /* Scales exactly as 1.8% of 500px */
    }
}

@keyframes slideUpCard {
    0% { transform: translateY(100px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.invitation-bg-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Floating Hot Air Balloons on Page 2 */
.invitation-balloon-cover {
    position: absolute;
    z-index: 2; /* Sits above page_1.svg but below the floating balloon */
}

.b1-cover {
    left: 81.82%;
    top: 48.09%;
    width: 13.2%;
    height: 4.0%;
    background-color: #F3E0D0; /* Matches the exact peach/tan background color in this area */
}

.b2-cover {
    left: 81.82%;
    top: 84.61%;
    width: 13.2%;
    height: 4.0%;
    /* Matches the exact mauve-to-rose-pink vertical gradient in this area */
    background: linear-gradient(to bottom, 
        #E7D2D4 0%, 
        #FCD9D4 20%, 
        #F4A5A5 50%, 
        #EBD8D9 80%, 
        #E7D2D4 100%
    );
}

.floating-invitation-balloon {
    position: absolute;
    width: 13.2%;
    height: auto;
    z-index: 3;
    pointer-events: none; /* Clicks pass through to hotspots behind if any */
}

.b1-balloon {
    left: 81.82%;
    top: 48.09%;
    animation: floatInvitation1 5s infinite ease-in-out;
}

.b2-balloon {
    left: 81.82%;
    top: 84.61%;
    animation: floatInvitation2 5.5s infinite ease-in-out;
}

@keyframes floatInvitation1 {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50% { transform: translateY(-0.8em) rotate(1.5deg); }
}

@keyframes floatInvitation2 {
    0%, 100% { transform: translateY(0) rotate(1.5deg); }
    50% { transform: translateY(-0.8em) rotate(-1.5deg); }
}

/* INTERACTIVE OVERLAYS ON PAGE 2 IMAGE */

/* 1. Music Player Overlay (Play button overlay centered over drawn play button) */
.music-player-overlay {
    position: absolute;
    top: 20.53%; /* Center of drawn play button (Y=950/4627) */
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.play-btn {
    width: 4.6em; /* Made 10% larger as requested */
    height: 4.6em;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold) 0%, #90713E 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 0.4em 1.2em rgba(142, 111, 62, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
    outline: none;
}

.play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0.6em 1.8em rgba(142, 111, 62, 0.45);
}

.play-btn:active {
    transform: scale(0.95);
}

.play-svg-icon, .pause-svg-icon {
    width: 1.9em; /* Scaled up proportionally */
    height: 1.9em;
}

.play-svg-icon.hidden, .pause-svg-icon.hidden {
    display: none;
}

/* 2. Countdown Timer Overlay */
.countdown-overlay {
    position: absolute;
    top: 37.39%; /* Center of countdown digits (Y=1730/4627) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 82%;
    height: 2.3%;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.countdown-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.countdown-val {
    font-family: 'Montserrat', sans-serif;
    font-size: 3.7em;
    font-weight: 700; /* Extra bold and thicker Montserrat */
    color: var(--gold);
    line-height: 1;
}

.countdown-sep {
    font-family: 'Montserrat', sans-serif;
    font-size: 2.6em;
    font-weight: 700;
    color: var(--gold);
    line-height: 1;
    animation: flash 1s infinite step-end;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 3. Calendar Heart Outline Overlay (Pulsing over July 18) */
.calendar-heart-overlay {
    position: absolute;
    top: 50.0%; /* Center of date 18 (Y=2315/4627) */
    left: 76.75%; /* Center of Saturday column (X=680/886) */
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

.pulsing-heart-svg {
    width: 3.5em;
    height: 3.2em;
    fill: rgba(224, 102, 102, 0.22); /* Transparent red fill */
    stroke: #E06666; /* Red border outline */
    stroke-width: 1.5px;
    animation: heartBeat 1.4s infinite cubic-bezier(0.215, 0.610, 0.355, 1);
    transform-origin: center;
    filter: drop-shadow(0 0.2em 0.4em rgba(0,0,0,0.08));
}

@keyframes heartBeat {
    0% { transform: scale(0.95); }
    5% { transform: scale(1.1); }
    39% { transform: scale(0.85); }
    45% { transform: scale(1.05); }
    60% { transform: scale(0.95); }
    100% { transform: scale(0.95); }
}

/* 4. Location Link Overlay (Ver Ubicación Button Hotspot) */
.location-link-overlay {
    position: absolute;
    top: 59.0%; /* Centered vertically (Y=2730/4627) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 34%; /* Centered button width */
    height: 1.3%; /* Centered button height */
    border-radius: 2em;
    cursor: pointer;
    background-color: rgba(255,255,255,0);
    box-shadow: inset 0 0 0 0.2em transparent;
    transition: background-color 0.3s, box-shadow 0.3s;
    z-index: 10;
}

.location-link-overlay:hover {
    background-color: rgba(179, 141, 79, 0.08);
    box-shadow: inset 0 0 0 0.2em rgba(179, 141, 79, 0.3);
}

/* 5. RSVP WhatsApp Button Overlay (Confirmar Button Hotspot) */
.rsvp-link-overlay {
    position: absolute;
    top: 80.7%; /* Centered vertically (Y=3735/4627) */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36%; /* Centered button width */
    height: 1.5%; /* Centered button height */
    border-radius: 2.5em;
    cursor: pointer;
    background-color: rgba(255,255,255,0);
    box-shadow: inset 0 0 0 0.2em transparent;
    transition: background-color 0.3s, box-shadow 0.3s;
    z-index: 10;
}

.rsvp-link-overlay:hover {
    background-color: rgba(179, 141, 79, 0.08);
    box-shadow: inset 0 0 0 0.2em rgba(179, 141, 79, 0.3);
}

/* FLOATING AUDIO BAR (Post envelope open) */
.floating-audio-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;
    transition: opacity 0.5s, transform 0.5s;
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.floating-audio-bar.show {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.float-audio-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 1px solid rgba(179, 141, 79, 0.2);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3px;
}

.audio-wave-bar {
    display: inline-block;
    width: 3px;
    height: 8px;
    background-color: var(--gold);
    border-radius: 1px;
    transition: height 0.2s;
}

.float-audio-btn.playing .audio-wave-bar {
    animation: soundWave 0.8s infinite alternate ease-in-out;
}

.float-audio-btn.playing .audio-wave-bar:nth-child(1) { animation-delay: 0.1s; }
.float-audio-btn.playing .audio-wave-bar:nth-child(2) { animation-delay: 0.3s; }
.float-audio-btn.playing .audio-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.float-audio-btn.playing .audio-wave-bar:nth-child(4) { animation-delay: 0.4s; }

@keyframes soundWave {
    0% { height: 4px; }
    100% { height: 18px; }
}
