body {
  font-family: 'Noto Serif JP', serif;
  margin: 2rem;
  background: #f9f9f9;
}

h1 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, auto));
  gap: 1rem;
  justify-content: center;
}

.item {
  max-width: 150px;
  margin: 0 auto;
  text-align: center;
  font-size: 0.75rem;
  color: #333;

  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

.item.show {
  opacity: 1;
  transform: translateY(0);
}

.item:hover {
  transform: scale(1.03);
}

.item img {
  width: 100%;
  max-width: 140px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: block;
}

.caption {
  margin-top: 0.3rem;
  line-height: 1.2;
}


#preview-box {
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 400px;
  background: white;
  padding: 0.5rem;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: none;
  z-index: 9999;
  pointer-events: none; /* ← これが肝！ */
}

#preview-box.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}





#preview-box img {
  width: 100%;
  height: auto;
  display: block;
}



.gallery-top-image {
  max-width: 250px;
  opacity: 0.8;
  margin-top: 1rem; /* ← ここで調整 */
}


.gallery-top-video {
  max-width: 400px;
  opacity: 0.8;
  margin-top: 1rem; /* お好みで 0.5rem〜2rem などに調整 */
 display: block;
 margin-left: auto;
 margin-right: auto;

}






@media (max-width: 600px) {
  body {
    margin: 1rem;
  }

  h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr); /* 1列だと縦に長すぎるので2列推奨 */
    gap: 0.75rem;
  }

  .item {
    font-size: 0.7rem;
    max-width: none;
  }

  .item img {
    max-width: 100%;
    border-radius: 4px;
  }

  #preview-box {
    width: 90vw;
    top: auto;
    bottom: 1rem;
    right: 50%;
    transform: translateX(50%);
    padding: 0.5rem;
    font-size: 0.85rem;
  }



/* 最初に :hover 効果なしにしておく */
.item:hover {
  transform: none;
}

}

/* PCだけで hover 効かせる */
@media (hover: hover) and (pointer: fine) {
  .item:hover {
    transform: scale(1.03);
  }
}


