/* ギャラリーページ（p_Gallery.php）専用 */

.gallery-cover h1 {
	margin: 0;
	font-size: 40px;
	font-weight: 700;
	color: #fff;
}

.gallery-cover .gallery-cover-title {
	padding-right: 30px;
}

.section-gallery .gallery-empty {
	margin: 0;
	text-align: center;
}

.section-gallery .gallery-category {
	margin-bottom: 30px;
}

.section-gallery .gallery-category:last-child {
	margin-bottom: 0;
}

.section-gallery .page-cate-title {
	margin-bottom: 30px;
}

.section-gallery .page-cate-title h2 {
	display: inline-block;
	vertical-align: middle;
	font-weight: 700;
	margin-bottom: 0;
	font-size: 24px;
	color: #000;
	max-width: calc(100% - 25px);
	overflow-wrap: anywhere;
}

.section-gallery .gallery-item {
	margin-bottom: 30px;
	text-align: center;
}

.section-gallery .gallery-thumb {
	display: flex;
	margin-bottom: 10px;
	align-items: center;
	justify-content: center;
	aspect-ratio: 4 / 3;
	padding: 10px;
	border: 1px solid #ddd;
	background-color: #fff;
	cursor: zoom-in;
	overflow: hidden;
}

.section-gallery .gallery-thumb img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	transition: 0.6s;
}

.section-gallery .gallery-thumb:hover img {
	opacity: 0.7;
}

.section-gallery .gallery-name {
	margin: 0 0 10px;
	font-size: 16px;
	font-weight: 700;
	color: #333;
	word-break: break-all;
}

.section-gallery .gallery-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}

.section-gallery .gallery-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	width: 160px;
	max-width: 100%;
	margin: 0;
	font-size: 14px;
	line-height: 1.5;
	white-space: nowrap;
	cursor: pointer;
}

.section-gallery .gallery-review-button {
	background-color: #f8f5eb;
	font-weight: 700;
}

.section-gallery .gallery-action:hover,
.gallery-review-modal .gallery-review-link:hover {
	color: #fff;
	background-color: #e0c16f;
}

.section-gallery .gallery-action:focus-visible,
.gallery-review-modal .gallery-review-link:focus-visible {
	outline: 2px solid #8b6b24;
	outline-offset: 3px;
}

/* 拡大表示 */
.gallery-modal {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 10001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background-color: rgba(15, 23, 42, 0.65);
	visibility: hidden;
	opacity: 0;
	/* 閉じるときはフェードアウト後に非表示にする */
	transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.gallery-modal.is-open {
	visibility: visible;
	opacity: 1;
	/* 開くときはすぐに表示状態にする（閉じるボタンへフォーカスを移せるように） */
	transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.gallery-modal-body {
	position: relative;
	width: 100%;
	max-width: 900px;
	max-height: 100%;
	padding: 24px;
	border-radius: 18px;
	background-color: #fff;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.gallery-modal-figure {
	margin: 0;
	text-align: center;
}

.gallery-modal-figure img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: 80vh;
	/* 画面の高さが低い場合も、余白・製品名を含めて画面内に収める */
	max-height: min(80vh, calc(100vh - 130px));
	margin: 0 auto;
	border-radius: 14px;
	object-fit: contain;
}

.gallery-modal-figure figcaption {
	margin-top: 10px;
	color: #333;
	font-weight: 700;
	line-height: 24px;
	word-break: break-all;
}

.gallery-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid #d1d5db;
	border-radius: 50%;
	background-color: #fff;
	color: #111827;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

/* レビュー記事一覧。見出しと閉じるボタンを残し、記事部分だけスクロールする */
.gallery-review-modal .gallery-modal-body {
	display: flex;
	flex-direction: column;
	max-width: 800px;
	padding: 32px;
}

.gallery-review-modal .gallery-review-header {
	flex-shrink: 0;
	padding: 0 48px 20px 0;
	border-bottom: 1px solid #ddd;
}

.gallery-review-modal .gallery-review-header h2 {
	margin: 0 0 12px;
	color: #333;
	font-size: 24px;
	font-weight: 700;
	overflow-wrap: anywhere;
}

.gallery-review-modal .gallery-review-count {
	margin: 0;
	color: #666;
	font-size: 16px;
}

.gallery-review-modal .gallery-review-list {
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.gallery-review-modal .gallery-review-items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.gallery-review-modal .gallery-review-item {
	padding: 24px 4px;
	border-bottom: 1px solid #ddd;
}

.gallery-review-modal .gallery-review-item:last-child {
	border-bottom: 0;
}

.gallery-review-modal .gallery-review-item h3 {
	margin: 0 0 20px;
	color: #333;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.6;
	overflow-wrap: anywhere;
}

.gallery-review-modal .gallery-review-links {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.gallery-review-modal .gallery-review-link {
	max-width: 100%;
	padding: 10px 20px;
	background-color: #f8f5eb;
	text-align: center;
	/* テーマ共通の transition: all による visibility の遅延を防ぐ */
	transition: color 0.3s ease, background-color 0.3s ease;
}

/* ダウンロード済みの印 */
.section-gallery .gallery-download.is-downloaded {
	color: #fff;
	background-color: #e0c16f;
}

/* ダウンロード時のお知らせ */
.gallery-toast {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 10002;
	width: calc(100% - 32px);
	max-width: 420px;
	padding: 14px 18px;
	border-radius: 12px;
	background-color: rgba(17, 24, 39, 0.92);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
	color: #fff;
	text-align: center;
	visibility: hidden;
	opacity: 0;
	transform: translate(-50%, 10px);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
	pointer-events: none;
}

.gallery-toast.is-show {
	visibility: visible;
	opacity: 1;
	transform: translate(-50%, 0);
	transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}

.gallery-toast p {
	margin: 0;
}

.gallery-toast-title {
	font-size: 15px;
	font-weight: 700;
}

.gallery-toast-title::before {
	content: "\f00c";
	margin-right: 6px;
	font-family: "Font Awesome 5 Free";
	font-weight: 900;
	color: #e0c16f;
}

.gallery-toast-name {
	margin-top: 2px !important;
	font-size: 14px;
	overflow-wrap: anywhere;
}

.gallery-toast-note {
	margin-top: 4px !important;
	font-size: 13px;
	color: #d1d5db;
}

.gallery-toast-name:empty,
.gallery-toast-note:empty {
	display: none;
}

body.gallery-modal-open {
	overflow: hidden;
}

@media only screen and (max-width: 767px) {
	.gallery-cover .gallery-cover-title {
		padding-right: 0;
	}

	.gallery-cover h1 {
		margin-bottom: 15px;
	}

	.section-gallery .page-cate-title {
		margin-bottom: 20px;
	}

	.section-gallery .page-cate-title h2 {
		font-size: 18px;
	}

	.section-gallery .gallery-thumb {
		padding: 5px;
	}

	.section-gallery .gallery-name {
		font-size: 14px;
	}

	.section-gallery .gallery-actions {
		flex-direction: column;
		align-items: stretch;
	}

	.section-gallery .gallery-action {
		width: 100%;
		font-size: clamp(12px, 3.4vw, 14px);
		padding: 7px 5px;
	}

	.gallery-modal-body {
		padding: 18px;
	}

	.gallery-review-modal .gallery-modal-body {
		padding: 20px 18px;
	}

	.gallery-review-modal .gallery-review-header {
		padding-bottom: 16px;
	}

	.gallery-review-modal .gallery-review-header h2 {
		font-size: 18px;
	}

	.gallery-review-modal .gallery-review-count {
		font-size: 14px;
	}

	.gallery-review-modal .gallery-review-item {
		padding-top: 18px;
		padding-bottom: 18px;
	}

	.gallery-review-modal .gallery-review-item h3 {
		margin-bottom: 14px;
		font-size: 16px;
	}

	.gallery-review-modal .gallery-review-link {
		padding: 8px 12px;
		font-size: 14px;
	}
}
