/* ------------------------------------------------------------------ *
 *  gallery.css — a section's stream of work
 *  One picture at a time, centred, lots of air. A small caption under
 *  the left edge. Click a picture and it fills the screen. Flat — no
 *  frames, no glows.
 * ------------------------------------------------------------------ */

.g-head {
  max-width: var(--col);
  margin: 0 auto;
  padding: clamp(3rem, 12vh, 8rem) var(--pad-edge) clamp(2.5rem, 8vh, 5rem);
}
.g-back {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin-bottom: 2rem;
  transition: color var(--t-fast) var(--ease);
}
.g-back:hover { color: var(--ink); }

.g-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: var(--w-light);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}
/* the section's own word-font (.three__word:nth-child(n) on the landing
   page) rather than one shared display face for every section's h1 —
   build.py picks the class by the same position in galleries.json that
   decides which word this section is on the landing nav */
.g-title--1 { font-family: var(--font-word-1); }
.g-title--2 { font-family: var(--font-word-2); }
.g-title--3 { font-family: var(--font-word-3); }
.g-meta {
  margin-top: 0.6rem;
  font-family: var(--font-meta);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}
.g-note {
  margin-top: 1.1rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-soft);
  max-width: 46ch;
}
.g-note + .g-note { margin-top: 1.4rem; }
/* a section with nothing to show yet, in place of the usual empty stream */
.g-note.coming-soon { font-style: italic; }

/* a private client delivery page's single-field password form */
.gate__field {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.6rem;
  max-width: 22rem;
}
.gate__input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper-sink);
  border: 1px solid var(--ink-ghost);
  border-radius: 2px;
  padding: 0.6rem 0.8rem;
}
.gate__input:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
.gate__submit {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--ink);
  background: var(--paper-sink);
  border: 1px solid var(--ink-ghost);
  border-radius: 2px;
  padding: 0.6rem 1.1rem;
  transition: background var(--t-mid) var(--ease), color var(--t-mid) var(--ease);
}
.gate__submit:hover { background: var(--ink); color: var(--paper); }
.gate__error { color: var(--ink-soft); font-style: italic; }

/* a plain page (me, contact) — same placard, no stream after it */
.page-prose .g-head { padding-bottom: clamp(3rem, 10vh, 6rem); }

/* an optional centred variant of the header — g-back is inline-block and
   g-title/g-meta are full-width blocks, so text-align alone centres them;
   g-note is narrower than its parent (max-width: 46ch) and isn't centred
   itself by default, so it needs its own margin to match */
.g-head--center { text-align: center; }
.g-head--center .g-note { margin-left: auto; margin-right: auto; }

.contact-email {
  color: var(--ink);
  border-bottom: 1px solid var(--ink-ghost);
  transition: border-color var(--t-fast) var(--ease);
}
.contact-email:hover { border-color: var(--ink); }

/* the stream */
.stream {
  max-width: var(--media);
  margin: 0 auto;
  padding: 0 var(--pad-edge) clamp(4rem, 14vh, 9rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(3.5rem, 11vh, 8rem);
}
.shot {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: zoom-in;
}
.shot__frame { position: relative; width: 100%; display: flex; justify-content: center; }
.shot img,
.shot video {
  max-height: 86vh;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.shot--feature { max-width: var(--media-wide); }

/* — a true masonry, balanced at build time (build.py, masonry_columns()),
   not left to the browser's own `column-count`. Every frame keeps its own
   natural aspect ratio (width:100% of its column, height:auto — nothing
   is ever cropped or stretched); each .stream-col is just a plain flex
   column holding the frames build.py already assigned to it. The old
   version used CSS multi-column with `column-width`, which picks its own
   column COUNT from the viewport (2 on a phone, 3 here, 4-5 on a wide
   desktop) — fine in principle, but it meant the arrangement (which
   frames end up near which) reshuffled at every breakpoint, never
   matching a specific reference layout the way a fixed count does.
   Balancing it here instead means the column count is a deliberate
   choice (MASONRY_COLS in build.py), not a side effect of window width. */
.stream--masonry {
  display: flex;
  flex-direction: row;   /* .stream (the base rule) sets column — without
                             this override, that wins and stacks the
                             columns instead of placing them side by side */
  align-items: stretch;  /* likewise overrides .stream's own center */
  gap: clamp(0.7rem, 1.8vw, 1.4rem);
  max-width: var(--media-wide);
}
.stream-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(0.7rem, 1.8vw, 1.4rem);
}
.stream--masonry .shot {
  display: block;
  width: 100%;
  cursor: pointer;
}
.stream--masonry .shot__frame { width: 100%; display: block; }
.stream--masonry .shot img,
.stream--masonry .shot video {
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
  display: block;
}

@media (max-width: 560px) {
  /* not a rebalance — the phone just stacks the same build-time columns
     one after another (column 1's frames, then column 2's, then column
     3's), the same column-major order a masonry always reads in */
  .stream--masonry { flex-direction: column; }
}

.shot figcaption {
  align-self: flex-start;
  margin-top: 0.85rem;
  font-family: var(--font-caption);
  font-size: 0.74rem;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
}

/* video: a plain play triangle, no ring, no glow */
.shot--video .shot__frame::after {
  content: "";
  position: absolute;
  inset: 0; margin: auto;
  width: 0; height: 0;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent var(--paper);
  filter: drop-shadow(0 0 1px var(--ink));
  pointer-events: none;
  transition: transform var(--t-mid) var(--ease);
}
.shot--video:hover .shot__frame::after { transform: scale(1.14); }
/* no video file yet — just its poster standing in for it — so no play
   triangle either, which would promise a click plays something */
.shot--video-pending .shot__frame::after { display: none; }

/* scroll-in: a small fade + lift */
.js .shot { opacity: 0; transform: translateY(12px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.js .shot.is-in { opacity: 1; transform: none; }

/* — lightbox — the picture fills the paper, everything else gone ——— */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  opacity: 0; visibility: hidden;
  transition: opacity var(--t-mid) var(--ease), visibility var(--t-mid) var(--ease);
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__media img,
.lightbox__media video { max-width: 94vw; max-height: 88vh; width: auto; height: auto; }
.lightbox__caption {
  position: fixed; left: 0; right: 0; bottom: var(--pad-edge);
  text-align: center;
  font-family: var(--font-caption);
  font-size: 0.74rem; color: var(--ink-faint);
}
.lightbox__count {
  position: fixed; top: var(--pad-edge); left: var(--pad-edge);
  font-family: var(--font-meta);
  font-size: 0.72rem; color: var(--ink-faint);
}
.lightbox__close {
  position: fixed; top: var(--pad-edge); right: var(--pad-edge);
  font-family: var(--font-ui);
  font-size: 1.1rem; line-height: 1; color: var(--ink-faint);
}
.lightbox__close:hover { color: var(--ink); }
.lightbox__nav {
  position: fixed; top: 0; bottom: 0; width: 22vw;
  display: flex; align-items: center;
  color: transparent;
  font-size: 0.9rem;
}
.lightbox__nav:hover { color: var(--ink-faint); }
.lightbox__nav--prev { left: 0; justify-content: flex-start; padding-left: var(--pad-edge); cursor: w-resize; }
.lightbox__nav--next { right: 0; justify-content: flex-end; padding-right: var(--pad-edge); cursor: e-resize; }
body.lightbox-open { overflow: hidden; }

@media (max-width: 720px) {
  .shot img, .shot video { max-height: 76vh; }
  .stream { padding-inline: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  .js .shot { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ *
 *  The sheet on the inner pages
 *  Same canvas as the landing, but at full strength: there is no single
 *  thing here to open a hole around, so .glass--full drops the mask and
 *  the page's own content sits above it instead. Content is the layer
 *  that must stay legible, so everything below is about putting it on
 *  top and turning the type to paper — but only once the sheet has
 *  actually painted (.glass-lit), so the no-canvas case stays ink on
 *  warm paper and readable either way.
 * ------------------------------------------------------------------ */
/* Name the content blocks rather than sweeping every child of body: the
   wordmark is a sibling too, and a blanket rule turns its position:fixed
   into relative, which stretches it to full width and overflows the page. */
.g-head, .stream, .frame, .more { position: relative; z-index: 3; }

.glass-lit .page-gallery,
.glass-lit .page-prose,
.glass-lit .page-frame { color: rgba(244, 241, 234, 0.85); }
.glass-lit .g-title { color: var(--paper); }
.glass-lit .g-meta { color: rgba(244, 241, 234, 0.65); }
.glass-lit .g-note { color: rgba(244, 241, 234, 0.85); }
.glass-lit .g-back { color: rgba(244, 241, 234, 0.7); }
.glass-lit .g-back:hover { color: var(--paper); }
/* this had no text colour at all under glass-lit — only the border was
   overridden — so the address itself stayed the page's plain ink and was
   genuinely invisible on the dark sheet, not just faint */
.glass-lit .contact-email { color: rgba(244, 241, 234, 0.85); border-color: rgba(244, 241, 234, 0.4); }
.glass-lit .contact-email:hover { border-color: var(--paper); }
.glass-lit .shot figcaption { color: rgba(244, 241, 234, 0.72); }
.g-title, .g-meta, .g-note, .g-back, .shot figcaption {
  transition: color var(--t-mid) var(--ease);
}

/* --- a frame in a stream is now a link to its own page ------------- */
.shot__link { display: block; color: inherit; }
/* shutter · aperture · iso, over the bottom of the frame on hover —
   the same treatment the landing page uses */
.shot__exif {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.6rem 0.7rem 0.55rem;
  font-family: var(--font-meta);
  font-size: 0.64rem;
  letter-spacing: 0.03em;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.shot__link:hover .shot__exif,
.shot__link:focus-visible .shot__exif { opacity: 1; transform: none; }

/* --- a single frame's page ---------------------------------------- */
.g-head--frame { padding-bottom: clamp(1.2rem, 4vh, 2.4rem); }

/* --media-wide is 1560px, wider than most windows, so these need the page
   gutter and a width cap or the caption runs off the left edge while the
   picture, capped by max-height, still looks centred */
.frame {
  max-width: var(--media-wide);
  margin: 0 auto clamp(3rem, 10vh, 7rem);
  padding: 0 var(--pad-edge);
}
.frame__media { width: 100%; display: flex; justify-content: center; }
.frame__media img,
.frame__media video {
  max-width: 100%;
  max-height: 78vh;
  width: auto; height: auto;
  display: block;
}
/* shutter · aperture · iso — its own centred line right under the
   picture, not tucked in alongside the caption, and sized up so it
   actually reads at a glance rather than needing a second look */
.frame__exif {
  margin: 0.7rem 0 0;
  text-align: center;
  font-family: var(--font-meta);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  color: var(--ink-faint);
}
.glass-lit .frame__exif { color: rgba(244, 241, 234, 0.65); }
.frame__cap {
  margin-top: 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem clamp(1rem, 4vw, 2.5rem);
  align-items: baseline;
}
.frame__text { font-size: 0.95rem; line-height: 1.6; margin: 0; }

.frame__nav {
  margin-top: 1.6rem;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
}
.frame__nav a { transition: color var(--t-mid) var(--ease); }
.frame__nav a:hover { color: var(--ink); }
.glass-lit .frame__nav { color: rgba(244, 241, 234, 0.65); }
.glass-lit .frame__nav a:hover { color: var(--paper); }

/* --- the rest of the set, below ----------------------------------- */
.more {
  max-width: var(--media-wide);
  margin: 0 auto;
  padding: 0 var(--pad-edge) clamp(4rem, 14vh, 9rem);
}
.more__head {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: var(--w-light);
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin: 0 0 1.2rem;
}
.glass-lit .more__head { color: rgba(244, 241, 234, 0.65); }
.more__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(120px, 18vw, 210px), 1fr));
  gap: clamp(0.6rem, 1.6vw, 1.1rem);
}
.more__item { display: block; }
.more__frame {
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.12);
}
.more__frame img,
.more__frame video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--t-mid) var(--ease);
}
.more__item:hover .more__frame img,
.more__item:hover .more__frame video { opacity: 0.78; }
.more__cap {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--ink-faint);
}
.glass-lit .more__cap { color: rgba(244, 241, 234, 0.72); }

@media (prefers-reduced-motion: reduce) {
  .shot__exif, .more__frame img, .more__frame video { transition: none; }
}
