:root {
  --gallery-height: min(70vh, 640px);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.filter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: bold;
}

.filter select {
  width: 100%;
  padding: 4px 2px;
  font-size: 0.85rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
}

.filter-actions {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin: 14px 0 18px;
}

.filter-actions .back-btn {
  grid-column: 1;
  justify-self: start;
}

.apply-btn {
  grid-column: 2;
  padding: 6px 16px;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: transform 0.2s;
}

.apply-btn:hover {
  transform: scale(1.05);
}

.apply-btn:active {
  transform: scale(0.97);
}

.gallery-box {
  height: var(--gallery-height);
  overflow-y: auto;
  overflow-x: hidden;
  border: 2px dashed var(--ink);
  padding: 4px 14px 14px;
}

.year-heading {
  margin: 14px 0 12px;
  padding-bottom: 5px;
  text-align: center;
  border-bottom: 2px dashed var(--ink);
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.thumbnail {
  display: block;
  border: 2px solid var(--ink);
  background: #fff;
  transition: transform 0.2s;
}

.thumbnail img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.thumbnail:hover,
.thumbnail:focus-visible {
  transform: rotate(-2deg) scale(1.03);
}

.gallery-message {
  padding: 30px 10px;
  text-align: center;
}

.gallery-message.is-error {
  color: #b00020;
}

.sl-overlay {
  background: #fff;
  opacity: 0.93;
}

.sl-wrapper .sl-close,
.sl-wrapper .sl-navigation button {
  color: var(--ink);
}

.desc-toggle {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 10010;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  cursor: pointer;
}

.desc-toggle[hidden],
.desc-panel[hidden] {
  display: none;
}

.desc-panel {
  position: fixed;
  left: 50%;
  bottom: 60px;
  z-index: 10010;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  max-height: 40vh;
  overflow-y: auto;
  padding: 12px 14px;
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 2px dashed var(--ink);
}

@media (max-width: 560px) {
  .filter {
    font-size: 0.8rem;
  }
  .filter select {
    font-size: 0.75rem;
  }
  .gallery-box {
    padding: 4px 10px 10px;
  }
  .thumbnail-grid {
    gap: 10px;
  }
}
