@font-face {
    font-family: 'GTFAdieuTRIAL-Bold';
    src: url('./fonts/GTFAdieuTRIAL-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
    font-display: swap; /* Improve font loading performance */
}

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

html, body {
    /* Ensure background fills the full device viewport on mobile */
    min-height: 100vh;   /* fallback */
    min-height: 100dvh;  /* dynamic viewport for mobile browsers */
    overflow: hidden;
    font-family: 'Muli', sans-serif;
    font-weight: 500;
    background: #0D0E0F; /* extend black beyond content to avoid white bars */
}

.container {
    position: relative;
    width: 100vw;
    min-height: 100vh;  /* fallback */
    min-height: 100dvh; /* dynamic viewport height */
    background: #0D0E0F;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 30px;
}

.container::before {
    content: '';
    position: absolute;
    /* Cover the entire container even when its height is driven by min-height */
    inset: 0;
    background: url('./assets/29-web.png') center center / cover no-repeat;
    z-index: 0;
    will-change: transform; /* Optimize for animations */
}

.main-title {
    font-family: 'GTFAdieuTRIAL-Bold', serif;
    font-size: clamp(3rem, 8vw, 6.5rem);
    font-weight: bold;
    color: #111111;
    text-shadow: 0px 1px 2px #FFFBDD;
    margin-bottom: 30px;
    text-align: center;
    z-index: 10;
    position: relative;
}

.content {
    max-width: 800px;
    text-align: center;
    z-index: 10;
    position: relative;
    margin-bottom: 40px;
    padding: 0;
}

.description {
    font-family: 'Muli', sans-serif;
    font-weight: 200;
    font-size: 14px;
    line-height: 1.3;
    color: #F7F7F7;
    width: 800px;
}

.description strong {
    font-weight: 700;
}

.polaroid {
    position: absolute;
    transform-origin: center;
    z-index: 5;
}

.polaroid img {
    width: 300px;
    height: 300px;
    object-fit: cover;
    display: block;
}


.left-polaroid {
    bottom: 6rem;
    left: 160px;
    transform: rotate(8deg) scale(1.3);
    animation: float 6s ease-in-out infinite;
}

.right-polaroid {
    bottom: 4rem;
    right: 200px;
    transform: rotate(-12deg) scale(0.85);
    animation: float 6s ease-in-out infinite 3s;
}

.cake-container {
    position: absolute;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%) rotate(-8deg);
    z-index: 8;
}

.main-cake {
    width: clamp(300px, 40vw, 450px);
    height: auto;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}



@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(8deg) scale(1.2);
    }
    50% {
        transform: translateY(-10px) rotate(8deg) scale(1.2);
    }
}

.right-polaroid {
    animation-name: floatRight;
}

@keyframes floatRight {
    0%, 100% {
        transform: translateY(0px) rotate(-12deg) scale(0.85);
    }
    50% {
        transform: translateY(-10px) rotate(-12deg) scale(0.85);
    }
}

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

/* Desktop and larger screens - 1000px and above */
@media (min-width: 1000px) {
    .photo-grid-container {
        margin: 0 2rem !important;
        padding: 0 !important;
    }
    
    /* Force 2rem margin for all desktop screens */
    .container .photo-grid-container {
        margin: 0 2rem !important;
        padding: 0 !important;
    }
}

/* Nest Hub specific adjustments (1024x600) */
@media (min-width: 1000px) and (max-width: 1100px) and (min-height: 580px) and (max-height: 620px) {
    .container {
        padding: 0;
    }
    
    .video-page.container {
        align-items: stretch;
    }
    
    .video-page .main-title {
        font-size: 5.2rem !important;
        margin-bottom: 15px;
    }
    
    .content {
        margin-bottom: 20px;
    }
    
    .description {
        font-size: 12px;
        line-height: 1.2;
        width: 700px;
    }
    
    .polaroid img {
        width: 230px;
        height: 230px;
    }
    
    .left-polaroid {
        bottom: 6rem;
        left: 80px;
        transform: rotate(8deg) scale(1.15);
    }
    
    .right-polaroid {
        bottom: 4rem;
        right: 120px;
        transform: rotate(-12deg) scale(0.9);
    }
    
    .cake-container {
        bottom: -60px;
    }
    
    .main-cake {
        width: 350px;
    }
    
    @keyframes float {
        0%, 100% {
            transform: translateY(0px) rotate(8deg) scale(1.15);
        }
        50% {
            transform: translateY(-8px) rotate(8deg) scale(1.15);
        }
    }
    
    @keyframes floatRight {
        0%, 100% {
            transform: translateY(0px) rotate(-12deg) scale(0.9);
        }
        50% {
            transform: translateY(-8px) rotate(-12deg) scale(0.9);
        }
    }
}

/* Responsive adjustments for mobile - 768px and below */
@media (max-width: 768px) {
    .container {
        padding: 0 1.5rem;
        padding-top: 40px !important;
    }
    
    .container::before {
        background: url('./assets/29-mobile.png') center center / cover no-repeat;
    }
    
    .main-title {
        font-size: clamp(5rem, 15vw, 7rem);
        margin-left: 0;
        padding-left: 0;
        margin-bottom: 20px;
    }
    
    .description {
        font-size: 16px;
        padding: 0 !important;
        width: auto;
        text-align: left;
        margin: 0 !important;
    }
    
    .polaroid img {
        width: 150px;
        height: 150px;
    }
    
    .left-polaroid {
        top: 600px !important;
        left: 40px !important;
        z-index: 39;
        transform: rotate(8deg) scale(1.9) !important;
    }
    
    .right-polaroid {
        top: 7rem !important;
        right: -6rem !important;
        z-index: 40;
        transform: rotate(-18deg) scale(1.3) !important;
    }
    
    .main-cake {
        width: clamp(450px, 60vw, 400px);
    }
    
    @keyframes float {
        0%, 100% {
            transform: translateY(0px) rotate(8deg) scale(0.8);
        }
        50% {
            transform: translateY(-10px) rotate(8deg) scale(0.8);
        }
    }
    
    @keyframes floatRight {
        0%, 100% {
            transform: translateY(0px) rotate(-12deg) scale(0.6);
        }
        50% {
            transform: translateY(-10px) rotate(-12deg) scale(0.6);
        }
    }

    /* Video modal styles for mobile */
    .video-modal-content {
        max-width: 98vw;
        max-height: 90vh;
        height: auto;
        padding: 20px;
        display: flex;
        flex-direction: column;
    }
    
    .video-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-container video {
        min-width: auto;
        min-height: auto;
        max-height: 80vh;
        height: auto;
        width: 100%;
    }

    /* Video page specific styles */
    .video-page {
        padding-top: 40px;
    }
    
    .video-page .main-title {
        font-size: clamp(5rem, 15vw, 7rem);
        margin-left: 0;
        padding-left: 0;
    }
    
    .video-page .tabs-container {
        margin-bottom: 40px;
        gap: 20px;
        justify-content: flex-start !important;
        width: 100%;
    }
    
    .tab {
        font-size: 16px;
    }
    
    .photo-grid-container {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        margin: 0;
        padding: 0 1rem;
    }
    
    .photo-grid {
        display: flex;
        flex-direction: row;
        gap: 10px;
        width: auto;
        transform: none !important;
        padding-left: 0;
    }
    
    .photo-card {
        flex-shrink: 0;
        width: calc((100vw - 2rem - 30px) / 2.5);
        max-width: 280px;
        aspect-ratio: 4/5;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
}

/* Small mobile devices - 480px and below */
@media (max-width: 480px) {
    .container {
        padding: 0 1.5rem;
    }

    .container::before {
        background: url('./assets/29-mobile.png') center center / cover no-repeat;
    }
    
    .main-title {
        font-size: 4.4rem !important;
        text-align: left;
    }
    
    .description {
        font-size: 14px;
    }
    
    .polaroid img {
        width: 120px;
        height: 120px;
    }
    
    .left-polaroid {
        top: 320px;
        left: 10px;
        transform: rotate(8deg) scale(0.7);
    }
    
    .right-polaroid {
        top: 1rem;
        right: 1rem;
        transform: rotate(-12deg) scale(0.5);
    }
    
    @keyframes float {
        0%, 100% {
            transform: translateY(0px) rotate(8deg) scale(0.7);
        }
        50% {
            transform: translateY(-10px) rotate(8deg) scale(0.7);
        }
    }
    
    @keyframes floatRight {
        0%, 100% {
            transform: translateY(0px) rotate(-12deg) scale(0.5);
        }
        50% {
            transform: translateY(-10px) rotate(-12deg) scale(0.5);
        }
    }

    /* Video modal styles for small mobile */
    .video-modal-content {
        padding: 15px;
        height: auto;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
    
    .video-container {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .video-container video {
        max-height: 75vh;
        height: auto;
        width: 100%;
    }

    /* Photo grid styles for small mobile */
    .photo-grid-container {
        padding: 0;
    }
    
    .photo-card {
        width: 70vw;
        max-width: 350px;
        aspect-ratio: 4/5;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    .tab {
        font-size: 14px;
    }
    
    .video-page .tabs-container {
        gap: 15px;
        justify-content: flex-start !important;
        padding-left: 1.5rem;
    }
}

/* Mobile Navigation Button - Styled with black background and rounded corners */
.mobile-nav-button {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: none;
    background: #000000;
    color: #ffffff;
    border: none;
    border-radius: 25px;
    padding: 12px 34px;
    font-family: 'Muli', sans-serif;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s ease, transform 0.2s ease;
}

.mobile-nav-button:hover {
    background: #333333;
    transform: translateX(-50%) scale(1.05);
}

/* Navigation Button for Index Page - Desktop Only */
.nav-button {
    position: fixed;
    width: 90px;
    height: 90px;
    padding: 8px;
    background: #AFA0FF;
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: none; /* Hidden by default, shown via JavaScript */
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
    z-index: 1000;
    font-family: 'Muli', sans-serif;
    font-weight: 700;
    font-size: 11px;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    pointer-events: none; /* Don't block clicks */
    transform: translate(-50%, -50%);
    white-space: normal;
    text-align: center;
    line-height: 1.1;
    word-wrap: break-word;
    will-change: left, top, transform;
}

.nav-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(175, 160, 255, 0.9);
}

/* Video Message Page Styles */
.video-page {
    padding-top: 30px;
}

.video-page .main-title {
    margin-bottom: 40px;
}

.tabs-container {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    justify-content: center;
    z-index: 10;
    position: relative;
    align-items: flex-start;
    padding: 0 !important;
}

.tab {
    font-family: 'Muli', sans-serif;
    font-weight: 500;
    font-size: 18px;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab:hover {
    color: #888;
}

.tab.active {
    color: #ffffff;
}

.tab-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab.active .tab-indicator {
    background: #ffffff;
    border-color: #ffffff;
}

.photo-grid-container {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    margin: 0 2rem;
    padding: 0;
    z-index: 10;
    cursor: default;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    
    /* Better scroll behavior on mobile */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.photo-grid-container::-webkit-scrollbar {
    height: 8px;
}

.photo-grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.photo-grid-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.photo-grid-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.photo-grid {
    display: flex;
    flex-direction: row;
    gap: 20px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    position: relative;
    width: max-content;
    min-width: 100%;
    margin: 0;
}

.photo-card {
    width: 280px;
    height: 373px;
    aspect-ratio: 3/4;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
    
    /* Better touch behavior */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}


.photo-card:hover {
    transform: none;
    box-shadow: none;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
    content-visibility: auto; /* allow browser to skip offscreen */
    contain: paint; /* isolate paint to the image */
}

.photo-card:hover img {
    transform: scale(1.1);
}

.photo-card.empty {
    background: rgba(255, 255, 255, 0.05);
    cursor: default;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-card.empty:hover {
    transform: none;
    box-shadow: none;
}

.placeholder-text {
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Muli', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.swipe-button {
    position: fixed;
    width: 90px;
    height: 90px;
    padding: 0;
    background: #AFA0FF;
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
    z-index: 15;
    font-family: 'Muli', sans-serif;
    font-weight: 700;
    font-size: 12px;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    will-change: left, top, transform;
}

/* Button will be shown via JavaScript when hovering over individual cards */

.swipe-button:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(255, 255, 255, 1);
}

/* Video Modal Styles */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* dynamic viewport to avoid white bars */
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.video-modal.active {
    opacity: 1;
    visibility: visible;
}

.video-modal-content {
    position: relative;
    max-width: 95vw;
    max-height: 85vh;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease;
    z-index: 1001;
}

.close-button:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
}

.video-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-container video {
    width: 100%;
    height: auto;
    max-width: 90vw;
    max-height: 70vh;
    border-radius: 15px;
    outline: none;
    object-fit: contain;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.video-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: white;
    font-family: 'Muli', sans-serif;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive modal - now consolidated above in main 768px media query */

/* Second 480px media query removed - consolidated above */

/* Responsive adjustments for video page */
@media (min-width: 1000px) and (max-width: 1100px) and (min-height: 580px) and (max-height: 620px) {
    .video-page {
        padding: 0;
    }
    
    .video-page .main-title {
        font-size: 4rem;
        margin-bottom: 25px;
    }
    
    .tabs-container {
        margin-bottom: 25px;
        gap: 30px;
    }
    
    .tab {
        font-size: 16px;
    }
    
    .photo-grid-container {
        max-width: 100%;
        margin: 0 4rem;
        padding: 0;
        cursor: none;
        border-radius: 20px;
        background: rgba(255, 255, 255, 0.02);
        backdrop-filter: blur(5px);
    }
    
    .photo-grid {
        gap: 15px;
        margin: 0;
    }
    
    .photo-card {
        width: 220px;
        height: 293px;
    }
}

/* Second 768px media query removed - consolidated above */

/* Third 480px media query removed - consolidated above */

/* Second 1000px media query removed - consolidated above */

/* Nest Hub Max specific adjustments (1280x800) */
@media (min-width: 1200px) and (max-width: 1350px) and (min-height: 750px) and (max-height: 850px) {
    .photo-grid-container {
        margin: 0 3rem !important;
        padding: 0 !important;
    }
    
    .video-page .photo-grid-container {
        margin: 0 3rem !important;
        padding: 0 !important;
    }
}

/* Even more specific for video page */
.video-page .photo-grid-container {
    margin: 0 2rem !important;
    padding: 0 !important;
}
