/**
 *
 * 来源：原 hr-category-grid.css 的「十、文章内页网格风格样式」区块 +
 * 「通用弹窗（分享/赞赏）」区块。拆分动机：文章页此前加载整个 42.9KB
 * 分类/首页样式包，其中约 2/3（网格卡片/封面/首页模块/轮播）在单页
 * 从不渲染（R-10/C-09 挂账项，Chrome Coverage 的静态等价拆分）。
 * 分类网格页与首页网格的渲染路径不变，仍加载原文件。
 *
 * @package HaoResource
 *
 * 文件契约：
 * - 作用域：文章内页（.hr-single-article）、论坛帖子内页、分享/赞赏弹窗
 * - 加载方：条件加载：is_singular(post/hao_forum_post)（inc/category-layout.php）
 * - 依赖：components.css、cards.css（弹窗关闭钮几何在 hr-enhance.css）
 * - 注意：与 single-grid.css（评论/互动条）在单页同时加载，二者职责互补。
 */

/* =========================================================================
 * 十、文章内页网格风格样式
 *   template-parts/single-hr-grid.php 已作为死文件删除，
 *   本节选择器仍由 single.php 使用，规则保留。
 *   1. 面包屑导航
 *   2. 文章标题
 *   3. 分隔符
 *   4. 作者栏（头像 + 昵称 + 等级标识 + 右侧关注/私信按钮，整行带线框）
 *   5. 正文 + 底部评论区复用论坛样式（此处仅覆盖顶部区域）
 * ======================================================================= */

.hr-single-article .hr-breadcrumb {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 4px;
	margin-bottom: 12px;
	font-size: var(--font-size-sm, 13px);
	color: var(--color-text-secondary, #606266);
}

.hr-single-article .hr-breadcrumb a {
	color: var(--color-text-secondary, #606266);
	text-decoration: none;
	white-space: nowrap;
	flex-shrink: 0;
	transition: color 0.2s var(--ease-ios, cubic-bezier(0.2, 0, 0.2, 1));
}

/* 面包屑首页图标 — inline-flex 横向排列，避免 svg display:block 导致上下堆叠
 *   在部分浏览器把图标撑高，导致 inline-flex 盒子变高、图标与文字纵向错位 */
.hr-single-article .hr-crumb-home {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	line-height: 1;
}

.hr-single-article .hr-crumb-home svg {
	flex-shrink: 0;
	width: 14px;
	height: 14px;
	display: block;
}

.hr-single-article .hr-breadcrumb a:hover {
	color: var(--color-primary, #22c55e);
}

.hr-single-article .hr-crumb-sep {
	color: var(--color-text-tertiary, #909399);
	user-select: none;
	flex-shrink: 0;
}

.hr-single-article .hr-crumb-current {
	color: var(--color-text, #303133);
	font-weight: 500;

	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* 10.2 文章标题 */
.hr-single-article .hr-article-title {
	margin: 0 0 12px;
	font-size: 1.5em;
	font-weight: 700;
	line-height: 1.35;
	color: var(--color-text, #303133);
}

/* 2026-11-18 站主指定：论坛帖内页标题与论坛首页卡片统一为 19px，
 * 不再使用 1.5em（桌面偏大、移动端 1.3em 偏小的两档不一致）。 */
.single-hao_forum_post .hr-single-article .hr-article-title {
	font-size: 19px;
}

/* 10.3 作者栏（平铺无线框，垂直方向整体缩小 25%） */
.hr-single-article .hr-author-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 0;
	margin-bottom: 4px;
}

.hr-single-article .hr-author-avatar-link {
	/* 改 flex 居中。原本 block 包 inline-flex 头像，行盒基线对齐
	 * 把 link 撑到 41.5px 且头像在内部偏上 ~2.7px，与关注/私信按钮不对齐 */
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.hr-single-article .hr-author-bar .user-avatar-wrapper.avatar-small,
.hr-single-article .hr-author-bar .user-avatar-img {
	width: 30px;
	height: 30px;
	border-radius: var(--radius-avatar);
	object-fit: cover;
}

.hr-single-article .hr-author-bar .user-avatar-wrapper.avatar-small {
	display: flex;
	align-items: center;
	justify-content: center;
}

.hr-single-article .hr-author-info {
	display: flex;
	flex-direction: column;
	justify-content: center;

	/* 纵向 flex 默认 align-items:stretch 会把昵称 <a> 拉撑到整行宽，
	 * 导致头像与按钮之间的空白区整块可点击、误跳用户中心；改 flex-start 让链接只包裹文字 */
	align-items: flex-start;
	gap: 3px; /* 原 4px → 3px，缩小 25% */
	flex: 1;
	min-width: 0;
}

.hr-single-article .hr-author-name {
	font-size: var(--text-base, 14px); /* 原 15px → 14px */
	font-weight: 500;
	color: var(--color-text, #303133);
	text-decoration: none;
	transition: color 0.2s var(--ease-ios, cubic-bezier(0.2, 0, 0.2, 1));
}

.hr-single-article .hr-author-name:hover {
	color: var(--color-primary, #22c55e);
}

/* 关注/私信按钮容器：推到最右 */
.hr-single-article .hr-user-actions {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
	margin-left: auto;
}

/* 按钮：垂直方向缩小 25%（原 padding 4px 12px → 3px 12px） */
.hr-single-article .hr-user-actions .hao-follow-btn,
.hr-single-article .hr-user-actions .hao-hover-card-pm-btn {
	padding: 3px 12px;
	font-size: var(--text-sm, 12px);
	line-height: 1.4;
}

/* 10.4 作者栏与时间行之间的分隔符 */
.hr-single-article .hr-meta-divider {
	height: 1px;
	margin: 0 0 2px;
	background: var(--color-divider, rgb(0 0 0 / 6%));
}

/* 10.5 时间 + 阅读量行：发布时间 + 更新时间（左）+ 阅读量（最右） */
.hr-single-article .hr-article-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 12px;
	/* 字号 12px（--font-size-sm 实际解析值）→ 14px，站主指定，移动端同样生效
		（下方 ≤768px 媒体查询无字号覆盖，继承本值） */
	font-size: 14px;
	color: var(--color-text-secondary, #606266);
}

.hr-single-article .hr-meta-time {
	color: var(--color-text-secondary, #606266);
}

.hr-single-article .hr-meta-update {
	color: var(--color-text-tertiary, #909399);
}

/* 统计数据组（收藏/点赞/阅读量）推到最右 */
.hr-single-article .hr-meta-stats {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	margin-left: auto;
}

.hr-single-article .hr-meta-favorites,
.hr-single-article .hr-meta-likes,
.hr-single-article .hr-meta-views {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--color-text-secondary, #606266);
}

.hr-single-article .hr-meta-favorites svg,
.hr-single-article .hr-meta-likes svg,
.hr-single-article .hr-meta-views svg {
	opacity: 0.7;
}

/* 移动端：时间在左，统计组在右 */
@media (width <= 768px) {
	.hr-single-article .hr-article-title {
		font-size: 1.3em;
	}

	/* 有更新时间时隐藏发布时间+分隔点——更新时间覆盖发布时间，
	 * 时间与统计一行放得下，不再右飘换行（:has 不支持的旧浏览器回退为两行换行） */
	.hr-single-article .hr-article-meta:has(.hr-meta-update) .hr-meta-time,
	.hr-single-article .hr-article-meta:has(.hr-meta-update) .hr-meta-sep {
		display: none;
	}

	.hr-single-article .hr-meta-stats {
		gap: var(--hao-gap-block, 14px);
	}
}

/* 10.6 正文段落间距覆盖（仅网格内页，不影响论坛内页） */
.hr-single-article .single-article-content p {
	margin-bottom: 12px;
}

/* 正文首元素顶边距归零 —— 首元素是 <h2>/<h3> 小节标题时自带大 margin-top，
 * 叠加在时间行下方造成「隔得远」；归零后所有文章与时间行的间距统一为时间行的 12px，
 * 无需再动时间行的 margin */
.hr-single-article .single-article-content > :first-child {
	margin-top: 0;
}

/* 标题间距与段落统一 12px（hr-enhance 的 em 边距在内页太宽） */
.hr-single-article .single-article-content h2,
.hr-single-article .single-article-content h3,
.hr-single-article .single-article-content h4 {
	margin: 12px 0;
}

/* 文章内页单张竖图限宽 75%（lazyload.js 识别打标 is-portrait-single）
 * 完整显示不裁切，居中；多图/横图不受影响 */
.single-article-content img.is-portrait-single {
	max-width: 75% !important;
	width: auto;
	height: auto;
	display: block;
	margin: 0 auto;
}

@media (width <= 768px) {
	/* 小屏放宽到 90%，避免竖图太窄 */
	.single-article-content img.is-portrait-single {
		max-width: 90% !important;
	}
}

/* ------ 通用弹窗（分享 / 赞赏） ------ */
.hao-modal-mask {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgb(15 18 25 / 55%);
	backdrop-filter: blur(4px);
	animation: haoModalFade 0.18s ease;
}
.hao-modal-mask[hidden] { display: none; }

@keyframes haoModalFade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.hao-modal-card {
	position: relative;
	width: 100%;
	max-width: 380px;
	background: var(--bg-card, #fff);
	border-radius: var(--radius-modal, 14px);
	padding: 22px 22px 18px;
	box-shadow: 0 18px 60px rgb(0 0 0 / 25%);
	animation: haoModalPop 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes haoModalPop {
	from { transform: translateY(14px) scale(0.96); opacity: 0; }
	to { transform: translateY(0) scale(1); opacity: 1; }
}

.hao-modal-title {
	margin: 0 0 8px;
	font-size: 17px;
	font-weight: 700;
	color: var(--color-text, #303133);
	text-align: center;
}

.hao-modal-close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 30px;
	height: 30px;
	border: 0;
	background: transparent;
	font-size: 22px;
	line-height: 1;
	color: var(--color-text-tertiary, #909399);
	cursor: pointer;
	border-radius: 50%;
}

.hao-modal-close:hover {
	color: var(--color-text, #303133);
	background: rgb(0 0 0 / 5%);
}

/* ------ 赞赏弹窗 ------ */
.hao-reward-tip {
	margin: 0 0 14px;
	font-size: 13px;
	color: var(--color-text-secondary, #606266);
	text-align: center;
}

.hao-reward-qr-wrap {
	display: flex;
	justify-content: center;
	margin-bottom: 14px;
}

.hao-reward-qr {
	width: 210px;
	height: 210px;
	object-fit: contain;
	border-radius: var(--radius-card-sm, 10px);
	background: #fff;
	border: 1px solid var(--color-border, rgb(0 0 0 / 8%));
}

.hao-reward-wallet {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border: 1px dashed var(--color-border, rgb(0 0 0 / 15%));
	border-radius: var(--radius-card-sm, 10px);
	background: rgb(0 0 0 / 2%);
}

.hao-reward-wallet-type {
	flex-shrink: 0;
	font-size: 12px;
	font-weight: 700;
	color: var(--color-primary, #22c55e);
	background: rgb(34 197 94 / 12%);
	border-radius: var(--radius-tag, 6px);
	padding: 3px 8px;
}

.hao-reward-wallet-addr {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 12px;
	color: var(--color-text, #303133);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	direction: ltr;
}

.hao-reward-copy {
	flex-shrink: 0;
	border: 0;
	background: var(--color-primary, #22c55e);
	color: #fff;
	font-size: 12px;
	padding: 5px 10px;
	border-radius: var(--radius-btn, 7px);
	cursor: pointer;
}
.hao-reward-copy:hover { filter: brightness(1.06); }

/*
	副本漏抄；站主拍板按两个内页的共用模式统一。本文件只保留页面差异：
	文章内页封面裁切（1.1:0.618）即基础口径随基础组在 cards.css；论坛内页
	自适应覆盖见本文件末尾 .forum-single-page .hao-share-auto 块。
	JS 钩子（data-share-copy / data-hao-modal-close / #hao-share-modal）不变 ------ */

/* 弹窗暗色模式适配（跟随主题变量；赞赏弹窗共用 .hao-modal-card 外壳） */
[data-theme="dark"] .hao-modal-card {
	background: var(--bg-card, #1c1f26);
}

[data-theme="dark"] .hao-reward-wallet {
	background: rgb(255 255 255 / 4%);
}

[data-theme="dark"] .hao-reward-qr {
	background: #fff; /* 二维码底恒为白，保证扫码 */
}

/* =========================================================================
 * ======================================================================= */

/* 评论「回复」按钮移除图标（站主指定「回复那栏移除那个图标」）——
 * 模板为全站共用部件，此处按 body 类定界只对论坛内页隐藏 svg */
.forum-single-page .comment-reply-btn svg {
	display: none;
}

/* 移动端回复行改方形（站主指定）——回复/编辑/删除按钮、评论输入框、
 * 发送按钮由胶囊圆角改小圆角 */
@media (max-width: 768px) {
	.forum-single-page .comment-reply-btn {
		border-radius: var(--radius-btn, 6px);
	}

	.forum-single-page .card-comment-input,
	.forum-single-page .card-comment-send-btn {
		border-radius: var(--radius-btn, 6px);
	}
}

.forum-single-page .hao-share-auto .hao-share-media {
	aspect-ratio: auto;
	width: fit-content;
	max-width: 100%;
	margin: 0 auto 12px;
}

.forum-single-page .hao-share-auto .hao-share-media img {
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 280px;
	margin: 0 auto;
	object-fit: contain;
}

/* =========================================================================
 *   forum-cpt.php hao_forum_gallery_waterfall() 把内页第一个 core/gallery 块
 *   使用 cards.css 的 .hr-collage-* Telegram 式自动拼图（全站合并包，零新增 CSS）。
 *   grid 方案（!important）互相打架，产生空洞错位，教训入册第 9 章。
 * ======================================================================= */

/* =========================================================================
 * 版块「登录可见」门控（8.0.1）：游客访问锁定版块帖子（body.forum-gated，
 * single-hao_forum_post.php 输出）→ 正文媒体毛玻璃。图库块已由 post-images.php
 * 加 .hao-gated-media 走 cards.css 规则，此处覆盖图库之外的零散正文图/视频/嵌入。
 * 头像在 .hr-author-bar（本选择器之外）、表情 img.hao-emoji 显式豁免。
 * ======================================================================= */
body.forum-gated .single-article-content img,
body.forum-gated .single-article-content video,
body.forum-gated .single-article-content iframe {
	filter: blur(18px);
	transform: scale(1.12);
	pointer-events: none;
}

body.forum-gated .single-article-content img.hao-emoji {
	filter: none;
	transform: none;
	pointer-events: auto;
}
