/* -------------------------------------------------------- */
/* GALLERY PAGE STYLES                                       */
/* -------------------------------------------------------- */

/* -------------------------------------------------------- */
/* TAB BUTTONS (OCaK Gallery / Blur's Corner)               */
/* -------------------------------------------------------- */

.gallery-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  justify-content: center;
}

.gallery-tab-btn {
  background: var(--btn-800);
  color: var(--text);
  border: 3px solid var(--ink-900);
  border-radius: 12px;
  padding: 10px 28px;
  font-weight: 700;
  font-size: 1em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
  box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.3);
}

.gallery-tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 8px 2px rgba(0,0,0,0.35);
}

.gallery-tab-btn.active {
  background: var(--ui-800);
  color: #fff;
  border-color: var(--ink-900);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 2px 2px 5px 1px rgba(0,0,0,0.3);
  transform: translateY(0);
}

/* -------------------------------------------------------- */
/* TAB PANES                                                 */
/* -------------------------------------------------------- */

.gallery-pane {
  display: none;
}

.gallery-pane.active {
  display: block;
}

/* -------------------------------------------------------- */
/* FILTER AREA                                               */
/* -------------------------------------------------------- */

.gallery-filters-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

/* Filter row: collapsibles side by side */
.gallery-filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* Shared collapsible filter panel */
.gallery-filter-collapsible {
  flex: 1;
  min-width: 180px;
  background: var(--btn-background-1);
  border: 3px solid rgba(28,12,1,0.6);
  border-radius: 12px;
  overflow: hidden;
}

.gallery-filter-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 15px;
  font-size: 0.95em;
  font-weight: 700;
  color: var(--IB-text-alt);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

.gallery-filter-collapsible-header::-webkit-details-marker {
  display: none;
}

.gallery-filter-collapsible-header::after {
  content: '▸';
  font-size: 0.9em;
  transition: transform 0.2s ease;
}

.gallery-filter-collapsible[open] > .gallery-filter-collapsible-header::after {
  transform: rotate(90deg);
}

.gallery-filter-collapsible-header:hover {
  background: var(--btn-background-2);
  color: #fff;
}

.gallery-filter-collapsible-content {
  padding: 5px 15px 15px;
}

/* -------------------------------------------------------- */
/* TAG FILTER BUTTONS (3-state)                             */
/* -------------------------------------------------------- */

.gallery-tag-filters,
.gallery-type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.gallery-tag-filter,
.gallery-type-filter {
  background: var(--IB-bg-alt-3);
  color: var(--IB-text);
  border: 2px solid rgba(28,12,1,0.3);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-tag-filter:hover,
.gallery-type-filter:hover {
  border-color: rgba(28,12,1,0.6);
}

/* Include state */
.gallery-tag-filter.tag-include {
  background: rgba(76,140,74,0.3);
  border-color: rgba(76,140,74,0.8);
  color: #2d5a2b;
}
.gallery-tag-filter.tag-include::before { content: '✓ '; }

/* Exclude state */
.gallery-tag-filter.tag-exclude {
  background: rgba(192,114,88,0.3);
  border-color: rgba(192,114,88,0.8);
  color: #8b3a2a;
  text-decoration: line-through;
}
.gallery-tag-filter.tag-exclude::before {
  content: '✗ ';
  text-decoration: none;
  display: inline;
}

/* Type filter active state (simple toggle, no 3-state) */
.gallery-type-filter.active {
  background: var(--ui-800);
  color: #fff;
  border-color: var(--ink-900);
}

/* AI filter toggle row */
.gallery-ai-filter-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-ai-btn {
  background: var(--IB-bg-alt-3);
  color: var(--IB-text);
  border: 2px solid rgba(28,12,1,0.3);
  border-radius: 8px;
  padding: 5px 14px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-ai-btn:hover {
  border-color: rgba(28,12,1,0.6);
}

.gallery-ai-btn.active {
  background: var(--ui-800);
  color: #fff;
  border-color: var(--ink-900);
}

/* Filter legend */
.gallery-filter-legend {
  font-size: 0.75em;
  color: var(--IB-text);
  opacity: 0.6;
  margin-top: 10px;
  font-style: italic;
}

/* Result count */
.gallery-count {
  font-size: 0.82em;
  color: var(--IB-text);
  opacity: 0.65;
  font-style: italic;
  text-align: right;
  margin-bottom: 8px;
}

/* -------------------------------------------------------- */
/* GALLERY GRID                                             */
/* -------------------------------------------------------- */

/* Uniform CSS Grid — 4 cols desktop, 3 tablet, 2 mobile, 1 small.
   Items append to the end; nothing ever moves on load more.      */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.blur-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 1100px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 800px) {
  .gallery-grid,
  .blur-grid    { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .gallery-grid,
  .blur-grid    { grid-template-columns: repeat(1, 1fr); }
}

.gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  display: block;
  text-decoration: none !important;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 2px solid rgba(28,12,1,0.15);
  aspect-ratio: 1 / 1;
}

.gallery-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  border-color: rgba(28,12,1,0.45);
}

.gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 8px;
}

/* AI badge on thumbnail */
.gallery-item-ai-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(28,12,1,0.72);
  color: #f2e4cf;
  font-size: 0.68em;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 5px;
  pointer-events: none;
}

/* Mature content overlay (reusing existing maturefilter pattern) */
.gallery-item.maturefilter::before {
  content: attr(data-mature-label);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.9rem;
  color: #fff;
  text-align: center;
  padding: 0.5em;
  backdrop-filter: blur(4px);
  background: rgba(0,0,0,0.72);
  pointer-events: none;
  border-radius: 8px;
}

.ul-disclaimer,
.gallery-load-notice {
  margin:      6px auto 0;
  font-family: var(--font, 'Times New Roman', serif);
  font-size:   .82em;
  color:       var(--IB-text, #4B2E12);
  text-align:  center;
  opacity:     .85;
}

/* Hidden gallery items (filtered out) */
.gallery-item.gallery-hidden {
  display: none;
}

/* -------------------------------------------------------- */
/* EMPTY / LOADING STATES                                   */
/* -------------------------------------------------------- */

.gallery-loading,
.gallery-empty,
.gallery-error {
  text-align: center;
  padding: 40px;
  font-size: 1em;
  color: var(--IB-text);
  opacity: 0.7;
}

.gallery-error {
  background: rgba(192,114,88,0.12);
  border: 2px solid var(--IB-warning);
  border-radius: 12px;
  color: var(--IB-warning);
  opacity: 1;
}

/* -------------------------------------------------------- */
/* BLUR'S CORNER                                            */
/* -------------------------------------------------------- */

.blur-corner-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(28,12,1,0.2);
}

.blur-corner-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(28,12,1,0.4);
  object-fit: cover;
  object-position: center top;
}

.blur-corner-title {
  font-family: var(--heading-font);
  font-size: 1.25em;
  font-weight: 700;
  color: var(--IB-text-alt);
  margin: 0;
}

.blur-corner-desc {
  font-size: 0.85em;
  color: var(--IB-text);
  opacity: 0.7;
  margin: 0;
}

/* Blur uses a wider masonry (fewer columns since there'll be fewer pieces) */
.blur-masonry {
  columns: 3;
  column-gap: 10px;
}

/* -------------------------------------------------------- */
/* RESPONSIVE                                               */
/* -------------------------------------------------------- */

@media (max-width: 800px) {
  .gallery-filter-row {
    flex-direction: column;
  }

  .gallery-filter-collapsible {
    min-width: 0;
    width: 100%;
  }

  .gallery-tab-btn {
    padding: 8px 16px;
    font-size: 0.9em;
  }
}
/* -------------------------------------------------------- */
/* CHARACTER TIER COLLAPSIBLES (inside Characters filter)   */
/* -------------------------------------------------------- */

.gallery-tier-toggle-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.gallery-char-tier-collapsible {
  background: rgba(0,0,0,0.04);
  border: 1.5px solid rgba(28,12,1,0.15);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 6px;
}

.gallery-char-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  font-size: 0.8em;
  font-weight: 700;
  color: var(--IB-text-alt);
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

.gallery-char-tier-header::-webkit-details-marker {
  display: none;
}

.gallery-char-tier-header::after {
  content: '▸';
  font-size: 0.85em;
  transition: transform 0.2s ease;
  opacity: 1;
}

.gallery-char-tier-collapsible[open] > .gallery-char-tier-header::after {
  transform: rotate(90deg);
}

.gallery-char-tier-header:hover {
  background: rgba(28,12,1,0.06);
  opacity: 1;
}

.gallery-char-tier-content {
  padding: 6px 10px 10px;
}
/* -------------------------------------------------------- */
/* LOAD MORE / LOAD ALL BUTTONS                             */
/* -------------------------------------------------------- */

/* "Load All" row at the top of the page */
.gallery-load-all-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 8px 0 4px;
  flex-wrap: wrap;
}

.gallery-load-all-btn {
  background: var(--IB-bg-alt-3);
  color: var(--IB-text);
  border: 2px solid rgba(28,12,1,0.3);
  border-radius: 8px;
  padding: 5px 16px;
  font-size: 0.82em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-style: italic;
  opacity: 0.8;
}

.gallery-load-all-btn:hover {
  border-color: rgba(28,12,1,0.6);
  opacity: 1;
}

/* "Load More" row at the bottom of each gallery pane */
.gallery-more-row {
  display: flex;
  justify-content: center;
  padding: 20px 0 10px;
}

.gallery-load-more-btn {
  background: var(--btn-800);
  color: var(--text);
  border: 3px solid var(--ink-900);
  border-radius: 12px;
  padding: 10px 32px;
  font-weight: 700;
  font-size: 1em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
  box-shadow: 2px 2px 5px 1px rgba(0,0,0,0.3);
}

.gallery-load-more-btn:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 8px 2px rgba(0,0,0,0.35);
  background: var(--ui-800);
  color: #fff;
}