/* Photos: a masonry wall. Equal columns, natural heights, tight gutters. */

.photos-body {
  --paper: #0a0a0b;
  --ink: #f0f0f2;
  --soft: #7a7a88;
  --hair: rgba(255,255,255,0.10);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", -apple-system, sans-serif;
  overflow-x: hidden;
}

.ph-nav, .foot { font-size: 0.74rem; }

/* ─── NAV ─── */
.ph-nav {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  padding: 28px 11vw;
}

.ph-nav a { color: var(--soft); transition: color 300ms; }
.ph-nav a:hover { color: var(--ink); }

/* ─── HEAD ─── */
.head { padding: 14vh 11vw 5vh; }

.head h1 {
  font-weight: 500;
  font-size: clamp(1.9rem, 3.8vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.head h1 em { font-style: normal; font-weight: 300; color: var(--soft); }

/* ─── THE WALL ─── */
/* Columns, so every picture keeps its own height and nothing is cropped.
   Column width rather than a fixed count, so the wall adapts to the screen.
   Mixed portrait and landscape is what makes it fill: a set that is all one
   shape balances into the first few columns and leaves the rest empty. */
.grid {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 0 11vw 12vh;
}

.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cell {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: #141418;
  border-radius: 2%;
  overflow: hidden;
  cursor: pointer;

  /* the wall assembles itself: each picture rises out of a blur, in turn */
  opacity: 0;
  transform: translateY(26px) scale(0.97);
  filter: blur(10px);
  transition:
    opacity 900ms var(--ease) var(--d, 0ms),
    transform 1000ms var(--ease) var(--d, 0ms),
    filter 900ms var(--ease) var(--d, 0ms);
}

.cell.in {
  opacity: 1;
  transform: none;
  filter: none;
  /* once landed, drop the entrance timing so hovering feels immediate */
  transition:
    opacity 420ms var(--ease),
    transform 520ms var(--ease),
    filter 420ms var(--ease);
}

.cell img {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 900ms var(--ease);
}

/* look at one and the rest step back */
.grid.looking .cell.in { filter: opacity(0.4); }
.grid.looking .cell.in:hover,
.cell.in:focus-visible { filter: none; }
.cell.in:hover img, .cell.in:focus-visible img { transform: scale(1.035); }
.cell:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ─── ENDS ─── */
.empty {
  padding: 22vh 11vw;
  text-align: center;
  font-size: 1rem;
  color: var(--soft);
}

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 11vw;
  padding: 26px 0 40px;
  border-top: 1px solid var(--hair);
  color: var(--soft);
}

.foot a { color: var(--soft); transition: color 300ms; }
.foot a:hover { color: var(--ink); }

/* ─── FULL VIEW ─── */
.view {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  cursor: zoom-out;
}

/* the ground fades in behind while the photograph travels over it */
.view-bg {
  position: absolute;
  inset: 0;
  background: var(--paper);
  opacity: 0;
  transition: opacity 380ms ease;
}

.view.is-open .view-bg { opacity: 1; }

/* Visibility is the hidden attribute alone. It used to be a transitioned
   opacity, which could stick at 0: the overlay would open invisibly and
   swallow the page scroll, so clicking looked like it did nothing. */
.view[hidden] { display: none; }
.view:focus, .view:focus-visible { outline: none; }

.view img {
  position: relative;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  display: block;
  /* JS drives the flight, so no resting transition to fight it */
  transform-origin: center;
  will-change: transform;
}

/* ─── NARROW ─── */
@media (max-width: 860px) {
  .head { padding: 12vh 4vw 4vh; }
  .ph-nav { padding: 24px 4vw; }
  .grid { gap: 8px; padding: 0 4vw 8vh; }
  .col { gap: 8px; }
  .foot { margin: 0 4vw; }
  /* no hover on a phone, so nothing should ever be dimmed */
  .grid.looking .cell.in { filter: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cell { opacity: 1; transform: none; filter: none; transition: filter 200ms linear; }
  .cell.in:hover img { transform: none; }
  .view-bg { transition: none; }
}
