/*
CSS Stylesheet for /gallery.html
Author: Joshua Sendgikoski
Responsive pass: box-sizing reset, fluid masonry grid, fluid lightbox.
*/

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* GLOBAL RESET & RESPONSIVE SAFETY NET      */
/* (gallery.html loads ONLY this file, so it */
/*  needs its own copy of these rules.)      */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
body{
    margin:0;
    padding: 0;
    font-family: Georgia, 'Times New Roman', serif;
    color: #ffffff;
    background-color: #000000;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 10px;
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* Navigation Bar */
.navbar{
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar ul{
    list-style: none;
    margin: 0;
    padding: 0 60px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 30px;
}

.navbar a{
    display: block;
    color: #ffffff;
    text-decoration: none;
    padding: 20px 0px;
    font-size: 1rem;
    letter-spacing: 2px;
    transition: color 0.2s ease;
}

.navbar a:hover{
    color: #3399ff;
}

.navbar a:focus-visible{
    outline: 2px solid #3399ff;
    outline-offset: 4px;
}

.navbar a.active{
    border-bottom: 2px solid #3399ff;
    color: #3399ff;
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* Hyperlink*/
a {
    color:#3399ff;
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* MASONRY GALLERY & LIGHTBOX */

.gallery-page-container {
    width: 90%;
    max-width: 1400px;
    margin: 40px auto;
    padding: 20px;
}

.gallery-header {
    text-align: center;
    margin-bottom: 40px;
}

.gallery-header h1 {
    font-size: clamp(2.2rem, 7vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #ffffff;
    margin-bottom: 10px;
}

.gallery-header p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #a0aec0;
}

/* CSS Grid with Auto-Fit for Masonry Feel.
   min() keeps the minimum column from ever being wider than the
   screen, which is what stops narrow phones from scrolling sideways. */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    grid-auto-rows: 250px;
    grid-auto-flow: dense;
    gap: 20px;
}

.grid-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.4);
}

.grid-item.wide {
    grid-column: span 2;
}

.grid-item.tall {
    grid-row: span 2;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.grid-item:hover img {
    transform: scale(1.05);
    filter: brightness(0.85);
}

.grid-item .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.grid-item:hover .overlay {
    opacity: 1;
}

.view-btn {
    color: #ffffff;
    background: rgba(51, 153, 255, 0.8);
    padding: 8px 18px;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 1px;
    backdrop-filter: blur(4px);
}

/* Lightbox Base */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 30px 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    background: none;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    z-index: 10001;
    line-height: 1;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #3399ff;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-arrow:hover {
    background: rgba(51, 153, 255, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-arrow.prev { left: 30px; }
.lightbox-arrow.next { right: 30px; }

.lightbox-content {
    max-width: 85vw;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: auto;
}

.image-wrapper {
    max-width: 100%;
    max-height: 65vh;
    display: flex;
    justify-content: center;
}

.image-wrapper img {
    max-width: 100%;
    max-height: 65vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
    margin-top: 15px;
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: #e2e8f0;
    text-align: center;
    max-width: 800px;
    line-height: 1.5;
}

/* Lightbox Thumbnails */
.lightbox-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    max-width: 90vw;
}

.lightbox-thumbnails .thumb {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    opacity: 0.5;
    cursor: pointer;
    border: 2px solid transparent;
    transition: opacity 0.2s, border-color 0.2s;
    flex: 0 0 auto;                 /* thumbnails keep their size and scroll sideways */
}

.lightbox-thumbnails .thumb.active,
.lightbox-thumbnails .thumb:hover {
    opacity: 1;
    border-color: #3399ff;
}

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/* RESPONSIVE / MEDIA QUERIES */

/* Tablets (<= 900px): slightly shorter rows so images aren't too tall */
@media (max-width: 900px) {
    .masonry-grid {
        grid-auto-rows: 220px;
    }
}

/* Phones (<= 768px): single column, and drop the wide/tall spans
   so every photo gets a full, uncropped cell. */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 240px;
    }

    .grid-item.wide,
    .grid-item.tall {
        grid-column: span 1;
        grid-row: span 1;
    }

    .lightbox-close { top: 12px; right: 16px; font-size: 2.4rem; }
    .lightbox-arrow { width: 40px; height: 40px; }
    .lightbox-arrow.prev { left: 10px; }
    .lightbox-arrow.next { right: 10px; }
}