/* ============================================================
   GALLERY PAGE — page-specific styles
   Requires shared.css to be loaded first.
   ============================================================ */

.gallery-intro-card {
  text-align: center;
}

.gallery-intro-card h2 {
  color: #0a3d62;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.gallery-intro {
  margin-bottom: 1.25rem;
}

.gallery-status {
  margin-top: 0.95rem;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.6;
}

.gallery-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.gallery-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid #c8dfff;
  border-radius: 20px;
  background: #e8f1ff;
  color: #0a3d62;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.gallery-filter span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
}

.gallery-filter:hover,
.gallery-filter.is-active {
  background: #0077cc;
  color: #fff;
  border-color: #0077cc;
}

.gallery-filter.is-active span {
  background: rgba(255, 255, 255, 0.16);
}

.gallery-filter:focus-visible,
.gallery-media-trigger:focus-visible,
.gallery-modal__close:focus-visible {
  outline: 3px solid rgba(0, 119, 204, 0.2);
  outline-offset: 2px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  overflow: hidden;
}

.gallery-card[hidden] {
  display: none;
}

.gallery-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #eef3f8;
  border-bottom: 1px solid #ddd;
}

.gallery-card__caption {
  display: none;
}

.gallery-media-trigger {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: inherit;
}

.gallery-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-media-error {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 1rem;
  color: #555;
  font-size: 0.9rem;
  text-align: center;
}

.gallery-media-error[role="status"] {
  line-height: 1.6;
}

.gallery-card__media--video::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.02));
  pointer-events: none;
}

.gallery-play-badge {
  position: absolute;
  inset: auto auto 1rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  background: rgba(10, 61, 98, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.3);
  pointer-events: none;
}

.gallery-play-badge__icon {
  margin-left: 0.16rem;
  width: 0;
  height: 0;
  border-top: 0.5rem solid transparent;
  border-bottom: 0.5rem solid transparent;
  border-left: 0.85rem solid #fff;
}

.gallery-card__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 1.15rem;
}

.gallery-card__meta {
  color: #0077cc;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.gallery-card__body h3 {
  color: #0a3d62;
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 0.45rem;
}

.gallery-card__body p {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.7;
}

.gallery-card__actions {
  margin-top: auto;
}

.gallery-empty-state {
  margin-top: 1.5rem;
  text-align: center;
}

.gallery-empty-state h3 {
  margin-bottom: 0.45rem;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.gallery-modal[hidden] {
  display: none;
}

.gallery-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
}

.gallery-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 960px);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1rem;
}

.gallery-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 0.9rem;
  margin-left: auto;
  margin-bottom: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f7f9fb;
  color: #0a3d62;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.gallery-modal__figure {
  display: grid;
  gap: 1rem;
}

.gallery-modal__figure img,
.gallery-modal__video {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #eef3f8;
}

.gallery-modal__video {
  aspect-ratio: 16 / 9;
}

.gallery-modal__video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.gallery-modal__caption h3 {
  color: #0a3d62;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  line-height: 1.3;
  margin-bottom: 0.4rem;
}

.gallery-modal__caption p {
  color: #555;
  font-size: 0.95rem;
  line-height: 1.7;
}

#galleryModalCaption {
  margin-top: 0.45rem;
}

#galleryModalLinkWrap {
  margin-top: 0.85rem;
}

body.gallery-modal-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .gallery-card__body {
    padding: 1rem;
  }

  .gallery-modal {
    padding: 0.75rem;
  }

  .gallery-modal__dialog {
    max-height: calc(100vh - 1.5rem);
    padding: 0.85rem;
  }

  .gallery-play-badge {
    width: 2.75rem;
    height: 2.75rem;
    inset: auto auto 0.85rem 0.85rem;
  }
}

@media (max-width: 480px) {
  .gallery-filter-bar {
    justify-content: stretch;
  }

  .gallery-filter {
    width: 100%;
    justify-content: center;
  }
}
