/* ============================================================
   gallery.css — personal art grid + detail modal
   ============================================================ */

.gallery-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 7rem 4rem 5.5rem;
}

.gallery-page .about-heading {
  margin-top: 0.5rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 200px;
  grid-auto-flow: dense;
  gap: 1.25rem;
  margin-top: 2.5rem;
}

.gallery-item {
  position: relative;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.gallery-video-toggle {
  position: absolute;
  bottom: 0.6rem;
  right: 0.6rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.gallery-video-toggle:hover,
.gallery-video-toggle:focus-visible {
  background: rgba(0, 0, 0, 0.8);
}

.gallery-item img,
.gallery-item video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* crop: false in gallery-data.js — show the full media, letterboxed instead of cropped */
.gallery-item[data-crop="false"] img,
.gallery-item[data-crop="false"] video {
  object-fit: contain;
  background: var(--bg);
}

/* Freeform sizing — set per piece via the `size` field in gallery-data.js */
.gallery-item[data-size="wide"] {
  grid-column: span 2;
}

.gallery-item[data-size="tall"] {
  grid-row: span 2;
}

.gallery-item[data-size="large"] {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item:hover,
.gallery-item:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
}

.gallery-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ── Artwork detail modal ── */
.art-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.art-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.art-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 20, 24, 0.6);
}

.art-modal-content {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 2rem;
  width: 100%;
  max-width: 720px;
  background: var(--bg);
  border-radius: 4px;
  padding: 2.5rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s ease;
}

.art-modal.is-open .art-modal-content {
  transform: translateY(0) scale(1);
}

.art-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mid);
  cursor: pointer;
  transition: color 0.2s;
}

.art-modal-close:hover {
  color: var(--accent);
}

.art-modal-image,
.art-modal-video {
  display: block;
  max-width: 260px;
  max-height: 360px;
  width: auto;
  height: auto;
  border-radius: 3px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

.art-modal-image[hidden],
.art-modal-video[hidden] {
  display: none;
}

.art-modal-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.art-modal-meta {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 0.5rem;
}

.art-modal-title {
  font-family: var(--serif);
  font-size: 1.75rem;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 1rem;
}

.art-modal-description {
  font-size: 0.9375rem;
  font-weight: 300;
  color: var(--mid);
  line-height: 1.7;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .gallery-page {
    padding: 5.5rem 1.5rem 3.5rem;
  }

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

  .art-modal-content {
    flex-direction: column;
    padding: 2rem;
  }

  .art-modal-image,
  .art-modal-video {
    max-width: 100%;
    max-height: 280px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .gallery-item[data-size] {
    grid-column: span 1;
    grid-row: span 1;
  }
}
