/* Main */

header {
  margin-bottom: 1.5rem;
}

.gallery-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
  flex-wrap: wrap;
}

.gallery-tab {
  font-family: var(--font-mono);
  color: var(--text-dim);
  border-radius: 100px;
  padding: 0.4em 0.9em;
  cursor: pointer;
  transition: 0.4s var(--ease-soft);
}

.gallery-tab:hover {
  color: var(--text);
  box-shadow: inset 0 0 12px var(--glow), 0 0 6px var(--glow);
}

.gallery-tab.active {
  color: var(--text);
  box-shadow: inset 0 0 10px var(--glow);
  filter: brightness(1.1);
}

/* Grid */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

/* Items */

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 10px;

  border: 1px solid var(--border);
  background: var(--surface-gradient);

  transition: 0.35s var(--ease-soft);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;

  transition: transform 0.4s var(--ease-soft),
              opacity 0.3s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
}

.gallery-item:hover img {
  transform: scale(1.06);
  opacity: 1;
}

/* Hidden state */

.gallery-item.hidden {
  display: none;
}


/* Lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.lightbox.hidden {
  display: none;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 10px;
}

/* arrows */
.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  padding: 1rem;
  user-select: none;
}

#lightbox-prev {
  left: 20px;
}

#lightbox-next {
  right: 20px;
}

.lightbox-arrow:hover {
  opacity: 0.7;
}

.lightbox-img {
  transition: opacity 0.25s ease, transform 0.25s ease;
  opacity: 1;
  transform: translateX(0);
}

.lightbox-img.is-changing {
  opacity: 0;
  transform: translateX(calc(20px * var(--dir, 1)));
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-caption {
  margin-top: 10px;
  max-width: 80%;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.85;
  line-height: 1.4;
  transition: opacity 0.2s ease;
}

.is-changing + .lightbox-caption {
  opacity: 0;
}
