/* ---------- Filter chips ---------- */

.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--accent-soft);
}

.chip--active {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Photo count ---------- */

.photo-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---------- Sort select ---------- */

.sort-select {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.sort-select:hover {
  border-color: var(--accent-soft);
}

/* ---------- Layout switcher ---------- */

.layout-switcher {
  display: flex;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
}

.layout-switcher button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.layout-switcher button:hover {
  color: var(--text);
}

.layout-switcher button.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- Photo tiles ---------- */

.photo-img {
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.25s ease;
}

.photo-img.loaded {
  opacity: 1;
}

.grid-item:hover .photo-img,
.masonry-item:hover .photo-img,
.justified-item:hover .photo-img {
  transform: scale(1.02);
  filter: brightness(1.08);
}

@keyframes galleryItemIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item {
  animation: galleryItemIn 0.5s ease both;
}

/* ---------- Skeleton loading ---------- */

.skeleton {
  background: linear-gradient(100deg, #141414 30%, #1c1c1c 50%, #141414 70%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 6, 0.96);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 4rem 5rem;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.lightbox-image--visible {
  opacity: 1;
  transform: scale(1);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: none;
  background: transparent;
  color: var(--text);
  opacity: 0.7;
  transition: opacity 0.15s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  opacity: 1;
  color: var(--accent);
}

.lightbox-close {
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
  line-height: 1;
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  line-height: 1;
  padding: 0.5rem 0.75rem;
}

.lightbox-prev {
  left: 0.5rem;
}

.lightbox-next {
  right: 0.5rem;
}

.lightbox-caption {
  position: absolute;
  bottom: 1.5rem;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.lightbox-tags {
  color: var(--accent);
}

.lightbox-exif {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  opacity: 0.75;
}

.lightbox-exif:empty {
  display: none;
}

/* Touch devices, not "narrow screens" — a phone in landscape can be wider
   than this breakpoint, but it's still a touch device that needs minimal
   chrome and no crossfade. Gating on hover/pointer instead of width means
   the compact lightbox applies in both portrait and landscape. */
@media (hover: none) {
  .lightbox-stage {
    padding: 0.5rem 0.5rem 3.5rem;
  }

  .lightbox-prev,
  .lightbox-next {
    font-size: 2rem;
    padding: 0.4rem 0.5rem;
  }

  .lightbox-image {
    transition: none;
  }
}
