/* Photography uses the portfolio's type, colors, spacing and motion tokens.
   Justified rows keep every photograph at its own aspect ratio and fill every
   row edge to edge, including the final one (balanced in photography.js). */
.photography-page main { min-height: 65vh; }
.photography-page .section-shell { max-width: 1440px; }
.photo-intro { padding-top: 96px; padding-bottom: 44px; }
.photo-eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font: 400 11px/1.5 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.photo-intro h1 {
  max-width: 100%;
  margin: 0;
  font: 500 clamp(36px, 4.4vw, 64px)/1.06 "Barlow Condensed", "Arial Narrow", sans-serif;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.photo-intro-copy {
  max-width: 590px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.5;
}
.photo-archive { padding-top: 0; padding-bottom: 0; scroll-margin-top: 72px; }
.photo-archive:focus { outline: none; }
.photo-collection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 0;
  border-top: 1px solid var(--hairline);
}
.photo-collection-head h2 { margin: 0; font-size: 16px; font-weight: 400; }
.photo-collection-head h2 > span:first-child { margin-inline: 12px; color: var(--muted-soft); }
.photo-count { color: var(--muted); font: 400 11px/1.5 "IBM Plex Mono", monospace; }
.photo-collection-head > p { margin: 0; color: var(--muted); font-size: 14px; }
/* Without script, tiles still wrap into rows sized by their aspect ratio. */
.photo-mosaic { --photo-gap: 10px; display: flex; flex-wrap: wrap; gap: var(--photo-gap); }
.photo-mosaic > .photo-tile { flex: calc(var(--r) * 100) 1 calc(var(--r) * 260px); }
.photo-mosaic.is-justified { display: grid; }
.photo-row { display: flex; gap: var(--photo-gap); }
/* Growing in proportion to aspect ratio gives every tile in a row one height. */
.photo-row > .photo-tile { flex: var(--r) 1 0; }
.photo-tile {
  aspect-ratio: var(--r);
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  margin: 0;
  border-radius: 4px;
  background: var(--surface-solid);
}
.photo-open {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  padding: 0;
  background: transparent;
  cursor: zoom-in;
}
.photo-open img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 280ms ease;
}
.photo-open::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 64px;
  background: linear-gradient(transparent, rgb(0 0 0 / .56));
  opacity: 0;
  transition: opacity 240ms ease;
  pointer-events: none;
}
/* Hover is reserved for verified location/date; captions live in the viewer. */
.photo-caption {
  position: absolute;
  inset: auto 14px 11px;
  color: rgb(255 255 255 / .9);
  pointer-events: none;
  opacity: 0;
  transition: opacity 240ms ease;
}
.photo-caption-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  font: 400 10px/1.45 "IBM Plex Mono", monospace;
  letter-spacing: 0;
}
.photo-location { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-date { flex-shrink: 0; }
.photo-caption [hidden] { display: none; }
.photo-open:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.photo-tile:focus-within { z-index: 1; }
.photo-tile.has-photo-meta .photo-open:focus-visible::after,
.photo-tile:has(.photo-open:focus-visible) .photo-caption { opacity: 1; transition: none; }
.photo-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: 16px; }
.photo-error[hidden] { display: none; }
.photo-tile.is-unavailable .photo-open img { opacity: 0; }
.photo-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 40px; padding-bottom: 44px; }
.photo-footer a { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; font-size: 15px; }
.photo-footer p { margin: 0; color: var(--muted); font: 400 10px/1.5 "IBM Plex Mono", monospace; }

/* Native dialog supplies focus containment and Escape dismissal. */
.photo-viewer {
  width: min(1200px, calc(100vw - 64px));
  max-width: none;
  height: min(960px, calc(100dvh - 48px));
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-xs);
  background: var(--canvas);
  color: var(--text);
}
.photo-viewer::backdrop { background: rgb(0 0 0 / .84); backdrop-filter: blur(8px); }
.photo-viewer-panel { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; padding: 16px 24px 24px; }
.photo-viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 44px; padding-bottom: 12px; }
.photo-viewer-count { color: var(--muted); font: 400 11px/1.5 "IBM Plex Mono", monospace; }
.photo-viewer .photo-viewer-close {
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: auto;
  height: auto;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  cursor: pointer;
  transform: none;
}
.photo-viewer-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.photo-viewer-image-wrap { position: relative; min-height: 0; display: grid; place-items: center; }
.photo-viewer-image { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.photo-viewer-image[hidden], .photo-viewer-error[hidden] { display: none; }
.photo-viewer-error { text-align: center; color: var(--muted); }
.photo-viewer-retry { min-height: 44px; padding: 8px 16px; border: 1px solid var(--hairline-strong); border-radius: 4px; background: var(--surface); cursor: pointer; }
.photo-viewer-bottom { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 20px; }
.photo-viewer-copy { min-width: 0; }
.photo-viewer-copy h2 { margin: 0; font: 500 23px/1.25 "Barlow Condensed", sans-serif; }
.photo-viewer-metadata { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 12px 0 0; }
.photo-viewer-metadata > div { display: grid; gap: 3px; }
.photo-viewer-metadata dt { color: var(--muted); font: 400 9px/1.5 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .05em; }
.photo-viewer-metadata dd { margin: 0; font-size: 13px; line-height: 1.4; color: var(--body); }
.photo-viewer-metadata .is-missing { color: var(--muted); }
.photo-viewer-nav { display: flex; flex-shrink: 0; align-items: center; gap: 10px; }
.photo-viewer-nav button {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: transform 140ms var(--ease), opacity 180ms ease;
}
.photo-viewer-nav button::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: var(--surface-elevated);
  opacity: 0;
  transition: opacity 180ms ease;
}
.photo-viewer-nav svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 200ms var(--ease);
}
.photo-viewer-nav button[aria-disabled="true"] { opacity: .28; cursor: default; }
.photo-viewer-nav button:not([aria-disabled="true"]):active { transform: scale(.96); }
.photo-viewer-nav button:focus-visible { transition: none; }
.photo-viewer-nav button:focus-visible svg { transition: none; }
@media (hover: hover) and (pointer: fine) {
  .photo-tile:hover .photo-open img { transform: scale(1.008); }
  .photo-tile.has-photo-meta:hover .photo-open::after { opacity: 1; }
  .photo-tile:hover .photo-caption { opacity: 1; }
  .photo-footer a:hover { color: var(--link); }
  .photo-viewer-nav button:not([aria-disabled="true"]):hover::before { opacity: 1; }
  .photo-viewer-nav button[data-photo-direction="-1"]:not([aria-disabled="true"]):hover svg { transform: translateX(-2px); }
  .photo-viewer-nav button[data-photo-direction="1"]:not([aria-disabled="true"]):hover svg { transform: translateX(2px); }
  .photo-viewer .photo-viewer-close:hover { background: var(--surface-elevated); }
}
@media (max-width: 1023px) and (min-width: 601px) {
  .photo-caption { inset-inline: 12px; bottom: 10px; }
}
@media (max-width: 600px) {
  .photography-page .section-shell { padding-inline: 20px; }
  .photo-intro { padding-top: 88px; padding-bottom: 30px; }
  .photo-eyebrow { margin-bottom: 14px; font-size: 10px; }
  .photo-intro h1 { max-width: 360px; font-size: clamp(36px, 9vw, 48px); line-height: 1.08; }
  .photo-intro-copy { margin-top: 16px; max-width: 360px; font-size: 17px; }
  .photo-collection-head { gap: 12px; padding-block: 16px; }
  .photo-collection-head h2 { font-size: 15px; }
  .photo-collection-head h2 > span:first-child { margin-inline: 6px; }
  .photo-collection-head > p { font-size: 12px; }
  .photo-mosaic { --photo-gap: 6px; }
  .photo-mosaic > .photo-tile { flex-basis: calc(var(--r) * 150px); }
  .photo-caption { inset-inline: 12px; bottom: 10px; }
  .photo-footer { align-items: flex-start; flex-direction: column; gap: 10px; padding-top: 24px; padding-bottom: 30px; }
  .photo-viewer { width: calc(100vw - 20px); height: calc(100dvh - 20px); }
  .photo-viewer-panel { padding: 8px 14px 18px; }
  .photo-viewer-bottom { align-items: center; gap: 16px; padding-top: 18px; }
  .photo-viewer-copy h2 { font-size: 22px; }
  .photo-viewer-metadata { gap: 10px 18px; }
  .photo-viewer-nav button { width: 44px; height: 44px; }
  .photo-viewer-nav { gap: 6px; }
  .photography-page .notes-back { font-size: 10px; letter-spacing: .02em; }
  .photography-page .site-header { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .photography-page .wordmark { font-size: 12px; letter-spacing: .04em; }
}
@media (prefers-reduced-motion: reduce) {
  .photo-open img, .photo-viewer-nav button, .photo-viewer-nav svg { transform: none !important; }
  .photo-open img { transition: none; }
  .photo-caption { transition: opacity 150ms ease; }
  .photo-open::after { transition-duration: 150ms; }
}
