
/* Gallery introduction and notices */
.photo-gallery-intro,
.photo-gallery-notice {
  margin: 16px 0;
}

.photo-gallery-notice {
  padding: 16px;
  border: 1px solid #d7dce2;
  border-radius: 6px;
  background: #f7f8fa;
}

/* Year filter */
.photo-gallery-year-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin: 20px 0;
  box-sizing: border-box;
}

.photo-gallery-year-form select,
.photo-gallery-year-form button {
  padding: 8px 12px;
}

/* Responsive photo grid */
.photo-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  width: 100%;
  margin: 24px 0;
  box-sizing: border-box;
}

.photo-gallery-card {
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fff;
}

.photo-gallery-image-link {
  display: block;
  cursor: zoom-in;
}

.photo-gallery-card img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 5px;
}

.photo-gallery-card h3 {
  margin: 12px 0 6px;
  font-size: 1rem;
}

.photo-gallery-year {
  margin-bottom: 0;
  color: #666;
}

/* Lightbox */
.photo-gallery-lightbox[hidden] {
  display: none !important;
}

.photo-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 55px 70px;
  background: rgb(0 0 0 / 92%);
}

.photo-gallery-lightbox-open {
  overflow: hidden;
}

.photo-gallery-lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}

.photo-gallery-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100vh - 145px);
  object-fit: contain;
}

.photo-gallery-lightbox-caption {
  margin-top: 14px;
  color: #000;
  text-align: center;
}

.photo-gallery-lightbox button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgb(255 255 255 / 15%);
  font-size: 28px;
  cursor: pointer;
}

.photo-gallery-lightbox button:hover {
  background: rgb(255 255 255 / 30%);
}

.photo-gallery-lightbox-close {
  top: 16px;
  right: 20px;
}

.photo-gallery-lightbox-prev {
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
}

.photo-gallery-lightbox-next {
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
}

.photo-gallery-lightbox-count {
  position: absolute;
  bottom: 12px;
  left: 0;
  width: 100%;
  margin: 0;
  color: #fff;
  text-align: center;
}

.photo-gallery-lightbox button:focus-visible,
.photo-gallery-image-link:focus-visible {
  outline: 3px solid #f0c040;
  outline-offset: 3px;
}

/* Pagination */
.photo-gallery-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 30px 0;
  padding: 0;
  list-style: none;
  box-sizing: border-box;
}

.photo-gallery-pagination li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.photo-gallery-pagination a,
.photo-gallery-pagination span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-width: 40px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #d5dbe3;
  border-radius: 5px;
  text-decoration: none;
  box-sizing: border-box;
}

.photo-gallery-pagination a:hover {
  background: #f0f4f8;
}

.photo-gallery-pagination .is-active a,
.photo-gallery-pagination a.is-active {
  color: #fff;
  background: #174a7e;
  border-color: #174a7e;
}

/* Photo Gallery page: fix Drupal's constrained content grid */
body.path-photo-gallery .ignou-main {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

body.path-photo-gallery .ignou-main > .region--content {
  display: block !important;
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* Expand the gallery block and its content */
body.path-photo-gallery #block-ignou-rc01-content,
body.path-photo-gallery #block-ignou-rc01-content .block__content {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0;
  box-sizing: border-box !important;
}

/* Consistent width for gallery elements */
body.path-photo-gallery .photo-gallery-intro,
body.path-photo-gallery .photo-gallery-year-form,
body.path-photo-gallery .photo-gallery-summary,
body.path-photo-gallery .photo-gallery-grid,
body.path-photo-gallery .photo-gallery-pagination {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Tablet */
@media (max-width: 900px) {
  .photo-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-gallery-card img {
    height: 200px;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .photo-gallery-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .photo-gallery-card img {
    height: auto;
    max-height: 320px;
    object-fit: contain;
  }

  .photo-gallery-lightbox {
    padding: 60px 45px;
  }

  .photo-gallery-lightbox-prev {
    left: 4px;
  }

  .photo-gallery-lightbox-next {
    right: 4px;
  }

  .photo-gallery-lightbox button {
    width: 38px;
    height: 38px;
    font-size: 23px;
  }

  .photo-gallery-pagination {
    gap: 5px;
  }

  .photo-gallery-pagination a,
  .photo-gallery-pagination span {
    min-width: 34px;
    min-height: 36px;
    padding: 6px 9px;
  }
}
