/* ───── Photography ─────
   The frame, the header and the set heads come from page.css. */

.photo-albums[hidden] {
  display: none;
}

.photo-albums {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.photo-album-tab {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-dim);
  font-family: inherit;
  font-size: var(--t-label);
  letter-spacing: 0.15em;
  padding: 0.35rem 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.photo-album-tab:is(:hover, .is-hover),
.photo-album-tab.active {
  border-color: var(--fg);
  color: var(--fg);
  background: rgba(var(--fg-rgb), 0.07);
}

.photo-row {
  display: flex;
}

/* Hairline borders, no chrome: the frames carry the page. */
.photo-cell {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--wash);
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease);
  box-sizing: border-box;
  flex-shrink: 0;
}

.photo-cell:is(:hover, .is-hover) {
  border-color: rgba(var(--fg-rgb), 0.9);
  box-shadow: 0 0 14px rgba(var(--fg-rgb), 0.28);
}

/* Two stacked copies of the same frame. The tinted one sits on top and fades
   out on hover.
   This deliberately animates opacity rather than filter: a filter transition
   is a main-thread repaint of a large bitmap, and when the main thread is
   busy — or rendering is throttled — it stalls mid-way and hover appears
   dead. Opacity is composited, so it cannot stall the same way. Both images
   share one src, so it is a single fetch and decode. */
.photo-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* The base copy is the photograph as shot — nothing is applied to it, or
   there would be nothing to reveal underneath. */
.photo-base {
  filter: none;
}

.photo-tint {
  filter: var(--photo-rest);
  opacity: 1;
  transition: opacity 0.28s ease;
}

.photo-cell:is(:hover, .is-hover) .photo-tint,
.photo-cell.is-hover .photo-tint {
  opacity: 0;
}

/* Frames that are black-and-white to begin with have nothing to reveal, so
   theirs only lifts slightly rather than dissolving. */
.photo-cell.is-mono:is(:hover, .is-hover) .photo-tint,
.photo-cell.is-mono.is-hover .photo-tint {
  opacity: 0.55;
}

/* Rides just above the footer bar rather than underneath it. Pointer-only:
   there is no hover on a phone, so it would only ever be an empty strip. */
.photo-status {
  position: fixed;
  left: var(--page-pad-x);
  bottom: calc(var(--footer-h) + 0.6rem);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  color: rgba(var(--fg-rgb), 0.75);
  text-shadow: 0 0 8px rgba(var(--fg-rgb), 0.4);
  pointer-events: none;
  z-index: 5;
}

@media (hover: none) {
  .photo-status { display: none; }
}

.photo-empty {
  border: 1px dashed var(--rule-strong);
  padding: 2.5rem;
  text-align: center;
  color: var(--ink-dim);
  line-height: 2;
}

.photo-empty code {
  background: rgba(var(--fg-rgb), 0.08);
  color: var(--fg);
  padding: 0.15em 0.45em;
  border-radius: 2px;
}

/* ───── Lightbox ───── */
body.photo-lightbox-open {
  overflow: hidden;
}

.photo-lightbox[hidden] {
  display: none;
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.96);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.photo-lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  min-height: 0;
}

.photo-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 1px solid rgba(var(--fg-rgb), 0.3);
  /* Opened full screen, a photograph should be the photograph. */
  filter: none;
}

.photo-lightbox-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  color: rgba(var(--fg-rgb), 0.75);
  flex-wrap: wrap;
}

.photo-lightbox-keys {
  color: var(--ink-faint);
}

.photo-lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--ink-dim);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--ease);
}

.photo-lightbox-close:is(:hover, .is-hover) {
  color: var(--fg);
}



/* ───── Sets ───── */
.photo-set {
  margin-bottom: 2rem;
}

/* ───── More ───── */
.photo-more {
  margin-top: 2.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
  text-align: center;
}

/* JS-driven mirror of :hover — see js/components/hover.js. Both paths are
   matched so the effect lands whichever resolves first. */
.photo-cell.is-hover {
  border-color: rgba(var(--fg-rgb), 0.9);
  box-shadow: 0 0 14px rgba(var(--fg-rgb), 0.28);
}

@media (hover: none) {
  /* No pointer to hover with: the tint stays put and a tap opens the frame. */
  .photo-cell:is(:hover, .is-hover) .photo-tint {
    opacity: 1;
  }

  .photo-cell.is-mono:is(:hover, .is-hover) .photo-tint {
    opacity: 1;
  }
}


