/* ==========================================================================
   ARKADE LOUNGE — Gallery
   --------------------------------------------------------------------------
   A masonry-ish grid that stays calm. The photographs are the content, so the
   chrome around them is deliberately quiet: no borders competing with the
   images, no glow, one accent on the active filter.
   ========================================================================== */

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-block-end: var(--sp-6);
}

.gallery-filter {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-sm);
  /* A filter chip is a target on a phone, so it carries a real height rather
     than the line box of its label. */
  min-block-size: 2.75rem;
  padding-inline: var(--sp-5);
  transition: border-color var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              background-color var(--dur-fast) var(--ease-out);
}

.gallery-filter:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.gallery-filter[aria-pressed='true'] {
  background: var(--accent-quiet);
  border-color: var(--purple-400);
  color: var(--text);
}

/* --------------------------------------------------------------------------
   THE GRID
   -------------------------------------------------------------------------- */

.gallery {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}

.gallery__empty {
  grid-column: 1 / -1;
  padding-block: var(--sp-8);
  text-align: center;
}

.gallery-item {
  margin: 0;
  min-inline-size: 0;
}

/* A featured photograph takes two columns where there is room for two. */
@media (min-width: 48rem) {
  .gallery-item--featured {
    grid-column: span 2;
    grid-row: span 2;
  }
}

.gallery-item__open {
  background: var(--surface-sunken);
  border: 0;
  /* The same cut corner as the buttons and cards, so the gallery belongs to
     the rest of the site rather than looking like a plugin. */
  clip-path: polygon(
    0 0,
    calc(100% - var(--cut)) 0,
    100% var(--cut),
    100% 100%,
    var(--cut) 100%,
    0 calc(100% - var(--cut))
  );
  cursor: zoom-in;
  display: block;
  inline-size: 100%;
  overflow: hidden;
  padding: 0;
}

.gallery-item__open:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
}

.gallery-item__image {
  aspect-ratio: 4 / 3;
  display: block;
  inline-size: 100%;
  object-fit: cover;
  transition: transform var(--dur-base) var(--ease-out);
}

.gallery-item--featured .gallery-item__image {
  aspect-ratio: 1 / 1;
}

/* Only on a device that can actually hover. On a touchscreen this fires on
   tap and leaves the image zoomed. */
@media (hover: hover) {
  .gallery-item__open:hover .gallery-item__image {
    transform: scale(1.04);
  }
}

.gallery-item__caption {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding-block-start: var(--sp-3);
}

.gallery-item__title {
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.gallery-item__event {
  color: var(--text-muted);
  font-size: var(--fs-xs);
}

/* --------------------------------------------------------------------------
   LIGHTBOX
   -------------------------------------------------------------------------- */

.lightbox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--text);
  max-block-size: 92vh;
  max-inline-size: min(96vw, 68rem);
  padding: 0;
}

.lightbox::backdrop {
  background: rgba(19, 18, 24, 0.88);
}

.lightbox__close {
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  color: var(--text);
  cursor: pointer;
  font-size: 1.5rem;
  inline-size: 2.75rem;
  block-size: 2.75rem;
  inset-block-start: var(--sp-3);
  inset-inline-end: var(--sp-3);
  line-height: 1;
  position: absolute;
  z-index: var(--z-base);
}

.lightbox__close:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.lightbox__figure {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.lightbox__image {
  display: block;
  inline-size: 100%;
  max-block-size: 78vh;
  object-fit: contain;
}

.lightbox__caption {
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  padding: var(--sp-4) var(--sp-5);
}

.lightbox__caption:empty {
  display: none;
}
