.gallery {
  padding: 0 4em;
  display: grid;

  grid-template-columns: repeat(
    auto-fit,
    minmax(300px, max-content)
  );

  justify-content: center;
  gap: 1rem;

  width: 100%;
}

.gallery-item {
  margin: 0;          /* ← gapだけで管理 */
  cursor: pointer;
  max-width: 300px;
  width: 100%;
}
.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}
.gallery-item img {
  filter: grayscale(100%);
  transition: filter 0.5s ease; /* 0.5秒かけてフィルターを変化させる */
} /* ホバー時にグレースケールを外してカラー表示 */ .gallery-item:hover img {
  filter: grayscale(0%);
}
@media (max-width: 800px) {
  .gallery {
    grid-template-columns: 1fr;
    width: 60%;
  }
  .gallery-item {
    max-width: 100%;
  }
  .section.gallerysec {
    height: auto;
    overflow-y: auto;
    padding: 20% 0;
  }
}
/* モーダル */ .modal {
  display: none;
  position: fixed;
  z-index: 10000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  align-items: center;
  justify-content: center;
}
.modal img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
}
.modal .close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}
.modal img, .modal iframe {
  max-width: 90vw;
  max-height: 90vh;
} /* YouTube用 */ .modal iframe {
  width: 90vw;
  height: auto;
  aspect-ratio: 16 / 9;
}