/* ============================================
   カスタムギャラリー CSS
   配置先: テーマフォルダ/css/custom-gallery.css
   カラー: #006400 / #008000 ベース
   ============================================ */

/* --- グリッド --- */
.cg-gallery {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 0;
}

.cg-cols-2 { grid-template-columns: repeat(2, 1fr); }
.cg-cols-3 { grid-template-columns: repeat(3, 1fr); }
.cg-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* --- 各アイテム --- */
.cg-item {
  cursor: pointer;
}

.cg-img-wrap {
  overflow: hidden;
  border-radius: 6px;
  aspect-ratio: 4 / 3;
  background: #f0f0f0;
}

.cg-img-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- タイトル（常時表示） --- */
.cg-caption {
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: #006400;
  text-align: center;
  letter-spacing: 0.02em;
}

/* --- ライトボックス --- */
.cg-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 40, 0, 0.9);
  align-items: center;
  justify-content: center;
}

.cg-lightbox.is-active {
  display: flex;
}

.cg-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cg-lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
}

.cg-lightbox-caption {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  margin-top: 14px;
  text-align: center;
  letter-spacing: 0.03em;
}

.cg-lightbox-close,
.cg-lightbox-prev,
.cg-lightbox-next {
  position: absolute;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
  padding: 8px;
  line-height: 1;
}

.cg-lightbox-close:hover,
.cg-lightbox-prev:hover,
.cg-lightbox-next:hover {
  color: #fff;
}

.cg-lightbox-close {
  top: 20px;
  right: 24px;
  font-size: 36px;
}

.cg-lightbox-prev,
.cg-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 32px;
}

.cg-lightbox-prev { left: 20px; }
.cg-lightbox-next { right: 20px; }

/* --- レスポンシブ --- */
@media (max-width: 768px) {
  .cg-gallery {
    gap: 16px;
  }

  .cg-cols-3,
  .cg-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .cg-caption {
    font-size: 12px;
  }

  .cg-lightbox-prev { left: 8px; }
  .cg-lightbox-next { right: 8px; }
  .cg-lightbox-close { top: 10px; right: 12px; }
}

@media (max-width: 480px) {
  .cg-gallery {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px;
  }
}
