/**
 * works フロント用スタイル
 *
 * - アーカイブグリッド (PC3列 / SP2列)
 * - シングルの比較スライダー (img-comparison-slider) のカスタムハンドル含む
 * - シングルのギャラリーグリッド
 *
 * 命名は BEM (works-card / works-single / works-compare / works-gallery)。
 */

/* ============================================================================
 * Archive
 * ========================================================================= */

.works-archive__header {
	margin: 0 0 1.5em;
	text-align: center;
}

.works-archive__title {
	font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
	margin: 0;
}

.works-archive__filter {
	margin: 0 0 2em;
}

.works-archive__filter-list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.works-archive__filter-link {
	display: inline-block;
	padding: 0.4em 1.2em;
	background: #f3f4f6;
	color: #333;
	text-decoration: none;
	border-radius: 999px;
	font-size: 0.9em;
	transition: background 0.2s ease, color 0.2s ease;
}

.works-archive__filter-link:hover {
	background: #e5e7eb;
}

.works-archive__filter-link.is-current {
	background: #1f2937;
	color: #fff;
}

.works-archive__grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.works-archive__grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 24px;
	}
}

.works-archive__empty {
	text-align: center;
	padding: 3em 0;
	color: #666;
}

/* ============================================================================
 * Card
 * ========================================================================= */

.works-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	overflow: hidden;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.works-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.works-card__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.works-card__thumb {
	position: relative;
	aspect-ratio: 4 / 3;
	background: #f3f4f6;
	overflow: hidden;
}

.works-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.works-card__thumb-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.works-card__body {
	padding: 12px 14px;
}

.works-card__title {
	font-size: 0.95em;
	margin: 0 0 0.4em;
	line-height: 1.4;
}

.works-card__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.works-card__cat {
	font-size: 0.72em;
	padding: 2px 8px;
	background: #eef2ff;
	color: #3730a3;
	border-radius: 999px;
}

/* ============================================================================
 * Single - header
 * ========================================================================= */

.works-single__header {
	margin: 0 0 1.5em;
	padding-bottom: 1em;
	border-bottom: 1px solid #e5e7eb;
}

.works-single__title {
	font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.875rem);
	margin: 0 0 0.6em;
}

.works-single__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0 0 0.6em;
	padding: 0;
	list-style: none;
}

.works-single__cat {
	font-size: 0.78em;
	padding: 3px 10px;
	background: #eef2ff;
	color: #3730a3;
	border-radius: 999px;
}

.works-single__date {
	margin: 0;
	color: #555;
	font-size: 0.9em;
}

.works-single__date-label {
	font-weight: 600;
}

.works-single__overview {
	margin: 0 0 2em;
	line-height: 1.8;
}

/* ============================================================================
 * Single - section (サブセクション共通)
 * ========================================================================= */

.works-section {
	margin: 0 0 2.5em;
}

.works-section:last-child {
	margin-bottom: 0;
}

.works-section__subtitle {
	margin: 0 0 0.8em;
	padding-left: 0.6em;
	font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.25rem);
	font-weight: 600;
	line-height: 1.4;
	border-left: 4px solid #1f2937;
}

.works-section__body {
	margin: 0;
}

/* comparison のサブセクション内で複数ペアが縦並びになるとき */
.works-section__body--comparison {
	display: flex;
	flex-direction: column;
	gap: 2em;
}

/* ============================================================================
 * Single - comparison slider
 * ========================================================================= */

.works-single__comparisons {
	display: flex;
	flex-direction: column;
	gap: 2.5em;
	margin: 0 0 2em;
}

.works-compare {
	margin: 0;
}

.works-compare__slider {
	/* 縦スクロールはページに通す。ハンドル要素側で横ドラッグ確定 */
	touch-action: pan-y;
	display: block;
	width: 100%;
	max-width: 100%;
	--divider-width: 2px;
	--divider-color: rgba(255, 255, 255, 0.9);
	--default-handle-opacity: 0;
}

.works-compare__slider img {
	display: block;
	width: 100%;
	height: auto;
}

/* カスタムハンドル */
.works-compare__handle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	background: #fff;
	color: #1f2937;
	border: 2px solid #1f2937;
	border-radius: 50%;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	/* 横ドラッグを確定させる */
	touch-action: none;
	cursor: ew-resize;
}

.works-compare__caption {
	display: flex;
	justify-content: space-between;
	margin-top: 0.6em;
	font-size: 0.78em;
	color: #555;
}

.works-compare__label {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 4px;
	font-weight: 600;
	letter-spacing: 0.04em;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
}

/* Before/After ラベルをスライダー上にオーバーレイ表示するための位置補正 */
.works-compare {
	position: relative;
}

.works-compare__caption {
	position: absolute;
	top: 12px;
	left: 12px;
	right: 12px;
	pointer-events: none;
}

.works-compare__label--before {
	margin-right: auto;
}

.works-compare__label--after {
	margin-left: auto;
	align-self: flex-end;
	margin-top: auto;
}

/* ============================================================================
 * Single - gallery
 * ========================================================================= */

.works-single__gallery {
	margin: 0 0 2em;
}

.works-gallery {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.works-gallery {
		grid-template-columns: repeat(3, 1fr);
		gap: 12px;
	}
}

.works-gallery__item {
	margin: 0;
}

.works-gallery__link {
	display: block;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: 4px;
	background: #f3f4f6;
	transition: opacity 0.2s ease;
}

.works-gallery__link:hover {
	opacity: 0.85;
}

.works-gallery__link img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* ============================================================================
 * Single - slideshow (Swiper)
 *
 * 施工写真は縦横比がバラバラなので object-fit: contain。
 * pagination / nav 矢印の配色は既存 comparison ハンドル (#1f2937) と揃える。
 * ========================================================================= */

.works-single__slideshow {
	margin: 0 0 2em;
}

.works-slideshow {
	max-width: 100%;
	margin: 0 auto;
}

.works-slideshow .swiper {
	background: #1f2937;
	border-radius: 4px;
	overflow: hidden;
}

.works-slideshow .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
	aspect-ratio: 16 / 10;
	background: #1f2937;
}

.works-slideshow .swiper-slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.works-slideshow .swiper-pagination-bullet {
	background: #fff;
	opacity: 0.55;
	transition: opacity 0.2s ease;
}

.works-slideshow .swiper-pagination-bullet-active {
	background: #fff;
	opacity: 1;
}

.works-slideshow .swiper-button-prev,
.works-slideshow .swiper-button-next {
	color: #fff;
	width: 40px;
	height: 40px;
	margin-top: -20px;
	background: rgba(31, 41, 55, 0.6);
	border: 0;
	border-radius: 50%;
	transition: background 0.2s ease;
}

.works-slideshow .swiper-button-prev:hover,
.works-slideshow .swiper-button-next:hover {
	background: rgba(31, 41, 55, 0.85);
}

.works-slideshow .swiper-button-prev::after,
.works-slideshow .swiper-button-next::after {
	font-size: 16px;
	font-weight: 700;
}

@media (max-width: 767px) {
	/* SP は矢印を消してスワイプ操作前提、pagination ドットのみ残す */
	.works-slideshow .swiper-button-prev,
	.works-slideshow .swiper-button-next {
		display: none;
	}

	.works-slideshow .swiper-slide {
		aspect-ratio: 4 / 3;
	}
}

/* ============================================================================
 * Single - nav
 * ========================================================================= */

.works-single__nav {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	margin: 2em 0 0;
	padding-top: 1em;
	border-top: 1px solid #e5e7eb;
	font-size: 0.9em;
}

.works-single__nav-prev,
.works-single__nav-next {
	flex: 1;
}

.works-single__nav-next {
	text-align: right;
}
