/* =====================================================================
   PHOTOGRAPHY PAGE — photography.css  v11
   High-end editorial gallery. Seamless masonry, full-height lightbox.
   Inherits all design tokens from style.css.
   ===================================================================== */

/* ---- Page layout --------------------------------------------------- */
.photo-page {
  padding-block: 56px 96px;
}

/* ---- Header -------------------------------------------------------- */
.photo-header {
  margin-top: 36px;
  margin-bottom: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 28px;
}

.photo-header__left { max-width: 640px; }

.photo-header__title {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  margin-bottom: 16px;
  line-height: 1.06;
  letter-spacing: -0.03em;
}

.photo-gradient {
  background: linear-gradient(120deg, var(--accent-bright), var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.photo-header__sub {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 52ch;
  margin-bottom: 20px;
}

.photo-header__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Count badge */
.photo-count-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.photo-count-num {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  background: linear-gradient(120deg, var(--accent-bright), var(--accent-cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.photo-count-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: 3px;
}

/* ---- Divider ------------------------------------------------------- */
.photo-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-cyan) 40%, transparent 100%);
  opacity: 0.3;
  margin-bottom: 36px;
}

/* =====================================================================
   GALLERY — seamless masonry, no card chrome
   ===================================================================== */
.gallery { width: 100%; }

/* ── Edit mode ───────────────────────────────────────────────────── */
.edit-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: #0a0e16;
  background: linear-gradient(120deg, var(--accent-bright), var(--accent-cyan));
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 28px;
}

.edit-banner__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.edit-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: #0a0e16;
  background: rgba(0,0,0,0.15);
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.edit-action-btn:hover { background: rgba(0,0,0,0.25); }

.edit-action-btn--save {
  background: rgba(0,0,0,0.3);
  font-weight: 600;
}

.drag-dragging        { opacity: 0.35; cursor: grabbing; }
.drag-over            { outline: 2px solid var(--accent-bright); outline-offset: -2px; }
.photo-card[draggable="true"] { cursor: grab; }

.edit-crop-ctrl {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 10;
}

.photo-card:hover .edit-crop-ctrl {
  opacity: 1;
  pointer-events: all;
}

.edit-crop-ctrl__inner {
  width: 100%;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.edit-crop-ctrl__label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

.edit-crop-ctrl__slider {
  flex: 1;
  accent-color: var(--accent-bright);
  cursor: pointer;
  height: 3px;
}

.edit-crop-ctrl__val {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-bright);
  white-space: nowrap;
  min-width: 28px;
  text-align: right;
}

.edit-crop-ctrl__status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--accent-cyan);
  white-space: nowrap;
  min-width: 16px;
}

/* ── Filter bar ──────────────────────────────────────────────────── */
.gallery-filters {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.gallery-filter {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0 5px;
  cursor: pointer;
  transition: color 0.22s, border-color 0.22s;
}

.gallery-filter:hover { color: var(--text); }

.gallery-filter.active {
  color: var(--text);
  border-bottom-color: var(--accent-bright);
}

.gallery-filter-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
}

/* ── Editorial row layout ─────────────────────────────────────────── */
.gallery-row {
  display: flex;
  gap: 3px;
  margin-bottom: 3px;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.gallery-row.row--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Photo card ---------------------------------------------------- */
.photo-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #060810;
  flex-shrink: 0;
}

.photo-card--full       { flex: 1 1 100%; }
.photo-card--half       { flex: 1 1 50%; }
.photo-card--third      { flex: 1 1 33.333%; }
.photo-card--two-thirds { flex: 1 1 66.666%; }

.photo-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.photo-card__img-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.photo-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.photo-card:hover .photo-card__img-wrap img {
  transform: scale(1.05);
}

/* Hover overlay — gradient rising from bottom */
.photo-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.18) 45%,
    rgba(0, 0, 0, 0)    70%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 22px 20px;
  opacity: 0;
  transition: opacity 0.38s ease;
}

.photo-card:hover .photo-card__overlay,
.photo-card:focus-visible .photo-card__overlay {
  opacity: 1;
}

/* Title — thin tracked caps, slides up on hover */
.photo-card__title {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 4px;
  transform: translateY(6px);
  transition: transform 0.38s ease;
}

.photo-card:hover .photo-card__title,
.photo-card:focus-visible .photo-card__title {
  transform: translateY(0);
}

/* EXIF strip */
.photo-card__exif {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  transform: translateY(6px);
  transition: transform 0.38s ease 0.04s;
}

.photo-card:hover .photo-card__exif,
.photo-card:focus-visible .photo-card__exif {
  transform: translateY(0);
}

/* ── Mobile: stack rows into 2-col grid ───────────────────────────── */
@media (max-width: 680px) {
  .gallery-row {
    flex-wrap: wrap;
    height: auto !important;
  }
  .photo-card--full,
  .photo-card--half,
  .photo-card--third,
  .photo-card--two-thirds {
    flex: 0 0 calc(50% - 1.5px);
    height: 180px;
  }
}

@media (max-width: 400px) {
  .photo-card--full,
  .photo-card--half,
  .photo-card--third,
  .photo-card--two-thirds {
    flex: 0 0 100%;
    height: 220px;
  }
}

/* ---- Empty state --------------------------------------------------- */
.gallery__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 96px 24px;
  text-align: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.gallery__empty-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: grid;
  place-items: center;
  color: var(--text-faint);
}

/* =====================================================================
   LIGHTBOX — full-height, image-dominant
   ===================================================================== */

.lightbox__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 10, 0.97);
  z-index: 900;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 901;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 40px;
}

.lightbox[hidden],
.lightbox__backdrop[hidden] {
  display: none;
}

/* Close button — fixed at top-right of viewport, always visible */
.lightbox__close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 902; /* above lightbox */
  transition: background 0.25s, border-color 0.25s, color 0.25s;
}

.lightbox__close:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
  color: var(--text);
}

/* Shell — flex row, size driven by JS-sized stage + fixed panel */
.lightbox__shell {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  background: #070b14;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius-lg);
  box-shadow:
    0 60px 140px -24px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(91, 141, 239, 0.06);
  overflow: hidden;
  /* Shell grows around the JS-sized stage */
}

/* Stage — JS sets exact width + height to match photo's aspect ratio.
   Because container = photo's ratio, image fills it with NO crop, NO bars. */
.lightbox__stage {
  position: relative;
  flex-shrink: 0;
  background: #050810;
  overflow: hidden;
  /* width and height injected by sizeStage() in JS */
}

/* Subtle vignette at edges of the stage */
.lightbox__stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(5,8,16,0.3) 100%);
  z-index: 1;
  pointer-events: none;
}

/* The image — object-fit: contain guarantees zero cropping ever.
   Stage is JS-sized to match the photo ratio, so contain fills
   the stage fully with no black bars and no crop. */
/* Blurred background fill — same src as main image, absolutely placed so it
   doesn't participate in flow and push the main image off-screen. */
.lightbox__img-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(28px);
  transform: scale(1.1); /* hide blur edge artefacts */
  opacity: 0.25;
  z-index: 0;
}

.lightbox__img {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

canvas.lightbox__img {
  object-fit: unset;
}

/* Counter pill */
.lightbox__counter {
  position: absolute;
  z-index: 2;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(5, 8, 16, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* Nav arrows — sit inside the stage, ghost by default, solid on stage hover */
.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(5, 8, 16, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s var(--ease), background 0.25s, border-color 0.25s,
              color 0.25s, transform 0.3s var(--ease);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Reveal on stage hover */
.lightbox__stage:hover .lightbox__nav:not(:disabled) {
  opacity: 1;
}

.lightbox__nav--prev { left: 14px; }
.lightbox__nav--next { right: 14px; }

/* Fill solid when hovering the arrow itself */
.lightbox__nav:hover:not(:disabled) {
  background: rgba(19, 28, 43, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.lightbox__nav--prev:hover:not(:disabled) { transform: translateY(-50%) translateX(-2px); }
.lightbox__nav--next:hover:not(:disabled) { transform: translateY(-50%) translateX(2px); }

.lightbox__nav:disabled { opacity: 0 !important; cursor: default; }

/* ---- Info panel — matches the stage height, scrolls if content is taller */
.lightbox__panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  background: #0c1220;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.lightbox__panel::-webkit-scrollbar { width: 3px; }
.lightbox__panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* Title block */
.lightbox__panel-head {
  padding: 28px 22px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 10px;
  word-break: break-word;
}

.lightbox__desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.75;
  word-break: break-word;
}

/* ---- EXIF quick stats — 2×2 grid ---------------------------------- */
.exif-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255, 255, 255, 0.04); /* creates grid lines */
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.exif-stats[hidden] { display: none; }

.exif-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  background: #0c1220;
  text-align: center;
  transition: background 0.2s;
}

.exif-stat:hover { background: rgba(91, 141, 239, 0.05); }

.exif-stat__icon {
  color: var(--accent);
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
}

.exif-stat__value {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.exif-stat__label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ---- Gear tags (camera + lens) ------------------------------------ */
.exif-gear {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.exif-gear[hidden] { display: none; }

.exif-gear-tag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(91, 141, 239, 0.08);
  border: 1px solid rgba(91, 141, 239, 0.18);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-bright);
  word-break: break-word;
  flex-wrap: wrap;
}

.exif-gear-tag--lens {
  background: rgba(56, 214, 200, 0.06);
  border-color: rgba(56, 214, 200, 0.18);
  color: var(--accent-cyan);
}

.exif-gear-tag svg { flex-shrink: 0; }

/* ---- Date ---------------------------------------------------------- */
.lightbox__date {
  padding: 14px 22px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.lightbox__date[hidden] { display: none; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Header: stack badge below on mobile */
@media (max-width: 640px) {
  .photo-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
  }

  .photo-count-badge {
    flex-direction: row;
    width: auto;
    height: auto;
    border-radius: 999px;
    padding: 8px 18px;
    gap: 10px;
  }

  .photo-count-num   { font-size: 1.2rem; }
  .photo-count-label { margin-top: 0; }

  .photo-header__title { font-size: clamp(2rem, 9vw, 3rem); }
  .photo-header__sub   { font-size: 0.92rem; }
  .photo-divider       { margin-bottom: 24px; }
}

/* Lightbox: bottom sheet on mobile, stacked vertically */
@media (max-width: 840px) {
  .lightbox {
    padding: 0;
    align-items: flex-end;
  }

  .lightbox__shell {
    flex-direction: column;
    width: 100%;
    max-height: 96vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  /* On mobile: stage fills full width, capped at 60vh so contain has a real box */
  .lightbox__stage {
    width: 100% !important;   /* override JS inline style */
    height: 60vh !important;  /* explicit height — needed for object-fit:contain */
    flex-shrink: 0;
  }

  /* Image fills the stage exactly; contain letterboxes without cropping */
  .lightbox__img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  .lightbox__panel {
    width: 100%;
    flex: 1;
    min-height: 0;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    overflow-y: auto;
  }

  .lightbox__close {
    top: 14px;
    right: 14px;
  }

  .lightbox__nav {
    width: 36px;
    height: 36px;
  }

  .lightbox__nav--prev { left: 10px; }
  .lightbox__nav--next { right: 10px; }
}

@media (max-width: 480px) {
  .exif-stat { padding: 12px 8px; }
  .exif-stat__value { font-size: 0.9rem; }
  .exif-gear-tag { font-size: 0.7rem; padding: 8px 12px; }
  .lightbox__panel-head { padding: 18px 16px 16px; }
  .lightbox__title { font-size: 1.05rem; }
  .exif-gear { padding: 12px 16px; }
  .lightbox__date { padding: 12px 16px; }
}
