/**
 * /parts-search/ (ID 2613 "部位檢索") — subtle / low-fi.
 * Layout: header + intro; below = two-col grid (parts list | figure badge).
 * The figure badge always shows BOTH male + female figures side-by-side
 * (original shortcode JS toggles via .show class; we force both visible).
 */

.ps-page {
	max-width: 1200px;
	margin: 0 auto;
	padding: 72px 24px 120px;
	box-sizing: border-box;
	font-family: 'Noto Serif TC', 'Crimson Text', 'Source Han Serif TC', serif;
	color: #4b4b4b;
	font-size: 15px;
	line-height: 1.9;
	letter-spacing: 0.5px;
}

/* Close button is drawer-only (injected by JS for both viewports); hide on PC. */
.ps-drawer-close {
	display: none;
}

.ps-page p,
.ps-page ol,
.ps-page ul,
.ps-page li {
	font-family: inherit;
}

/* -------- Header -------- */
.ps-header {
	margin: 0 0 24px;
	padding: 0 0 20px;
	border-bottom: 1px solid #e5e2db;
}

.ps-title {
	font-family: 'Noto Serif TC', serif;
	font-size: 22px;
	font-weight: 500;
	color: #2a2a2a;
	letter-spacing: 2px;
	line-height: 1.4;
	margin: 0;
}

.ps-en {
	font-family: 'Crimson Text', serif;
	font-size: 13px;
	font-weight: 500;
	color: #8e8e8e;
	letter-spacing: 1.2px;
	line-height: 1.6;
	margin: 6px 0 0;
	font-style: italic;
}

.ps-intro {
	font-size: 14px;
	color: #6b6b6b;
	letter-spacing: 1px;
	line-height: 1.8;
	margin: 0 0 40px;
}

/* -------- Two column grid -------- */
.ps-content {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 48px;
	align-items: start;
}

/* -------- Left: parts list -------- */
.ps-list .part-warp {
	display: flex;
	flex-direction: column;
	border-top: 1px solid #e5e2db;
}

.ps-list .part {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 10px;
	border-bottom: 1px solid #e5e2db;
	color: #3a3a3a;
	text-decoration: none;
	transition: background 0.2s, color 0.2s;
}

.ps-list .part:hover,
.ps-list .part.active {
	background: #f8f7f3;
	color: #2a2a2a;
}

.ps-list .part_title {
	font-family: 'Noto Serif TC', serif;
	font-size: 14px;
	font-weight: 500;
	letter-spacing: 1.2px;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	line-height: 1.4;
}

.ps-list .part_tag {
	font-family: 'Crimson Text', serif;
	font-size: 10px;
	font-weight: 500;
	padding: 2px 8px;
	border: 1px solid #d6d0c5;
	color: #8e8e8e;
	letter-spacing: 0.5px;
	font-style: italic;
	border-radius: 2px;
}

.ps-list .part-arrow {
	width: 7px;
	height: 7px;
	border-right: 1px solid #a0a0a0;
	border-top: 1px solid #a0a0a0;
	transform: rotate(45deg);
	flex-shrink: 0;
	opacity: 0.7;
	transition: opacity 0.2s, border-color 0.2s;
}

.ps-list .part:hover .part-arrow {
	opacity: 1;
	border-color: #79895f;
}

/* -------- Right: preview "badge" with 2 figures -------- */
.ps-preview .part-preview {
	background: #f8f7f3;
	border: 1px solid #e5e2db;
	padding: 28px 32px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.ps-preview .preview-info {
	padding-bottom: 20px;
	border-bottom: 1px solid #e5e2db;
	min-height: 60px;
}

.ps-preview .preview-title {
	font-family: 'Noto Serif TC', serif;
	font-size: 18px;
	font-weight: 500;
	color: #2a2a2a;
	letter-spacing: 1.5px;
	line-height: 1.5;
	margin: 0 0 10px;
}

.ps-preview .preview-title:empty::before {
	content: "請選擇部位";
	color: #b0b0b0;
	font-weight: 400;
}

.ps-preview .preview-excerpt {
	font-size: 14px;
	line-height: 1.9;
	color: #4b4b4b;
	letter-spacing: 0.8px;
}

.ps-preview .preview-btn {
	display: inline-block;
	margin-top: 14px;
	padding: 8px 22px;
	border: 1px solid #79895f;
	color: #79895f;
	font-family: 'Noto Serif TC', serif;
	font-size: 13px;
	letter-spacing: 1.5px;
	text-decoration: none;
	transition: background 0.2s, color 0.2s;
}

.ps-preview .preview-btn:hover {
	background: #79895f;
	color: #fff;
}

.ps-preview .preview-btn:empty {
	display: none;
}

/* Inline 健檢建議 block — shown after preview-info, before figures */
.ps-preview .preview-suggestion {
	display: none;
	margin: 0;
	padding: 0;
}

.ps-preview .preview-suggestion.show {
	display: block;
	padding-top: 4px;
}

.ps-preview .preview-suggestion-title {
	font-family: 'Noto Serif TC', serif;
	font-size: 14px;
	font-weight: 600;
	color: #2a2a2a;
	letter-spacing: 1.5px;
	margin: 0 0 10px;
	line-height: 1.5;
}

.ps-preview .preview-suggestion ul {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.ps-preview .preview-suggestion li {
	font-family: 'Noto Serif TC', serif;
	font-size: 13px;
	line-height: 1.8;
	color: #4b4b4b;
	letter-spacing: 0.5px;
	padding-left: 16px;
	position: relative;
}

.ps-preview .preview-suggestion li::before {
	content: "–";
	position: absolute;
	left: 0;
	top: 0;
	color: #79895f;
	font-weight: 600;
}

/* Preview card vertical layout */
.ps-preview .part-preview {
	display: flex;
	flex-direction: column;
}

.ps-preview .preview-img { margin-top: 24px; }

/* Suggestion sits between excerpt and the 了解相關方案 button inside preview-info */
.ps-preview .preview-info .preview-suggestion.show {
	margin: 18px 0 4px;
	padding-top: 18px;
	border-top: 1px solid #e5e2db;
}

.ps-preview .preview-info .preview-btn {
	margin-top: 14px;
}

/* Two figures side-by-side, always both visible, equal sized.
   Both default images share aspect ratio ~0.624 (1477×2368 / 1201×2368).
   Lock the cell with aspect-ratio so male and female cells render identical. */
.ps-preview .preview-img {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	align-items: stretch;
	justify-items: center;
}

.ps-preview .preview-img img {
	display: block !important;
	width: 100%;
	max-width: 240px;
	aspect-ratio: 1477 / 2368;
	height: auto;
	object-fit: contain;
	object-position: center bottom;
}

.ps-preview .preview-img img.male,
.ps-preview .preview-img img.female {
	display: block !important;
}

/* =========================================================
   Mobile (≤767px) — bottom-sheet style preview drawer
   ========================================================= */
@media (max-width: 767px) {
	.ps-page {
		padding: 40px 16px 80px;
		font-size: 14px;
	}

	.ps-title {
		font-size: 20px;
		letter-spacing: 1.5px;
	}

	.ps-intro {
		font-size: 13px;
		margin-bottom: 24px;
	}

	/* Stack. List stays visible; preview is a fixed bottom sheet. */
	.ps-content {
		display: block;
	}

	/* Parts list — touch-friendly taps */
	.ps-list .part {
		padding: 16px 12px;
		min-height: 48px;
	}

	.ps-list .part_title {
		font-size: 15px;
		letter-spacing: 1.2px;
	}

	.ps-list .part_tag {
		font-size: 11px;
	}

	/* Preview = bottom sheet drawer, hidden until a part is tapped */
	.ps-preview {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 500;
		background: #fff;
		box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.12);
		max-height: 85vh;
		transform: translateY(100%);
		transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.35, 1);
		border-top: 1px solid #e5e2db;
		will-change: transform;
		-webkit-overflow-scrolling: touch;
		touch-action: pan-y;
	}

	.ps-preview.ps-drawer-open {
		transform: translateY(0);
	}

	/* Drag-grip handle at top of sheet */
	.ps-preview::before {
		content: "";
		position: absolute;
		top: 8px;
		left: 50%;
		width: 40px;
		height: 4px;
		background: #d6d0c5;
		border-radius: 2px;
		transform: translateX(-50%);
		pointer-events: none;
	}

	/* Close button (injected via JS) — only shown on mobile */
	.ps-drawer-close {
		display: block;
		position: absolute;
		top: 12px;
		right: 12px;
		width: 32px;
		height: 32px;
		border: none;
		background: transparent;
		color: #8e8e8e;
		font-size: 20px;
		line-height: 1;
		cursor: pointer;
		z-index: 1;
		padding: 0;
	}

	.ps-drawer-close::before {
		content: "✕";
	}

	.ps-preview .part-preview {
		padding: 32px 20px 24px;
		background: #fff;
		border: none;
		overflow-y: auto;
		max-height: 85vh;
		box-sizing: border-box;
	}

	.ps-preview .preview-title {
		font-size: 17px;
	}

	.ps-preview .preview-excerpt {
		font-size: 13.5px;
		line-height: 1.85;
	}

	.ps-preview .preview-suggestion-title {
		font-size: 13px;
	}

	.ps-preview .preview-suggestion li {
		font-size: 12.5px;
		line-height: 1.75;
	}

	.ps-preview .preview-btn {
		display: block;
		text-align: center;
		padding: 10px 20px;
		margin-top: 12px;
		font-size: 14px;
	}

	.ps-preview .preview-img {
		gap: 10px;
		margin-top: 20px;
	}

	.ps-preview .preview-img img {
		max-width: 160px;
	}

	/* Backdrop dimmer when drawer is open */
	.ps-drawer-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(0, 0, 0, 0.35);
		z-index: 499;
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.3s;
	}

	.ps-drawer-backdrop.ps-drawer-open {
		opacity: 1;
		pointer-events: auto;
	}

	body.ps-drawer-open {
		overflow: hidden;
	}
}
