/*
Theme Name: Blog-whsir Child
Description: wh-blog 子主题：仅三个功能（服务器运行天数、十年存档面板、文章列表卡片化）。其余样式保持父主题原样，停用本子主题即完全恢复。
Template: wh-blog
Version: 1.1
Text Domain: Wuhao
*/

/* ============================================================
   布局修正（不修这三处，三个功能都会被父主题的老布局挤坏）
   ============================================================ */
/* 父主题 .header-top 固定 70px 高且内部元素全是浮动：
   高度 auto 时浮动不参与计算，浮动块会溢出到主导航行，
   把导航菜单挤到右边、状态行也被压到导航边线上。
   用 overflow 建立 BFC 真正包住浮动，高度随内容自适应。 */
#masthead .header-top {
	height: auto;
	min-height: 70px;
	overflow: hidden;
}
/* 父主题老容器：inline-block 导致列表与侧栏错位，1px 灰框套住整列 */
#page .border-page {
	display: block;
	border: 0;
}

/* ============================================================
   功能一：服务器已稳定运行 N 天（header.php 中输出）
   ============================================================ */
.whsir-status {
	display: flex;
	align-items: flex-start;
	gap: 7px;
	margin: 4px 0 0;
	font-size: 12px;
	color: #8a8a86;
	line-height: 1.5;
}
.whsir-status .whsir-dot {
	width: 7px;
	height: 7px;
	margin-top: 5px;
	border-radius: 50%;
	background: #28c840;
	box-shadow: 0 0 0 3px rgba(40, 200, 64, .14);
	animation: whsir-breath 2.2s ease-in-out infinite;
	flex: 0 0 auto;
}
/* 文字包成一个整体：小屏折行时按正常文本流动，不再被 flex 拆碎 */
.whsir-status .whsir-status-text {
	flex: 1 1 auto;
	min-width: 0;
}
@keyframes whsir-breath {
	0%, 100% { opacity: 1; }
	50% { opacity: .35; }
}
.whsir-status b {
	color: #FF5E52;
	font-weight: 600;
}

/* ============================================================
   功能二：十年存档面板（JS 自动生成，插入侧栏顶部，年份可点击）
   ============================================================ */
.widget-area .widget.whsir-archive {
	background: #fff;
	border: 1px solid #e6e8ec;
	border-radius: 10px;
	padding: 14px 16px;
	margin-bottom: 16px;
	box-sizing: border-box;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.widget-area .widget.whsir-archive .widget-title {
	background: none;
	border: none;
	padding: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	color: #333;
}
.whsir-archive .whsir-row {
	display: flex;
	align-items: center;
	width: 100%;
	gap: 8px;
	margin: 0 0 7px;
}
.whsir-archive .whsir-row:last-child {
	margin-bottom: 0;
}
.whsir-archive a.whsir-year {
	flex: 0 0 38px;
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
	font-weight: 600;
	color: #55554e;
	text-decoration: none;
	transition: color .2s ease;
}
.whsir-archive a.whsir-year:hover {
	color: #FF5E52;
}
.whsir-archive .whsir-track {
	flex: 1 1 auto;
	min-width: 0;
	display: block;
	height: 12px;
	background: #f0f2f5;
	border-radius: 6px;
	overflow: hidden;
}
.whsir-archive .whsir-bar {
	display: block;
	height: 100%;
	background: #FF5E52;
	border-radius: 6px;
	min-width: 3px;
}
.whsir-archive .whsir-count {
	flex: 0 0 46px;
	text-align: right;
	font-family: Consolas, Monaco, monospace;
	font-size: 11px;
	color: #8a8a86;
}

/* ============================================================
   功能三：文章列表卡片化（只作用于首页/归档列表页，
   独立页面如"关于"用的也是 .type-page，必须排除在外）
   ============================================================ */
body.home #content .type-post,
body.archive #content .type-post {
	/* 父主题内联样式定死 598px，在 640px 内容列里加边框后右侧会空出 42px */
	width: 100%;
	border: 1px solid #e6e8ec;
	border-bottom: 1px solid #e6e8ec;
	border-radius: 10px;
	margin-bottom: 16px;
	box-sizing: border-box;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
	transition: box-shadow .2s, transform .2s, border-color .2s;
}
/* 包住卡片内部的浮动缩略图，防止高度塌陷 */
body.home #content .type-post:after,
body.archive #content .type-post:after {
	content: "";
	display: table;
	clear: both;
}
body.home #content .type-post:hover,
body.archive #content .type-post:hover {
	box-shadow: 0 5px 16px rgba(16, 24, 40, .09);
	border-color: #dde1e7;
	transform: translateY(-2px);
}

/* 小屏兼容 */
@media (max-width: 768px) {
	.whsir-status {
		font-size: 11px;
		line-height: 1.6;
	}
	.whsir-status .whsir-dot {
		margin-top: 5px;
	}
	body.home #content .type-post,
	body.archive #content .type-post {
		transform: none;
	}
}

/* ============================================================
   功能五：文章图片点击放大（lightbox）
   ============================================================ */
/* 正文里的可放大图片显示抓手光标；带链接的图片保持默认
   （single.php 的容器 id 实际是 logPanel，不能用 #content 选择器） */
.entry-content img {
	cursor: zoom-in;
}
.entry-content a img {
	cursor: pointer;
}

.whsir-lb {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 99999;
	background: rgba(10, 12, 16, .92);
	/* 触摸手势全部交给灯箱自己的 JS 处理（双指缩放/拖动/滑动） */
	touch-action: none;
	overflow: hidden;
}
.whsir-lb.whsir-lb-on {
	display: block;
	animation: whsir-lb-fade .18s ease;
}
@keyframes whsir-lb-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
.whsir-lb-img {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	max-width: 92vw;
	max-height: 88vh;
	box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
	cursor: zoom-out;
	touch-action: none;
	will-change: transform;
}
.whsir-lb-close {
	position: absolute;
	top: 12px;
	right: 16px;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 24px;
	line-height: 40px;
	text-align: center;
	padding: 0;
	cursor: pointer;
}
.whsir-lb-close:hover {
	background: rgba(255, 255, 255, .26);
}
.whsir-lb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .14);
	color: #fff;
	font-size: 28px;
	line-height: 40px;
	text-align: center;
	padding: 0;
	cursor: pointer;
}
.whsir-lb-nav:hover {
	background: rgba(255, 255, 255, .26);
}
.whsir-lb-prev {
	left: 14px;
}
.whsir-lb-next {
	right: 14px;
}
.whsir-lb-counter {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	color: rgba(255, 255, 255, .8);
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
}
@media (max-width: 768px) {
	.whsir-lb-nav {
		width: 36px;
		height: 36px;
		font-size: 22px;
	}
	.whsir-lb-prev {
		left: 8px;
	}
	.whsir-lb-next {
		right: 8px;
	}
	.whsir-lb-img {
		max-width: 96vw;
		max-height: 80vh;
	}
}
