* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-attachment: fixed;
    transition: background 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding: 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    transform: translateZ(0); /* Enable hardware acceleration */
    will-change: transform;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.product-image-container {
    width: 100%;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.product-image {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    transform: translateZ(0); /* Enable hardware acceleration */
    will-change: transform;
}

/* Placeholder image styling */
.product-image[src*="placeholder"] {
    opacity: 0.9;
    filter: brightness(1.1);
}

/* Landscape images */
.product-image-container.landscape {
    aspect-ratio: 16 / 9;
}

.product-image-container.landscape .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Portrait images */
.product-image-container.portrait {
    aspect-ratio: 9 / 16;
}

.product-image-container.portrait .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Square images */
.product-image-container.square {
    aspect-ratio: 1 / 1;
}

.product-image-container.square .product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Gallery for multiple images */
.product-image-container.gallery {
    display: flex;
    flex-direction: row;
    gap: 15px;
    min-height: 500px;
    align-items: stretch;
}

.product-image-container.gallery .gallery-image {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image-container.gallery .gallery-image.landscape {
    aspect-ratio: 16 / 9;
}

.product-image-container.gallery .gallery-image.portrait {
    aspect-ratio: auto;
    height: 100%;
}

.product-image-container.gallery .gallery-image.square {
    aspect-ratio: 1 / 1;
}

.product-image-container.gallery .gallery-image .product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
}

/* Ensure gallery images fill the available space */
.product-image-container.gallery .gallery-image.portrait .product-image {
    width: auto;
    height: 100%;
    max-width: 100%;
    max-height: none;
}

.product-title {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #2d3748;
    font-weight: 600;
}

.product-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #4a5568;
    margin-bottom: 20px;
}

.product-location {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

.product-location a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.product-location a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.product-location svg {
    width: 20px;
    height: 20px;
}

footer {
    text-align: center;
    color: white;
    padding: 20px;
    margin-top: 40px;
    opacity: 0.9;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .product-card {
        padding: 20px;
    }

    /* Stack gallery images vertically on mobile */
    .product-image-container.gallery {
        flex-direction: column;
        min-height: auto;
    }

    .product-image-container.gallery .gallery-image {
        width: 100%;
        flex: none;
        height: auto;
        min-height: 250px;
    }

    .product-image-container.gallery .gallery-image .product-image {
        height: auto;
        max-height: none;
        width: 100%;
    }
}

