:root {
  --brand: #39ff14;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  background: #ffffff;
  color: #171717;
}

button {
  font-family: inherit;
}

.gallery {
  padding: 4rem 1rem;
}

.gallery__inner {
  max-width: 72rem;
  margin: 0 auto;
}

.gallery__header {
  max-width: 42rem;
  margin: 0 auto;
  text-align: center;
}

.gallery__heading {
  margin: 0;
  font-size: clamp(1.75rem, 1.4rem + 1.8vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #171717;
}

.gallery__subheading {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #737373;
}

.tabs {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.tab {
  border-radius: 999px;
  border: none;
  background: #f5f5f5;
  color: #525252;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 200ms ease,
    color 200ms ease;
}

.tab:hover {
  background: #e5e5e5;
}

.tab.is-active {
  background: #171717;
  color: #ffffff;
}

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

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 2rem;
}

.card {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 1rem;
  background: #f5f5f5;
}

.card.is-hidden {
  display: none;
}

.card__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__caption {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 0.75rem;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
}

.card__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: #ffffff;
}

.card__category {
  margin: 0.125rem 0 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 640px) {
  .grid {
    gap: 1rem;
  }

  .card__caption {
    padding: 1rem;
  }
}

@media (min-width: 1024px) {
  .gallery {
    padding: 6rem 2rem;
  }

  .tabs {
    margin-top: 2.5rem;
  }

  .grid {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 2.5rem;
  }
}

/*
 * Gallery 08 — "category filter transitions + grid reshuffle" animation
 * identity. Same canonical keyframe as `Gallery08.tailwind.css`. Scoped so
 * this never collides with another Resource's own animation layer.
 * Entirely disabled under reduced motion: cards appear directly at their
 * final, fully visible state with no entrance animation.
 */
@keyframes al-gallery08-enter {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .card.is-entering {
    animation: al-gallery08-enter 400ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .card__image {
    transition: transform 400ms ease;
  }

  .card:hover .card__image {
    transform: scale(1.05);
  }
}
