/*
Theme Name: Bashige Theme
Theme URI: https://theme.bashige.com
Author: Custom
Description: Bashige Theme — 双栏布局；白纸黑字配色，宋体系中文排版（思源宋体等）。
Version: 1.5.0
Requires at least: 5.9
Tested up to: 7.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bashige-theme
Tags: two-columns, right-sidebar, custom-menu, featured-images, blog, minimal
*/

/* --------------------------------------------------------------------------
   设计变量 — 白纸黑字；宋体 / 明体系（笔画清晰、有棱有角）
   -------------------------------------------------------------------------- */
:root {
	--paper: #ffffff;
	--paper-subtle: #f5f5f5;
	--ink: #000000;
	--ink-muted: #333333;
	--ink-faint: #555555;
	--line: rgba(0, 0, 0, 0.12);
	--accent: #000000;
	--accent-soft: rgba(0, 0, 0, 0.06);
	/* 简体宋体在前；思源宋体笔画分明，再回退系统宋体与仿宋 */
	--font-serif: "Noto Serif SC", "Noto Serif JP", "Source Han Serif SC", "Songti SC", "SimSun", "NSimSun", "FangSong", "STFangSong", "KaiTi", serif;
	--measure: 65ch;
	--space-xs: 0.5rem;
	--space-sm: 1rem;
	--space-md: 1.75rem;
	--space-lg: 3rem;
	--space-xl: 4.5rem;
	--radius: 2px;
	/* 列表缩略图、正文图片：直角 */
	--radius-image: 0;
	/* 页眉与主内容区水平对齐 */
	--site-gutter: var(--space-sm);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--font-serif);
	font-size: 1rem;
	line-height: 1.85;
	color: var(--ink);
	background-color: var(--paper);
	font-weight: 400;
	letter-spacing: 0.04em;
	font-feature-settings: "kern" 1;
}

a {
	color: var(--accent);
	text-decoration: underline;
	text-underline-offset: 0.18em;
	transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover,
a:focus-visible {
	color: var(--ink-muted);
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}

/* --------------------------------------------------------------------------
   布局外壳
   -------------------------------------------------------------------------- */
.site {
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow-x: clip;
}

/* 单一内容栏：标题区与主栏共用同一 max-width 与左右内边距，保证与文章左端对齐 */
.site-inner {
	flex: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--site-gutter);
	padding-right: var(--site-gutter);
	box-sizing: border-box;
	min-height: 0;
}

.site-main-wrap {
	flex: 1;
	width: 100%;
	margin: 0;
	padding: var(--space-md) 0 var(--space-xs);
}

.layout-two-col {
	display: flex;
	flex-wrap: wrap;
	gap: 0;
	align-items: flex-start;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

/* 主栏略加宽（约 8 : 3），正文不再限制 65ch，避免栏内右侧大块留白 */
.layout-primary {
	flex: 8 1 0;
	min-width: 0;
	padding: var(--space-md) var(--space-md) var(--space-md) 0;
	border-right: 1px solid var(--line);
}

.layout-secondary {
	flex: 3 1 0;
	min-width: 220px;
	padding: var(--space-md) 0 var(--space-md) var(--space-md);
}

@media (max-width: 782px) {
	.layout-two-col {
		flex-direction: column;
		border: none;
	}

	.layout-primary {
		border-right: none;
		border-bottom: 1px solid var(--line);
		padding: var(--space-md) 0;
	}

	.layout-secondary {
		padding: var(--space-md) 0 0;
		min-width: 100%;
	}
}

/* --------------------------------------------------------------------------
   页眉
   -------------------------------------------------------------------------- */
.site-header {
	padding: var(--space-lg) 0 var(--space-md);
	margin: 0;
	box-sizing: border-box;
}

.site-branding {
	text-align: left;
}

/* 主标题与副标题同一行，与下方 .layout-primary 左缘对齐 */
.site-branding__row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 1rem;
	row-gap: var(--space-xs);
}

.site-branding__row--logo {
	align-items: center;
}

.site-branding__row .site-title,
.site-branding__row .site-description {
	flex: 0 1 auto;
	min-width: 0;
}

.site-title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	letter-spacing: 0.14em;
}

.site-title a {
	color: var(--ink);
	text-decoration: none;
	font-weight: 700;
}

.site-title a:hover {
	text-decoration: none;
	opacity: 0.7;
}

.site-description {
	margin: 0;
	font-size: 0.8125rem;
	color: var(--ink-muted);
	font-weight: 400;
	letter-spacing: 0.06em;
}

/* --------------------------------------------------------------------------
   导航
   -------------------------------------------------------------------------- */
.main-navigation ul {
	list-style: none;
	margin: var(--space-md) 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-md);
}

.main-navigation a {
	color: var(--ink-muted);
	font-size: 0.875rem;
	letter-spacing: 0.08em;
	text-decoration: none;
}

.main-navigation a:hover,
.main-navigation .current-menu-item a {
	color: var(--ink);
	text-decoration: none;
}

/* --------------------------------------------------------------------------
   文章列表
   -------------------------------------------------------------------------- */
.post-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.post-list__item {
	padding: var(--space-md) 0;
	border-bottom: 1px solid var(--line);
}

.post-list__item:first-child {
	padding-top: 0;
}

.post-list__item:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.post-list__meta {
	font-size: 0.75rem;
	color: var(--ink-faint);
	letter-spacing: 0.06em;
	margin-bottom: var(--space-xs);
}

.post-list__title {
	margin: 0 0 var(--space-xs);
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.06em;
}

.post-list__title a {
	color: var(--ink);
	text-decoration: none;
}

.post-list__title a:hover {
	color: var(--ink);
	text-decoration: underline;
}

.post-list__excerpt {
	margin: 0;
	font-size: 0.9375rem;
	color: var(--ink-muted);
	line-height: 1.8;
}

.post-list__more {
	margin: var(--space-sm) 0 0;
	font-size: 0.875rem;
}

.post-list__more a {
	font-weight: 600;
	text-decoration: none;
}

.post-list__more a:hover {
	text-decoration: underline;
}

.post-list__thumb {
	position: relative;
	margin-bottom: var(--space-sm);
	overflow: hidden;
	border-radius: var(--radius-image);
	background: var(--paper-subtle);
}

.post-list__thumb img {
	display: block;
	width: 100%;
	object-fit: cover;
	aspect-ratio: 16 / 9;
}

.post-list__sticky {
	position: absolute;
	top: 0;
	left: 0;
	padding: 0.25em 0.6em;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.4;
	color: var(--paper);
	background-color: var(--ink);
	border-radius: 0 0 var(--radius) 0;
}

/* 分页 */
.pagination {
	margin-top: var(--space-lg);
	padding-top: var(--space-md);
	border-top: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm);
	align-items: center;
	justify-content: space-between;
}

.pagination .page-numbers {
	font-size: 0.875rem;
	color: var(--ink-muted);
	padding: 0.35em 0.65em;
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.pagination a.page-numbers {
	text-decoration: none;
}

.pagination .page-numbers.current,
.pagination a.page-numbers:hover {
	color: var(--ink);
	border-color: var(--ink-faint);
	background: var(--accent-soft);
}

/* --------------------------------------------------------------------------
   单篇正文（single）
   -------------------------------------------------------------------------- */
.entry-header {
	margin-bottom: var(--space-md);
}

.entry-title {
	margin: 0 0 var(--space-xs);
	font-size: 1.5rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	line-height: 1.45;
}

.entry-meta {
	font-size: 0.75rem;
	color: var(--ink-faint);
	letter-spacing: 0.06em;
}

/* 占满主栏宽度；正文段落与列表两端对齐（中文用 inter-ideograph） */
.entry-content {
	max-width: 100%;
}

.entry-content p,
.entry-content li {
	text-align: justify;
	text-justify: inter-ideograph;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
	text-align: start;
	text-justify: auto;
}

.entry-content pre,
.entry-content .wp-block-code,
.entry-content table {
	text-align: start;
	text-justify: auto;
}

/* 正文内图片：figure 圆角 + 裁剪；内层 img 不再单独圆角，避免叠成双重 */
.entry-content figure {
	text-align: start;
	text-justify: auto;
	border-radius: var(--radius-image);
	overflow: hidden;
}

.entry-content img {
	border-radius: var(--radius-image);
}

.entry-content figure img {
	border-radius: 0;
}

.entry-content img.emoji,
.entry-content img.wp-smiley {
	border-radius: 0;
}

/* --------------------------------------------------------------------------
   WordPress 7.0 区块间距适配
   WP 7.0 将区块布局改为通过父容器 gap 控制间距，并将各区块自身
   margin 清零。经典主题若未声明 layout 支持，连续图片等区块之间
   的间距会消失。以下规则恢复合理的垂直间距。
   -------------------------------------------------------------------------- */

/*
 * 通用区块垂直间距：为 .entry-content 内直接子区块恢复上下 margin。
 * 使用 :where() 降低优先级，避免覆盖编辑器内联样式。
 */
.entry-content > :where(:not(:first-child)) {
	margin-top: var(--space-md);
}

.entry-content > :where(:not(:last-child)) {
	margin-bottom: 0;
}

/*
 * 图片区块（含 figure.wp-block-image）：确保上下间距存在。
 * WP 7.0 core 可能将 .wp-block-image 的 margin 设为 0，这里显式恢复。
 */
.entry-content .wp-block-image {
	margin-top: var(--space-md);
	margin-bottom: var(--space-md);
}

.entry-content > .wp-block-image:first-child {
	margin-top: 0;
}

.entry-content > .wp-block-image:last-child {
	margin-bottom: 0;
}

/*
 * 连续图片之间保持间距（两个 figure 紧邻时）。
 */
.entry-content .wp-block-image + .wp-block-image {
	margin-top: var(--space-md);
}

/*
 * 画廊区块间距。
 */
.entry-content .wp-block-gallery {
	margin-top: var(--space-md);
	margin-bottom: var(--space-md);
}

/*
 * 段落、标题、列表等常规区块也确保间距（防止 WP 7.0 清零）。
 */
.entry-content > p,
.entry-content > .wp-block-heading,
.entry-content > h1,
.entry-content > h2,
.entry-content > h3,
.entry-content > h4,
.entry-content > h5,
.entry-content > h6,
.entry-content > ul,
.entry-content > ol,
.entry-content > blockquote,
.entry-content > .wp-block-quote,
.entry-content > .wp-block-list,
.entry-content > pre,
.entry-content > .wp-block-code,
.entry-content > .wp-block-preformatted,
.entry-content > .wp-block-verse,
.entry-content > .wp-block-table,
.entry-content > .wp-block-separator,
.entry-content > .wp-block-group,
.entry-content > .wp-block-columns,
.entry-content > .wp-block-cover,
.entry-content > .wp-block-media-text,
.entry-content > .wp-block-embed,
.entry-content > .wp-block-video,
.entry-content > .wp-block-audio {
	margin-top: var(--space-md);
	margin-bottom: 0;
}

.entry-content > p:first-child,
.entry-content > .wp-block-heading:first-child,
.entry-content > h1:first-child,
.entry-content > h2:first-child,
.entry-content > h3:first-child,
.entry-content > h4:first-child,
.entry-content > h5:first-child,
.entry-content > h6:first-child {
	margin-top: 0;
}

/*
 * WP 7.0 has-global-padding / wp-block-post-content 布局容器适配：
 * 确保即使 WP 生成 .is-layout-constrained / .is-layout-flow 容器，
 * 子元素仍有垂直间距。
 */
.entry-content.is-layout-flow > *,
.entry-content.is-layout-constrained > * {
	margin-top: 0;
	margin-bottom: 0;
}

.entry-content.is-layout-flow > * + *,
.entry-content.is-layout-constrained > * + * {
	margin-top: var(--space-md);
}

/*
 * WP 7.0 可能对 figure 添加 margin: 0，这里用更高优先级覆盖。
 */
.entry-content figure.wp-block-image {
	margin-top: var(--space-md);
	margin-bottom: var(--space-md);
}

.entry-content > figure.wp-block-image:first-child {
	margin-top: 0;
}

.entry-content > figure.wp-block-image:last-child {
	margin-bottom: 0;
}

.entry-content p:first-child {
	margin-top: 0;
}

.entry-content p:last-child {
	margin-bottom: 0;
}

/* 区块编辑器：宽栏 / 通栏 */
.entry-content .alignwide {
	max-width: min(70rem, 96vw);
	margin-left: auto;
	margin-right: auto;
	width: 100%;
}

.entry-content .alignfull {
	max-width: none;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	position: relative;
}

.entry-footer {
	margin-top: var(--space-lg);
	padding-top: var(--space-md);
	border-top: 1px solid var(--line);
	font-size: 0.8125rem;
	color: var(--ink-muted);
}

/* 单篇底部：相关阅读（评论区上方） */
.related-reading {
	margin-top: var(--space-lg);
	padding-top: var(--space-md);
	border-top: 1px solid var(--line);
	max-width: 100%;
}

.related-reading__title {
	margin: 0 0 var(--space-sm);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.related-reading__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.related-reading__item {
	padding: var(--space-xs) 0;
	border-bottom: 1px solid var(--line);
	font-size: 0.9375rem;
	line-height: 1.45;
}

.related-reading__item:last-child {
	border-bottom: none;
}

.related-reading__item a {
	color: var(--ink-muted);
	text-decoration: none;
}

.related-reading__item a:hover {
	color: var(--ink);
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* --------------------------------------------------------------------------
   侧栏小工具
   -------------------------------------------------------------------------- */
.widget-area .widget {
	margin-bottom: var(--space-lg);
	padding-bottom: var(--space-md);
	border-bottom: 1px solid var(--line);
}

.widget-area .widget:last-child {
	margin-bottom: 0;
	padding-bottom: 0;
	border-bottom: none;
}

.widget-title {
	margin: 0 0 var(--space-sm);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
}

.widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.widget li {
	padding: var(--space-xs) 0;
	border-bottom: 1px solid var(--line);
	font-size: 0.875rem;
}

.widget li:last-child {
	border-bottom: none;
}

.widget a {
	color: var(--ink-muted);
	text-decoration: none;
}

.widget a:hover {
	color: var(--ink);
	text-decoration: underline;
}

.widget_search .search-form {
	display: flex;
	gap: var(--space-xs);
	margin-top: var(--space-xs);
}

.widget_search input[type="search"] {
	flex: 1;
	padding: 0.5em 0.75em;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--paper);
	font-family: inherit;
	font-size: 0.875rem;
}

.widget_search input[type="submit"] {
	padding: 0.5em 0.9em;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--ink);
	color: var(--paper);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	cursor: pointer;
	font-family: inherit;
}

.widget_search input[type="submit"]:hover {
	opacity: 0.85;
}

/* --------------------------------------------------------------------------
   页脚
   -------------------------------------------------------------------------- */
.site-footer {
	margin-top: auto;
	padding: 0 var(--site-gutter) var(--space-xs);
	border-top: none;
	text-align: center;
	font-size: 0.75rem;
	line-height: 1.35;
	color: var(--ink-faint);
	letter-spacing: 0.06em;
}

.site-footer p {
	margin: 0;
}

.site-footer a {
	color: var(--ink-muted);
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

.site-footer__inner {
	display: inline-flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0;
}

.site-footer__copyright {
	white-space: nowrap;
}

.site-footer__links {
	display: inline-flex;
	flex-wrap: wrap;
	align-items: center;
}

.site-footer__links a {
	white-space: nowrap;
}

.site-footer__divider {
	margin: 0 0.5em;
	color: var(--line);
}

/* --------------------------------------------------------------------------
   空状态与无障碍
   -------------------------------------------------------------------------- */
.screen-reader-text {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	width: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	word-wrap: normal !important;
}

.skip-link:focus {
	clip: auto !important;
	clip-path: none;
	height: auto;
	left: 6px;
	top: 6px;
	width: auto;
	z-index: 100000;
	padding: 0.5em 1em;
	background: var(--ink);
	color: var(--paper);
}

.alignnone,
.aligncenter {
	display: block;
	margin: var(--space-sm) 0;
}

.wp-caption-text {
	font-size: 0.8125rem;
	color: var(--ink-muted);
	margin-top: var(--space-xs);
}

.site-branding .custom-logo-link {
	display: inline-block;
}

.site-branding .custom-logo-link img {
	max-height: 48px;
	width: auto;
}

.page-links {
	margin-top: var(--space-md);
	font-size: 0.875rem;
	color: var(--ink-muted);
}

.comments-area .comment-list li {
	padding: var(--space-sm) 0;
	border-bottom: 1px solid var(--line);
	font-size: 0.9375rem;
}

.comments-area .reply {
	font-size: 0.8125rem;
	margin-top: var(--space-xs);
}

/* 评论表单：名称、邮箱、网站同一行；其余字段独占一行 */
#respond .comment-form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-sm) var(--space-md);
	align-items: flex-start;
}

#respond .comment-form .comment-form-author,
#respond .comment-form .comment-form-email,
#respond .comment-form .comment-form-url {
	flex: 1 1 0;
	min-width: 0;
	margin: 0;
}

#respond .comment-form .comment-notes,
#respond .comment-form .logged-in-as,
#respond .comment-form .must-log-in,
#respond .comment-form .comment-form-comment,
#respond .comment-form .comment-form-cookies-consent,
#respond .comment-form .form-submit {
	flex: 1 1 100%;
	width: 100%;
	margin-left: 0;
	margin-right: 0;
}

@media (max-width: 36rem) {
	#respond .comment-form .comment-form-author,
	#respond .comment-form .comment-form-email,
	#respond .comment-form .comment-form-url {
		flex: 1 1 100%;
		min-width: 100%;
	}
}

#respond label {
	display: block;
	font-size: 0.8125rem;
	color: var(--ink-muted);
	margin-bottom: var(--space-xs);
}

#respond input[type="text"],
#respond input[type="email"],
#respond input[type="url"],
#respond textarea {
	width: 100%;
	max-width: 100%;
	padding: 0.5em 0.75em;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--paper);
	font-family: inherit;
	font-size: 0.9375rem;
}

#respond input#submit {
	padding: 0.5em 1.25em;
	border: 1px solid var(--ink);
	border-radius: var(--radius);
	background: var(--ink);
	color: var(--paper);
	font-size: 0.8125rem;
	cursor: pointer;
	font-family: inherit;
	margin-top: var(--space-sm);
}
