/* ==========================================================================
   WINDOWS/SOURCE VGUI GALLERY VIEWER (IE11 SAFE)
   ========================================================================== */

/* Container for the whole section - tighter width for the "logo" shape */
.windows-gallery-container {
    position: relative;
    max-width: 500px; 
    margin: 40px auto;
    padding: 20px;
}

/* The Grid (Flexbox fallback) */
.image-grid {
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin: -4px; /* Very tight gap, like the Win 11 logo */
    justify-content: center;
}

/* The Picture/Image styling 
   Uses a padding trick to force a perfect 1:1 square in IE11
*/
.gallery-item {
    display: block;
    -ms-flex: 0 0 calc(50% - 8px);
    flex: 0 0 calc(50% - 8px);
    margin: 4px;
    position: relative; /* For absolute positioning the image inside */
    cursor: pointer;
    background: #2b2b2b;
    border: 1px solid #111;
    padding: 4px;
    transition: z-index 0.3s ease, border-color 0.3s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

/* IE11 Perfect Square Hack */
.gallery-item::before {
    content: "";
    display: block;
    padding-top: 100%; /* Forces height to equal width */
}

.gallery-item img {
    position: absolute;
    top: 4px; left: 4px;
    /* Subtract the 4px padding on all sides (8px total) */
    width: calc(100% - 8px); 
    height: calc(100% - 8px);
    display: block;
    object-fit: cover; 
    border: 1px solid #111;
    box-sizing: border-box;
    transition: transform 0.2s ease;
}

/* Hover effect */
.gallery-item:hover {
    z-index: 10;
    border-color: #888;
    background: #4c4c4c;
}

/* Scale the image slightly on hover, keeping the rigid Win11 grid shape */
.gallery-item:hover img {
    transform: scale(1.03); 
}

/* ==========================================================================
   "WAY BIGGER" STATE (Bulletproof Centering)
   ========================================================================== */
.gallery-item.expanded {
    position: fixed;
    /* Bulletproof IE11 centering using auto margins instead of transform */
    top: 0; left: 0; right: 0; bottom: 0; 
    margin: auto;
    
    width: 85vw;
    height: 85vh;
    max-width: 1200px;
    max-height: 800px;
    z-index: 1000;
    
    background: #3d3d3d;
    border: 1px solid #666;
    padding: 10px;
    box-shadow: 5px 5px 30px rgba(0,0,0,0.9);
    cursor: default;
}

/* Disable the square hack when expanded */
.gallery-item.expanded::before {
    display: none;
}

/* Reset image positioning for expanded state */
.gallery-item.expanded img {
    position: static;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Prevents cropping */
    background: #1a1a1a; 
    transform: scale(1); /* Reset the hover zoom */
}

/* Overlay background when expanded */
.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 999;
    display: none;
    cursor: pointer; 
}

/* ==========================================================================
   REVERT / CLOSE BUTTON
   ========================================================================== */
.revert-button {
    display: none; 
    position: fixed;
    top: 25px;
    right: 35px;
    z-index: 1001;
    cursor: pointer;
    background: #4c4c4c;
    border: 1px solid #666666;
    color: #e1e1e1;
    padding: 6px 20px;
    font-family: "Tahoma", "Verdana", sans-serif;
    font-size: 12px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.6);
}

.revert-button:hover {
    background: #5a5a5a;
    border-color: #999999;
    color: #ffffff;
}

.revert-button:active {
    background: #333333;
    border-color: #222222;
}