/*!
 * B2 宝贝回家 · 寻亲墙
 * 样式尽量复用 B2 主题的 CSS 变量：--b2color / --b2radius / --b2light / --b2lightcolor
 * 主题没有这些变量时全部走兜底值，所以在非 B2 主题上也不会变形。
 */

/* ============ 侧边栏卡片 ============ */
.bbhj {
	--bbhj-accent: var(--b2color, #f4511e);
	--bbhj-radius: var(--b2radius, 10px);
	--bbhj-line: rgba(0, 0, 0, 0.08);
	--bbhj-muted: #9aa0a6;
	--bbhj-text: #3d424a;
	--bbhj-ratio: 3 / 4;
	padding: 0 12px 12px;
	box-sizing: border-box;
}

.bbhj * {
	box-sizing: border-box;
}

.bbhj-empty {
	padding: 18px 16px;
	text-align: center;
	font-size: 13px;
	color: var(--bbhj-muted);
}

.bbhj-inner {
	border: 1px solid var(--bbhj-line);
	border-radius: var(--bbhj-radius);
	overflow: hidden;
	background: #fbfbfc;
}

/* 照片 */
.bbhj-photo {
	position: relative;
	display: block;
	background: #f2f3f5;
	aspect-ratio: var(--bbhj-ratio);
	/* 侧边栏本来就窄，竖版照片会把小工具顶到半屏高。
	   这里封顶，并按比例把宽度一起收窄 —— 只限高会让照片两侧留出大片灰边。 */
	width: calc(var(--bbhj-photo-h, 190px) * var(--bbhj-ratio-num, 0.75));
	max-width: 100%;
	max-height: var(--bbhj-photo-h, 190px);
	margin: 0 auto;
	overflow: hidden;
	text-decoration: none;
}

.bbhj-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	object-position: center;
	transition: transform 0.35s ease;
}

.bbhj-photo:hover img {
	transform: scale(1.03);
}

.bbhj-flag {
	position: absolute;
	left: 0;
	top: 0;
	padding: 2px 8px;
	font-size: 11px;
	line-height: 1.5;
	color: #fff;
	background: var(--bbhj-accent);
	border-bottom-right-radius: 8px;
	letter-spacing: 0.5px;
}

.bbhj-zoom {
	position: absolute;
	right: 8px;
	bottom: 8px;
	padding: 2px 8px;
	font-size: 11px;
	line-height: 1.5;
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
	border-radius: 20px;
	opacity: 0;
	transform: translateY(4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.bbhj-photo:hover .bbhj-zoom,
.bbhj-photo:focus .bbhj-zoom {
	opacity: 1;
	transform: translateY(0);
}

/* 文字区 */
.bbhj-body {
	padding: 8px 10px 2px;
}

.bbhj-name {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--bbhj-text);
}

.bbhj-name span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.bbhj-name em {
	flex: 0 0 auto;
	font-style: normal;
	font-size: 12px;
	font-weight: 400;
	color: var(--bbhj-muted);
}

/* 主题有 .widget ul li { padding:16px }，这里必须提高优先级压掉 */
.widget .bbhj-meta,
.bbhj .bbhj-meta {
	list-style: none;
	margin: 6px 0 0;
	padding: 0;
}

.widget .bbhj-meta li,
.bbhj .bbhj-meta li {
	display: flex;
	align-items: flex-start;
	gap: 6px;
	margin: 0;
	padding: 0;
	font-size: 12px;
	line-height: 1.7;
	border: 0;
}

.widget .bbhj-meta li + li,
.bbhj .bbhj-meta li + li {
	margin-top: 2px;
}

.bbhj-meta li.is-empty {
	display: none;
}

.bbhj-k {
	flex: 0 0 auto;
	color: var(--bbhj-muted);
}

.bbhj-v {
	flex: 1 1 auto;
	min-width: 0;
	color: var(--bbhj-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* 底部操作 */
.bbhj-foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-top: 8px;
}

.bbhj-next {
	flex: 0 0 auto;
	min-width: 86px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 28px;
	padding: 0 12px;
	font-size: 12px;
	line-height: 1;
	cursor: pointer;
	color: var(--bbhj-accent);
	background: var(--b2light, rgba(0, 0, 0, 0.03));
	border: 1px solid var(--b2lightcolor, rgba(0, 0, 0, 0.12));
	border-radius: var(--bbhj-radius);
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	-webkit-appearance: none;
}

.bbhj-next:hover {
	color: #fff;
	background: var(--bbhj-accent);
	border-color: var(--bbhj-accent);
}

.bbhj-next:active {
	transform: translateY(1px);
}

.bbhj-total {
	flex: 0 0 auto;
	font-size: 11px;
	color: var(--bbhj-muted);
}

.bbhj-sub {
	margin: -4px 0 8px;
	padding: 0 12px;
	font-size: 11px;
	line-height: 1.5;
	color: var(--bbhj-muted);
}

/* 没有 JS 时「点击放大」是假的（会直接跳转官方链接），所以干脆不显示 */
.bbhj:not(.bbhj-js) .bbhj-zoom {
	display: none;
}

/* 手机端没有 hover，放大提示常显 */
@media (hover: none) {
	.bbhj-zoom {
		opacity: 1;
		transform: none;
	}
}

/* ============ 详情弹层 ============ */
.bbhj-lb {
	position: fixed;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 10000000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.bbhj-lb.is-open {
	display: flex;
}

.bbhj-lb-mask {
	position: absolute;
	left: 0;
	top: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.72);
}

/* DarkReader 整页反色会把遮罩翻成亮的，这里补一次反向 */
html[data-darkreader-scheme='dark'] .bbhj-lb-mask {
	background: rgba(0, 0, 0, 0.72);
	filter: invert(1);
}

.bbhj-lb-box {
	position: relative;
	width: 800px;
	max-width: calc(100% - 32px);
	max-height: calc(100vh - 64px);
	background: #fff;
	border-radius: var(--b2radius, 12px);
	box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	animation: bbhj-lb-in 0.22s ease;
}

@keyframes bbhj-lb-in {
	from {
		opacity: 0;
		transform: translateY(14px) scale(0.985);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.bbhj-lb-close {
	position: absolute;
	right: 10px;
	top: 10px;
	z-index: 3;
	width: 34px;
	height: 34px;
	padding: 0;
	font-size: 22px;
	line-height: 1;
	color: #7d838b;
	background: rgba(0, 0, 0, 0.06);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-appearance: none;
}

.bbhj-lb-close:hover {
	color: #fff;
	background: rgba(0, 0, 0, 0.55);
}

.bbhj-lb-body {
	display: flex;
	min-height: 0;
	overflow: auto;
}

.bbhj-lb-photo {
	flex: 0 0 42%;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px;
	background: #f5f6f7;
}

.bbhj-lb-photo img {
	display: block;
	max-width: 100%;
	max-height: min(64vh, 520px);
	object-fit: contain;
	border-radius: 6px;
}

.bbhj-lb-info {
	flex: 1 1 auto;
	min-width: 0;
	padding: 26px 28px 22px;
	overflow: auto;
}

.bbhj-lb-title {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin: 0 0 4px;
	padding: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.4;
	color: #23262b;
}

.bbhj-lb-title em {
	font-style: normal;
	font-size: 12px;
	font-weight: 400;
	color: var(--bbhj-muted, #9aa0a6);
}

.bbhj-lb-dl {
	margin: 10px 0 0;
	padding: 0;
}

.bbhj-lb-dl > div {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px dashed rgba(0, 0, 0, 0.07);
}

.bbhj-lb-dl > div:last-child {
	border-bottom: 0;
}

.bbhj-lb-dl dt {
	flex: 0 0 76px;
	margin: 0;
	font-size: 13px;
	line-height: 1.7;
	color: #9aa0a6;
}

.bbhj-lb-dl dd {
	flex: 1 1 auto;
	margin: 0;
	min-width: 0;
	font-size: 14px;
	line-height: 1.7;
	color: #3d424a;
	word-break: break-word;
}

.bbhj-lb-feature h3 {
	margin: 18px 0 6px;
	padding: 0;
	font-size: 13px;
	font-weight: 500;
	color: #9aa0a6;
}

.bbhj-lb-feature p {
	margin: 0;
	font-size: 14px;
	line-height: 1.85;
	color: #3d424a;
	white-space: pre-line;
	word-break: break-word;
}

.bbhj-lb-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 20px;
}

.bbhj-lb-tel {
	flex: 1 1 190px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 9px 12px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
	background: var(--b2color, #f4511e);
	border-radius: var(--b2radius, 8px);
	text-decoration: none;
}

.bbhj-lb-tel em {
	font-style: normal;
	font-size: 11px;
	font-weight: 400;
	opacity: 0.85;
}

.bbhj-lb-tel:hover {
	color: #fff;
	opacity: 0.92;
}

.bbhj-lb-link {
	flex: 1 1 140px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 10px 12px;
	font-size: 13px;
	color: #3d424a;
	background: #f5f6f7;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: var(--b2radius, 8px);
	text-decoration: none;
}

.bbhj-lb-link:hover {
	color: var(--b2color, #f4511e);
	border-color: var(--b2color, #f4511e);
}

.bbhj-lb-note {
	margin: 16px 0 0;
	font-size: 12px;
	line-height: 1.7;
	color: #9aa0a6;
}

.bbhj-lb [hidden] {
	display: none !important;
}

body.bbhj-lb-lock {
	overflow: hidden !important;
}

@media (max-width: 782px) {
	.bbhj-lb-box {
		width: calc(100% - 20px);
		max-width: calc(100% - 20px);
		max-height: calc(100vh - 40px);
	}

	.bbhj-lb-body {
		flex-direction: column;
	}

	.bbhj-lb-photo {
		flex: 0 0 auto;
		padding: 12px;
	}

	.bbhj-lb-photo img {
		max-height: 44vh;
	}

	.bbhj-lb-info {
		padding: 16px 16px 20px;
	}

	.bbhj-lb-title {
		font-size: 17px;
		padding-right: 36px;
	}

	.bbhj-lb-dl dt {
		flex-basis: 68px;
		font-size: 12px;
	}
}

/* ============ 海报模式（自动抓取的官方寻亲信息图） ============ */
.bbhj-poster-link {
	position: relative;
	display: block;
	max-width: 100%;
	border: 1px solid var(--bbhj-line);
	border-radius: var(--bbhj-radius);
	overflow: hidden;
	background: #f2f3f5;
	line-height: 0;
}

.bbhj-poster-link img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.35s ease;
}

.bbhj-poster-link:hover img {
	transform: scale(1.02);
}

/* 弹层：整张海报 */
.bbhj-lb-box-poster {
	width: auto;
	max-width: calc(100vw - 40px);
	background: #fff;
}

.bbhj-lb-poster-wrap {
	line-height: 0;
	background: #f5f6f7;
}

.bbhj-lb-poster-img {
	display: block;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: calc(100vh - 170px);
}

.bbhj-lb-poster-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 11px 16px;
	font-size: 12px;
	line-height: 1.5;
	color: #9aa0a6;
}

.bbhj-lb-goto {
	flex: 0 0 auto;
	color: var(--b2color, #f4511e);
	text-decoration: none;
	white-space: nowrap;
}

.bbhj-lb-goto:hover {
	text-decoration: underline;
}

.bbhj-lb-box-poster .bbhj-lb-note {
	margin: 0;
	padding: 0 16px 14px;
}

@media (max-width: 782px) {
	.bbhj-lb-box-poster {
		max-width: calc(100vw - 20px);
	}

	.bbhj-lb-poster-img {
		max-height: calc(100vh - 190px);
	}
}

/* ============ 图片上的左右切换箭头 ============ */
.bbhj-stage {
	position: relative;
	display: block;
}

.bbhj-arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	width: 22px;
	height: 22px;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	background: rgba(0, 0, 0, 0.34);
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	opacity: 0;
	transform: translateY(-50%);
	transition: opacity 0.18s ease, background 0.18s ease;
	-webkit-appearance: none;
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.bbhj-arrow-prev {
	left: 5px;
}

.bbhj-arrow-next {
	right: 5px;
}

.bbhj-stage:hover .bbhj-arrow,
.bbhj-arrow:focus {
	opacity: 1;
}

.bbhj-arrow:hover {
	background: rgba(0, 0, 0, 0.62);
}

.bbhj-arrow:active {
	transform: translateY(-50%) scale(0.94);
}

/* 只有真·触摸设备（手机/平板）才常显；
   触屏笔记本带鼠标，仍然悬停才出现。 */
@media (hover: none) and (pointer: coarse) {
	.bbhj-arrow {
		opacity: 0.8;
	}
}

/* 「点击放大」提示挪到左下，避开右箭头 */
.bbhj-poster-link .bbhj-zoom {
	right: auto;
	left: 8px;
}

/* ============ 「只显示图片」模式 ============ */
.bbhj-bare {
	position: relative;
	padding: 0;
	border-radius: var(--b2radius, 8px);
	overflow: hidden;
}

.bbhj-bare .bbhj-poster-link {
	border: 0;
	border-radius: 0;
}

