/* ===========================
   Gallery ページ専用スタイル
=========================== */

/* ページタイトル
=========================== */
.gallery-header {
  padding: 80px 0 0;
  text-align: center;
}

.gallery-title {
  font-family: var(--font-ja);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.67em;
  color: var(--color-black);
  text-align: center;
  letter-spacing: 0.1em;
}

/* ギャラリーセクション
=========================== */
.gallery-section {
  padding: 24px 17px 80px;
}

/* グリッド：SP 2列 */
.gallery-grid {
  display: grid;
  gap: 30px;
  margin-bottom: 40px;
  align-items: center;
  list-style: none;
  padding: 0;
}

/* 各アイテム：正方形にクロップ */
.gallery-item {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  width: calc(258/375*100%);
  margin: 0 auto;
  cursor: pointer;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
}

/* ページネーション
=========================== */
.gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  margin: 0 auto;
}

.pagination-nums {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.pagination-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 16px;
  line-height: 1;
  color: var(--color-black);
  text-decoration: none;
}

.pagination-num.is-current {
  background: #474747;
  color: var(--color-white);
  font-weight: 700;
}

.pagination-arrow {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}

.pagination-arrow img {
  display: block;
}

.pagination-prev img {
  transform: scaleX(-1);
}

/* ===========================
   モーダル
=========================== */
.gallery-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.gallery-modal.is-open {
  display: flex;
}

.gallery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
}

.gallery-modal-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: calc(100% - 32px);
  max-width: 480px;
}

.gallery-modal-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 16px;
}

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

.gallery-modal-nav {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 16px;
}

.gallery-modal-prev,
.gallery-modal-next {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.gallery-modal-prev:hover,
.gallery-modal-next:hover {
  opacity: 0.7;
}

.gallery-modal-prev img,
.gallery-modal-next img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.gallery-modal-prev img {
  transform: scaleX(-1);
}

body.modal-open {
  overflow: hidden;
}

/* ===========================
   PC メディアクエリ（768px〜）
=========================== */
@media (min-width: 768px) {

  .gallery-header {
    padding: 160px 0 24px;
  }

  .gallery-title {
    font-size: 32px;
    line-height: 1.25em;
  }

  .gallery-section {
    padding: 40px 20px 100px;
    max-width: 1160px;
    margin: 0 auto;
  }

  /* PC: 4列グリッド */
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: min(2.196193265vw, 30px);
    margin-bottom: 56px;
  }

  .gallery-item {
    width: 100%;
    margin: 0;
  }

  .gallery-pagination {
    gap: 24px;
  }

  .pagination-nums {
    gap: 20px;
  }

  .gallery-modal-content {
    width: clamp(300px, 50vw, 668px);
    max-width: 100%;
  }

  /* PC: 矢印を画像の左右サイドに配置 */
  .gallery-modal-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -150px;
    right: -150px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    width: auto;
    pointer-events: none;
  }

  .gallery-modal-prev,
  .gallery-modal-next {
    pointer-events: all;
    width: 48px;
    height: 48px;
  }

}

/* end @media (min-width: 768px) */