:root {
    --gold: #d4af37;
    --gold-light: #f3e5ab;
    --dark-bg: #111;
    --glass-bg: rgba(20, 20, 20, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #fff;
    --text-muted: #aaa;
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
    --anim-ease: cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Times New Roman', serif;
    /* Premium serif feel */
    background-color: #000;
    color: var(--text-main);
    overflow: hidden;
    /* App-like feel */
    height: 100dvh;
    width: 100vw;
}

/* Utilities */
.hidden {
    display: none !important;
}

.full-width {
    width: 100%;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 400;
    letter-spacing: 1px;
}

button {
    font-family: inherit;
}

/* 1. Unlock Screen */
#unlock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 0.8s ease;
}

.unlock-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('assets/unlock_bg.png') center/cover no-repeat;
    opacity: 0.6;
}

.gold-strip-container {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 60px;
    /* Adjust based on asset */
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.gold-strip {
    height: 100%;
    width: auto;
    object-fit: cover;
}

.seal-container {
    position: relative;
    z-index: 1000;
    /* High z-index to ensure interactivity */
    cursor: grab;
    touch-action: none;
    margin-bottom: 20%;
    /* Push up slightly */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wax-seal {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    transition: transform 0.1s linear;
}

.seal-track-hint {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.5;
    animation: fadeInOut 2s infinite;
}

.chevron {
    width: 10px;
    height: 10px;
    border-bottom: 2px solid var(--gold);
    border-right: 2px solid var(--gold);
    transform: rotate(45deg);
    margin: -4px;
}

.unlock-instruction {
    position: absolute;
    bottom: calc(var(--safe-bottom) + 40px);
    color: var(--gold-light);
    font-size: 0.9rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* 2. Main Scene - Refactored */
#main-scene {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    perspective: 1000px;
    opacity: 0;
    transition: opacity 1s ease;
}

.parallax-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.scene-bg {
    position: absolute;
    top: -5%;
    left: -5%;
    width: 110%;
    height: 110%;
    background: url('assets/scene_bg.jpg') center/cover no-repeat;
}

.content-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Let clicks pass to background interactions if any */
}

/* Position FRAME within the scene background - Manual Tweak Required */
.photo-frame-card {
    position: absolute;
    /* Basic guess based on typical center frame */
    top: 20%;
    left: 50%;
    transform: translateX(-50%) rotateX(5deg);
    width: 40vw;
    /* Adjust based on BG frame size */
    max-width: 200px;
    aspect-ratio: 3/4;
    /* Adjust to match BG frame */
    background: transparent;
    border: none;
    /* No border, using BG's frame */
    box-shadow: none;
    /* No shadow, let BG handle it or add internal shadow */
    overflow: hidden;
    /* If the bg frame is tilted, we might need rotation here */

    /* Initially hidden as per request - Revealed on tap */
    opacity: 0;
    pointer-events: none;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.couple-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: normal;
    opacity: 1;
}

/* Floating Elements Container */
.floating-invite-container {
    position: absolute;
    bottom: calc(var(--safe-bottom) + 40px);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    pointer-events: auto;
    z-index: 20;
}

/* Small Invite Card Preview */
.invite-preview {
    width: 120px;
    height: auto;
    transform: rotate(-15deg);
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
    animation: floatCard 6s ease-in-out infinite;
    z-index: 5;
    margin-bottom: -10px;
    /* Overlap button slightly */
}

@keyframes floatCard {

    0%,
    100% {
        transform: rotate(-15deg) translateY(0);
    }

    50% {
        transform: rotate(-12deg) translateY(-10px);
    }
}

/* Glowing Envelope Button */
/* Glowing Envelope Button - Smaller, No Pulse */
.btn-glow-envelope {
    position: relative;
    width: 60px;
    height: 60px;
    /* Smaller */
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
    transition: transform 0.3s ease;
}

.btn-glow-envelope:active {
    transform: scale(0.9);
}

.glow-ring {
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    opacity: 0;
    animation: ripple 2s infinite;
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.invite-label {
    font-size: 0.9rem;
    color: var(--gold-light);
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    margin-top: 10px;
}

/* Modal Actions */
.modal-actions {
    padding: 20px;
    background: #000;
    width: 100%;
}

/* 3. Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.modal-content-wrapper {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    z-index: 201;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: #000;
    font-size: 2.5rem;
    font-weight: bold;
    cursor: pointer;
    text-shadow: 0 0 8px var(--gold), 0 0 15px var(--gold-light);
    z-index: 205;
    transition: transform 0.3s ease;
}

.modal-close-btn:hover {
    transform: scale(1.1);
}

.invite-card-container {
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    /* allow scrolling if image is long */
    display: flex;
    justify-content: center;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.invite-card-img {
    width: 100%;
    height: auto;
    display: block;
}

/* 4. Bottom Sheets */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sheet-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #1a1a1a;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px;
    padding-bottom: calc(var(--safe-bottom) + 20px);
    transform: translateY(100%);
    transition: transform 0.3s var(--anim-ease);
    max-height: 80vh;
    overflow-y: auto;
}

.sheet-overlay.active .bottom-sheet {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 5px;
    background: #444;
    border-radius: 5px;
    margin: 0 auto 20px auto;
}

.sheet-content h2 {
    color: var(--gold);
    margin-bottom: 20px;
    text-align: center;
}

.sheet-close-btn {
    display: none;
    /* Usually drag down or tap backdrop to close */
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--gold);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-family: inherit;
}

input,
select {
    width: 100%;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: #fff;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
}

.form-checkbox {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 30px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.form-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--gold);
    cursor: pointer;
    box-shadow: none;
    border: 1px solid var(--gold);
}

.form-checkbox label {
    margin: 0;
    color: #ddd;
    text-transform: none;
    letter-spacing: 0.5px;
    font-size: 0.95rem;
    cursor: pointer;
}

/* Premium Primary Button */
.btn-premium {
    background: linear-gradient(135deg, #d4af37 0%, #f3e5ab 50%, #d4af37 100%);
    background-size: 200% auto;
    color: #000;
    border: none;
    padding: 18px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
    cursor: pointer;
    transition: all 0.4s ease;
    display: block;
    width: 100%;
    text-align: center;
}

.btn-premium:hover {
    background-position: right center;
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    transform: translateY(-2px);
}

.btn-premium:active {
    transform: scale(0.98);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #000;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 300;
    opacity: 1;
    transition: opacity 0.3s;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.gallery-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

/* Contact Cards */
.contact-card {
    background: #222;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.contact-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    background: #444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #fff;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
}

/* Animations */
@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }

    50% {
        opacity: 0.8;
        transform: translateY(5px);
    }
}

@media (min-width: 768px) {

    /* Desktop optimization: simulate mobile view */
    body {
        background: #222;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    #unlock-screen,
    #main-scene,
    .modal,
    .lightbox,
    .sheet-overlay {
        width: 100%;
        max-width: 420px;
        height: 100%;
        max-height: 900px;
        position: relative;
        /* Contain within wrapper logic usually, but fixed works if parent is transformed? No, fixed is viewport. */
        /* To properly wrap fixed elements on desktop, we strictly need them to be absolute within a relative container.
           But 'fixed' is required for overlays.
           For this microsite, we will let it take full screen on desktop but constrain content width.
        */
        position: fixed;
    }

    .content-container,
    .bottom-dock,
    .modal-content-wrapper,
    .bottom-sheet {
        max-width: 400px;
        left: 50%;
        transform: translateX(-50%);
    }

    .bottom-dock {
        transform: translateX(-50%);
    }

    .bottom-sheet {
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        width: 400px;
    }

    .sheet-overlay.active .bottom-sheet {
        transform: translateX(-50%) translateY(0);
    }
}

/* Enlarged Photo Frame State */
.photo-frame-card.enlarged {
    position: fixed;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    /* Override parallax/absolute */
    width: 90vw;
    /* Fallback */
    max-width: 60vh;
    /* Constraint to viewport height somewhat */
    height: 60vh;
    /* 60% of screen height as requested */
    aspect-ratio: auto;
    z-index: 50;
    border: 2px solid var(--gold);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);

    /* Make visible */
    opacity: 1 !important;
    pointer-events: auto !important;
}

.photo-frame-card.enlarged img {
    object-fit: contain;
    background: #000;
}

/* Dim others when enlarged */
body.photo-active .floating-invite-container {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* Subtle Glow RSVP Button */
.btn-subtle-rsvp {
    background: transparent;
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: var(--gold);
    padding: 15px 30px;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-radius: 30px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.1);
    transition: all 0.3s ease;
    width: 80%;
    /* Width constrained */
    margin: 0 auto;
    display: block;
    cursor: pointer;
}

.btn-subtle-rsvp:active {
    background: rgba(212, 175, 55, 0.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transform: scale(0.98);
}

/* 5. Visual Effects & Particles */
#particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    /* Above unlock bg, below text */
    overflow: hidden;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, var(--gold) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes floatUp {
    0% {
        transform: translateY(110vh) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: var(--p-opacity);
    }

    90% {
        opacity: var(--p-opacity);
    }

    100% {
        transform: translateY(-10vh) translateX(var(--drift));
        opacity: 0;
    }
}

/* Breathing Glow Effect */
@keyframes breatheGlow {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
    }

    50% {
        transform: scale(1.03);
        filter: drop-shadow(0 0 15px rgba(212, 175, 55, 0.5));
    }
}

.wax-seal {
    /* Existing transition */
    transition: transform 0.1s linear;
    /* Add animation */
    animation: breatheGlow 4s ease-in-out infinite;
}

.btn-glow-envelope {
    /* Existing styles, just ensure animation doesn't conflict */
    /* It has no existing animation on the button itself, only on .glow-ring child. */
    animation: breatheGlow 3s ease-in-out infinite;
}