/* ========================================
   Mobile First Responsive Design
======================================== */

/* Base styles are mobile-first (already defined in styles.css) */

/* ========================================
   Extra Small Devices (Portrait Phones)
   < 576px
======================================== */
@media (max-width: 575.98px) {
    .container {
        padding: 0 15px;
    }

    /* Header */
    .header {
        padding: 1rem;
        min-height: 100vh;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .header-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        padding: 2rem 0 6rem 0;
        min-height: calc(100vh - 120px);
        justify-content: center;
        align-items: center;
    }

    .header-text {
        order: 1;
        margin-bottom: 1rem;
    }

    .header-image {
        order: 2;
        margin-bottom: 2rem;
    }

    .bride-groom-names {
        font-size: 2.5rem !important;
        flex-direction: column;
        gap: 0.5rem;
    }

    .ampersand {
        font-size: 2rem !important;
    }

    .wedding-date {
        font-size: 1.2rem !important;
    }

    .catchphrase {
        font-size: 1rem !important;
    }

    .main-photo {
        max-width: 250px !important;
        width: 100%;
        height: auto;
        margin: 0 auto;
        display: block;
    }

    /* Scroll indicator adjustment for mobile */
    .scroll-indicator {
        position: absolute;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 10;
        background: rgba(255, 255, 255, 0.8);
        padding: 0.5rem 1rem;
        border-radius: 20px;
        backdrop-filter: blur(5px);
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    .scroll-text {
        font-size: 0.8rem;
        margin-bottom: 0.3rem;
        color: #333;
        font-weight: 500;
        text-align: center;
        display: block;
        width: 100%;
    }

    .scroll-arrow {
        margin: 0 auto;
        display: block;
    }

    /* Navigation */
    .nav-list {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0 1rem;
    }

    .nav-link {
        padding: 0.75rem 1rem;
        text-align: center;
    }

    /* Section Titles */
    .section-title {
        font-size: 2rem;
    }

    /* Profiles - portrait mode */
    .profiles {
        padding: 4rem 0;
    }

    .profiles-container {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 2rem;
    }

    .profile-card {
        padding: 1.5rem;
    }

    .profile-photo {
        width: 150px;
        height: 150px;
    }

    .profile-name {
        font-size: 1.5rem;
    }

    .favorites ul {
        grid-template-columns: 1fr;
    }

    .meeting-story {
        padding: 2rem;
        margin-top: 1rem;
    }

    /* Timeline */
    .timeline {
        padding: 4rem 0;
    }

    .timeline-container::before {
        left: 30px;
    }

    .timeline-item {
        flex-direction: column !important;
        align-items: flex-start;
        padding-left: 60px;
    }

    .timeline-date {
        position: absolute;
        left: 0;
        width: 100px;
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .timeline-content {
        margin: 0;
        margin-top: 1rem;
        width: 100%;
    }

    /* Memory Section */
    .memory-container {
        min-height: auto;
        padding: 2rem 1rem;
        flex-direction: column;
        gap: 2rem;
    }

    .central-photo {
        position: static;
        transform: none;
        margin: 0 auto 2rem auto;
        display: block;
        text-align: center;
        order: 1;
    }

    .couple-photo {
        width: 150px;
        height: 150px;
    }

    .memory-bubble {
        position: static;
        margin: 0 auto 1.5rem auto;
        max-width: 320px;
        width: 100%;
        display: block;
        transform: none !important;
        opacity: 1 !important;
    }

    .bubble-top { order: 2; }
    .bubble-right { order: 3; }
    .bubble-bottom { order: 4; }
    .bubble-left { order: 5; }

    .memory-bubble.animate {
        transform: none !important;
    }

    .bubble-arrow {
        display: none;
    }

    /* Footer */
    .footer {
        padding: 3rem 0;
    }

    .footer-names {
        font-size: 1.5rem;
    }
}

/* ========================================
   Mobile Landscape (Phones in Landscape)
   < 768px height and landscape orientation
======================================== */
@media (max-width: 767.98px) and (orientation: landscape) {
    /* Header adjustments for landscape */
    .header {
        min-height: 100vh;
        padding: 0.5rem;
    }

    .header-content {
        gap: 1rem;
        padding-bottom: 2rem;
    }

    .bride-groom-names {
        font-size: 2rem !important;
    }

    .main-photo {
        max-width: 200px !important;
    }

    /* Profiles in landscape - side by side */
    .profiles {
        padding: 2rem 0;
    }

    .profiles-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .profile-card {
        padding: 1rem;
        margin: 0;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
    }

    .profile-info {
        gap: 0.5rem;
    }

    .info-item {
        gap: 0.3rem;
    }

    .info-label {
        font-size: 0.8rem;
    }

    .info-value {
        font-size: 0.9rem;
    }

    .profile-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    /* Section title for landscape */
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 1.5rem;
    }

    /* Timeline adjustments */
    .timeline {
        padding: 2rem 0;
    }

    .timeline-item {
        padding: 1rem;
    }

    /* Memory section adjustments */
    .memory-container {
        min-height: 500px;
        padding: 1rem;
    }

    .couple-photo {
        width: 120px;
        height: 120px;
    }

    .memory-bubble {
        max-width: 200px;
        min-width: 180px;
        padding: 1rem;
    }

    .bubble-content h4 {
        font-size: 1rem;
    }

    .bubble-content p {
        font-size: 0.8rem;
    }

    /* Adjust bubble positions for smaller landscape screens */
    .bubble-top {
        top: 30px;
        left: 30px;
    }

    .bubble-right {
        top: 30px;
        right: 30px;
    }

    .bubble-bottom {
        bottom: 30px;
        right: 30px;
    }

    .bubble-left {
        bottom: 30px;
        left: 30px;
    }
}

/* ========================================
   Small Devices (Landscape Phones)
   576px - 767.98px
======================================== */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        padding: 0 20px;
    }

    /* Header */
    .header-content {
        flex-direction: column;
        gap: 3rem;
    }

    .bride-groom-names {
        font-size: 3rem;
    }

    .ampersand {
        font-size: 2.5rem;
    }

    .main-photo {
        max-width: 350px;
    }

    /* Navigation */
    .nav-list {
        gap: 1.5rem;
    }

    /* Profiles */
    .profiles-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .profile-photo {
        width: 180px;
        height: 180px;
    }

    /* Timeline */
    .timeline-container::before {
        left: 30px;
    }

    .timeline-item {
        flex-direction: column !important;
        align-items: flex-start;
        padding-left: 80px;
    }

    .timeline-date {
        position: absolute;
        left: 0;
        width: 110px;
    }

    .timeline-content {
        margin: 0;
        margin-top: 1rem;
        width: 100%;
    }

    /* Memory Section */
    .memory-container {
        min-height: 700px;
        padding: 2rem 1rem;
    }

    .couple-photo {
        width: 170px;
        height: 170px;
    }

    .memory-bubble {
        max-width: 220px;
        min-width: 200px;
    }

    /* Adjust positioning for smaller screens - 四隅配置 */
    .bubble-top {
        top: 30px;
        left: 30px;
    }

    .bubble-right {
        top: 30px;
        right: 30px;
    }

    .bubble-bottom {
        bottom: 30px;
        right: 30px;
    }

    .bubble-left {
        bottom: 30px;
        left: 30px;
    }

    .bubble-content h4 {
        font-size: 1.1rem;
    }

    .bubble-content p {
        font-size: 0.85rem;
    }
}

/* ========================================
   Medium Devices (Tablets)
   768px - 991.98px
======================================== */
@media (min-width: 768px) and (max-width: 991.98px) {
    /* Header */
    .header-content {
        flex-direction: column;
        gap: 3rem;
    }

    .bride-groom-names {
        font-size: 3.5rem;
    }

    .main-photo {
        max-width: 380px;
    }

    /* Profiles */
    .profiles-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .profile-card {
        max-width: 600px;
        margin: 0 auto;
    }

    /* Timeline */
    .timeline-item {
        margin-bottom: 3rem;
    }

    .timeline-content {
        margin: 0 1.5rem;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* ========================================
   Large Devices (Desktops)
   992px - 1199.98px
======================================== */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }

    /* Header */
    .bride-groom-names {
        font-size: 3.8rem;
    }

    /* Profiles */
    .profiles-container {
        gap: 3rem;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Extra Large Devices (Large Desktops)
   ≥ 1200px
======================================== */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }

    /* Header */
    .bride-groom-names {
        font-size: 4rem;
    }

    /* Gallery */
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   Ultra Large Devices
   ≥ 1400px
======================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1200px;
    }

    .header-content {
        gap: 5rem;
    }

    .profiles-container {
        gap: 4rem;
    }
}

/* ========================================
   Landscape Orientation
======================================== */
@media (orientation: landscape) and (max-height: 500px) {
    .header {
        min-height: 100vh;
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: row;
        gap: 2rem;
    }

    .bride-groom-names {
        font-size: 2.5rem;
    }

    .scroll-indicator {
        bottom: 10px;
    }
}

/* ========================================
   High Resolution Displays
======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .main-photo,
    .profile-photo,
    .timeline-image img,
    .gallery-item img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .navigation,
    .scroll-indicator,
    .lightbox {
        display: none !important;
    }

    .header,
    .profiles,
    .timeline,
    .gallery,
    .footer {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }

    .section-title {
        color: #000;
        page-break-after: avoid;
    }
}

/* ========================================
   Accessibility & Reduced Motion
======================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .scroll-arrow {
        animation: none;
    }

    .floating-hearts {
        display: none;
    }
}

/* ========================================
   Dark Mode (if user prefers)
======================================== */
@media (prefers-color-scheme: dark) {
    /* Note: This is optional since the design is specifically light-themed for a wedding */
    /* Uncomment if dark mode support is needed */
    /*
    body {
        background-color: #1a1a1a;
        color: #f0f0f0;
    }

    .header {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    }

    .profile-card,
    .timeline-content {
        background: #2a2a2a;
        color: #f0f0f0;
    }
    */
}

/* ========================================
   Focus Styles for Accessibility
======================================== */
@media (any-hover: hover) {
    .nav-link:focus,
    .gallery-item:focus,
    .profile-card:focus,
    .timeline-content:focus {
        outline: 2px solid #D4AF37;
        outline-offset: 2px;
    }
}

/* ========================================
   Touch Device Optimizations
======================================== */
@media (hover: none) and (pointer: coarse) {
    .nav-link,
    .gallery-item,
    .profile-card {
        min-height: 44px; /* Minimum touch target size */
        min-width: 44px;
    }

    .gallery-item::before,
    .gallery-item::after {
        opacity: 0.7; /* Make overlay always visible on touch devices */
    }

    /* Remove hover effects on touch devices */
    .profile-card:hover,
    .timeline-content:hover,
    .gallery-item:hover {
        transform: none;
    }
}
