/* ============================================================
   三井屋 ギャラリーセクション（写真が上下左右から中央に集まる演出）
   index102.html の以下のクラスに対応しています：
   .gallery-container / .photo-item（top, bottom, left, right）
   .gallery-link / .overlay-content / .site-title

   ★ すでに style.css をお持ちの場合は、このファイルの内容を
     既存の style.css の末尾に「追記」してください（上書きではなく追記）。
   ★ style.css をまだお持ちでない場合は、このファイルをそのまま
     index102.html と同じフォルダに style.css として置いてください。
   ============================================================ */

.gallery-container {
  position: relative;
  width: 80%;
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.photo-item {
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform var(--duration, 1s) cubic-bezier(0.16, 0.84, 0.44, 1),
    opacity 0.9s ease;
  transition-delay: var(--delay, 0s);
}

/* 4枚それぞれ、どの方向から来るか */
.photo-item.top    { transform: translateY(-140px); }
.photo-item.bottom { transform: translateY(140px); }
.photo-item.left   { transform: translateX(-140px); }
.photo-item.right  { transform: translateX(140px); }

/* 横方向（left / right）は縦方向より少しゆっくり動かす */
.photo-item.left,
.photo-item.right {
  --duration: 1.6s;
}

/* JS が画面内に入ったことを検知すると .gallery-container に
   is-visible が付き、ここで初期位置から本来の位置へ動く */
.gallery-container.is-visible .photo-item {
  opacity: 1;
  transform: translate(0, 0);
}

.gallery-link {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;        /* 横長写真の比率 */
  overflow: hidden;
  border-radius: 4px;
  text-decoration: none;
  background: #e9e9e9;
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.18);
  transition: box-shadow 0.4s ease;
}

.gallery-link:hover {
  box-shadow: 0 24px 48px -14px rgba(0, 0, 0, 0.30);
}

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

.gallery-link:hover img {
  transform: scale(1.06);
}

/* 中央に最後に浮かび上がるタイトル部分 */
.overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -35%);
  z-index: 5;
  pointer-events: none;        /* 下の写真のクリックを邪魔しない */
  opacity: 0;
  transition: opacity 1.1s ease, transform 1.1s ease;
  transition-delay: 1.8s;      /* 写真の動きが収まってから表示 */
}

.gallery-container.is-visible .overlay-content {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.site-title {
  margin: 0;
  color: #ffffff;
  font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
  font-weight: 800;            /* 太く */
  font-size: clamp(44px, 8vw, 140px);  /* 大きく */
  letter-spacing: 0.15em;
  white-space: nowrap;
  text-shadow: 0 4px 28px rgba(0, 0, 0, 0.5);
}

/* スマホ表示：1列に */
@media (max-width: 720px) {
  .gallery-container {
    width: 92%;
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .site-title {
    letter-spacing: 0.15em;
  }
}

/* アニメーションを好まない設定の方への配慮 */
@media (prefers-reduced-motion: reduce) {
  .photo-item {
    transition: opacity 0.6s ease !important;
    transform: none !important;
  }
  .overlay-content {
    transition: opacity 0.6s ease !important;
    transform: translate(-50%, -50%) !important;
  }
}
