/* WORKS ページ固有（Wix版: 3列・正方形・幅1008px・間隔10px のギャラリー） */

.works-gallery { background: #fff; padding: 40px 0 60px; }
.gallery-tabs { width: min(1008px, 100% - 48px); margin: 0 auto 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.gallery-tabs button { padding: 9px 16px; border: 1px solid var(--green); border-radius: 999px; background: #fff; color: var(--green-text); font-size: 14px; font-weight: 500; letter-spacing: .04em; transition: background .2s, color .2s; }
.gallery-tabs button:hover, .gallery-tabs button.is-active { background: var(--green); color: #fff; }
.gallery li .cap { display: block; margin-top: 6px; font-size: 12px; line-height: 1.5; color: #444; }
.lightbox-cap { position: absolute; left: 0; right: 0; bottom: 44px; margin: 0; text-align: center; color: #fff; font-size: 14px; padding: 0 90px; }
.gallery {
  width: min(1008px, 100% - 48px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.gallery li { margin: 0; }
.gallery li[hidden] { display: none; }
.gallery-item {
  display: block;
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #eee;
  cursor: zoom-in;
}
.gallery-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .4s ease, opacity .3s;
}
.gallery-item:hover img, .gallery-item:focus-visible img { transform: scale(1.04); }
.gallery-item:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* ---------- 画像ライトボックス ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 300;
  display: none;
  background: rgba(0, 0, 0, .88);
  align-items: center; justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox-stage {
  position: relative;
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 90px 50px;
}
.lightbox-img {
  max-width: 100%; max-height: calc(100vh - 110px); max-height: calc(100svh - 110px);
  width: auto; height: auto;
  object-fit: contain;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  user-select: none;
}
.lightbox-count {
  position: absolute; left: 0; right: 0; bottom: 16px;
  margin: 0; text-align: center;
  font-family: var(--font-kaku); font-size: 14px; letter-spacing: .12em; color: #fff;
}
.lightbox-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.lightbox-btn:hover, .lightbox-btn:focus-visible { background: rgba(255,255,255,.32); }
.lightbox-btn svg { width: 34px; height: 34px; fill: #fff; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-close { position: absolute; top: 18px; right: 22px; width: 44px; height: 44px; }
.lightbox-close::before, .lightbox-close::after { content: ""; position: absolute; left: 50%; top: 50%; width: 32px; height: 2px; background: #fff; transform: translate(-50%,-50%) rotate(45deg); }
.lightbox-close::after { transform: translate(-50%,-50%) rotate(-45deg); }
.lightbox-close:focus-visible, .lightbox-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 760px) {
  .works-gallery { padding: 18px 0 20px; }
  .gallery { width: 100%; gap: 6px 4px; grid-template-columns: repeat(2, 1fr); }
  .gallery li .cap { font-size: 11px; padding: 0 2px; }
  .gallery-tabs { width: 100%; margin-bottom: 16px; }
  .gallery-tabs button { padding: 7px 12px; font-size: 12px; }
  .lightbox-cap { bottom: 40px; padding: 0 16px; font-size: 12px; }
  .lightbox-stage { padding: 56px 12px 50px; }
  .lightbox-img { max-height: calc(100vh - 106px); max-height: calc(100svh - 106px); }
  .lightbox-btn { width: 44px; height: 44px; top: auto; bottom: 6px; transform: none; background: rgba(255,255,255,.2); }
  .lightbox-btn svg { width: 28px; height: 28px; }
  .lightbox-prev { left: 12px; }
  .lightbox-next { right: 12px; }
  .lightbox-count { bottom: 18px; }
}

.gallery-tabs button { font-size: var(--fs-sm); }
.gallery li .cap { font-size: var(--fs-sm); }
.lightbox-cap { font-size: var(--fs-sm); }
@media (max-width: 760px) { .gallery li .cap { font-size: var(--fs-xs); } .gallery-tabs button { font-size: var(--fs-xs); } }
