/* Photography gallery
   ===================
   Standalone section: this page reads its own data (photography-data.js)
   and its own images (images/photography, images/optimized/gallery). It
   shares the site's tokens and card language, not its project pipeline.

   Structure
     .photo-hero        image banner (page identity)
     .photo-themes      row of series cards ("All" + one per series)
     .photo-section     one per visible series:
       .photo-section-head   serif title · note · year + count, 3px rule
       .photo-grid           justified rows of photos

   The grid is a justified row wall: each tile carries --ratio (width /
   height from the data file), so a row always fills the container width
   with every photo at the same height. No cropping, no holes, and photos
   stay in reading order.
*/

/* ------------------------------------------------------------------ */
/* Page shell                                                          */
/* ------------------------------------------------------------------ */

/* Keep the fixed back-to-top button clear of the last row of photos. */
.photo-page #main-content {
  padding-bottom: 72px;
}

/* ------------------------------------------------------------------ */
/* Hero                                                                */
/* ------------------------------------------------------------------ */

/* The hero sits on a photo, so its scrim and type are fixed dark values
   instead of theme variables - the backdrop must stay legible whether the
   site is in light or dark mode. */
.photo-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(320px, 46vh, 500px);
  margin: 24px 0 56px;
  border: 2px solid var(--darkSlateGray);
  border-radius: var(--radius);
  overflow: hidden;
  background-color: #16211d;
}

.photo-hero-media {
  position: absolute;
  inset: 0;
}

.photo-hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.photo-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(12, 20, 17, 0.10) 0%,
    rgba(12, 20, 17, 0.45) 55%,
    rgba(12, 20, 17, 0.86) 100%
  );
}
.photo-hero-content {
  position: relative;
  z-index: 1;
  padding: clamp(24px, 4vw, 48px);
  max-width: 720px;
}

.photo-hero-content h2 {
  margin: 0 0 12px;
  font-family: ambroise-std, serif;
  font-weight: 700;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.01em;
  color: #f9e8c1;
}

.photo-hero-content p {
  margin: 0;
  max-width: 52ch;
  font-family: stratos-lights, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: #f2e4c6;
  opacity: 0.92;
}

/* Hero slideshow ------------------------------------------------------ */

/* The static <img> in the markup is the base layer and the no-JS hero.
   photo-hero.js layers one .photo-hero-slide per series on top of it and
   crossfades between them; the base layer is never removed, so a failed
   script or a missing frame degrades to the original single still. */
/* z-index 0 keeps the whole deck underneath the scrim: the slides' own
   z-index only competes inside this stacking context, so the gradient still
   darkens whichever frame is up (and the title stays legible over it). */
.photo-hero-deck {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* One slow dissolve, and nothing else. The banner used to add a push-in
   zoom on top of the fade; combined with the (former) shuffled order it
   made the hero read as a glitch rather than a photograph. A long
   crossfade on its own is calmer and stops competing with the title. */
.photo-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.3s ease;
  will-change: opacity;
}

.photo-hero-slide.is-active {
  opacity: 1;
  z-index: 2;
}

.photo-hero-slide-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* No per-frame zoom. The still simply sits still for its whole hold
   (HOLD_MS in photo-hero.js) and then dissolves. */

/* Control cluster: caption chip + arrows, pinned top-right where the
   statement copy (bottom-aligned) never reaches it. */
.photo-hero-ui {
  position: absolute;
  top: clamp(14px, 2.4vw, 22px);
  right: clamp(14px, 2.4vw, 22px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Controls fade in with the opening frame (photo-hero.js drops
   .photo-hero-booting on first paint), so the banner never shows an empty
   caption pill while the first photograph is still downloading. */
.photo-hero-ui,
.photo-hero-ticks {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.photo-hero-booting .photo-hero-ui,
.photo-hero-booting .photo-hero-ticks {
  opacity: 0;
}

.photo-hero-caption {
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background-color: rgba(12, 20, 17, 0.82);
  color: #f9e8c1;
  font-family: stratos, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
}

.photo-hero-arrows {
  display: flex;
  gap: 6px;
}

.photo-hero-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 2px solid rgba(249, 232, 193, 0.55);
  border-radius: 999px;
  background-color: rgba(12, 20, 17, 0.62);
  color: #f9e8c1;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.photo-hero-arrow svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.photo-hero-arrow:hover,
.photo-hero-arrow:focus-visible {
  background-color: #f9e8c1;
  border-color: #f9e8c1;
  color: #16211d;
}

.photo-hero-arrow:focus-visible {
  outline: 2px solid #f9e8c1;
  outline-offset: 2px;
}

/* Seek ticks along the bottom edge: one per frame, doubling as a progress
   bar for the frame that is currently up. */
.photo-hero-ticks {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  gap: 4px;
  padding: 0 2px 2px;
}

.photo-hero-tick {
  flex: 1 1 0;
  height: 14px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.photo-hero-tick::before {
  content: '';
  display: block;
  height: 3px;
  border-radius: 2px;
  background-color: rgba(249, 232, 193, 0.32);
  transition: background-color 0.2s ease;
}

.photo-hero-tick:hover::before,
.photo-hero-tick:focus-visible::before {
  background-color: rgba(249, 232, 193, 0.6);
}

.photo-hero-tick:focus-visible {
  outline: 2px solid #f9e8c1;
  outline-offset: -2px;
}

/* The current frame's tick fills left-to-right for the length of its hold,
   then hands over. --hold is written by photo-hero.js so the CSS timing and
   the JS timer can never drift apart. */
.photo-hero-tick.is-current::before {
  background-color: rgba(249, 232, 193, 0.32);
  animation: photo-hero-tick-fill var(--hold, 8000ms) linear forwards;
}

@keyframes photo-hero-tick-fill {
  from { background-color: #f9e8c1; transform: scaleX(0); transform-origin: left; }
  to { background-color: #f9e8c1; transform: scaleX(1); transform-origin: left; }
}

/* Hovering or focusing the hero holds the sequence (photo-hero.js sets
   .is-paused), so the progress bar has to hold with it. */
.photo-hero-ticks.is-paused .photo-hero-tick.is-current::before {
  animation-play-state: paused;
}

/* Reduced motion: no deck, no ticks - photo-hero.js never builds them, and
   these rules cover the case where it already did before the media query
   was re-evaluated. */
@media (prefers-reduced-motion: reduce) {
  .photo-hero-deck,
  .photo-hero-ui,
  .photo-hero-ticks {
    display: none;
  }
}

@media (max-width: 768px) {
  /* The cluster would crowd the title on a narrow hero; the ticks alone
     keep it seekable. */
  .photo-hero-arrows {
    display: none;
  }

  .photo-hero-caption {
    font-size: 0.58rem;
    padding: 5px 10px;
  }
}

/* ------------------------------------------------------------------ */
/* Section header (one component, used for the filter and each series) */
/* ------------------------------------------------------------------ */

.photo-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px 32px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 3px solid var(--darkSlateGray);
}

.photo-section-intro {
  min-width: 0;
}

/* h3 inherits an uppercase transform from base.css; series names are
   title case everywhere else on the site, so opt out here. */
.photo-series-title {
  margin: 0;
  font-family: ambroise-std, serif;
  font-weight: 700;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.12;
  text-transform: none;
  color: var(--darkSlateGray);
}

.photo-series-note {
  margin: 8px 0 0;
  max-width: 62ch;
  font-family: stratos-lights, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--darkSlateGray);
  opacity: 0.82;
}

.photo-series-count {
  margin: 0;
  font-family: stratos, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--darkSlateGray);
  opacity: 0.7;
  white-space: nowrap;
}
/* ------------------------------------------------------------------ */
/* Series cards                                                        */
/* ------------------------------------------------------------------ */

/* One compact picker: "All" plus one card per series. Equal cells and a
   fixed media ratio keep it reading as a control, not a second gallery. */
.photo-themes {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}

@media (max-width: 1024px) {
  .photo-themes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 560px) {
  .photo-themes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}


.photo-theme-card {
  display: block;
  padding: 0;
  margin: 0;
  border: 2px solid var(--darkSlateGray);
  border-radius: var(--radius);
  background-color: var(--darkSlateGray);
  color: var(--dutchWhite);
  font: inherit;
  text-align: left;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.photo-theme-card:hover {
  transform: translateY(-3px);
  box-shadow: 4px 4px 0 rgba(var(--darkSlateGray-rgb), 0.35);
}

.photo-theme-card.active:hover {
  transform: none;
}

.photo-theme-card:focus-visible {
  outline: 3px solid var(--darkSlateGray);
  outline-offset: 3px;
}

/* Selected: the label inverts and the card takes the site's hard offset
   shadow. The photo itself is never covered - that was what made the old
   active card look like an empty box. */
.photo-theme-card.active {
  box-shadow: 4px 4px 0 var(--darkSlateGray);
}

.photo-theme-media {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background-color: var(--darkSlateGray);
}

/* Shuffling cover: a stack of thumbnails that skips through them while its
   card is hovered. photography-stack.js owns the timing; the motion lives
   here. Slides sit absolutely on top of each other and swap on a short
   fade with a tiny settle-zoom, so the change reads as flicking through
   prints rather than a slow dissolve. */
.photo-shuffle {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--darkSlateGray);
  transition: transform 0.35s ease;
}

.photo-shuffle-slide {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transform: scale(1);
  /* Short on purpose: a 160ms hand-over reads as a skip, a long one reads
     as a dissolve and the card stops feeling like it is flipping. */
  transition: opacity 0.16s ease;
}

/* Each photo lands with a tiny snap back to rest - 4% over a third of a
   second. The class is dropped before the next one is added, so every skip
   starts from the same pose and the sequence stays crisp. */
.photo-shuffle-slide.is-current {
  opacity: 1;
  z-index: 2;
  animation: photo-shuffle-skip 0.34s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes photo-shuffle-skip {
  from { transform: scale(1.04); }
  to { transform: scale(1); }
}

/* Static single cover: touch devices, reduced motion, and the no-module
   fallback all keep this plain image. */
.photo-theme-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Card hover zoom, unchanged from the static-cover version. Only the
   single stack zooms directly - the mosaic zooms as one box, so its four
   tiles never drift apart. */
.photo-theme-card:hover .photo-theme-media > .photo-shuffle,
.photo-theme-card:hover .photo-theme-mosaic {
  transform: scale(1.04);
}

/* "All" cover: a 2x2 mosaic of four series, each tile shuffling its own
   photos (staggered in photography.js) so the change ripples across the
   box instead of flipping in unison. */
.photo-theme-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  width: 100%;
  height: 100%;
  transition: transform 0.35s ease;
}

.photo-theme-mosaic .photo-shuffle {
  transition: none;
}
.photo-theme-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  background-color: rgba(12, 20, 17, 0.82);
  color: #f9e8c1;
  font-family: stratos, sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.photo-theme-card:hover .photo-theme-count,
.photo-theme-card:focus-visible .photo-theme-count,
.photo-theme-card.active .photo-theme-count {
  opacity: 1;
}

.photo-theme-label {
  display: block;
  background-color: var(--darkSlateGray);
  color: var(--dutchWhite);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.photo-theme-card:hover .photo-theme-label,
.photo-theme-card.active .photo-theme-label {
  background-color: var(--dutchWhite);
  color: var(--darkSlateGray);
}

.photo-theme-name {
  display: block;
  padding: 9px 12px;
  font-family: stratos, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
}

/* Touch devices have no hover: keep the count visible so the card still
   says how many photos it holds. */
@media (hover: none) {
  .photo-theme-count {
    opacity: 1;
  }
}
/* ------------------------------------------------------------------ */
/* Justified photo grid                                                */
/* ------------------------------------------------------------------ */

/* Rows fill the container edge to edge. Each tile's flex-basis is
   row-height x its aspect ratio, and its flex-grow is the same ratio, so
   every item in a row ends up the same height and keeps its own shape.
   --ratio is written inline by photography.js from the data file, which
   is why nothing here can crop or shift on load. */
.photo-grid {
  --row-height: 250px;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 16px;
}

/* Absorbs the slack on the final row so it keeps the row height instead
   of stretching one or two photos across the full width. */
.photo-grid::after {
  content: '';
  flex: 1000 1 0;
  height: 0;
}

.photo-tile {
  --ratio: 1.5;
  flex: var(--ratio) 1 calc(var(--row-height) * var(--ratio));
  aspect-ratio: var(--ratio);
  min-width: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--darkSlateGray);
  border-radius: var(--radius);
  background-color: var(--darkSlateGray);
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.5s ease;
  transition-delay: 0s, 0s, calc(var(--reveal-index, 0) * 50ms);
}

.photo-tile:hover {
  transform: translateY(-3px);
  box-shadow: 5px 5px 0 rgba(var(--darkSlateGray-rgb), 0.22);
}

.photo-tile-link {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.photo-tile-link:focus-visible {
  outline: 3px solid var(--darkSlateGray);
  outline-offset: -6px;
  border-radius: calc(var(--radius) - 2px);
}

.photo-tile-media {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
}

.photo-tile-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.45s ease;
}

.photo-tile:hover .photo-tile-img,
.photo-tile-link:focus-visible .photo-tile-img {
  transform: scale(1.03);
}
/* Caption on the photo, revealed on hover/focus. Keeps the wall clean -
   the series name is already the section title. */
.photo-tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 28px 14px 12px;
  background: linear-gradient(180deg, rgba(12, 20, 17, 0) 0%, rgba(12, 20, 17, 0.78) 78%);
  color: #f9e8c1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.photo-tile:hover .photo-tile-overlay,
.photo-tile-link:focus-visible .photo-tile-overlay {
  opacity: 1;
  transform: translateY(0);
}

.photo-tile-index {
  font-family: ambroise-std, serif;
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
}

.photo-tile-meta {
  min-width: 0;
  font-family: stratos, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

/* No hover on touch: drop the overlay entirely, the lightbox carries the
   same information. */
@media (hover: none) {
  .photo-tile-overlay {
    display: none;
  }
}

/* Entrance: tiles rise in as their row reveals. No-JS and reduced motion
   never hide anything. */
html.js .photo-tile.is-pending {
  opacity: 0;
  transform: translateY(16px);
}

/* ------------------------------------------------------------------ */
/* Empty state                                                         */
/* ------------------------------------------------------------------ */

.photo-empty {
  margin: 0;
  padding: 18px 20px;
  border: 2px dashed var(--darkSlateGray);
  border-radius: var(--radius);
  font-size: 15px;
  line-height: 1.6;
  color: var(--darkSlateGray);
}
/* ------------------------------------------------------------------ */
/* Lightbox additions                                                  */
/* ------------------------------------------------------------------ */

/* The shared #lightbox shell (layout.css) is reused unchanged; this page
   only adds the scroll lock. The camera settings live on the thumbnail
   hover overlay, so the lightbox carries just the caption and the counter. */
body.photo-lightbox-open {
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {
  .photo-grid {
    --row-height: 210px;
    gap: 14px;
  }

  .photo-hero {
    margin-bottom: 40px;
  }
}

@media (max-width: 768px) {
  .photo-hero {
    min-height: 340px;
    margin-top: 12px;
    margin-bottom: 32px;
  }

  .photo-hero-content {
    padding: 20px;
  }

  .photo-hero-content p {
    font-size: 15px;
  }

  .photo-themes {
    margin-bottom: 40px;
  }

  .photo-section-head {
    align-items: flex-start;
    gap: 6px 16px;
  }
}

@media (max-width: 560px) {
  .photo-grid {
    --row-height: 150px;
    gap: 10px;
  }

  .photo-tile {
    border-width: 2px;
  }

  .photo-theme-name {
    padding: 8px 10px;
    font-size: 0.66rem;
  }
}

/* ------------------------------------------------------------------ */
/* Reduced motion                                                      */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .photo-theme-card,
  .photo-shuffle,
  .photo-shuffle-slide,
  .photo-theme-mosaic,
  .photo-tile,
  .photo-tile-img,
  .photo-tile-overlay {
    transition: none !important;
  }

  .photo-theme-card:hover,
  .photo-theme-card.active,
  .photo-tile:hover {
    transform: none;
  }

  /* The stack never cycles here, so its cover sits at rest - no drift,
     no zoom. */
  .photo-shuffle-slide,
  .photo-shuffle-slide.is-current {
    animation: none;
    transform: none;
  }

  .photo-theme-card:hover .photo-theme-media > .photo-shuffle,
  .photo-theme-card:hover .photo-theme-mosaic,
  .photo-tile:hover .photo-tile-img,
  .photo-tile-link:focus-visible .photo-tile-img {
    transform: none;
  }

  html.js .photo-tile.is-pending {
    opacity: 1;
    transform: none;
  }

  #photoSections.is-swapping {
    animation: none !important;
  }
}

/* Series swap: the new section fades/rises in so switching feels like a
   transition rather than a reload. */
#photoSections.is-swapping {
  animation: photo-swap-in 0.35s ease both;
}

@keyframes photo-swap-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.photo-section {
  margin-bottom: 56px;
}

.photo-section:last-child {
  margin-bottom: 0;
}
