/*
 * photo-gallery.css
 * Tag chip filter + search box + responsive grid + modal lightbox
 * for _extensions/photo-gallery shortcode output.
 */

.photo-gallery {
  margin: 1.5rem 0;
}

.photo-gallery-empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--bs-secondary-color, #6c757d);
  border: 1px dashed rgba(128, 128, 128, 0.3);
  border-radius: 0.5rem;
  font-size: 0.95rem;
}

/* Controls row */
.photo-gallery .gallery-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(128, 128, 128, 0.15);
}

.photo-gallery .tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1 1 auto;
}

.photo-gallery .tag-chip {
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  line-height: 1.3;
  border: 1px solid rgba(128, 128, 128, 0.4);
  background: transparent;
  color: var(--bs-body-color);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.photo-gallery .tag-chip:hover {
  border-color: var(--bs-link-color);
  color: var(--bs-link-color);
}

.photo-gallery .tag-chip.active {
  background: var(--bs-link-color);
  color: white;
  border-color: var(--bs-link-color);
}

.photo-gallery .gallery-search {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  border: 1px solid rgba(128, 128, 128, 0.4);
  border-radius: 0.25rem;
  background: transparent;
  color: var(--bs-body-color);
  min-width: 14rem;
  flex: 0 0 auto;
}

.photo-gallery .gallery-search:focus {
  outline: none;
  border-color: var(--bs-link-color);
  box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

/* Grid */
.photo-gallery .photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.photo-gallery .photo-card {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  border-radius: 0.375rem;
  overflow: hidden;
  background: rgba(128, 128, 128, 0.05);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.photo-gallery .photo-card .photo-number {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0 0.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  z-index: 2;
  pointer-events: none;
  user-select: none;
}

.photo-gallery .photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
}

.photo-gallery .photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.photo-gallery .photo-card figcaption {
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
}

.photo-gallery .photo-card .photo-title {
  font-weight: 500;
  line-height: 1.3;
  color: var(--bs-body-color);
}

.photo-gallery .photo-card .photo-date {
  font-size: 0.75rem;
  color: var(--bs-secondary-color, #6c757d);
  display: block;
  margin-top: 0.15rem;
}

.photo-gallery .photo-card.hidden {
  display: none;
}

/* Modal lightbox */
.photo-gallery .gallery-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 2rem;
}

.photo-gallery .gallery-modal[aria-hidden="false"] {
  display: flex;
}

.photo-gallery .gallery-modal .modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
  gap: 1rem;
}

.photo-gallery .gallery-modal .modal-img {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 4px;
  background: #000;
}

.photo-gallery .gallery-modal .modal-caption {
  color: white;
  text-align: center;
  font-size: 0.95rem;
  max-width: 60ch;
  line-height: 1.5;
}

.photo-gallery .gallery-modal .modal-caption strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.photo-gallery .gallery-modal button {
  position: absolute;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 3rem;
  height: 3rem;
  font-size: 1.8rem;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.photo-gallery .gallery-modal button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.photo-gallery .gallery-modal .modal-close {
  top: 1rem;
  right: 1rem;
}

.photo-gallery .gallery-modal .modal-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.photo-gallery .gallery-modal .modal-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}
