:root {
  --btn-offset: -80px;
}

/* =========================
   PCギャラリー
   ========================= */

.gallery_main .hg {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gallery_main .hg-wrapper {
  position: relative;
  width: 100%;
  max-width: 1280px;
  overflow: visible;
}

/* Safariでも確実に16:9を維持 */
.gallery_main .hg-wrapper::before {
  content: "";
  display: block;
  padding-top: 56.25%;
}

.gallery_main .hg-window {
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;
}

.gallery_main .hg-track {
  width: 100%;
  height: 100%;
  position: relative;
}

.gallery_main .hg-slide {
  position: absolute;
  inset: 0;

  opacity: 0;
  z-index: 0;

  -webkit-transform: translateX(30px);
  transform: translateX(30px);

  transition: 0.6s ease;
}

.gallery_main .hg-slide.active {
  opacity: 1;
  z-index: 10;

  -webkit-transform: translateX(0);
  transform: translateX(0);
}

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

/* =========================
   ▼ ボタン
   ========================= */

.gallery_main .hg-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 64px;
  height: 64px;

  border-radius: 50%;
  background: #fff;
  border: none;

  cursor: pointer;

  z-index: 500;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2);

  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery_main .hg-left {
  left: var(--btn-offset);
}

.gallery_main .hg-right {
  right: var(--btn-offset);
}

.gallery_main .hg-nav svg {
  width: 24px;
  height: 24px;
  fill: #e60000;
}

/* =========================
   サムネイル（PC）
   ========================= */

.gallery_main .hg-thumbs {
  margin-top: 12px;

  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);

  gap: 6px;

  width: 100%;
  max-width: 1280px;
}

.gallery_main .hg-thumb {
  width: 100%;
  height: 110px;

  object-fit: cover;

  cursor: pointer;
  opacity: 0.6;

  border: 3px solid transparent;
  transition: 0.2s;
}

.gallery_main .hg-thumb.active {
  opacity: 1;
  border: 3px solid #fff;
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
  transform: scale(1.03);
}

/* =========================
   スマホ
   ========================= */

@media (max-width: 768px) {

  .gallery_main .hg-thumbs {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
    gap: 3px;
  }

  .gallery_main .hg-thumb {
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  /* スマホでは左右ボタン非表示 */
  .gallery_main .hg-nav {
    display: none;
  }

}