/*
 * TourBreak Mosaic View Styles
 * Optimierte und wartbare CSS für die Bildmosaik-Galerie
 */

/* Gallery Section Styles */
.gallery-section {
    background: transparent;
    width: 100vw;
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    min-height: 60vh;
    z-index: 1;
    transform: none !important;
    overflow-x: hidden;
    box-sizing: border-box;
}

.gallery-section .container {
    max-width: none;
    padding: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Main Mosaic Grid - Optimiert für 3 Größenklassen */
.image-mosaic {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    height: 70dvh;
    padding: 20px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Mosaic Item Base Styles */
.image-mosaic div {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: transparent;
}

.image-mosaic img {
    transition: none; /* Disable transitions on load */
}

.image-mosaic div img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

/* Drei klar definierte Größenklassen */

/* GROSSE Bilder - Hero/Feature Bilder */
.image-mosaic .size-large {
    grid-column: span 3;
    grid-row: span 2;
}

/* MITTLERE Bilder - Highlight Bilder */
.image-mosaic .size-medium {
    grid-column: span 2;
    grid-row: span 1;
}

/* KLEINE Bilder - Standard Bilder */
.image-mosaic .size-small {
    grid-column: span 1;
    grid-row: span 1;
}

/* Specific positioning for balanced layout */
.image-mosaic .size-large:nth-of-type(1) {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
}

.image-mosaic .size-medium:nth-of-type(2) {
    grid-column: 4 / 6;
    grid-row: 1 / 2;
}

.image-mosaic .size-medium:nth-of-type(3) {
    grid-column: 1 / 3;
    grid-row: 3 / 4;
}

.image-mosaic .size-medium:nth-of-type(4) {
    grid-column: 4 / 6;
    grid-row: 3 / 4;
}

/* Responsive Breakpoints - Vereinfacht */

/* Large Tablets (max-width: 1024px) */
@media (max-width: 1024px) {
    .image-mosaic {
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(5, 1fr);
        height: 65vh;
        gap: 6px;
    }
    
    .image-mosaic .size-large {
        grid-column: span 2;
        grid-row: span 2;
    }
    
    .image-mosaic .size-medium {
        grid-column: span 2;
        grid-row: span 1;
    }
    
    .image-mosaic .size-small {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    /* Repositioning for tablet */
    .image-mosaic .size-large:nth-of-type(1) {
        grid-column: 1 / 3;
        grid-row: 1 / 3;
    }
    
    .image-mosaic .size-medium:nth-of-type(2) {
        grid-column: 3 / 5;
        grid-row: 1 / 2;
    }
    
    .image-mosaic .size-medium:nth-of-type(3) {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }
    
    .image-mosaic .size-medium:nth-of-type(4) {
        grid-column: 3 / 5;
        grid-row: 3 / 4;
    }
}

/* Tablets and Large Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .gallery-section {
        top: 50px;
    }
    
    .image-mosaic {
        grid-template-rows: repeat(6, 1fr);
        height: 60dvh;
        gap: 4px;
        padding: 15px;
    }
    
    .image-mosaic .size-large {
        grid-column: span 2;
        grid-row: span 2;
    }
    
    .image-mosaic .size-medium {
        grid-column: span 2;
        grid-row: span 1;
    }
    
    .image-mosaic .size-small {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    /* Auto-flow für mobile - einfacher zu warten */
    .image-mosaic div {
        grid-column: auto;
        grid-row: auto;
    }
    
    .image-mosaic .size-large:first-of-type {
        grid-column: span 2;
        grid-row: span 2;
    }
}

/* Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .gallery-section {
        top: 45px;
    }
    
    .image-mosaic {
        height: 50dvh;
        gap: 3px;
        box-sizing: border-box;
        padding: 10px;
    }
    
    
    /* Disable hover effects on mobile for better performance */
    .image-mosaic div:hover {
        transform: none;
        box-shadow: none;
    }
    
    .image-mosaic div:hover img {
        transform: none;
    }
}

/* Very Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .image-mosaic {
        gap: 2px;
    }
}

/* Accessibility Features */

/* Focus Styles for Better Keyboard Navigation */
.image-mosaic div:focus-within {
    outline: 3px solid #007acc;
    outline-offset: 2px;
    z-index: 3;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .image-mosaic div:focus-within {
        outline: 3px solid yellow;
        outline-offset: 2px;
    }
    
    .image-mosaic div {
        border: 1px solid transparent;
    }
    
    .image-mosaic div:hover {
        border: 1px solid currentColor;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .image-mosaic div,
    .image-mosaic div img {
        transition: none;
    }
    
    .image-mosaic div:hover {
        transform: none;
    }
    
    .image-mosaic div:hover img {
        transform: none;
    }
}

/* Loading States */
.image-mosaic div img[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-mosaic div img[loading="lazy"].loaded {
    opacity: 1;
}

/* Print Styles */
@media print {
    .gallery-section {
        position: static;
        height: auto;
    }
    
    .image-mosaic {
        height: auto;
        gap: 2px;
        grid-template-rows: auto;
    }
    
    .image-mosaic div:hover {
        transform: none;
        box-shadow: none;
    }
}

