/* ==========================================
   ギャラリーグリッド（Masonry風タイル張り）
========================================== */
.wgm-photo-grid {
  column-count: 4;
  column-gap: 16px;
  width: 100%;
}

@media (max-width: 767px) {
  .wgm-photo-grid {
    column-count: 2;
    column-gap: 10px;
  }
}

.wgm-photo-item {
  display: inline-block;
  width: 100%;
  margin-bottom: 16px;
  break-inside: avoid;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

@media (max-width: 767px) {
  .wgm-photo-item {
    margin-bottom: 10px;
  }
}

.wgm-photo-item img {
  width: 100%;
  height: auto;
  display: block;
}

/* ==========================================
   モーダル（拡張版：コメント＆リンク対応）
========================================== */
.wgm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 19999;
  padding: 20px;
  box-sizing: border-box;
}

.wgm-modal.open {
  display: flex;
}

/* 画像とテキストを縦に並べるためのコンテナ */
.wgm-modal-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  max-height: 100%;
}

/* 画像は画面からはみ出さないように、下のテキストの余白を考慮 */
.wgm-modal-img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

/* 情報エリア（コメントとリンク） */
.wgm-modal-info {
  text-align: center;
  margin-top: 16px;
  color: #fff;
  max-width: 800px;
}

.wgm-modal-caption {
  margin: 0 0 12px 0;
  font-size: .8rem;
  line-height: 1.6;
}

.wgm-modal-link {
  display: block;
  width: 100%;
  color: #fff;
  border: 1px solid #fff;
  padding: .3rem;
  text-decoration: none;
  font-size: .8rem;
  border-radius: .3rem;
  transition: all 0.3s ease;
}

.wgm-modal-link:hover {
  background: #fff;
  color: #333;
}

.wgm-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  z-index: 10000;
  line-height: 1;
}