/* ===== スライダー本体 ===== */
.cgs-wrapper {
  position: relative;
  width: 100%;
  height: 560px;
  overflow: hidden;
  box-sizing: border-box;
  margin-bottom: 20px;
}
.cgs-track {
  position: relative;
  left: 0;
  display: flex;
  gap: 20px;
  align-items: center;
  transition: left .45s ease;
  will-change: left;
}
.cgs-frame {
  flex: 0 0 auto;
  width: 400px;
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transform: scale(.90);
  transition: transform .25s ease;
}
.cgs-frame.is-active {
  transform: scale(.96);
  z-index: 1;
}
.cgs-frame img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1); /* 少し影をつけてリッチに */
}

/* PDFの場合のリンク制御 */
.cgs-frame--pdf a { display: block; width:100%; height:100%; display:flex; align-items:center; justify-content:center; }
.cgs-frame--pdf a > img { pointer-events: none; } /* クリックをaタグに渡す */

/* ===== サムネイル ===== */
.cgs-thumbnail-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}
.cgs-thumbnail {
  width: 120px;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  border: 1px solid #e6e6e6;
}
.cgs-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.cgs-thumbnail.is-active {
  border-color: #2a9d8f;
  box-shadow: 0 0 0 2px #2a9d8f;
}

/* ===== 静止画モード (Single) ===== */
.cgs-single-container {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}
.cgs-single-frame {
  width: 400px; /* スライダーと同じサイズ感 */
  height: 560px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cgs-single-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* ===== モーダル ===== */
.cgs-modal {
  display: none; /* JSでflexにする */
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.6);
}
.cgs-modal .cgs-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 40px;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.cgs-modal img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
}

/* スマホ対応 */
@media (max-width: 600px) {
  .cgs-wrapper, .cgs-single-frame, .cgs-frame { height: 380px; }
  .cgs-frame, .cgs-single-frame { width: 240px; }
  .cgs-thumbnail { width: 90px; }
}