/* ==== GALLERY PAGE ==== */

/* Caption */
.hp-gallery-caption {
  margin-top: 8px;
  font-size: 0.95em;
  color: #444;
}

/* Header layout */
.hp-gallery-header-block {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.hp-gallery-toggle-filters {
  display: none;
}

.hp-gallery-active-filter-label-mobile {
  display: none;
}

/* Style selected tabs */
:root {
  --hp-gallery-accent: #1abc9c;
  --hp-gallery-accent-hover: #16a085;
  --hp-gallery-accent-border: rgba(26, 188, 156, 0.4);
}

.hp-gallery-group-tab-btn.hp-gallery-active-group,
.hp-gallery-subgroup-btn.hp-gallery-active-subgroup,
.hp-gallery-filter-category-btn.hp-gallery-active-filter,
.hp-gallery-filter-contributor-btn.hp-gallery-active-filter {
  background-color: var(--hp-gallery-accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 0 2px var(--hp-gallery-accent-border);
  border: none;
}

.hp-gallery-group-tab-btn.hp-gallery-active-group:hover,
.hp-gallery-subgroup-btn.hp-gallery-active-subgroup:hover,
.hp-gallery-filter-category-btn.hp-gallery-active-filter:hover,
.hp-gallery-filter-contributor-btn.hp-gallery-active-filter:hover {
  background-color: var(--hp-gallery-accent-hover);
}

/* Group Tabs */
.hp-gallery-group-tabs {
  text-align: center;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
}

.hp-gallery-group-tab-btn {
  background-color: #7f8c8d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95em;
}

/* Filter Containers */
.hp-gallery-filters {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.hp-gallery-contributor-container {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.hp-gallery-filter-contributor-btn {
  display: flex !important;
  flex: 0 1 auto;
  min-width: 120px;
  max-width: 45%;
  text-align: center;
  margin-bottom: 0.5rem;
  justify-content: center;
  align-items: center;
}

/* Subgroup Buttons */
.hp-gallery-subgroup-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.hp-gallery-subgroup-btn {
  background-color: #e67e22;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95em;
}

.hp-gallery-category-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Category + Contributor Buttons */
.hp-gallery-filter-category-btn,
.hp-gallery-filter-contributor-btn {
  background-color: #3498db;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.95em;
}

.hp-gallery-filter-category-btn {
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}


/* Active Filter Label */
.hp-gallery-active-filter-label {
  text-align: center;
  font-size: 0.9em;
  color: #666;
  margin: 1rem auto;
  max-width: 90%;
}

/* Gallery Grid */
.hp-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
  padding: 0 2rem;
}

.hp-gallery-grid.loading {
  min-height: 400px;
  opacity: 0.5;
  transition: opacity 0.3s ease;
}
.hp-gallery-grid.ready {
  opacity: 1;
}

/* Gallery Item */
.hp-gallery-item {
  text-align: center;
  background: #f9f9f9;
  border-radius: 6px;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}
.hp-gallery-item:hover {
  transform: scale(1.02);
}
.hp-gallery-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  border-radius: 4px;
}

/* Missing Image Styling */
.hp-gallery-item.missing {
  display: none;
  opacity: 0.5;
  background: repeating-linear-gradient(
    45deg,
    #f8f8f8,
    #f8f8f8 10px,
    #e0e0e0 10px,
    #e0e0e0 20px
  );
}
.hp-gallery-item.missing .missing-image {
  font-size: 0.8em;
  color: #999;
  display: block;
  margin-top: 4px;
}
.hp-gallery-item.missing .missing-filename {
  font-size: 0.75em;
  color: #c00;
  font-family: monospace;
  display: block;
  margin-top: 2px;
}

/* Toggle Missing Button */
.hp-gallery-toggle-missing {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  background-color: #444;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 4px;
}

/* Modal */
.hp-gallery-modal {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

body.hp-gallery-modal-scroll-lock{
  overflow: hidden !important;
}

.hp-gallery-modal.show {
  opacity: 1;
  transform: scale(1);
}
.hp-gallery-modal-content {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  width: 2400px;
  max-height: 98%;
  flex-wrap: nowrap;
  overflow: hidden;
}
.hp-gallery-modal-arrow {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 2.4rem;
  color: white;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.3s ease;
}
.hp-gallery-modal-arrow:hover {
  background: rgba(255,255,255,0.2);
}
.hp-gallery-modal-arrow.disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: default;
}
.hp-gallery-modal-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1080px;
  max-width: none;
  width: 85%;
  height: 850px;
  flex-shrink: 0;
}
.hp-gallery-modal-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  border-radius: 6px;
  flex-shrink: 0;
  transition: opacity 0.3s ease;
}
.hp-gallery-modal-details {
  color: #eee;
  font-size: 0.9em;
  max-width: 300px;
  line-height: 1.4;
  flex-shrink: 0;
}
.hp-gallery-modal-close {
  position: fixed;
  top: 20px;
  right: 20px;
  font-size: 2.4rem;
  color: white;
  cursor: pointer;
  font-weight: bold;
  z-index: 10001;
  background: rgba(0,0,0,0.6);
  padding: 8px 14px;
  border-radius: 6px;
  line-height: 1;
}
.hp-gallery-modal-close:hover {
  background: rgba(255,255,255,0.2);
}
.hp-gallery-modal-reset-zoom {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.hp-gallery-modal-zoom-hint {
  display: block;
  font-size: 1em;
  color: #ccc;
}

body.hp-gallery-modal-scroll-lock #main-header {
  display: none !important;
}
