/* --- 1. Global Resets & Typography --- */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    /* Wall Color */
    background-color: #f0f0f0; 
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

/* --- 2. Header & Logo --- */
.main-header {
    background-color: #ffffff;
    color: #333;
    padding: 15px 20px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
}

.header-logo {
    height: auto;
    max-height: 500px; 
    width: auto;
    max-width: 100%;
    display: inline-block;
}

/* --- 3. Gallery Grid Layout --- */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 50px 20px;
    
    display: grid;
    /* CHANGE 1: Lowered minmax to 280px to fit smaller phone screens */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px; 
}

/* --- 4. The "Hanging Frame" Style --- */
.gallery-item {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center; 
}

/* The Frame & Mat */
.gallery-item a {
    display: block;
    background-color: #fff;     /* The White Mat */
    padding: 20px;              /* Width of the Mat */
    border: 12px solid #111;    /* The Black Frame */
    
    /* Realistic Wall Shadow */
    box-shadow: 5px 10px 20px rgba(0,0,0,0.4); 
    
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
}

.gallery-item a:hover {
    transform: scale(1.02); 
    box-shadow: 10px 15px 30px rgba(0,0,0,0.5);
    border-color: #000; 
}

.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover; 
    display: block;
    box-shadow: 0 0 4px rgba(0,0,0,0.2); 
}

/* --- 5. The "Museum Label" (Text) --- */
.meta {
    margin-top: 15px;
    background-color: #fff;
    padding: 10px 15px;
    text-align: center;
    
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    width: 90%; 
    border-radius: 2px;
}

.meta-name {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.meta-line {
    font-size: 0.8em;
    color: #555;
    margin: 2px 0;
    font-style: italic;
}

/* --- 6. Single Image View (image.php) --- */
.single-view-body {
    background-color: #222; 
    min-height: 100vh;
    /* CHANGE 2: Better Flex settings to prevent clipping on mobile */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.full-image-container {
    text-align: center;
    max-width: 100%;
}

/* The Single Large Frame */
.full-image-frame {
    background-color: #fff;     
    padding: 30px;              
    border: 15px solid #111;    
    box-shadow: 0 20px 50px rgba(0,0,0,0.6); 
    
    max-width: 100%;
    max-height: 80vh; 
    height: auto;
    display: block;
    margin: 0 auto 20px auto;
}

.full-image-container h2 {
    color: #fff; 
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.back-link {
    display: inline-block;
    padding: 10px 25px;
    background-color: #fff;
    color: #000;
    border-radius: 30px;
    font-weight: bold;
    margin-top: 10px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.back-link:hover {
    background-color: #ddd;
}

.error-message {
    color: #fff;
    text-align: center;
}

/* --- 7. Mobile Adjustments --- */
@media (max-width: 600px) {
    .header-logo {
        max-height: 200px;
    }

    /* Single Image View Mobile Fixes */
    .single-view-body {
        /* Remove centering so we can scroll long images */
        display: block; 
        padding-top: 40px;
    }

    .full-image-frame {
        /* Shrink the frame thickness on mobile so the art is bigger */
        padding: 10px; 
        border-width: 8px;
        max-height: none; /* Let the image grow tall if needed */
        width: 100%;
    }

    /* Gallery Grid Mobile Fixes */
    .gallery-container {
        grid-template-columns: 1fr; 
        padding: 30px 20px;
        gap: 30px;
    }
    
    .gallery-item a {
        /* Thinner mat and frame on mobile */
        padding: 10px;
        border-width: 8px;
    }
    
    .gallery-item img {
        height: auto; 
        /* Allow image to be its natural height on mobile */
        max-height: 500px;
    }
}