/* ── Gallery pages (photography, mood) ─────────────────────────────
   Rows of images under the shared navigation layer (base.css).
   ───────────────────────────────────────────────────────────────── */

html, body { background: var(--paper, #fff); }
body { margin: 0; }

/* ── The grid ──────────────────────────────────────────────────────
   Built by js/gallery.js: a board (masonry columns) or a sheet (justified rows).
   It starts just below the name and role; the chrome passes over it as it scrolls. */
.gal { padding-top: calc(var(--pad-top) + var(--ident-h) + var(--clearance)); }

.gal--board {
  position: relative;
  padding-right: var(--pad-right);
  padding-bottom: var(--pad-bottom);
  padding-left: var(--pad-left);
}
.gal--board .gal-item { position: absolute; }
.gal--board .gal-item img { height: 100%; object-fit: cover; }

.gal--sheet { padding-bottom: 2px; }   /* edge to edge, 2px between */
.gal-row { display: flex; gap: 2px; margin-bottom: 2px; }
.gal--sheet .gal-item { height: 100%; min-width: 0; }
.gal--sheet .gal-item img { height: 100%; object-fit: cover; }

/* Grid: square cells, each photo whole and centred in its own (photography).
   One column on phones; three on a small tablet or an open foldable held upright;
   four on those turned sideways; five on a laptop; six on very wide screens. */
.gal--grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  gap: var(--clearance);
  padding-right: var(--pad-right);
  padding-bottom: calc(var(--pad-bottom) + var(--clearance));
  padding-left: var(--pad-left);
}
@media (min-width: 600px)  { .gal--grid { --cols: 3; } }
@media (min-width: 900px)  { .gal--grid { --cols: 4; } }
@media (min-width: 1200px) { .gal--grid { --cols: 5; } }
@media (min-width: 2000px) { .gal--grid { --cols: 6; } }
.gal--grid .gal-item { aspect-ratio: 1; background: none; }
.gal--grid .gal-item img { width: 100%; height: 100%; object-fit: contain; }

.gal-item {
  display: block;
  position: relative;
  background: var(--hold, #f2f2f2);  /* space held until the image arrives */
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.gal-item.is-loaded { background: none; }
.gal-item img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity var(--t-fade, 240ms) var(--ease, cubic-bezier(.25, 1, .5, 1));
}
.gal-item.is-loaded img { opacity: 1; }
.gal-item.is-lifted { visibility: hidden; } /* its image is up in the viewer */
.gal-item:focus-visible { outline: 1px solid var(--ink, #000); outline-offset: 2px; }

/* ── Viewer ────────────────────────────────────────────────────────
   One image on the page colour, as large as fits under the name. */
html.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 50; color: var(--ink, #000); }
.viewer:focus { outline: none; }
.viewer-ground { position: absolute; inset: 0; background: var(--paper, #fff); }
.viewer-img {
  position: absolute;
  transform-origin: 0 0;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}
.viewer-zone { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 1; }
.viewer-zone--prev { left: 0; cursor: w-resize; }
.viewer-zone--next { right: 0; cursor: e-resize; }
.viewer-zone:focus-visible { outline: 1px solid var(--ink, #000); outline-offset: -1px; }
.viewer-chrome {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  padding: var(--pad-top) var(--pad-right) var(--pad-bottom) var(--pad-left);
  pointer-events: none;
}
.viewer-chrome button { pointer-events: auto; }
.viewer-count { line-height: 1.1; }
@media (hover: hover) {
  .viewer-close { opacity: .5; transition: opacity var(--t-state, 150ms) var(--ease, ease); }
  .viewer-close:hover { opacity: 1; }
}

/* No-script fallback: the images as a plain list */
.ph-nojs { list-style: none; margin: 0; padding: calc(var(--pad-top) + var(--ident-h) + var(--clearance)) 0 0; }
.ph-nojs img { display: block; width: 100%; height: auto; }
.ph-nojs-note { padding: 16px var(--pad-right) 16px var(--pad-left); }

.ph-empty {
  padding: calc(var(--pad-top) + var(--ident-h) + var(--clearance)) var(--pad-right) 0 var(--pad-left);
  opacity: .4;
}


@media (prefers-reduced-motion: reduce) {
  .gal-item img { transition: opacity 150ms linear; }
}

/* ── Legacy header — only tools/index.html still uses this ───────── */
.ph-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
}
.ph-header-left { display: flex; flex-direction: column; }
.ph-name,
.ph-title,
.ph-back {
  font-family: Abcmonumentgrotesk, Arial, sans-serif;
  font-size: 14px;
  line-height: 110%;
  font-weight: 400;
  color: #000;
}
.ph-title { opacity: .5; }
.ph-back {
  text-decoration: none;
  opacity: .5;
  transition: opacity var(--t-state, 150ms) var(--ease, cubic-bezier(.25, 1, .5, 1));
  padding-bottom: .5rem;
}
.ph-back:hover { opacity: 1; }
@media (max-width: 767px) {
  .ph-header { padding: 16px; }
}
