/* ギャラリー（一覧／カテゴリーアーカイブ）。広幅 = カテゴリー（サイド）＋画像グリッド（メイン）、
   狭幅は縦積み。FAQ と同パターン。 */

.gallery-layout {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: clamp(28px, 4vw, 56px);
	align-items: start;
}

/* カテゴリータブ（広幅は縦タブ、アクティブは右にアクセント線）。 */
.gallery-cats {
	display: flex;
	flex-direction: column;
	border-right: 1px solid var(--wp--preset--color--line, #ececec);
}
.gallery-cat {
	display: block;
	padding: 12px 18px;
	margin-right: -1px;
	border-right: 2px solid transparent;
	font-family: var(--wp--custom--brand-ui, var(--wp--custom--brand-body));
	font-size: 14px;
	line-height: 1.5;
	letter-spacing: 0.04em;
	color: #555;
	text-decoration: none;
	transition: color 0.2s, border-color 0.2s;
}
.gallery-cat:hover {
	color: var(--aureate, #b89766);
}
.gallery-cat.is-current {
	color: var(--aureate, #b89766);
	border-right-color: var(--aureate, #b89766);
	font-weight: 700;
}

/* 画像グリッド（メイン側）。広幅4列・中幅3列・狭幅2列。キャプションは小さく。 */
.gallery-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
}
.gallery-grid figure {
	margin: 0;
}
.gallery-grid a {
	display: block;
}
.gallery-grid img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}
/* サムネイルリンクのホバー: 軽く透過させる。 */
.gallery-grid a img {
	transition: opacity 0.2s;
}
.gallery-grid a:hover img {
	opacity: 0.85;
}
.gallery-grid figcaption {
	font-family: var(--wp--custom--brand-ui, var(--wp--custom--brand-body));
	font-size: 11px;
	letter-spacing: 0.08em;
	color: #6e6e6e;
	padding-top: 6px;
}
.gallery-empty {
	padding: 24px 0;
	color: #666;
}
@media (max-width: 1100px) {
	.gallery-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
	.gallery-grid { grid-template-columns: 1fr 1fr; }
}

/* 1024px 以下: 1カラム化、カテゴリーは横スクロールの上タブ。 */
@media (max-width: 1024px) {
	.gallery-layout {
		grid-template-columns: 1fr;
		gap: clamp(20px, 4vw, 28px);
	}
	.gallery-cats-scroll {
		margin-left: -32px;
		margin-right: -32px;
		padding-left: 32px;
		padding-right: 32px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
	.gallery-cats {
		flex-direction: row;
		flex-wrap: nowrap;
		width: max-content;
		min-width: 100%;
		border-right: 0;
		border-bottom: 1px solid var(--wp--preset--color--line, #ececec);
	}
	.gallery-cat {
		margin-right: 0;
		margin-bottom: -1px;
		border-right: 0;
		border-bottom: 2px solid transparent;
		padding: 10px 14px;
		font-size: 13px;
		white-space: nowrap;
		flex-shrink: 0;
	}
	.gallery-cat.is-current {
		border-right-color: transparent;
		border-bottom-color: var(--aureate, #b89766);
	}
}

/* SP（≤700px）はガター 16px に合わせる。 */
@media (max-width: 700px) {
	.gallery-cats-scroll {
		margin-left: -16px;
		margin-right: -16px;
		padding-left: 16px;
		padding-right: 16px;
	}
}

/* ===== 一覧アイテム（クリックでモーダル） ===== */
.gallery-item__btn {
	display: block;
	position: relative;
	width: 100%;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
	overflow: hidden;
}
.gallery-item__btn img {
	transition: transform 0.5s ease;
}
.gallery-item__btn:hover img {
	transform: scale(1.05);
}
.gallery-item__btn:focus-visible {
	outline: 2px solid var(--aureate, #b89766);
	outline-offset: 2px;
}
/* 360度バッジ（ストリートビュー） */
.gallery-item__badge {
	position: absolute;
	left: 8px;
	bottom: 8px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 9px;
	background: rgba(0, 0, 0, 0.62);
	color: #fff;
	font-family: var(--wp--custom--brand-ui, var(--wp--custom--brand-body));
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	border-radius: 2px;
	pointer-events: none;
}

/* ===== モーダル（ライトボックス／360度ビュー） ===== */
html.gallery-modal-open { overflow: hidden; }
.gallery-modal[hidden] { display: none; }
.gallery-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(16px, 4vw, 48px);
}
.gallery-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.88);
}
.gallery-modal__figure {
	position: relative;
	z-index: 1;
	margin: 0;
	max-width: 1320px;
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.gallery-modal__stage {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}
.gallery-modal__img {
	max-width: 100%;
	max-height: 82vh;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}
.gallery-modal__pano {
	width: min(100%, 1100px);
	aspect-ratio: 16 / 9;
	max-height: 82vh;
	border: 0;
	display: block;
	background: #111;
}
.gallery-modal__caption {
	margin-top: 14px;
	color: #fff;
	font-family: var(--wp--custom--brand-ui, var(--wp--custom--brand-body));
	font-size: 13px;
	letter-spacing: 0.04em;
	text-align: center;
}
.gallery-modal__caption[hidden] { display: none; }
/* 閉じる・前後ボタン */
.gallery-modal__close,
.gallery-modal__nav {
	position: absolute;
	z-index: 2;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	border: 0;
	cursor: pointer;
	line-height: 1;
	transition: background 0.2s;
}
.gallery-modal__close:hover,
.gallery-modal__nav:hover {
	background: rgba(0, 0, 0, 0.75);
}
.gallery-modal__close {
	top: 16px;
	right: 20px;
	width: 44px;
	height: 44px;
	font-size: 28px;
	border-radius: 50%;
}
.gallery-modal__nav {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 64px;
	font-size: 36px;
}
.gallery-modal__nav[hidden] { display: none; }
.gallery-modal__prev { left: 12px; }
.gallery-modal__next { right: 12px; }
@media (max-width: 700px) {
	.gallery-modal__nav { width: 40px; height: 52px; font-size: 28px; }
	.gallery-modal__prev { left: 4px; }
	.gallery-modal__next { right: 4px; }
}
