/* /css/photo.css */

/* === Photo セクション全体 === */
.photo-section {
  background-color: #f9f9f9;
  padding-bottom: 40px;
}

/* === グリッド共通設定（縦長・横長ギャラリー） === */
.portrait-gallery,
.landscape-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  max-width: 1200px;
  margin: 0 auto 20px;
  padding: 0 20px;
  justify-items: center;
}

/* === 個々の写真アイテム === */
.photo-item {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.photo-item img {
  display: block;
  max-width: 100%;
  max-height: 500px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.photo-item img:hover,
.photo-item img:focus {
  transform: scale(1.02);
}

/* === モーダル背景（初期は非表示） === */
.modal {
  display: none; /* 初期は表示しない */
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}

/* === モーダル画像ラッパー（左右ナビ領域あり） === */
.modal-image-wrapper {
  position: relative;
  padding: 5px calc(44px + 12px); /* ←左右にボタン幅＋余白を確保 */
  background-color:  transparent;
  box-shadow: none;

  /* ビューポートに収まり、かつ最大400pxを維持 */
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  overscroll-behavior: contain;
}

/* === モーダル内の画像（比率維持、最大700×700まで） === */
.modal-image-wrapper img.modal-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 700px;
  max-height: 700px;
  object-fit: contain;
}

/* === モーダル前後ナビボタン（画像横に配置） === */
.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 40px;
  color: #333;
  background-color: rgba(255, 255, 255, 0.6);
  padding: 8px 12px;
  cursor: pointer;
  user-select: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.modal-prev {
  left: 5px; /* 左余白部分に表示 */
}

.modal-next {
  right: 5px; /* 右余白部分に表示 */
}

/* === スマホ対応（画面幅600px以下） === */
@media (max-width: 600px) {
  .portrait-gallery,
  .landscape-gallery {
    grid-template-columns: 1fr;
  }

  .photo-item img {
    max-height: none;
  }

  .modal-image-wrapper {
    max-width: 80vw;
    max-height: 80vh;
    padding: 5px calc(36px + 10px); /* ボタン幅＋余白を再計算 */
  }

  .modal-image-wrapper img.modal-image {
    max-width: 80vw;
    max-height: 80vh;
  }

  .modal-nav {
    font-size: 30px;
    padding: 6px 10px;
  }

  .modal-prev {
    left: 4px;
  }

  .modal-next {
    right: 4px;
  }
}