/**
 * Shared Public Invitation Stylesheet
 * Handles Lightbox, Floating Audio, Countdown Alerts, Animations & Reduced Motion
 *
 * @package LuhurianDigital
 */

/* 1. Lightbox Modal */
.lightbox-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.lightbox-modal.active {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.lightbox-caption {
    margin-top: 14px;
    color: #f1f5f9;
    font-size: 14px;
    text-align: center;
    max-width: 600px;
    line-height: 1.4;
}

.lightbox-close {
    position: absolute;
    top: -48px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-size: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-50%) scale(1.05);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

@media (max-width: 640px) {
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-close { top: 12px; right: 12px; }
    .lightbox-img { max-height: 70vh; }
}

/* 2. Floating Music Player Controller */
.music-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--inv-primary, #4f46e5);
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.music-toggle-btn:hover {
    transform: scale(1.08);
}

.music-toggle-btn.playing svg {
    animation: luhur-spin 4s linear infinite;
}

@keyframes luhur-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 3. Gift Copy State */
.gift-copy-btn.copied {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

/* 4. Scroll Reveal Animations */
.inv-reveal-fade {
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.inv-reveal-fade.inv-revealed {
    opacity: 1;
}

.inv-reveal-slide {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.inv-reveal-slide.inv-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* 5. Reduced Motion Enforcement */
@media (prefers-reduced-motion: reduce) {
    .inv-reveal-fade,
    .inv-reveal-slide {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .music-toggle-btn.playing svg {
        animation: none !important;
    }
}

/* 6. Mobile Layout Stability & Accessible Focus */
html,
body.luhur-invitation-body {
    max-width: 100vw;
    overflow-x: hidden;
}

.inv-container,
.invitation-wrapper {
    overflow-x: hidden;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--inv-primary, #4f46e5);
    outline-offset: 2px;
}



/* 7. Custom Invitation Inner Background */
.invitation-wrapper {
    background-image: var(--inv-inner-bg-image, none) !important;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

.invitation-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.12);
    z-index: 0;
}

.invitation-wrapper > * {
    position: relative;
    z-index: 1;
}

.invitation-wrapper > .cover-overlay {
    z-index: 9999;
}
