/*
Theme Name: Laumy Fresh Theme
Theme URI: https://www.laumy.tech/
Author: Laumy
Author URI: https://www.laumy.tech/
Email: laumy0929@gmail.com
Description: 一个简洁、响应式的WordPress主题，具有固定顶部导航栏、左侧分类专栏、宽幅内容区域和右侧个人资料+最近更新。支持深色模式切换、文章目录、分类展开等功能。
Version: 1.0.0
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
Text Domain: laumy-fresh-theme
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Tags: blog, custom-background, custom-colors, custom-logo, custom-menu, editor-style, featured-images, footer-widgets, full-width-template, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready, block-styles, wide-blocks, accessibility-ready
*/

:root {
	--header-height: 56px;
	--sidebar-left-width: 260px;
	--sidebar-right-width: 300px;
	--container-max-width: 1800px;
	--gap: 14px;
	--color-bg: #ffffff;
	--color-text: #222;
	--color-muted: #666;
	--color-primary: #3498db;
	--color-border: #e6e6e6;
}

html, body {
	margin: 0;
	padding: 0;
	background: var(--color-bg);
	color: var(--color-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
	line-height: 1.6;
}

/* Header */
.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: var(--header-height);
	z-index: 1000;
	background: #fff;
	border-bottom: 1px solid var(--color-border);
}
.admin-bar .site-header { top: 32px; }

.header-inner {
	max-width: min(var(--container-max-width), 98vw);
	margin: 0 auto;
	height: 100%;
	display: grid;
	grid-template-columns: auto auto 1fr auto;
	align-items: center;
	gap: var(--gap);
	padding: 0 10px;
}
.site-title a {
	font-size: 22px;
	font-weight: 800;
	color: rgb(0, 26, 255);
	text-decoration: none;
	font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
	letter-spacing: -0.5px;
	text-shadow: 0 1px 2px rgba(21, 0, 255, 0.1);
	transition: all 0.3s ease;
	position: relative;
}

.site-title a:hover {
	color: #8b5cf6;
	transform: translateY(-1px);
	text-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}



.header-left {
	display: flex;
	align-items: center;
	gap: 12px;
}
.header-center { display: flex; justify-content: center; }
.search-form { width: 100%; max-width: 640px; }
.search-form input[type="search"] {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 12px;
	border: 1px solid var(--color-border);
	border-radius: 6px;
	outline: none;
}
.header-right { 
	display: flex; 
	align-items: center; 
	gap: 12px; 
	justify-content: flex-end; 
	margin-right: 40px;
}
/* Theme toggle */
.theme-toggle { width: auto; height: auto; border: 0; border-radius: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.theme-toggle:focus { outline: none; }
.theme-toggle .toggle-icon { width: 20px; height: 20px; background: none; display: inline-block; background-repeat: no-repeat; background-position: center; background-size: contain; }
/* Light: sun (stroke only, hollow center) */
.theme-toggle .toggle-icon { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><g stroke="%23000" stroke-width="2" fill="none" stroke-linecap="round"><circle cx="12" cy="12" r="4"/><path d="M12 3v2M12 19v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M3 12h2M19 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></g></svg>'); }
/* Dark: moon outline */
body.dark .theme-toggle .toggle-icon { background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" stroke="%23fff" stroke-width="2" fill="none"/></svg>'); }
.header-link { color: #333; text-decoration: none; }
body.dark .header-link { color: var(--color-text); }

/* Layout */
.main-container {
	max-width: min(var(--container-max-width), 98vw);
	margin: 0 auto 18px;
	padding: calc(var(--header-height) + 16px) 10px 0 10px;
	display: grid;
	grid-template-columns: var(--sidebar-left-width) 1fr var(--sidebar-right-width);
	gap: var(--gap);
}

/* Section headers visibility */
.categories-title, .posts-header, .card-header { color: var(--color-text); }

/* adjust when logged-in admin bar exists */
.admin-bar .main-container { padding-top: calc(var(--header-height) + 32px); }

/* sticky offsets closer to header */
.left-sidebar { position: sticky; top: calc(var(--header-height) + 20px); max-height: calc(100vh - var(--header-height) - 48px); overflow: auto; z-index: 2; }
.right-sidebar { position: sticky; top: calc(var(--header-height) + 20px); z-index: 2; max-height: none; overflow: visible; }
.admin-bar .left-sidebar, .admin-bar .right-sidebar { top: calc(var(--header-height) + 52px); }

.content-area { align-self: start; min-width: 0; }

/* 通用卡片样式 */
.categories-card,
.posts-card,
.card,
.toc-card,
.single-article {
	background: #fff;
	border: 1px solid var(--color-border);
	border-radius: 10px;
}

/* 特定卡片样式 */
.categories-card { padding: 12px 0; }
.card { margin-bottom: 16px; }
.single-article { padding: 16px; }
.categories-title {
	display: flex; align-items: center; justify-content: space-between;
	padding: 0 16px 8px 16px;
	border-bottom: 2px solid #eaf7f1;
	margin-bottom: 8px;
	position: relative;
}
.categories-title::before { 
	content: "📁"; 
	font-size: 20px; 
	position: absolute;
	left: 16px;
}
.categories-title .text { 
	font-weight: 700; 
	font-size: 18px; 
	margin-left: 32px;
}
.categories-list { list-style: none; margin: 0; padding: 0; }
.category-item { border-left: 2px solid transparent; }
.category-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; cursor: pointer; }
.category-header:hover { background: #fafafa; }
.category-link { color: #222; text-decoration: none; flex: 1; }
.category-toggle { color: #888; font-size: 12px; }
.subcategory-list { display: none; padding: 4px 0 8px 24px; }
.category-item.expanded > .subcategory-list { display: block; }
.subcategory-list a { display: block; padding: 6px 0; color: #444; text-decoration: none; }

/* Category counts */
.category-count, .subcategory-count {
	background: #f3f5f7;
	color: #666;
	border-radius: 999px;
	padding: 2px 8px;
	font-size: 12px;
	margin-left: 8px;
}



.posts-header { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-weight: 700; }
.posts-list { margin: 0; padding: 4px 10px; list-style: none; }
.post-item { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: start; column-gap: 18px; row-gap: 4px; padding: 10px 0; border-bottom: 1px dashed #eee; }
.post-item > a { display: block; grid-row: 1 / span 3; }
.post-thumb { width: 160px; height: 100px; object-fit: cover; display: block; }
.post-item > div { min-width: 0; }
.post-title { margin: 0 0 6px 0; font-size: 18px; line-height: 1.35; }
.post-title a { text-decoration: none; }
.post-excerpt { margin: 0 0 6px 0; color: var(--color-muted); width: 100%; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; white-space: normal; word-break: break-word; line-height: 1.6; max-height: calc(1.6em * 2); }
.post-meta { 
	font-size: 12px; 
	color: var(--color-muted); 
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.meta-item {
	display: flex;
	align-items: center;
	gap: 4px;
}

.meta-icon,
.meta-item .heat-icon {
	font-size: 14px;
	opacity: 0.8;
}

.meta-item .heat-count {
	color: var(--color-muted);
	font-size: 12px;
}

/* 作者图标样式 - 简洁的人形轮廓 */
.meta-item .author-icon {
	position: relative;
	width: 14px;
	height: 14px;
	display: inline-block;
}

.meta-item .author-icon::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	width: 14px;
	height: 14px;
	background: var(--color-muted);
	border-radius: 50% 50% 0 0;
}

.meta-item .author-icon::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 2px;
	width: 10px;
	height: 8px;
	background: var(--color-muted);
	border-radius: 0 0 5px 5px;
}


.card-header { padding: 12px 16px; border-bottom: 1px solid var(--color-border); font-weight: 700; }
.card-body { padding: 12px 16px; }
.profile-avatar { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); background: #fafafa; }
.profile-name { margin: 12px 0 4px 0; font-size: 20px; font-weight: 700; }
.profile-occupation { margin: 0 0 8px 0; color: var(--color-muted); }
.profile-desc { margin: 0; color: #444; }

.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-item { display: grid; grid-template-columns: 84px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px dashed #eee; }
.recent-thumb { width: 84px; height: 58px; object-fit: cover; border-radius: 4px; border: 1px solid var(--color-border); background: #fafafa; }
.recent-title { margin: 0; font-size: 14px; }
.recent-title a { text-decoration: none; }
.recent-date { font-size: 12px; color: var(--color-muted); }

/* Pagination */
.pagination { padding: 12px 16px 16px 16px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.pagination a, .pagination span { padding: 6px 10px; border: 1px solid var(--color-border); border-radius: 6px; text-decoration: none; color: #333; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }


.toc-header { 
	display: flex; 
	align-items: center; 
	justify-content: space-between; 
	padding: 10px 16px; 
	border-bottom: 1px solid var(--color-border); 
	position: relative; 
}
.toc-header::before { 
	content: "📋"; 
	font-size: 18px; 
	position: absolute; 
	left: 16px; 
}
.toc-header .text { 
	margin: 0 0 0 32px; 
	font-size: 16px; 
	font-weight: 700; 
}
.toc-list, .toc-children { list-style: none; margin: 8px 0 12px 0; padding: 0 16px; }
.toc-item { margin: 4px 0; }
.toc-link { text-decoration: none; color: #333; }

/* 多级目录样式 */
.toc-children { margin-left: 12px; border-left: 2px solid #f2f2f2; padding-left: 10px; }
.toc-children .toc-children { margin-left: 8px; border-left: 1px solid #e0e0e0; padding-left: 8px; }
.toc-children .toc-children .toc-children { margin-left: 6px; border-left: 1px solid #d0d0d0; padding-left: 6px; }
.toc-children .toc-children .toc-children .toc-children { margin-left: 4px; border-left: 1px solid #c0c0c0; padding-left: 4px; }


.single-title { margin-top: 0; }
.single-title a { text-decoration: none; }

/* 文章内容页面的元数据样式 */
.single-meta { 
	font-size: 14px; 
	color: var(--color-muted); 
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
	margin-bottom: 16px;
	padding: 8px 0;
}

.single-meta .meta-item {
	display: flex;
	align-items: center;
	gap: 6px;
}

.single-meta .meta-icon {
	font-size: 16px;
	opacity: 0.8;
}
.single-article, .single-article * { box-sizing: border-box; }
.single-article img { max-width: 100%; height: auto; }
.single-article table { max-width: 100%; display: block; overflow: auto; border-collapse: collapse; }
.single-article pre, .single-article code { max-width: 100%; display: block; overflow: auto; }
.single-article p, .single-article li { word-wrap: break-word; overflow-wrap: break-word; }

/* Previous/Next post navigation */
.post-nav { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-border); display: flex; justify-content: space-between; gap: 12px; }
.post-nav-prev, .post-nav-next { max-width: 48%; }
.post-nav a { color: var(--color-primary); text-decoration: none; word-break: break-word; }
.post-nav a:hover { text-decoration: underline; }

/* Footer */
.site-footer { border-top: 1px solid var(--color-border); padding: 16px; text-align: center; color: var(--color-muted); }
.site-footer a { color: var(--color-muted); text-decoration: none; }

/* Dark mode */
body.dark { 
	--color-bg: #181a1b; 
	--color-text: #eceff1; 
	--color-muted: #b8c1c8; 
	--color-border: #2e3439; 
	background: var(--color-bg); 
	color: var(--color-text); 
}

body.dark .site-header { background: #1f2224; border-color: var(--color-border); }
body.dark .categories-card,
body.dark .posts-card,
body.dark .card,
body.dark .toc-card,
body.dark .single-article { background: #202225; border-color: var(--color-border); }
body.dark .search-form input[type="search"] { background: #202225; color: var(--color-text); border-color: var(--color-border); }
body.dark .search-form input[type="search"]::placeholder { color: var(--color-muted); }
body.dark .categories-title { border-bottom-color: var(--color-border); }
body.dark .category-link { color: var(--color-text); }
body.dark .subcategory-list a { color: var(--color-muted); }
body.dark .recent-title a { color: var(--color-text); }
body.dark .toc-link, 
body.dark .header-link { color: var(--color-text); }



/* Responsive */
@media (max-width: 1200px) {
	:root { --sidebar-left-width: 200px; --sidebar-right-width: 220px; }
}
@media (max-width: 992px) {
	.main-container { grid-template-columns: 1fr; }
	.left-sidebar, .right-sidebar { position: static; }
}
@media (max-width: 768px) {
	/* 移动设备：隐藏标题和"支持与合作"链接，保留搜索框、背景切换和首页按钮 */
	.site-title { display: none; }
	.header-link[href*="%e8%81%94%e7%b3%bb%e6%88%91"] { display: none; } /* 隐藏"支持与合作"链接 */
	
	/* 调整header布局为三列布局 */
	.header-inner {
		grid-template-columns: auto 1fr auto;
		justify-items: center;
	}
	
	/* 首页按钮放在左边 */
	.header-left {
		grid-column: 1;
		justify-self: start;
	}
	
	/* 搜索框居中显示 */
	.header-center {
		grid-column: 2;
		justify-self: center;
	}
	
	/* 背景切换按钮移到搜索框右侧 */
	.header-right {
		grid-column: 3;
		justify-self: end;
	}
	
	/* 移动设备上首页按钮样式调整 */
	.header-left .header-link {
		font-size: 12px;
		padding: 4px 8px;
		background: transparent;
		color: var(--color-text);
		border-radius: 4px;
		text-decoration: none;
		white-space: nowrap;
	}
	
	.header-left .header-link:hover {
		color: var(--color-primary);
		background: rgba(0, 132, 255, 0.1);
	}
}





/* Profile card */
.profile-card .card-body { text-align: center; }
/* Center name alone */
.profile-name-wrap { display: inline-block; position: relative; text-align: center; }
/* Name visual */
.profile-name { font-size: 28px; font-weight: 800; line-height: 1.2; }
/* Badge positioned to the right of the name; it doesn't affect centering */
.profile-job-badge { position: absolute; left: 100%; margin-left: 8px; top: -6px; background: #2ecc71; color: #fff; border-radius: 999px; padding: 0 7px; font-size: 10px; white-space: nowrap; }
.profile-desc { margin-top: 6px; }
.profile-stats { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat-item { background: transparent; border: 0; box-shadow: none; padding: 8px 6px; }
.stat-label { display: block; font-size: 12px; color: var(--color-muted); }
.stat-number { display: block; font-size: 18px; font-weight: 700; margin-top: 4px; }

/* Hide profile card header */
.profile-card .card-header { display: none; }

/* TOC collapse and highlight */
.toc-item { position: relative; padding-left: 16px; }
.toc-item.has-children > .toc-arrow { position: absolute; left: 0; top: 0.55em; width: 12px; height: 12px; line-height: 12px; cursor: pointer; color: #666; }
.toc-item.has-children.expanded > .toc-arrow { transform: rotate(90deg); }
.toc-item > .toc-link.active { color: #e74c3c; font-weight: 700; }
.toc-item > .toc-children { display: none; }
.toc-item.expanded > .toc-children { display: block; }

.toc-link .toc-num{ display:inline-block; min-width:1.6em; color:#999; margin-right:2px; }
.toc-list > .toc-item > .toc-link .toc-num{ min-width:1.1em; margin-right:0; }

/* Comments */
.comments-area { margin-top: 18px; }
.comments-wrap { margin-top: 12px; border-top: 1px solid var(--color-border); padding-top: 14px; }
.comments-title { margin: 0 0 10px 0; font-size: 18px; font-weight: 700; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .children { list-style: none; margin-left: 24px; }
.comment-body { border-bottom: 1px dashed var(--color-border); padding: 10px 0; }
.comment-meta { font-size: 12px; color: var(--color-muted); margin-bottom: 6px; }
.comment-content { font-size: 14px; }
.comment-nav { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; }
.comment-respond { margin-top: 12px; }
.comment-respond input[type="text"],
.comment-respond input[type="email"],
.comment-respond input[type="url"],
.comment-respond textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--color-border); border-radius: 6px; padding: 8px 10px; background: #fff; color: var(--color-text); }
.comment-respond .form-submit .submit, .comment-respond .button { background: var(--color-primary); color: #fff; border: none; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
.comment-respond .form-submit .submit:hover { opacity: 0.9; }
body.dark .comment-respond input[type="text"],
body.dark .comment-respond input[type="email"],
body.dark .comment-respond input[type="url"],
body.dark .comment-respond textarea { background: #202225; color: var(--color-text); border-color: var(--color-border); }

/* Comment form inline fields */
.comment-fields-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#url, .comment-form-url { display: none !important; }

/* Simple code block background */
.single-article pre { background-color: #f7f7f7 !important; }

/* 分类展开/收起图标样式 */
.category-arrow {
	color: #666;
	font-size: 8px;
	margin-right: 4px;
	transition: transform 0.2s;
	width: 8px;
	text-align: center;
}

.category-item.expanded .category-arrow {
	transform: rotate(90deg);
}

/* 子分类缩进和左边框样式 */
.subcategory-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
	border-left: 2px solid var(--color-border);
	margin-left: 20px;
}

.category-item.expanded .subcategory-list {
	max-height: 500px;
}

.subcategory-list li {
	padding: 4px 12px 4px 20px;
	position: relative;
}

.subcategory-list li:before {
	content: '';
	position: absolute;
	left: -2px;
	top: 50%;
	width: 8px;
	height: 2px;
	background: var(--color-border);
	transform: translateY(-50%);
}

.subcategory-list a {
	color: var(--color-muted);
	text-decoration: none;
	font-size: 14px;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.subcategory-list a:hover {
	color: var(--color-text);
}
