/* The original img.vqvz.com stylesheet (2009-2016, recovered from the Wayback
   Machine), with the table/float layout swapped for flexbox and a few
   max-widths so it also works on a phone. Visually the same at desktop width. */

body {
    background: #FFF; color: #000;
    font: 12px/18px Helvetica, Calibri, Arial, sans-serif;
    margin: 0; padding: 0;
}

#content {
    max-width: 1026px;
    margin: 0 auto;
    padding: 0 25px;
}

/* Top Navigation Bar */

#gallery-banner * { margin: 0; padding: 0; }

#gallery-banner {
    position: sticky; top: 0; z-index: 10;  /* stays at the top of the screen */
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 20px;
    padding: 7px 12px;  /* the old table's cell spacing made the bar this tall */
    border-bottom: 1px solid black;
    background-color: #eeeeee;
}

#gallery-banner,
#gallery-banner h1,
#gallery-banner nav {
    font: 10px Helvetica, Calibri, Arial, sans-serif;
}

#gallery-banner nav { text-align: right; }

/* Header */

#header { margin: 30px 0; }

/* Style Photo
   Each photo + caption fills the viewport: the frame is as wide as the page
   allows, or as wide as fits the viewport height at the photo's aspect ratio
   (--ar, set per photo), whichever is smaller, but never wider than the
   largest size Flickr has (--max-w): small images are not upscaled. A photo
   held at its own size sits centred in its block.
   The banner stays fixed at the top, so "the viewport" here means the space
   below it (100svh - --banner).
   Each .photo block is as tall as its photo can be: one viewport when the
   photo is limited by height (desktop), or just the photo plus caption when
   it's limited by width (a landscape photo on a phone), so phones don't get
   screens of empty space between photos. j/k and scroll snap land on blocks. */

:root {
    /* Viewport height not available to the image: the caption line (26px)
       plus breathing room above and below (19px each). Keep in sync with the
       sizes attribute in templates/img/_macros.html. */
    --chrome: 64px;
    --gutter: 25px;  /* page side margin */
    /* Height of the fixed banner; banner.js sets the exact value. These
       fallbacks are its usual height on desktop and on phones (two lines). */
    --banner: 26px;
}

@media (max-width: 600px) {
    :root { --gutter: 12px; --banner: 39px; }
}

/* scroll-padding-top makes snapping (and j/k) stop each photo just below the
   fixed banner rather than underneath it. */
html.photos { scroll-snap-type: y proximity; scroll-padding-top: var(--banner); }
/* A snap point at the bottom too, or scrolling to the very bottom snaps back
   onto the last photo and the footer pager becomes unreachable. */
html.photos #footer { scroll-snap-align: end; }
html.photos #content { max-width: none; padding: 0 var(--gutter); }

.photo {
    min-height: calc(100vh - var(--banner));
    min-height: calc(100svh - var(--banner));
    /* ...or the photo's height at full page width plus its caption, if less. */
    min-height: min(calc(100svh - var(--banner)),
                    calc((100vw - 2 * var(--gutter)) / var(--ar, 1.5) + var(--chrome)));
    display: flex; align-items: center; justify-content: center;
    scroll-snap-align: start;
}

.frame {
    width: min(100%, calc((100vh - var(--banner) - var(--chrome)) * var(--ar, 1.5)), var(--max-w, 100%));
    width: min(100%, calc((100svh - var(--banner) - var(--chrome)) * var(--ar, 1.5)), var(--max-w, 100%));
}

.frame img {
    display: block;
    width: 100%; height: auto;
    border: 1px solid black;
    box-sizing: border-box;
}

.caption {
    display: flex; justify-content: space-between; gap: 20px;
    color: gray;
}

.caption p { margin: 8px 0 0; }

/* Other Pages */

.simple-page { max-width: 500px; }
.simple-page img { max-width: 100%; height: auto; }

#sets { list-style: none; margin: 0; padding: 0; }
#sets li { margin: 0 0 20px; }
#sets a { display: inline-flex; align-items: center; gap: 22px; }
#sets img { border: 1px solid black; }
#sets h3 { margin: 0; }

#news .date { color: gray; }
#news p { margin-top: 2em; }

.copyright { color: gray; margin-top: 5em; }

/* Footer */

#footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 20px;
    padding: 5px 10px;
    border-top: 1px solid black;
    background-color: #eeeeee;
    font: 10px Helvetica, Calibri, Arial, sans-serif;
}

a {
    text-decoration: none;
    font-weight: bold;
    color: #333;
}
