/**
 * GO OUT Gallery — フロント表示スタイル
 *
 * 全クラスを `gog` プレフィックスのBEMでスコープし、テーマ側CSSと
 * 相互に干渉しないようにしている。
 */

.gog {
  margin: 24px 0;
}

/* ============================================================
   横スワイプカルーセル
   ============================================================ */
.gog--carousel {
  position: relative;
}

.gog__cviewport {
  overflow: hidden;
  position: relative;
}

.gog__ctrack {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.gog__ctrack::-webkit-scrollbar {
  display: none;
}

.gog__cslide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  /* 比率はショートコード/ブロックの ratio 属性から --gog-car で上書き（既定 4:3）。 */
  aspect-ratio: var(--gog-car, 4 / 3);
  background: rgb(240, 240, 240);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

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

.gog__ccaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  padding: 24px 16px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.gog__cbtn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgb(220, 220, 220);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: rgb(0, 0, 0);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gog__cbtn:hover {
  background: #fff;
}

.gog__cbtn--prev {
  left: 12px;
}

.gog__cbtn--next {
  right: 12px;
}

.gog__cdots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.gog__cdots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: rgb(210, 210, 210);
  padding: 0;
  cursor: pointer;
  transition: background 0.15s;
}

.gog__cdots button.is-active {
  background: rgb(98, 80, 58);
  width: 22px;
  border-radius: 4px;
}

/* ============================================================
   縦積みストーリー型（不採用・互換描画のみ）
   ============================================================ */
.gog--story {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.gog__sitem {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
}

.gog__sitem:nth-child(even) {
  grid-template-columns: 1fr 1.4fr;
}

.gog__sitem:nth-child(even) .gog__simage {
  order: 2;
}

.gog__simage {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  cursor: pointer;
  background: rgb(240, 240, 240);
}

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

.gog__stitle {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  line-height: 1.4;
}

.gog__sdesc {
  font-size: 13px;
  line-height: 1.8;
  color: rgb(60, 60, 60);
  margin: 0 0 12px;
}

/* ============================================================
   ジャスティファイド（比率維持）
   ============================================================ */
.gog--justified {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  --gog-rowh: 220px;
}

.gog__jfig {
  margin: 0;
  height: var(--gog-rowh);
  flex-grow: 1;
  flex-basis: calc(var(--gog-rowh) * var(--gog-ar, 1.5));
  max-width: 100%;
  background: rgb(240, 240, 240);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

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

.gog__jcap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 12px;
  padding: 18px 10px 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gog__jfig:hover .gog__jcap {
  opacity: 1;
}

/* ============================================================
   メイン＋サムネ切替（比率維持版）
   ============================================================ */
.gog--swap {
  display: block;
}

.gog__hmain {
  width: 100%;
  height: 460px;
  background: rgb(245, 243, 240);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  /* 横スワイプは JS で前後送りに使う。縦スクロールはブラウザに任せる。 */
  touch-action: pan-y;
}

.gog__hmain img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.18s ease;
}

.gog__hthumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* 定寸ボックス。テーマの .entry-content img ルール（width/height:auto !important 等）に
   左右されず必ず表示されるよう、ボックスに幅・高さを与え img をフィルさせる。 */
.gog__hthumb {
  flex: 0 0 auto;
  width: 92px;
  height: 70px;
  padding: 0;
  border: 2px solid transparent;
  background: rgb(245, 243, 240);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.gog__hthumb.is-active {
  border-color: rgb(98, 80, 58);
}

.gog__hthumb:hover {
  border-color: rgb(160, 140, 110);
}

.gog__hthumb img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  display: block;
}

.gog__hcaption {
  margin: 12px 0 4px;
  font-size: 13px;
  color: rgb(60, 60, 60);
  line-height: 1.6;
}

/* ============================================================
   LIGHTBOX（全パターン共有 / JSが動的生成）
   ============================================================ */
.gog-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.gog-lightbox.is-open {
  display: flex;
}

.gog-lightbox__img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  display: block;
}

.gog-lightbox__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 24px;
  text-align: center;
  color: #fff;
  font-size: 13px;
  padding: 0 16px;
}

.gog-lightbox__btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gog-lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.gog-lightbox__close {
  top: 20px;
  right: 20px;
  font-size: 22px;
}

.gog-lightbox__prev {
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.gog-lightbox__next {
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}

.gog-lightbox__counter {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.gog-empty {
  padding: 16px;
  border: 1px dashed rgb(200, 200, 200);
  color: rgb(120, 120, 120);
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   MOBILE (≤900px)
   ============================================================ */
@media (max-width: 900px) {
  .gog--story .gog__sitem,
  .gog--story .gog__sitem:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .gog--story .gog__sitem:nth-child(even) .gog__simage {
    order: 0;
  }

  .gog__cbtn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .gog__cbtn--prev {
    left: 8px;
  }

  .gog__cbtn--next {
    right: 8px;
  }

  .gog__hmain {
    height: 320px;
  }

  .gog__hthumb {
    width: 68px;
    height: 52px;
  }

  .gog--justified {
    --gog-rowh: 140px;
    gap: 4px;
  }

  /* タッチ端末はhoverできないため、キャプションを常時うっすら表示 */
  .gog__jcap {
    opacity: 1;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
    padding: 24px 8px 6px;
    font-size: 11px;
  }

  .gog-lightbox__close {
    top: 14px;
    right: 14px;
  }

  .gog-lightbox__prev,
  .gog-lightbox__next {
    width: 40px;
    height: 40px;
  }

  .gog-lightbox__prev {
    left: 8px;
  }

  .gog-lightbox__next {
    right: 8px;
  }
}
