/* Photography grid, album cards, lightbox. Owned by the photography vertical.
   Design tokens live in tokens.css -- never hardcode a color or size here. */
/* ─── Photography Gallery ─────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.gallery-item {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
  background: var(--bg-elevated);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}

.gallery-item:hover img { transform: scale(1.04); }

.album-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  display: block;
  transition: border-color var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

.album-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.album-card__cover {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}

.album-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}

.album-card:hover .album-card__cover img { transform: scale(1.04); }

.album-card__cover-placeholder {
  font-size: 2.5rem;
  color: var(--text-secondary);
}

.album-card__info {
  padding: var(--space-4);
}

.album-card__info h3 {
  font-size: var(--text-base);
  color: var(--text-primary);
}

/* ─── Lightbox ────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

.lightbox.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}

.lightbox__close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-out);
}

.lightbox__close:hover { background: rgba(255, 255, 255, 0.2); }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--ease-out);
}

.lightbox__nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox__prev { left: var(--space-6); }
.lightbox__next { right: var(--space-6); }

@media (max-width: 640px) {
  .lightbox__nav { display: none; }
}

/* ─── Lightbox: hidden-state correctness ──────────────────── */
/* The `hidden` attribute alone does nothing here -- `display: flex` above
   outranks the UA stylesheet's `display: none`. Without this rule the dialog
   stays in the accessibility tree while closed, so screen readers announce a
   photo viewer that isn't open. JS removes [hidden] first, then adds .open on
   the next frame so the fade still runs. */
.lightbox[hidden] {
  display: none;
}

.lightbox__figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.lightbox__caption {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-align: center;
  max-width: 90vw;
}

/* ─── Photo sections, album grid, figures ─────────────────── */
/* These selectors are used by photography.html and album.html. They were
   missing entirely, so album cards laid out as full-width blocks and the
   gallery figures had no styling at all. */

.photo-section {
  margin-top: var(--space-16);
}

.photo-section__header {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.photo-section__title {
  margin: 0;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}

.photo-section__count {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-6);
  /* Cards carry captions of differing length; start-align so a short card
     doesn't stretch to match a tall neighbour. */
  align-items: start;
}

.album-card__meta {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: var(--space-1) 0 0;
}

/* ─── Album page ──────────────────────────────────────────── */

.album-back,
.album-footer a {
  display: inline-block;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  text-decoration: none;
}

.album-back:hover,
.album-footer a:hover {
  color: var(--accent);
}

.album-header__meta {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-top: var(--space-2);
}

.album-intro {
  max-width: 60ch;
  margin-top: var(--space-6);
  color: var(--text-secondary);
}

.album-footer {
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

/* ─── Gallery figures ─────────────────────────────────────── */

.photo-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* The tile is a real <button>; strip the UA chrome without losing the focus
   ring, which is the only affordance a keyboard user has here. */
.gallery-item {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  background: var(--bg-elevated);
}

.gallery-item__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-out);
}

.gallery-item:hover .gallery-item__img { transform: scale(1.04); }

.photo-figure__meta {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  line-height: 1.5;
}

/* Captions make rows uneven; start-align so tiles hang from a common top
   edge instead of floating in a stretched cell. */
.gallery-grid--captioned {
  align-items: start;
  gap: var(--space-6) var(--space-4);
}
