/* =========================================================
   Modal Gallery
   File: modal-gallery.css
   Purpose: フォトギャラリーのモーダル表示
========================================================= */

/* ===============================
   Wrapper / Visibility
=============================== */
.gallery-modal {
  position: fixed;
  inset: 0;
	top:56px;
  z-index: 2000;
  display: none;
  overflow: auto;
  overscroll-behavior: contain; /* 背景スクロール防止 */
}

.gallery-modal[aria-hidden="false"] {
  display: block;
	background-color: #fff;
}

/* 内側最大幅 */
.gallery-modal .gallery-header,
.gallery-modal .gallery-contents {
  max-width: 1056px;
  margin: 0 auto;
  padding: 16 auto;
}

/* ===============================
   Header
=============================== */
.gallery-modal .gallery-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid var(--wan-border, #e5e7eb);
  padding: 20px 12px 0;
}

/* 閉じるボタン */
.gallery-modal .gallery-close {
  appearance: none;
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  color: #111;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.gallery-modal .gallery-close .chev {
  font-size: 20px;
  line-height: 1;
  transform: translateY(-1px);
}

/* ===============================
   Tabs
=============================== */
.gallery-modal .gallery-tabs {
  display: flex;
  gap: 60px;
  list-style: none;
  margin: 0;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--wan-border, #e5e7eb);
}

.gallery-modal .gallery-tabs button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0 0 6px;
  font-size: 15px;
  font-weight: 600;
  color: #777;
  position: relative;
  cursor: pointer;
  transition: color 0.2s;
}

.gallery-modal .gallery-tabs button:hover {
  color: #333;
}

.gallery-modal .gallery-tabs button.active {
  color: #111;
  font-weight: 700;
}

/* アンダーライン */
.gallery-modal .gallery-tabs button .tab-underline {
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 3px;
  border-radius: 2px;
  background: transparent;
  transition: width 0.2s, background 0.2s;
}

.gallery-modal .gallery-tabs button.active .tab-underline {
  width: 80px;
  background: var(--wan-tab-active, #ff922b);
  left: 50%;
  transform: translateX(-50%);
}

/* キーボード操作の視認性 */
.gallery-modal :where(.gallery-close, .gallery-tabs button):focus-visible {
  outline: 2px solid var(--wan-tab-active, #ff922b);
  outline-offset: 2px;
  border-radius: 6px;
}

/* タイトル ::before リセット */
.post_content .gallery-block__title::before,
.gallery-modal .gallery-block__title::before {
  content: none;
  display: none;
  background-color: #fff;
}

/* ===============================
   Contents / Panels
=============================== */
.gallery-modal .gallery-contents {
  background: #fff;
  padding: 12px 16px;
}

.gallery-modal .gallery-content {
  display: none;
}

.gallery-modal .gallery-content.active {
  display: block;
}

.gallery-block {
  margin: 18px 0 10px;
}

.post_content .gallery-block__title,
.gallery-modal .gallery-block__title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  margin: 0 0 10px;
  padding: 0 0 6px;
}

/* ===============================
   Grid reset
=============================== */
.gallery-modal .gallery-contents,
.gallery-modal .gallery-content,
.gallery-modal .gallery-block,
.gallery-modal .gallery-grid,
.gallery-modal .gallery-grid--2 {
  column-count: initial !important;
  column-width: auto !important;
  -moz-column-count: initial !important;
  -webkit-column-count: initial !important;
  float: none !important;
  width: 100%;
}

/* 2列グリッド */
.gallery-modal .gallery-grid--2,
.gallery-modal [data-panel] .gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 32px !important;
}

/* ===============================
   Items
=============================== */
.gallery-item--land {
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #f5f5f5;
}

.gallery-item--land img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gallery-item--land img:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

/* 下余白確保 */
.gallery-modal .gallery-contents::after {
  content: "";
  display: block;
  height: 16px;
}

/* ===============================
   Media Queries
=============================== */
@media (max-width: 640px) {
  .gallery-modal .gallery-header {
    padding: 10px 14px 0;
  }

  .gallery-modal .gallery-tabs {
    gap: 20px;
  }

  .gallery-modal .gallery-contents {
    padding: 8px 12px;
  }

  .gallery-modal .gallery-grid--2,
  .gallery-modal [data-panel] .gallery-grid {
    gap: 10px !important;
  }

  .gallery-item--land {
    border-radius: 12px;
  }
}

@media (max-width: 480px) {
  .gallery-modal .gallery-header {
    overflow: hidden;
  }

  .gallery-modal .gallery-tabs {
    overflow: auto hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .gallery-modal .gallery-tabs::-webkit-scrollbar {
    display: none;
  }
}

/* ===============================
   Reduced Motion
=============================== */
@media (prefers-reduced-motion: reduce) {
  .gallery-modal *,
  .gallery-modal *::before,
  .gallery-modal *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
