/* Mobile Responsive Styles */

/* Tablets and small laptops */
@media (max-width: 1024px) {
    /* Fix background attachment on tablets */
    .hero,
    .about,
    .details,
    .gallery,
    .rsvp,
    .photo-upload {
        background-attachment: scroll !important;
    }
    
    .container {
        padding: 0 15px;
    }
    
    .section-title {
        font-size: 2.2rem;
    }
    
    .couple-names {
        font-size: 3.5rem;
    }
    
    .countdown {
        gap: 1.5rem;
    }
    
    .countdown-item {
        padding: 1rem 0.8rem;
        min-width: 70px;
    }
    
    .story-card,
    .detail-card,
    .registry-item {
        padding: 2rem;
    }
}

/* Tablets and Mobile devices */
@media (max-width: 768px) {
    /* Fix background images for mobile devices - MUST BE FIRST */
    .hero,
    .about,
    .details,
    .gallery,
    .rsvp,
    .photo-upload {
        background-attachment: scroll !important;
        background-position: center center !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
    }
    
    .hero {
        min-height: 100vh;
        background-position: center center !important;
    }
    
    .about {
        background-position: center center !important;
        padding: 120px 0;
    }
    
    /* Make details and gallery share continuous background */
    .details,
    .gallery {
        /* Updated extension from .jpeg to .jpg */
        background-image: url('../images/details-background.jpg') !important;
        background-position: center center !important;
        background-size: cover !important;
        background-attachment: scroll !important;
        background-repeat: no-repeat !important;
    }
    
    /* Create one continuous background by removing gaps */
    .details {
        padding-bottom: 0px !important;
        background-position: center top !important;
    }
    
    .gallery {
        padding-top: 80px !important;
        background-position: center bottom !important;
        margin-top: 0 !important;
    }
    
    /* Ensure sections connect seamlessly */
    .details + .gallery {
        border-top: none !important;
    }
    
    /* Navigation styles */
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 2rem 0;
        gap: 0;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-item {
        margin: 1rem 0;
    }
    
    .hamburger {
        display: flex;
    }
    
    .hamburger.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .hamburger.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .couple-names {
        font-size: 3rem;
    }
    
    .wedding-date {
        font-size: 1.3rem;
    }
    
    .countdown {
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .countdown-item {
        padding: 1rem 0.7rem;
        min-width: 60px;
    }
    
    .countdown-number {
        font-size: 1.5rem;
    }
    
    .countdown-label {
        font-size: 0.8rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .details-content {
        grid-template-columns: 1fr;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gallery-item {
        width: 100%;
        max-width: none;
        aspect-ratio: 1; /* Changed from 4/3 to 1 for square shape */
    }
    
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
    
    .registry-content {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .story-card,
    .detail-card,
    .registry-item,
    .rsvp-form {
        padding: 1.5rem;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    /* Additional mobile background fixes */
    .hero,
    .about,
    .details,
    .gallery {
        background-attachment: scroll !important;
        background-position: center center !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
    }
    
    /* Make details and gallery share continuous background on small mobile */
    .details,
    .gallery {
        /* Updated extension from .jpeg to .jpg */
        background-image: url('../images/details-background.jpg') !important;
        background-position: center center !important;
        background-size: cover !important;
        background-attachment: scroll !important;
        background-repeat: no-repeat !important;
    }
    
    .hero {
        background-position: center 30% !important;
    }
    
    .about {
        background-position: center center !important;
        padding: 100px 0;
    }
    
    /* Create seamless background between sections */
    .details {
        padding: 60px 0 0px 0 !important;
        background-position: center top !important;
    }
    
    .gallery {
        padding: 80px 0 60px 0 !important;
        background-position: center bottom !important;
        margin-top: 0 !important;
    }
    
    .nav-container {
        padding: 0 15px;
    }
    
    .nav-logo .couple-initials {
        font-size: 1.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .couple-names {
        font-size: 2.5rem;
    }
    
    .wedding-date {
        font-size: 1.1rem;
    }
    
    .wedding-location {
        font-size: 1rem;
        color: #CD853F;
        text-shadow: 0 0 20px rgba(205, 133, 63, 1), 0 2px 4px rgba(0, 0, 0, 1);
        font-weight: 600;
    }
    
    .countdown {
        gap: 0.5rem;
    }
    
    .countdown-item {
        padding: 0.8rem 0.5rem;
        min-width: 55px;
    }
    
    .countdown-number {
        font-size: 1.3rem;
    }
    
    .countdown-label {
        font-size: 0.7rem;
    }
    
    .story-icon,
    .detail-icon,
    .registry-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .story-card h3,
    .detail-card h3,
    .registry-item h3 {
        font-size: 1.3rem;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 10px;
        /* Optimize for performance */
        will-change: transform;
        contain: layout style;
    }
    
    .gallery-item {
        width: 100%;
        aspect-ratio: 1; /* Changed from 4/3 to 1 for square shape */
        border-radius: 10px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.1);
        /* Performance optimizations */
        transform: translateZ(0); /* Enable hardware acceleration */
        will-change: transform;
        contain: layout style paint;
    }
    
    .gallery-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border-radius: 10px;
        /* Optimize image rendering */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        transform: translateZ(0); /* Hardware acceleration */
        transition: transform 0.2s ease;
    }
    
    /* Add loading animation */
    .gallery-item:not(.loaded) {
        opacity: 0.7;
        transform: translateY(20px);
        transition: all 0.3s ease;
    }
    
    .gallery-item.loaded {
        opacity: 1;
        transform: translateY(0);
    }
    
    .placeholder-image {
        font-size: 1.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        background: rgba(255, 255, 255, 0.1);
        color: #d4a574;
    }
    
    .rsvp-form {
        padding: 2rem 1.5rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.8rem;
    }
    
    .radio-option {
        padding: 0.8rem;
    }
    
    .btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }
    
    /* Fix music player button for mobile */
    .music-player {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        z-index: 1000 !important;
    }
    
    .music-toggle {
        width: 50px !important;
        height: 50px !important;
        border-radius: 25px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: rgba(212, 165, 116, 0.9) !important;
        border: none !important;
        color: white !important;
        font-size: 1.2rem !important;
        cursor: pointer !important;
        touch-action: manipulation !important;
        -webkit-tap-highlight-color: transparent !important;
    }
    
    .footer {
        padding: 2rem 0 1rem;
    }
    
    .footer-content {
        gap: 1.5rem;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* Extra small phones */
@media (max-width: 320px) {
    .couple-names {
        font-size: 2.2rem;
    }
    
    .countdown {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .countdown-item {
        width: 80px;
    }
    
    .story-card,
    .detail-card,
    .registry-item {
        padding: 1rem;
    }
    
    .rsvp-form {
        padding: 1.5rem 1rem;
    }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 0 50px;
    }
    
    .couple-names {
        font-size: 2.8rem;
    }
    
    .countdown {
        margin-top: 1.5rem;
    }
    
    .countdown-item {
        padding: 0.8rem 0.6rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    .hero-bg {
        background-size: 100% auto;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero-bg {
        animation: none;
    }
}

/* Print styles */
@media print {
    .navbar,
    .hamburger,
    .countdown,
    .rsvp,
    .footer {
        display: none !important;
    }
    
    .hero {
        height: auto;
        padding: 50px 0;
        background: #fff;
    }
    
    .section-title,
    .couple-names {
        color: #000 !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    section {
        page-break-inside: avoid;
        padding: 20px 0;
    }
}
