/* 
body {
  background: #fff;
  font-family: sans-serif;
  margin: 20px;
}
 */

#gallery {
  max-width: 900px;
  margin: auto;
}

#viewerContainer {
  text-align: center;
}

#mainImage {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: inline-block;
}

#viewer {
  position: relative;
  /*background: #fff;*/
  overflow: hidden;
  /*display: flex;*/
  display: inline-block;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

#viewer img {
  margin-top: 10px;
  max-width: 100%;
  max-height: calc(100% - 60px); /* ← キャプション分の高さを確保 */
  /*max-height: 100%; */
  opacity: 0;
  transition: opacity 0.25s ease;
  object-fit: contain;
  display: inline-block;
  box-shadow:3px 3px 8px #464646;
}

#viewer img.show {
  opacity: 1;
}

#caption {
  height: 60px;
  margin-top: 8px;
  font-size: 14px;
  color: #333;
}

#fullscreenBtn {
  /*
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(255,255,255,0.8);
  padding: 6px 10px;
  box-shadow:2px 2px 5px #b2b2b2;
  */
  cursor: pointer;
  font-size: 16px;
}

#thumbnails {
  display: grid;
  justify-content: center;
  grid-template-columns: repeat(auto-fill, 100px);
  gap: 6px;
  margin-top: 20px;
  max-height: 200px;      /* サムネイル領域の高さ（調整可） */
  overflow-y: auto;       /* 縦スクロールを有効化 */
  overflow-x: hidden;     /* 横スクロールは不要なら隠す */
}

#thumbnails img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  cursor: pointer;
  transition: opacity .2s;
}

#thumbnails img:hover {
  opacity: 0.7;
}

#thumbnails img.active {
  outline: 2px solid dodgerblue;
  box-shadow:5px 5px 10px #b2b2b2;
}

#controls {
  margin-top: 5px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

#controls button {
  padding: 6px 12px;
  cursor: pointer;
}