/* Fonts are loaded via <link> in Invitation.html (faster than @import) */

/* --- 1. TRUE FULL SCREEN RESET --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
::-webkit-scrollbar { display: none; }

html {
    -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
    scrollbar-width: none; -ms-overflow-style: none;
}

body, html {
    width: 100%;
    height: 100vh; height: 100dvh;           /* dvh = real visible height on mobile browsers */
    font-family: 'Montserrat', sans-serif;
    background-color: #fdfbf7; overflow: hidden;
    display: flex; justify-content: center; align-items: center;
}
body { position: relative; }

#mobile-wrapper {
    position: relative; width: 100%; height: 100vh; height: 100dvh;
    background: #fdfbf7; overflow: hidden;
}

/* --- 2. PREMIUM MUTE BUTTON (safe-area aware) --- */
.premium-mute-btn {
    position: fixed;
    top: max(20px, calc(env(safe-area-inset-top, 0px) + 10px));
    right: max(20px, calc(env(safe-area-inset-right, 0px) + 10px));
    z-index: 1000;
    background: rgba(255, 253, 245, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 175, 55, 0.6); border-radius: 50%;
    width: 48px; height: 48px; display: flex; justify-content: center; align-items: center;
    cursor: pointer; box-shadow: 0 4px 20px rgba(0,0,0,0.1), inset 0 0 10px rgba(212,175,55,0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); color: #8a3a3a;
}
.premium-mute-btn:hover {
    background: #fff; border-color: #d4af37;
    box-shadow: 0 6px 25px rgba(0,0,0,0.15), inset 0 0 15px rgba(212,175,55,0.15);
    transform: scale(1.05);
}
.premium-mute-btn svg { width: 22px; height: 22px; fill: currentColor; transition: 0.3s ease; }

/* --- PREMIUM SCROLL SPY SIDE NAVIGATION --- */
.side-nav-container {
    position: fixed; right: max(clamp(10px, 3vw, 25px), env(safe-area-inset-right, 0px));
    top: 50%; transform: translateY(-50%);
    z-index: 1000; display: none; flex-direction: column; gap: 14px; align-items: flex-end;
    animation: fadeIn 1s ease forwards;
    pointer-events: none;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.side-nav-item {
    position: relative; display: flex; align-items: center; justify-content: flex-end;
    cursor: pointer; height: 24px; width: 40px;
    background: transparent; border: none; padding: 0; outline: none;
    pointer-events: auto;
}
.side-nav-label {
    position: absolute; right: calc(100% + 12px);
    font-family: 'Montserrat', sans-serif; font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px;
    color: #fff; background: #8a3a3a; padding: 6px 12px; border-radius: 4px;
    opacity: 0; transform: translateX(10px); transition: all 0.3s ease; pointer-events: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08); white-space: nowrap; border: 1px solid rgba(212, 175, 55, 0.2);
}
.side-nav-line {
    width: 14px; height: 3px; background: rgba(138, 58, 58, 0.3); border-radius: 2px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.side-nav-item:hover .side-nav-label,
.side-nav-item:focus-visible .side-nav-label { opacity: 1; transform: translateX(0); }
.side-nav-item:hover .side-nav-line { background: rgba(138, 58, 58, 0.7); width: 18px; }
.side-nav-item.active .side-nav-line { background: #8a3a3a; width: 26px; }

/* The side nav is only for wide screens with a mouse. JS shows it (display:flex) after the intro. */
@media (max-width: 1024px), (hover: none) {
    .side-nav-container { display: none !important; }
}

/* --- 3. FALLING FLORALS & HEARTS --- */
#particles-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 80; overflow: hidden;
}
.falling-particle {
    position: absolute; top: -10%; text-shadow: 0 2px 5px rgba(0,0,0,0.1);
    animation: fall linear forwards;
}
@keyframes fall {
    0% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(110vh) rotate(360deg) scale(1.2); opacity: 0; }
}

/* --- 4. INTRO SCREEN --- */
#intro-screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 100;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    overflow: hidden; background: #fdfbf7;
}
.bg-blur {
    position: absolute; top: -10%; left: -10%; width: 120%; height: 120%;
    background-size: cover; background-position: center;
    filter: blur(25px); opacity: 0.5; z-index: 1;
}
.intro-img {
    position: relative; width: 95%; max-width: 900px; height: auto; max-height: 80vh; max-height: 80dvh;
    object-fit: contain; z-index: 2; border-radius: 12px; box-shadow: 0 15px 50px rgba(0,0,0,0.2);
}
.tap-btn {
    position: absolute; bottom: max(8%, calc(env(safe-area-inset-bottom, 0px) + 20px)); z-index: 3;
    background: rgba(255, 255, 255, 0.4); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(212, 175, 55, 0.8); padding: 15px 45px; border-radius: 50px; min-height: 48px;
    font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 600; letter-spacing: 5px; color: #333;
    text-transform: uppercase; cursor: pointer; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0.5); } 70% { box-shadow: 0 0 0 20px rgba(212, 175, 55, 0); } 100% { box-shadow: 0 0 0 0 rgba(212, 175, 55, 0); } }

/* --- 5. GANESHA SCREEN & SKIP BTN --- */
#ganesha-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; z-index: 90;
    background: radial-gradient(circle at center, #4a2c11 0%, #0a0602 100%);
    display: none; align-items: center; justify-content: center;
}
.g-vid {
    width: 100%; height: 100vh; height: 100dvh;
    object-fit: cover;
    background: transparent;
    position: absolute; top: 0; left: 0; display: none;
}
@media (max-aspect-ratio: 1/1) {
    .g-vid { object-fit: contain; }
}

.skip-btn {
    position: absolute;
    bottom: calc(clamp(60px, 10vh, 90px) + env(safe-area-inset-bottom, 0px));
    right: max(clamp(20px, 5vw, 30px), calc(env(safe-area-inset-right, 0px) + 10px));
    z-index: 995;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 175, 55, 0.6); border-radius: 30px; padding: 10px 24px; min-height: 44px;
    font-family: 'Montserrat', sans-serif; font-size: 0.75rem; font-weight: 600; letter-spacing: 2px;
    color: #fff; text-transform: uppercase; cursor: pointer; display: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: 0.3s;
}
.skip-btn:hover { background: rgba(0, 0, 0, 0.85); border-color: #d4af37; }

/* --- 6. MAIN APP CONTENT --- */
#app-content {
    display: none; width: 100%; height: 100vh; height: 100dvh; position: relative; z-index: 10;
    overflow-y: scroll; overflow-x: hidden;
    scroll-snap-type: y proximity;               /* proximity: tall sections never trap the scroll */
    scroll-behavior: smooth;
    overscroll-behavior-y: contain;              /* stops Android pull-to-refresh replaying the intro */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
    background: #fdfbf7;
}

.snap-section {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    scroll-snap-align: start;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: clamp(20px, 4vh, 60px) max(20px, env(safe-area-inset-right, 0px)) clamp(20px, 4vh, 60px) max(20px, env(safe-area-inset-left, 0px));
    position: relative; overflow: hidden; box-sizing: border-box;
}
#sec-festivities { padding-top: 40px; }

.main-hero-img {
    position: relative; width: 95%; max-width: 1000px; height: auto; max-height: 85vh; max-height: 85dvh;
    object-fit: contain; z-index: 2; border-radius: 12px; box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}
.scroll-down-hint {
    position: absolute;
    bottom: clamp(15px, 4vh, 30px);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 3px;
    color: #8a3a3a;
    text-transform: uppercase;
    font-weight: 600;
    animation: bounce 2s infinite;
    z-index: 3;
}
@media (max-aspect-ratio: 1/1) {
    .scroll-down-hint { bottom: calc(12% + env(safe-area-inset-bottom, 0px)); }
}

/* Bounce animations (were missing before) */
@keyframes bounce   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bounce-x { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }

.wedding-border-card {
    background: #fffdf7; width: 100%; max-width: 800px; padding: clamp(25px, 5vh, 45px) 25px; border-radius: 15px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1); text-align: center;
    border: 4px solid #d4af37; position: relative; z-index: 2; margin: 0 auto;
}
.wedding-border-card::before {
    content: ''; position: absolute; top: 8px; left: 8px; right: 8px; bottom: 8px;
    border: 2px dashed #d4af37; border-radius: 8px; pointer-events: none;
}
.invite-text { font-family: 'Montserrat', sans-serif; font-size: clamp(0.95rem, 2vw, 1.1rem); color: #555; letter-spacing: 1px; line-height: 1.8; margin-bottom: 25px; font-style: italic;}

/* --- RESPONSIVE INVITATION CARD & ZOOM EFFECT --- */
.invitation-img-wrapper {
    position: relative; width: 100%; border-radius: 8px; overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15); cursor: pointer; display: block; background: rgba(0,0,0,0.03);
}
.invitation-img-wrapper img {
    width: 100%; height: auto; max-height: 60vh; max-height: 60dvh; object-fit: contain; display: block; transition: transform 0.3s ease;
}
.invitation-img-wrapper:hover img { transform: scale(1.02); }

.zoom-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.4); display: flex; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease;
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.invitation-img-wrapper:hover .zoom-overlay { opacity: 1; }

.zoom-icon {
    background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%; width: 65px; height: 65px; display: flex; justify-content: center; align-items: center;
    color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    transform: scale(0.8); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.invitation-img-wrapper:hover .zoom-icon { transform: scale(1); }

/* Touch devices have no hover: always show a small zoom badge in the corner */
@media (hover: none) {
    .zoom-overlay {
        opacity: 1; background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
        justify-content: flex-end; align-items: flex-end; padding: 10px; pointer-events: none;
    }
    .zoom-icon { width: 44px; height: 44px; background: rgba(0,0,0,0.45); transform: none; }
    .zoom-icon svg { width: 22px; height: 22px; }
}

/* --- LIGHTBOX MODAL FOR ZOOMING --- */
#invitation-lightbox {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; background: rgba(0,0,0,0.92);
    z-index: 3000; display: none; align-items: flex-start; justify-content: center; overflow: auto;
    padding: max(30px, env(safe-area-inset-top, 0px)) 0 30px; box-sizing: border-box; cursor: zoom-out;
    overscroll-behavior: contain;
}
.lightbox-close-btn {
    position: fixed;
    top: max(20px, calc(env(safe-area-inset-top, 0px) + 10px));
    left: max(20px, calc(env(safe-area-inset-left, 0px) + 10px));
    z-index: 3100;
    background: rgba(255,255,255,0.1); border: 1px solid #fff; border-radius: 50%;
    width: 45px; height: 45px; display: flex; justify-content: center; align-items: center;
    color: #fff; font-size: 1.5rem; cursor: pointer; transition: 0.3s;
}
.lightbox-close-btn:hover { background: rgba(255,255,255,0.3); }
#lightbox-img {
    margin: auto; max-width: 100%; max-height: 100%; object-fit: contain;
    transition: height 0.3s ease, max-width 0.3s ease, max-height 0.3s ease; cursor: zoom-in;
}
#lightbox-img.zoomed {
    max-width: none; max-height: none; height: 200vh; height: 200dvh; width: auto; cursor: zoom-out;
}

.section-title {
    font-family: 'Great Vibes', cursive; font-size: clamp(2.8rem, 11vw, 4.5rem); color: #8a3a3a; text-align: center;
    margin-bottom: clamp(15px, 3vh, 30px); font-weight: 400; text-shadow: 0 2px 10px rgba(0,0,0,0.05); line-height: 1;
}

/* --- 7. THE CELEBRATIONS LIST --- */
.event-list-container {
    width: 100%; max-width: 900px; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;
}
.event-list-item {
    display: flex; justify-content: space-between; align-items: stretch; gap: 15px;
    flex: 1 1 100%; max-width: 420px; text-align: left;
    background: rgba(255, 255, 255, 0.6); padding: clamp(15px, 2vh, 22px); border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05); border: 1px solid rgba(212, 175, 55, 0.2);
}
@media (min-width: 768px) { .event-list-item { flex: 1 1 350px; } }

.event-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; word-wrap: break-word; }
.event-date { font-size: 0.7rem; color: #a89f91; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 5px; font-weight: 600;}
.event-name {
    font-family: 'Cinzel', serif; font-size: clamp(1rem, 3vw, 1.3rem);
    color: #6d4b53; margin-bottom: 5px; font-weight: 700; line-height: 1.3;
    word-wrap: break-word; overflow-wrap: break-word;
}
.event-desc { font-size: 0.8rem; color: #888; margin-bottom: 8px; font-style: italic; line-height: 1.4;}
.event-time-venue { font-size: 0.75rem; font-weight: 600; color: #8a3a3a; margin-bottom: 12px; line-height: 1.4;}
.dir-btn {
    background: transparent; border: 1.5px solid #6d4b53; border-radius: 20px; padding: 8px 14px; min-height: 40px;
    font-size: 0.7rem; font-family: 'Montserrat', sans-serif; color: #6d4b53; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px; font-weight: 600; transition: 0.3s; align-self: flex-start;
}
.dir-btn:hover { background: #6d4b53; color: #fff; }

.event-thumb {
    width: clamp(80px, 15vw, 105px); height: clamp(100px, 20vh, 135px); border-radius: 12px; overflow: hidden; position: relative;
    cursor: pointer; flex-shrink: 0; box-shadow: 0 5px 15px rgba(0,0,0,0.15); border: 2px solid #e0d8c3; align-self: center;
}
.event-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-overlay {
    position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
    color: #fff; font-size: 0.7rem; text-align: center; padding: 10px 0; font-weight: 700; letter-spacing: 1px;
}

/* --- 8. STORY CAROUSEL, SWIPE HINT & ARROWS --- */
.swipe-hint {
    display: flex; justify-content: center; align-items: center; gap: 10px;
    color: #8a3a3a; font-family: 'Montserrat', sans-serif; font-size: 0.75rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 2px;
    margin-bottom: 15px; opacity: 0.8; animation: pulse-opacity 2s infinite;
}
.swipe-hint svg { animation: swipe-nudge 2s infinite; }
.swipe-hint svg:first-child { animation-direction: reverse; }
@keyframes pulse-opacity { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes swipe-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(3px); } }

.story-carousel-wrap { position: relative; width: 100%; max-width: 1100px; margin: 0 auto; }

.story-scroller {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 20px;
    padding: 10px; width: 100%; scroll-behavior: smooth;
    scrollbar-width: none; -ms-overflow-style: none;
    overscroll-behavior-x: contain;
}
.story-card {
    position: relative;
    width: min(400px, 85vw); flex-shrink: 0; scroll-snap-align: center;
    background: rgba(255, 253, 245, 0.95);
    border-radius: 15px; padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.3);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; margin: 0 auto;
}
.story-card h4 { font-family: 'Cinzel', serif; color: #8a3a3a; margin-bottom: 10px; font-size: clamp(1.3rem, 4vw, 1.7rem); font-weight: 700; word-wrap: break-word;}
.story-card p { font-size: 0.9rem; color: #666; line-height: 1.6; margin-bottom: 20px; font-style: italic;}
.story-media {
    width: 100%; max-height: 280px; max-height: min(280px, 32dvh); height: auto;
    object-fit: contain; background: rgba(0,0,0,0.02);
    border-radius: 8px; display: block; margin: 0 auto; box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Prev/next arrows: only for mouse/trackpad devices */
.carousel-btn {
    display: none; position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
    width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
    background: rgba(255, 253, 245, 0.92); color: #8a3a3a;
    border: 1px solid rgba(212, 175, 55, 0.7); box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    justify-content: center; align-items: center; transition: 0.3s;
}
.carousel-btn:hover { background: #8a3a3a; color: #fff; }
.carousel-prev { left: 4px; }
.carousel-next { right: 4px; }
@media (hover: hover) and (pointer: fine) {
    .carousel-btn { display: flex; }
    .swipe-hint span { font-size: 0; }
    .swipe-hint span::after { content: 'Browse the Story'; font-size: 0.75rem; }
}

/* --- 9. PREMIUM RESPONSIVE COUNTDOWN FRAME --- */
/* --frame-ratio (image width / height) is set automatically by script.js once the PNG loads */
.countdown-frame-container {
    --frame-ratio: 1;
    position: relative; margin: 0 auto;
    width: min(95%, 900px, calc(68vh * var(--frame-ratio)));
    width: min(95%, 900px, calc(68dvh * var(--frame-ratio)));
    display: flex; justify-content: center; align-items: center;
}
.countdown-frame-img {
    width: 100%; height: auto; display: block; object-fit: contain;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.1));
}
.countdown-content {
    position: absolute; top: 15%; bottom: 15%; left: 15%; right: 15%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.countdown-wrapper { width: 100%; display: flex; justify-content: center; gap: clamp(4px, 1.5vw, 15px); max-width: 500px; }
.time-col {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(255, 253, 245, 0.5); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(212, 175, 55, 0.4); border-radius: 8px;
    padding: clamp(8px, 2vh, 20px) 4px; flex: 1; min-width: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
}
.time-val { font-family: 'Cinzel', serif; font-size: clamp(1.1rem, 4.2vw, 2.8rem); color: #4a3b32; font-weight: 600; line-height: 1;}
.time-label { font-family: 'Montserrat', sans-serif; font-size: clamp(0.5rem, 1.1vw, 0.75rem); color: #888; letter-spacing: 1px; text-transform: uppercase; margin-top: 5px; font-weight: 600;}

/* --- 10. FULL SCREEN EVENT MODAL --- */
#event-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; height: 100dvh; z-index: 2000;
    display: none; background: radial-gradient(circle at center, #3a261f 0%, #0a0604 100%); overflow: hidden;
}
.close-btn {
    position: absolute;
    top: max(clamp(20px, 4vh, 30px), calc(env(safe-area-inset-top, 0px) + 10px));
    left: max(clamp(20px, 4vw, 30px), calc(env(safe-area-inset-left, 0px) + 10px));
    right: auto;
    z-index: 2100; background: rgba(255,255,255,0.9);
    border: 2px solid #d4af37; border-radius: 50%; width: 45px; height: 45px; font-size: 1.5rem;
    cursor: pointer; color: #8a3a3a; box-shadow: 0 4px 10px rgba(0,0,0,0.2); display: flex; justify-content: center; align-items: center;
}
.reveal-hint {
    position: absolute;
    top: max(clamp(20px, 4vh, 30px), calc(env(safe-area-inset-top, 0px) + 10px));
    left: 50%; transform: translateX(-50%);
    z-index: 2050; background: rgba(255,255,255,0.8);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    padding: 10px 15px; border-radius: 25px; font-size: 0.75rem; font-weight: bold; letter-spacing: 1px; color: #444; pointer-events: none; border: 1px solid #d4af37;
    animation: bounce-x 2s infinite; white-space: nowrap;
}

#modal-content-wrapper { position: relative; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;}
#modal-vid { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; z-index: 1;}

#modal-text-overlay {
    position: absolute; top: 15%; right: 8%; text-align: right; z-index: 15;
    color: #fff; text-shadow: 0 2px 15px rgba(0,0,0,0.9); pointer-events: none; width: 80%;
}
#modal-top-text { font-size: clamp(0.8rem, 2vw, 1rem); letter-spacing: 2px; margin-bottom: 5px; font-weight: 500;}
#modal-title { font-family: 'Cinzel', serif; font-size: clamp(1.8rem, 5vw, 3.5rem); color: #f4d03f; margin: 0; line-height: 1.1; font-weight: 700; word-wrap: break-word;}
#modal-subtitle { font-family: 'Great Vibes', cursive; font-size: clamp(2.5rem, 6vw, 3.5rem); color: #fff; margin: -5px 0 15px; font-weight: 400;}
#modal-details { font-size: clamp(0.75rem, 1.8vw, 0.9rem); line-height: 1.6; font-weight: 600; color: #eee; letter-spacing: 1px; margin-top: 10px;}
#modal-bottom-text {
    position: absolute; bottom: 12%; right: 8%; text-align: right; font-size: clamp(0.9rem, 2vw, 1.2rem);
    font-style: italic; font-weight: 600; z-index: 15; color: #fff; text-shadow: 0 2px 15px rgba(0,0,0,0.9); max-width: 80%; pointer-events: none;
}

@media (max-aspect-ratio: 1/1) {
    #modal-content-wrapper {
        flex-direction: column; justify-content: center;
        padding: max(70px, calc(env(safe-area-inset-top, 0px) + 60px)) 0 max(20px, env(safe-area-inset-bottom, 0px));
        overflow-y: auto;
    }
    #modal-vid {
        position: relative; height: auto; max-height: 45vh; max-height: 45dvh;
        object-fit: contain; width: 95%; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); margin-bottom: 20px;
        flex-shrink: 0;
    }
    #modal-text-overlay { position: relative; top: auto; right: auto; text-align: center; width: 90%; }
    #modal-bottom-text { position: relative; bottom: auto; right: auto; text-align: center; width: 90%; margin-top: 15px; }
}

#scratch-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 20; touch-action: none; cursor: crosshair;}

/* --- 11. FOOTER --- */
#final-screen {
    background: linear-gradient(to bottom, #2b1b16 0%, #120b08 100%); color: #fff; text-align: center;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.om-symbol { font-size: 5rem; color: #d4af37; margin-bottom: 25px; text-shadow: 0 0 30px rgba(212,175,55,0.4); }
.footer-text { font-family: 'Cinzel', serif; font-size: clamp(1rem, 2.5vw, 1.3rem); line-height: 2; color: #e0d8c3; margin-bottom: 40px; letter-spacing: 1.5px;}
.footer-names { font-family: 'Great Vibes', cursive; font-size: clamp(3.4rem, 12vw, 6.5rem); color: #d4af37; font-weight: 400; line-height: 1.1; }

/* --- 12. NON-BLOCKING ASSET LOADERS --- */
.asset-loader {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    display: none; flex-direction: column; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.5); border-radius: 12px; padding: 25px 35px;
    color: #fdfbf7; font-family: 'Montserrat', sans-serif; font-size: 0.9rem; font-weight: 600;
    letter-spacing: 2px; text-transform: uppercase; z-index: 3000; white-space: nowrap;
}
.spinner {
    width: 35px; height: 35px; margin-bottom: 15px;
    border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: #d4af37;
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Compact loader inside the small event thumbnails */
.event-thumb .asset-loader {
    top: 0; left: 0; transform: none; width: 100%; height: 100%;
    border-radius: 0; border: none; padding: 6px; font-size: 0.55rem; letter-spacing: 1px; white-space: normal; text-align: center;
}
.event-thumb .spinner { width: 20px; height: 20px; margin-bottom: 6px; border-width: 2px; }

/* --- 13. SHORT / LANDSCAPE PHONES --- */
@media (orientation: landscape) and (max-height: 500px) {
    .snap-section { padding-top: 16px; padding-bottom: 16px; }
    #sec-festivities { padding-top: 16px; }
    .section-title { font-size: 2.6rem; margin-bottom: 8px; }
    .invite-text { margin-bottom: 12px; line-height: 1.5; font-size: 0.85rem; }
    .wedding-border-card { padding: 16px 20px; }
    .invitation-img-wrapper img { max-height: 48vh; max-height: 48dvh; }
    .story-media { max-height: 28vh; max-height: 28dvh; }
    .story-card { padding: 16px; }
    .story-card p { margin-bottom: 10px; }
    .swipe-hint { margin-bottom: 6px; }
    .om-symbol { font-size: 3rem; margin-bottom: 10px; }
    .footer-text { margin-bottom: 15px; line-height: 1.6; }
    #modal-text-overlay { top: 12%; }
    #modal-subtitle { font-size: 1.8rem; margin-bottom: 6px; }
    #modal-details { line-height: 1.4; }
    #modal-bottom-text { bottom: 6%; }
}

/* --- 14. VERY LARGE SCREENS --- */
@media (min-width: 1600px) { html { font-size: 18px; } }
@media (min-width: 2200px) { html { font-size: 22px; } }

/* --- 14b. TALL / PORTRAIT SCREENS: keep controls next to the artwork, not at the screen bottom --- */
@media (max-aspect-ratio: 1/1) {
    /* Intro: image, then the "Tap to begin" button right under it */
    #intro-screen { padding: 0 16px; }
    .intro-img { max-height: 68vh; max-height: 68dvh; }
    .tap-btn {
        position: relative; bottom: auto; margin-top: 28px;
        padding: 14px 34px; letter-spacing: 4px;
    }

    /* Ganesha video: sits in the flow, Skip button right under it */
    #ganesha-screen { flex-direction: column; justify-content: center; }
    .g-vid {
        position: relative; top: auto; left: auto;
        width: 100%; height: auto; max-height: 72vh; max-height: 72dvh;
        object-fit: contain;
    }
    .skip-btn {
        position: relative; bottom: auto; right: auto;
        margin-top: 24px; align-self: flex-end;
        margin-right: max(20px, calc(env(safe-area-inset-right, 0px) + 10px));
    }

    /* Welcome section: "Scroll Down" right under the image */
    #sec-welcome { justify-content: center; }
    .scroll-down-hint {
        position: relative; bottom: auto; margin-top: 24px;
    }
}

/* --- 15. REDUCED MOTION --- */
@media (prefers-reduced-motion: reduce) {
    .falling-particle, .tap-btn, .scroll-down-hint, .reveal-hint, .swipe-hint, .swipe-hint svg { animation: none; }
    .reveal-hint { transform: translateX(-50%); }
    #app-content, .story-scroller { scroll-behavior: auto; }
}
/* --- 16. LANDSCAPE PHONES: stop "Tap to begin" overlapping the cover image --- */
@media (orientation: landscape) and (max-height: 500px) {
    .intro-img { max-height: 62vh; max-height: 62dvh; }
    .tap-btn {
        bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) + 8px));
        padding: 10px 34px;
        min-height: 44px;
        letter-spacing: 4px;
    }
}