/* ============================================================
   PHOTOS — editorial photo archive
   Vertical scroll, true masonry via CSS columns, lightbox overlay.
   Loaded after styles.css.
   ============================================================ */

.nav--photos { background: transparent; }

.mark-link {
  color: inherit;
  text-decoration: none;
}
.mark-link:hover { color: var(--accent); }

/* =====  MASTHEAD  ===== */
.ph-masthead {
  padding-top: calc(var(--silence-xl) + 24px);
  padding-bottom: var(--silence-md);
}
.ph-eyebrow {
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 28px;
}
.ph-title {
  font-size: clamp(80px, 14vw, 220px);
  font-weight: 900;
  line-height: 0.88;
  letter-spacing: -0.04em;
  margin: 0 0 40px;
  color: var(--ink);
}
.ph-blurb {
  font-size: clamp(18px, 1.8vw, 26px);
  font-weight: 300;
  line-height: 1.45;
  color: var(--ink);
  max-width: 640px;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}
.ph-meta {
  display: flex;
  align-items: baseline;
  gap: 18px;
  font-family: var(--font);
}
.ph-count {
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  letter-spacing: -0.025em;
}
.ph-meta-line {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-70);
  font-weight: 700;
}

/* =====  GRID SHELL  ===== */
.ph-shell {
  padding: 0 var(--gutter) var(--silence-xl);
}

/* =====  MASONRY GRID (CSS columns, true masonry, no JS layout) ===== */
.ph-grid {
  column-count: 3;
  column-gap: 18px;
}
@media (max-width: 1100px) { .ph-grid { column-count: 2; column-gap: 14px; } }
@media (max-width: 560px)  { .ph-grid { column-count: 1; column-gap: 0; } }

/* Individual tile.
   CSS columns stack tiles top-to-bottom within each column.
   `break-inside: avoid` keeps each photo together. Height comes from
   aspect-ratio set inline from the manifest, so portrait photos are tall
   and landscape photos are short — masonry rhythm without JS layout. */
.ph-tile {
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  transition: border-color 0.35s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}
@media (max-width: 1100px) { .ph-tile { margin-bottom: 14px; } }
@media (max-width: 560px)  { .ph-tile { margin-bottom: 14px; } }

.ph-tile picture, .ph-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.ph-tile img {
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.ph-tile.is-loaded img { opacity: 1; }

.ph-tile:hover {
  border-color: rgba(254, 202, 5, 0.4);
  box-shadow: 0 12px 40px -12px rgba(254, 202, 5, 0.2);
}
.ph-tile:hover img { transform: scale(1.02); }
.ph-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Quiet index number overlay top-left, fades in on hover.
   Useful for visitors to know "this is photo 17 of 52" without
   intruding on the editorial feel at rest. */
.ph-tile .ph-idx {
  position: absolute;
  top: 12px;
  left: 14px;
  font-size: 11px;
  letter-spacing: 0.28em;
  font-weight: 700;
  color: var(--ink);
  background: rgba(5, 11, 26, 0.7);
  padding: 4px 8px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  pointer-events: none;
}
.ph-tile:hover .ph-idx,
.ph-tile:focus-visible .ph-idx { opacity: 1; }

/* =====  LIGHTBOX  ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 13, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lb-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 84px;
}
@media (max-width: 720px) {
  .lb-stage { padding: 56px 16px; }
}
.lb-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
}
.lb-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.4s ease;
  box-shadow: 0 30px 100px -30px rgba(254, 202, 5, 0.18),
              0 0 0 1px rgba(255, 255, 255, 0.06);
}
.lb-frame img.is-loaded { opacity: 1; }

/* Lightbox controls */
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink);
  cursor: pointer;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.lb-close:focus-visible, .lb-prev:focus-visible, .lb-next:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.lb-close {
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}
.lb-prev, .lb-next {
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  font-size: 36px;
  font-weight: 300;
  line-height: 1;
}
.lb-prev { left: 24px; }
.lb-next { right: 24px; }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.05); }
@media (max-width: 720px) {
  .lb-close { top: 14px; right: 14px; width: 40px; height: 40px; font-size: 24px; }
  .lb-prev, .lb-next { width: 44px; height: 44px; font-size: 28px; }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

.lb-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-70);
  font-weight: 700;
  z-index: 1001;
}
.lb-counter span { color: var(--accent); }

body.lb-open { overflow: hidden; }

/* =====  MOBILE TUNING  ===== */
@media (max-width: 720px) {
  .ph-masthead {
    padding-top: calc(var(--silence-md) + 24px);
    padding-bottom: var(--silence-md);
  }
}

/* =====  REDUCED MOTION  ===== */
@media (prefers-reduced-motion: reduce) {
  .ph-tile, .ph-tile img, .ph-idx, .lb-frame img,
  .lightbox, .lb-close, .lb-prev, .lb-next {
    transition: none !important;
  }
}
