/*
 * The photographs. The gallery keeps the site's column, the same width as
 * every other page, so the frame holds still from page to page. The pictures
 * are shipped no wider than 1920 pixels all the same: a screen of twice the
 * density draws the column from the bigger file, and the cinema has the
 * whole screen to fill.
 */

.gallery {
  width: 100%;
  max-width: var(--page-width);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.photos {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 6vw, 4rem);
}

/* The picture is a button: pressing it opens the cinema on it. */
.photo__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0.5rem;
  cursor: zoom-in;
}

/* The big picture: as wide as the column, unless that would make it taller
 * than the screen — a portrait picture stops at the screen's height and
 * keeps to the left, where the strip under it starts. */
.photo img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 90vh;
  border-radius: 0.5rem;
  /* The picture's place, held at its shape, while it is still on its way. */
  background: var(--line);
}

/* The number stands above the picture, not beside the strip: a column of
 * its own would push the strip off the picture's edge, and with eight
 * thumbnails the strip needs the whole column to stand in one line. */
.photo__number {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

/* The strip of variants: small, the same box each whatever its shape, the
 * one on show marked. The picture as taken stands on its own; the
 * experiments are boxed together after it, and named as such. Both groups
 * are built the same — a heading, then thumbnails — so their thumbnails
 * stand at the same height; only the box has a border and a note. */
.variants {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.taken,
.experiments {
  min-width: 0;
  margin: 0;
  padding: 0.6rem 0.6rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.taken {
  /* No border to see, and none at the sides to shift the thumbnail by a pixel
     off the column; the top and bottom stay, at no width, so the heading sits
     exactly where the box's does. */
  border-color: transparent;
  border-inline-width: 0;
  padding-inline: 0;
}

.taken__legend,
.experiments__legend {
  padding: 0 0.35rem;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.taken__legend {
  padding-inline: 0;
}

/* What the box holds, in a line under its thumbnails. It asks for no width
 * of its own — a box is as wide as its thumbnails, and the line wraps to
 * that — and then takes the whole of what the thumbnails set. */
.experiments__note {
  flex-basis: 100%;
  width: 0;
  min-width: 100%;
  margin-top: 0.1rem;
  font-size: 0.8125rem;
  color: var(--ink-soft);
}


.variant {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0.35rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s var(--ease);
}

.variant:hover,
.variant[aria-pressed='true'] {
  opacity: 1;
}

.variant[aria-pressed='true'] {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.variant img {
  display: block;
  width: 5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 0.35rem;
  background: var(--line);
}

/* Under the pictures, in line with the strips above it. */
.hint {
  font-size: 0.8125rem;
  color: var(--ink-soft);
}

@media (hover: none) and (pointer: coarse) {
  /* Nothing to press a key with. */
  .hint--keyboard {
    display: none;
  }
}

/* The cinema --------------------------------------------------------------
 *
 * A dark room the size of the viewport with one picture in it, as large as it
 * fits, and a quiet line of controls beneath. The page behind it stops
 * scrolling while it is open. In fullscreen the room is the screen.
 */

.is-cinema {
  overflow: hidden;
}

.cinema {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  /* A zero minimum on the picture's row: at auto, a portrait picture would
     grow the row past the screen and carry the controls off the bottom. */
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  background: #0c0d10;
  color: #b8bec7;
  cursor: zoom-out;
}

.cinema[hidden] {
  display: none;
}

.cinema__picture {
  /* The picture, and only the picture, is the way to close by clicking. */
  cursor: default;
  justify-self: center;
  align-self: center;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.35rem;
}

.cinema__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  cursor: default;
  font-size: 0.8125rem;
}

.cinema__where {
  display: flex;
  gap: 1rem;
}

.cinema__number {
  font-variant-numeric: tabular-nums;
}

.cinema__variant {
  color: #7d848e;
}

.cinema__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

/* The controls read like the masthead's links: small capitals, no chrome. */
.cinema__button {
  font: inherit;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
  background: none;
  border: 0;
  padding: 0.75rem 0;
  margin: -0.75rem 0;
  cursor: pointer;
}

.cinema__button:hover {
  color: #f4f5f7;
}

.cinema__button:disabled {
  color: #4a5059;
  cursor: default;
}

.cinema :focus-visible {
  outline-color: #8fb4de;
}

.cinema--fullscreen {
  padding: 0;
}

.cinema--fullscreen .cinema__picture {
  border-radius: 0;
}

.cinema--fullscreen .cinema__bar {
  padding: 0.75rem clamp(0.75rem, 2vw, 1.5rem);
}
