/* Photos page. Load this AFTER style_general.css.
   Tweak the look here:
   --row-height : how tall each row of photos is
   --gap        : space between photos
   --side       : space at the left/right edge of the screen */

:root {
    --row-height: 300px;
    --gap: 14px;
    --side: 14px;
}

/* iPhone / small screens: shorter rows, tighter spacing */
@media (max-width: 700px) {
    :root {
        --row-height: 190px;
        --gap: 6px;
        --side: 10px;
    }
}

/* little italic "i" in the top right that links to the About page */
.info_link {
    position: absolute;
    right: var(--side);
    top: 50%;
    transform: translateY(-50%);
    padding: 10px;
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: 1.6rem;
    color: black;
}

.info_link:hover {
    color: gray;
}

/* the gallery */
.gallery {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--gap);
    padding: 100px var(--side) 40px; /* top padding clears the fixed header */
}

/* keeps the last row from stretching across the whole page */
.gallery::after {
    content: "";
    flex-grow: 100000;
}

/* photos stay hidden until the script has measured them, so rows don't jump around */
.gallery img {
    display: none;
    height: auto;
    min-width: 0;
    object-fit: cover;
}

.gallery img.ready {
    display: block;
    cursor: pointer;
}

/* full-screen photo viewer (opens when you click a photo) */
:root {
    --lightbox-bg: #fff;      /* try #000 for a black background */
    --lightbox-color: #000;   /* arrow / close / counter color: use #fff if the background is black */
}

html.lb_open,
html.lb_open body {
    overflow: hidden; /* stops the page scrolling behind the viewer */
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000; /* above the fixed header */
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--lightbox-bg);
    color: var(--lightbox-color);
}

.lightbox.open {
    display: flex;
}

/* the whole photo, never cropped: scaled down to fit the screen if it's bigger */
.lightbox_img {
    display: block;
    max-width: calc(100vw - 140px);
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    width: auto;
    height: auto;
    object-fit: contain;
    -webkit-user-drag: none;
    user-select: none;
}

.lb_btn {
    position: absolute;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.lb_btn svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.lb_btn:hover {
    opacity: 0.55;
}

.lb_close { top: 10px; right: 10px; }
.lb_prev  { left: 10px;  top: 50%; transform: translateY(-50%); }
.lb_next  { right: 10px; top: 50%; transform: translateY(-50%); }

.lb_count {
    position: absolute;
    bottom: 16px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

/* iPhone / small screens: photo uses the full width, arrows float on top of it */
@media (max-width: 700px) {
    .lightbox_img {
        max-width: 100vw;
        max-height: calc(100vh - 140px);
        max-height: calc(100dvh - 140px);
    }


    .lb_prev { left: 6px; }
    .lb_next { right: 6px; }
}
