/* Worksページのレイアウト */
/* ギャラリーコンテナ */
.gallery-container {
  max-width: 1200px; /* ページ中央に広めに表示 */
  margin: 0 auto; /* 中央寄せ */
  padding: 20px; /* 外側余白 */
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* 横5列 */
  gap: 20px; /* アイテム間の隙間 */
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .gallery-container {
    grid-template-columns: repeat(3, 1fr); /* タブレットでは3列 */
  }
}

@media (max-width: 600px) {
  .gallery-container {
    grid-template-columns: repeat(2, 1fr); /* スマホでは2列 */
  }
}

/* ギャラリーアイテム */
.gallery-item {
  background-color: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* 画像ラッパー */
.image-wrapper {
  position: relative;
  width: 100%;
  padding-top: 100%; /* 正方形維持 */
  overflow: hidden;
}


.responsive-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.3s;
  /* pointer-events: none; クリック操作を無効化 */
  user-select: none; /* 選択を無効化 */
  image-rendering: auto;
  -webkit-transform: translateZ(0); /* Chromeの補正（にじみ対策） */
}

/* テキスト部分 */
.description {
  padding: 15px;
}

.description h3 {
  margin: 0 0 10px;
  font-size: 1.5rem;
}

.description p {
  margin: 0;
  font-size: 1rem;
  color: #666;
}

/* レスポンシブ対応 */
@media (min-width: 768px) {
  .gallery-item {
    flex-direction: row; /* 横並び */
  }

  .image-wrapper {
    width: 100%; /* 画像領域 */
    padding-top: 100%; /* 縦横比維持 */
  }

  .description {
    width: 50%; /* 説明文領域 */
    padding: 30px;
  }
}

/* 画像クリック時の拡大
.responsive-image:active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8); /* 背景を暗くする */
} */

/* ページトップボタン */
.back-to-top {
  position: fixed;
  bottom: 50px; /* 下からの距離 */
  right: 20px; /* 右からの距離 */
  padding: 2px 15px;
  background-color: #ccc;
  color: #fff;
  font-size: 14px;
  text-align: center;
  border-radius: 30px;
  cursor: pointer;
  z-index: 1000; /* 最前面に配置 */
  display: none; /* 初期は非表示 */
  transition: opacity 0.3s ease; /* フェード効果 */
}

.back-to-top:hover {
  background-color: #b6d1e1;
}

.back-to-top:active {
  background-color: #ccc; /* 押した時の色 */
}

/* フッターの余白 */
.footer-space {
  height: 50vh; /* 画面高さの半分 */
  background-color: transparent; /* 背景透明 */
}

/* === モーダル（拡大画像） === */
.modal {
  display: none; /* 初期は非表示 */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

/* ふわっと出るアニメーション */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 拡大画像 */
.modal-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(255,255,255,0.2);
  animation: popIn 0.3s ease;
}

/* 拡大時のスッと現れる感じ */
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* 閉じるボタン */
.close {
  position: absolute;
  top: 20px;
  right: 35px;
  color: #fff;
  font-size: 40px;
  /* font-weight: bold; */
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: #ccc;
}
