.art-gallery {
  margin: 2rem 0;
}

.art-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.art-gallery-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 2rem;
  background: #171719;
  box-shadow: 0 4px 20px rgb(0 0 0 / 10%);
  color: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.art-gallery-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 30px rgb(0 0 0 / 22%);
}

.art-gallery-card:focus-visible {
  outline: 3px solid var(--link-color);
  outline-offset: 4px;
}

.art-gallery-cover {
  position: absolute;
  inset: 0;
  display: block;
  background-image: var(--art-gallery-cover);
  background-position: center;
  background-size: cover;
  transition: transform 240ms ease;
}

.art-gallery-card:hover .art-gallery-cover,
.art-gallery-card:focus-visible .art-gallery-cover {
  transform: scale(1.025);
}

.art-gallery-overlay {
  position: absolute;
  inset: auto 0 0;
  display: block;
  padding: 5rem 1.5rem 1.5rem;
  background: linear-gradient(transparent, rgb(0 0 0 / 82%));
  pointer-events: none;
}

.art-gallery-title,
.art-gallery-subtitle,
.art-gallery-count {
  display: block;
}

.art-gallery-title {
  margin-bottom: 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
}

.art-gallery-subtitle {
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.art-gallery-count {
  width: fit-content;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 20%);
  font-size: 0.8rem;
  opacity: 0.9;
}

body.art-gallery-open {
  overflow: hidden;
}

.art-gallery-modal[hidden] {
  display: none;
}

.art-gallery-modal {
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgb(0 0 0 / 92%);
  backdrop-filter: blur(5px);
}

.art-gallery-dialog {
  position: relative;
  width: min(1200px, 100%);
  height: min(90vh, 900px);
}

.art-gallery-close {
  position: absolute;
  z-index: 2;
  top: -2rem;
  right: 0;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 2rem;
  line-height: 1;
}

.art-gallery-close:hover,
.art-gallery-close:focus-visible {
  opacity: 0.72;
}

.art-gallery-modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 2rem;
  height: 100%;
}

.art-gallery-image-stage {
  position: relative;
  display: grid;
  overflow: hidden;
  place-items: center;
  border-radius: 8px;
  background: #f8f9fa;
}

.art-gallery-image-slot {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.art-gallery-modal-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  cursor: default;
  object-fit: contain;
  user-select: none;
}

.art-gallery-navigation {
  position: absolute;
  inset: 50% 0 auto;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  transform: translateY(-50%);
}

.art-gallery-nav {
  display: grid;
  width: 3rem;
  height: 3rem;
  min-width: 3rem;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 52%);
  color: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  pointer-events: auto;
  transition: background-color 180ms ease;
}

.art-gallery-nav:hover,
.art-gallery-nav:focus-visible {
  background: rgb(0 0 0 / 82%);
}

.art-gallery-info {
  overflow-y: auto;
  padding: 2rem;
  border-radius: 8px;
  background: #fff;
  color: #333;
}

.art-gallery-modal-title {
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.art-gallery-modal-description {
  margin-bottom: 1.5rem;
  color: #666;
  line-height: 1.6;
}

.art-gallery-counter {
  color: #888;
  font-size: 0.9rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .art-gallery-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .art-gallery-modal {
    padding: 1.25rem 0.75rem;
  }

  .art-gallery-dialog {
    height: 94vh;
  }

  .art-gallery-modal-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 3fr) minmax(8rem, 1fr);
    gap: 1rem;
  }

  .art-gallery-info {
    padding: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .art-gallery-card,
  .art-gallery-cover,
  .art-gallery-nav {
    transition: none;
  }
}
