@charset "UTF-8";

/* サムネ */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* 1ブロック */
.gallery-item {
  display: flex;
  flex-direction: column;
}

/* 画像 */
.gallery-item img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  cursor: pointer;
}

/* キャプション */
.gallery-caption {
  margin-top: 8px;
  font-size: 1.4rem;
  line-height: 1.6;
}

/* モーダル本体 */
.modal-img {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;

  opacity: 0; 
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s;
}

/* 開いた状態 */
.modal-img.is-active {
  opacity: 1;
  visibility: visible;
}

/* 画像 */
.modal-img__content {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;

  transform: scale(.9);
  transition: transform .3s ease, opacity .3s;
  opacity: 0;
}

.modal-img.is-active .modal-img__content {
  transform: scale(1);
  opacity: 1;
   transition-delay: .05s;
}

.modal-img__close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;

  opacity: 0;
  transform: translateY(-10px);
  transition: all .3s ease;
}

.modal-img.is-active .modal-img__close {
  opacity: 1;
  transform: translateY(0);
}
/* =========================
   SP / TABLET (<= 768px)
========================= */
@media screen and (max-width:768px){

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  }