/* Globals */
:root {
    --bg-color: #Fdfbf7;
    --text-primary: #3c403d;
    --text-secondary: #7a7a7a;
    --accent-color: #d4af37;
    --accent-dark: #b5952f;
    --envelope-color: #f7f1e3;
    --envelope-dark: #e8ddc5;
    --wax-color: #8b1c1c;
    
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Montserrat', sans-serif;
    --font-script: 'Great Vibes', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    background-image: url('../images/floral_bg.png');
    background-size: 500px;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Scroll lock when envelope is active */
body.locked {
    overflow: hidden;
    height: 100vh;
}

/* Typography elements */
h1, h2, h3 {
    font-family: var(--font-heading);
    font-weight: 400;
}

h2 {
    font-size: 2.2rem;
    color: var(--accent-dark);
    text-align: center;
}

.torn-divider {
    position: relative;
    background-color: #fff;
    padding: 30px 20px;
    margin: 40px 0;
    text-align: center;
    z-index: 10;
    box-shadow: 0 10px 15px rgba(0,0,0,0.03), 0 -10px 15px rgba(0,0,0,0.03);
}

.torn-divider::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0,20 L0,5 Q5,15 10,5 T20,7 T30,2 T40,10 T50,4 T60,12 T70,3 T80,10 T90,2 T100,8 L100,20 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 150px 20px;
    background-repeat: repeat-x;
}

.torn-divider::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0,0 L0,15 Q5,5 10,15 T20,13 T30,18 T40,10 T50,16 T60,8 T70,17 T80,10 T90,18 T100,12 L100,0 Z' fill='%23ffffff'/%3E%3C/svg%3E");
    background-size: 150px 20px;
    background-repeat: repeat-x;
}

/* --------------------
   Envelope Splash Screen
   -------------------- */
.envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    /* background-color: rgba(253, 251, 247, 0.95); */
    background: linear-gradient(135deg, #Fdfbf7 0%, #f4eee0 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease 0.6s, visibility 1s ease 0.6s;
}

.envelope-overlay.hide {
    opacity: 0;
    visibility: hidden;
}

.envelope-container {
    perspective: 1000px;
    width: 320px;
    height: 200px;
    position: relative;
    transition: transform 1s ease 0.3s;
}

/* When the envelope overlay begins to disappear, envelope slides UP */
.envelope-overlay.hide .envelope-container {
    transform: translateY(-100vh);
}

.envelope {
    width: 100%;
    height: 100%;
    position: absolute;
    background-color: #e3d9c6; /* Represents the dark hollow inside of the envelope */
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
    border-radius: 4px;
}

/* The back of the envelope where flaps fold */
.envelope-body {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 4px;
    z-index: 2;
}

/* Creating the side folds with CSS borders */
.fold {
    position: absolute;
    border-style: solid;
}

.fold.bottom {
    bottom: 0;
    left: 0;
    border-width: 0 160px 110px 160px;
    border-color: transparent transparent var(--envelope-color) transparent;
    z-index: 3;
    filter: drop-shadow(0 -4px 5px rgba(0,0,0,0.06));
}

.fold.left {
    top: 0;
    left: 0;
    border-width: 100px 0 100px 160px;
    border-color: transparent transparent transparent var(--envelope-dark);
    z-index: 2;
}

.fold.right {
    top: 0;
    right: 0;
    border-width: 100px 160px 100px 0;
    border-color: transparent var(--envelope-dark) transparent transparent;
    z-index: 2;
}

.flap-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 320px;
    height: 120px;
    transform-origin: top;
    transition: transform 0.8s ease-in-out;
    z-index: 10;
    transform-style: preserve-3d;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.flap-shape {
    width: 100%;
    height: 100%;
    background-color: var(--envelope-color);
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.envelope.is-opening .flap-wrapper {
    transform: rotateX(-180deg);
    filter: drop-shadow(0 -2px 3px rgba(0,0,0,0.05)); /* adjust shadow on back */
}

.wax-seal {
    position: absolute;
    top: 110px;
    left: 160px;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-image: url('../images/timbro.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    z-index: 11;
    opacity: 1;
    transition: opacity 0.1s;
}

.envelope.is-opening .wax-seal {
    opacity: 0;
    /* Wait until flap is pointing straight up (0.4s) before fading out immediately */
    transition: opacity 0.1s linear 0.35s;
}



/* Scroll indicator below the envelope */
.scroll-indicator {
    position: absolute;
    bottom: 10%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: pulse 2s infinite;
    cursor: pointer;
}

.scroll-indicator .arrow {
    width: 20px;
    height: 20px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    transform: rotate(45deg);
    margin: 10px auto 0;
}

@keyframes pulse {
    0% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(5px); }
    100% { opacity: 0.5; transform: translateY(0); }
}


/* --------------------
   Main Invitation Content
   -------------------- */
.invitation-content {
    position: relative;
    z-index: 1;
}

.section {
    min-height: auto;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.section.hero {
    min-height: 100vh;
}

.container {
    max-width: 800px;
    width: 100%;
    text-align: center;
}

/* Animations on Scroll */
.fade-in {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Hero Section */
.hero {
    background: none; /* Uses body bg */
    text-align: center;
}

.hero .subtitle {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-style: italic;
}

.hero .names {
    font-family: var(--font-script);
    font-size: clamp(3.5rem, 12vw, 5rem);
    color: var(--accent-color);
    margin: 1rem 0;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}

.hero .date {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 1rem;
}

/* Details Section */
.details {
    position: relative;
    background-color: var(--bg-color);
    z-index: 1;
    overflow: hidden;
}

.details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/ristorante1.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.35;
    z-index: -1;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 40px;
}

@media (min-width: 600px) {
    .details-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.detail-card {
    background-color: var(--bg-color);
    padding: 40px 20px;
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.detail-card h3 {
    font-family: var(--font-body);
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Timeline */
.program {
    background-color: var(--bg-color);
}

.timeline {
    position: relative;
    max-width: 400px;
    margin: 40px auto 0;
    padding-left: 30px;
    border-left: 2px solid var(--accent-color);
    text-align: left;
}

.timeline-item {
    margin-bottom: 30px;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -37px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: 3px solid var(--bg-color);
}

.timeline-item .time {
    display: block;
    font-weight: 500;
    color: var(--accent-dark);
    margin-bottom: 5px;
}

.timeline-item .event {
    font-family: var(--font-heading);
    font-size: 1.5rem;
}

/* Info Section */
.additional-info {
    background-color: #fff;
}

.additional-info p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* RSVP */
.rsvp {
    background-color: var(--bg-color);
}

.btn-rsvp,
.btn-directions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    padding: 15px 40px;
    background-color: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    font-family: var(--font-body);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
    transition: transform 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.btn-rsvp:hover,
.btn-directions:hover {
    background-color: var(--accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

/* Split Contacts Layout */
.contacts-split {
    display: flex;
    max-width: 800px;
    margin: 50px auto 0 auto;
}

.contact-person {
    flex: 1;
    text-align: center;
    font-size: 1.05rem;
    line-height: 1.4;
}

.contact-person:first-child {
    border-right: 1px solid rgba(212, 175, 55, 0.3);
    padding-right: 15px;
}

.contact-person:last-child {
    padding-left: 15px;
}

@media (max-width: 480px) {
    .contact-person {
        font-size: 0.95rem;
    }
}

/* --------------------
   General Responsive Tweaks
   -------------------- */
@media (max-width: 600px) {
    .section {
        padding: 40px 15px;
    }

    .contacts-split {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .contact-person:first-child {
        border-right: none;
        border-bottom: 1px solid rgba(212, 175, 55, 0.3);
        padding-right: 0;
        padding-bottom: 30px;
    }

    .contact-person:last-child {
        padding-left: 0;
    }

    .btn-rsvp,
    .btn-directions {
        padding: 12px 30px;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
    }
}

.section-title-band {
    background-color: #fff;
    padding: 40px 20px;
    text-align: center;
    width: 100%;
    position: relative;
    z-index: 10;
}
.section-title-band h2 {
    margin: 0;
}
