:root {
    --bg-dark: #0a0e17; 
    --gold: #d4af37;
    --gold-light: #f3e5ab;
    --gold-dark: #996515;
    --text-main: #fcfcfc;
    --text-muted: #a0aabf;
    --card-bg: rgba(15, 20, 30, 0.85);
    --border-gold: rgba(212, 175, 55, 0.4);
    --envelope-color: #12182b; /* Deep indigo */
}

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

body {
    background-color: var(--bg-dark);
    background-image: url('assets/floral-bg.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Montserrat', sans-serif;
    overflow-x: hidden;
    overflow-y: hidden; /* Locked until envelope opens */
}

/* Global Background Overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, rgba(10,14,23,0.6) 0%, rgba(10,14,23,0.95) 100%);
    z-index: -1;
}

canvas#flowerCanvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── 3D ENVELOPE (LIFAFA) ── */
.envelope-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-dark);
    transition: opacity 1.5s ease;
    perspective: 1000px;
}

.envelope-wrapper {
    position: relative;
    width: 400px;
    height: 250px;
    cursor: pointer;
    transition: transform 0.5s ease;
    transform-style: preserve-3d;
}

.envelope-wrapper:hover {
    transform: scale(1.05);
}

.envelope {
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--envelope-color);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8), inset 0 0 40px rgba(0,0,0,0.5);
    border-radius: 4px;
    transform-style: preserve-3d;
}

/* Back of envelope (pocket) */
.pocket {
    position: absolute;
    bottom: 0;
    width: 0;
    height: 0;
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-bottom: 150px solid #1a223a;
    border-radius: 4px;
    z-index: 3;
    filter: drop-shadow(0 -5px 10px rgba(0,0,0,0.3));
}
.pocket::after {
    content: '';
    position: absolute;
    left: -200px;
    bottom: -150px;
    border-left: 200px solid #161d33;
    border-top: 125px solid transparent;
    border-bottom: 125px solid transparent;
    z-index: 4;
}
.pocket::before {
    content: '';
    position: absolute;
    right: -200px;
    bottom: -150px;
    border-right: 200px solid #161d33;
    border-top: 125px solid transparent;
    border-bottom: 125px solid transparent;
    z-index: 4;
}

/* Flap */
.flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-top: 140px solid #1d2540;
    z-index: 5;
    transform-origin: top;
    transition: transform 0.4s ease-in-out, z-index 0.4s;
    filter: drop-shadow(0 5px 10px rgba(0,0,0,0.4));
}

/* Inner Letter */
.letter {
    position: absolute;
    bottom: 0;
    left: 5%;
    width: 90%;
    height: 90%;
    background: #fff;
    z-index: 2;
    transition: transform 0.6s ease-in-out 0.2s;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.letter-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--gold-dark);
}
.letter-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.1;
    z-index: 0;
}
.letter-names {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    z-index: 1;
}
.letter-content p {
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    z-index: 1;
    margin-top: 10px;
}

/* Wax Seal */
.wax-seal {
    position: absolute;
    top: 140px; /* At the tip of the flap */
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    z-index: 6;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}
.css-seal {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b, #8b6508);
    border-radius: 50%;
    box-shadow: 
        inset 0 0 10px rgba(0,0,0,0.5), 
        0 4px 10px rgba(0,0,0,0.6),
        inset 0 0 0 3px rgba(255,215,0,0.6);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}
.css-seal::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border: 2px solid rgba(255,215,0,0.4);
    border-radius: 50%;
}
.wax-seal span {
    position: absolute;
    bottom: -35px;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--gold);
    letter-spacing: 2px;
    animation: pulse 1.5s infinite;
}

/* Opening Animations applied via JS classes */
.envelope.open .flap {
    transform: rotateX(180deg);
    z-index: 1;
}
.envelope.open .wax-seal {
    opacity: 0;
}
.envelope.open .letter {
    transform: translateY(-100px);
}

.tap-hint {
    margin-top: 60px;
    font-family: 'Cinzel', serif;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 0.9rem;
}


/* ── MAIN CONTENT & SECTIONS ── */
.main-content {
    position: relative;
    z-index: 10;
    width: 100%;
}

.section {
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 80px 20px;
    position: relative;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 50px;
    letter-spacing: 4px;
    text-transform: uppercase;
    text-align: center;
}

/* ── Hero ── */
.hero-content {
    text-align: center;
}
.bismillah {
    font-size: 3.5rem;
    color: var(--gold);
    margin-bottom: 20px;
}
.intro-text {
    font-family: 'Cinzel', serif;
    letter-spacing: 5px;
    color: var(--gold-light);
    margin-bottom: 40px;
    text-transform: uppercase;
}
.names-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 40px;
}
.couple-names {
    font-family: 'Great Vibes', cursive;
    font-size: 6rem;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}
.ampersand {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--gold-dark);
}
.invite-text {
    font-size: 1.1rem;
    line-height: 2;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}
.scroll-indicator {
    margin-top: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: var(--gold-dark);
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
}
.scroll-indicator .line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--gold-dark), transparent);
    animation: growLine 2s infinite;
}
@keyframes growLine {
    0% { transform: scaleY(0); transform-origin: top; }
    50% { transform: scaleY(1); transform-origin: top; }
    50.1% { transform: scaleY(1); transform-origin: bottom; }
    100% { transform: scaleY(0); transform-origin: bottom; }
}


/* ── Countdown ── */
.timer-wrapper {
    display: flex;
    gap: 30px;
    justify-content: center;
}
.time-box {
    background: var(--card-bg);
    border: 1px solid var(--border-gold);
    border-radius: 8px;
    width: 100px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.time-box span {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold);
}
.time-box p {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
}


/* ── Our Story Timeline ── */
.story-section {
    padding: 100px 20px;
}
.timeline-container {
    position: relative;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}
.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-gold);
    transform: translateX(-50%);
}
.timeline-item {
    display: flex;
    justify-content: flex-end;
    padding-right: 50%;
    position: relative;
    margin-bottom: 60px;
}
.timeline-item.right {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: 50%;
}
.timeline-content {
    background: var(--card-bg);
    border: 1px solid var(--border-gold);
    padding: 30px;
    border-radius: 8px;
    width: 80%;
    position: relative;
}
.timeline-item.left .timeline-content { margin-right: 40px; }
.timeline-item.right .timeline-content { margin-left: 40px; }

.timeline-dot {
    position: absolute;
    left: 50%;
    top: 30px;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold);
    z-index: 2;
}
.timeline-content h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    margin-bottom: 10px;
    font-size: 1.3rem;
}
.timeline-content .date {
    color: var(--gold-light);
    font-size: 0.8rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.timeline-content p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}


/* ── Parallax Gallery ── */
.gallery-grid {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1000px;
}
.gallery-img {
    width: 300px;
    height: 450px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-gold);
}
.gallery-img img {
    width: 100%;
    height: 130%;
    object-fit: cover;
}
.g2 { transform: translateY(-40px); } /* Staggered layout */


/* ── 3D Flip Events ── */
.events-wrapper {
    overflow: hidden;
}
.events-container {
    display: flex;
    gap: 40px;
    max-width: 1200px;
    flex-wrap: wrap;
    justify-content: center;
}
.event-card {
    width: 320px;
    height: 420px;
    perspective: 1000px;
    opacity: 0;
    transform: translateY(50px);
}
.card-inner {
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}
.event-card:hover .card-inner {
    transform: rotateY(180deg);
}
.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--card-bg);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    text-align: center;
}
.card-front {
    background: linear-gradient(to bottom, rgba(15,20,30,0.9), rgba(15,20,30,0.7)), url('assets/floral-bg.jpg');
    background-size: cover;
}
.card-back {
    transform: rotateY(180deg);
}

.event-title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    color: var(--gold);
    margin-bottom: 20px;
}
.swipe-hint {
    position: absolute;
    bottom: 30px;
    font-size: 0.7rem;
    color: var(--gold-dark);
    text-transform: uppercase;
    letter-spacing: 2px;
}
.card-back h3 {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.5rem;
    margin-bottom: 15px;
}
.event-divider {
    width: 40px; height: 1px; background: var(--gold); margin: 0 auto 20px;
}
.event-time, .event-venue, .event-dress {
    margin-bottom: 15px;
    color: var(--text-main);
    line-height: 1.5;
}


/* ── Footer / RSVP ── */
.rsvp-content {
    text-align: center;
    padding: 80px;
    background: var(--card-bg);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    max-width: 600px;
}
.highlight {
    font-size: 1.5rem;
    color: var(--gold);
    display: block;
    margin: 15px 0;
}
.gold-btn {
    background: var(--gold);
    color: var(--bg-dark);
    font-family: 'Cinzel', serif;
    text-transform: uppercase;
    letter-spacing: 3px;
    padding: 18px 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-top: 30px;
}
.gold-btn:hover {
    background: var(--gold-light);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}

/* Animations */
.fade-up { opacity: 0; transform: translateY(40px); }

/* ── Premium Brand Footer ── */
.brand-footer {
    width: 100%;
    padding: 60px 20px 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 10;
}
.brand-footer-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.brand-divider {
    width: 120px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
}
.brand-footer-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 3px;
    text-transform: uppercase;
}
.brand-footer-name {
    font-family: 'Great Vibes', cursive;
    font-size: 2.5rem;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(212,175,55,0.3);
    line-height: 1;
}
.brand-footer-tagline {
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    color: var(--gold-dark);
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ── Music Toggle Button ── */
.music-btn {
    position: fixed;
    bottom: 30px; right: 30px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(15,20,30,0.9);
    border: 1px solid var(--border-gold);
    color: var(--gold);
    cursor: pointer;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}
.music-btn:hover { background: var(--gold); color: var(--bg-dark); }
.music-btn.muted { opacity: 0.4; }
.music-btn svg { width: 20px; height: 20px; }

/* ── RSVP Modal ── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(6px);
    z-index: 500;
    justify-content: center;
    align-items: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--card-bg);
    border: 1px solid var(--border-gold);
    border-radius: 12px;
    padding: 50px 40px 40px;
    max-width: 480px;
    width: 90%;
    position: relative;
    text-align: center;
    animation: modalSlideIn 0.5s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
    position: absolute; top: 15px; right: 20px;
    background: none; border: none;
    color: var(--gold); font-size: 1.8rem;
    cursor: pointer; line-height: 1;
}
.modal-seal {
    width: 60px; height: 60px;
    background: radial-gradient(circle at 30% 30%, #ffd700, #b8860b, #8b6508);
    border-radius: 50%;
    margin: 0 auto 20px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5), 0 4px 10px rgba(0,0,0,0.5);
}
.modal-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.6rem;
    margin-bottom: 10px;
    letter-spacing: 2px;
}
.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 25px;
}
.modal-note {
    color: var(--gold-light);
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    margin-top: 15px;
}
.rsvp-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}
.rsvp-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-gold);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 4px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    transition: border-color 0.3s;
}
.rsvp-input:focus { border-color: var(--gold); }
.rsvp-input option { background: #0a0e17; }

/* ── Fix: Timeline items start VISIBLE, GSAP only moves X ── */
.timeline-item {
    opacity: 1 !important; /* always visible regardless of GSAP state */
}

@media (max-width: 768px) {
    .couple-names { font-size: 4rem; }
    .names-wrapper { flex-direction: column; gap: 0; }
    .ampersand { display: none; }
    .timer-wrapper { flex-wrap: wrap; }
    .timeline-item.left, .timeline-item.right { padding: 0 0 0 40px; justify-content: flex-start; }
    .timeline-item.left .timeline-content, .timeline-item.right .timeline-content { margin: 0; width: 100%; }
    .timeline-line { left: 10px; }
    .timeline-dot { left: 10px; }
    .gallery-grid { flex-direction: column; }
    .g2 { transform: none; }
}

/* ── Music button states ── */
.music-btn.pulse-hint {
    animation: musicPulse 1.5s infinite;
    border-color: var(--gold);
}
@keyframes musicPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(212,175,55,0.5); }
    50%      { box-shadow: 0 0 0 10px rgba(212,175,55,0); }
}

/* ── Celebration Thank-You Card ── */
.celebration-box { text-align: center; padding: 10px 0; }
.celeb-hearts { display: flex; justify-content: center; gap: 12px; margin-bottom: 20px; }
.celeb-hearts span {
    color: #c0392b;
    font-size: 2rem;
    animation: heartBeat 0.8s infinite alternate;
}
.celeb-hearts span:nth-child(2) { animation-delay: 0.2s; color: var(--gold); }
.celeb-hearts span:nth-child(3) { animation-delay: 0.4s; }
@keyframes heartBeat {
    from { transform: scale(1); }
    to   { transform: scale(1.4); }
}
.celeb-main-text {
    font-family: 'Great Vibes', cursive;
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(212,175,55,0.4);
    margin: 10px 0;
    line-height: 1.1;
}
.celeb-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    margin: 0 auto 15px;
    max-width: 340px;
}
.celeb-urdu {
    font-size: 1.3rem;
    color: var(--gold-light);
    direction: rtl;
    margin: 12px 0;
}
.celeb-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 8px;
}
