/*
 * Slash WP - 现代化补丁（CSS）
 *
 * 修正 2012 年样式表在现代浏览器上的问题：
 * 盒模型、图片溢出、键盘焦点、触摸目标、动效偏好、打印样式。
 */

/*
 * 这里刻意不写全局 *{box-sizing:border-box}。
 *
 * 本主题是 2012 年的 content-box 布局：#aside / .masthead-widget /
 * .article_box .article / .widget / .button / .ico_link / .i-h 等大量元素，
 * 都是「固定 width + 左右 padding」配合同样固定宽度的背景图绘制的
 * （例如 .article 是 202px + 43px padding = 245px，配 246px 的 article_bg.png）。
 * 全局 border-box 会把这些元素压掉约 40px，而顶部/底部装饰条仍是 246px，
 * 于是侧栏旗帜和每一张内页卡片右侧都会「缺一块」。
 *
 * 只有 WordPress 7 的现代区块需要 border-box，下面单独声明。
 * WP 核心 block-library.css 也会为 .wp-block-columns 等显式设置。
 */
[class*="wp-block-"],
[class*="is-layout-"],
.wp-element-button {
	box-sizing: border-box;
}

/*
 * 3.0.6：首页-静态 / 首页-视频右下角的描述正文由
 * dt_slash_render_post_content() 输出，段落会带 wp-block-paragraph 类，
 * 于是命中上面的 border-box 白名单。home.css 里
 *   .pg_description p { width:410px } + #pg_desc2 div p { padding:15px 20px }
 * 依赖 content-box 得到 450px 宽；border-box 会把它压成 410px，
 * 描述块比 WP4.5 旧站窄 40px，标题块也随之错位。这里显式恢复老盒模型。
 */
.pg_description p,
#pg_desc1 div p,
#pg_desc2 div p {
	box-sizing: content-box;
}

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

body {
	min-height: 100vh;
	margin: 0;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

/*
 * 全局 img{max-width:100%} 同样会压坏老主题：188x130 的 logo、
 * 240px 的相册缩略图、highslide 大图、搜索框与按钮的装饰图都会变形。
 * 这里只对「正文内容里的图片/嵌入」做自适应；
 * 现代区块图片由 css/blocks.css 的 .wp-block-image img 等规则负责。
 */
.entry-content img,
.comment-content img,
.textwidget img {
	max-width: 100%;
	height: auto;
}

.entry-content iframe,
.entry-content video,
.entry-content embed,
.entry-content object,
.comment-content iframe {
	max-width: 100%;
}

/* 键盘焦点可见（无障碍 WCAG 2.1） */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
	outline: 2px solid #b8874a;
	outline-offset: 3px;
}

/* 跳转到主内容 */
.skip-link {
	position: absolute;
	top: -100px;
	left: 0;
	z-index: 100000;
	background: #fff;
	color: #222;
	padding: .75rem 1.25rem;
	border: 2px solid #b8874a;
	text-decoration: none;
}

.skip-link:focus {
	top: 0;
}

/* 移动端：取消旧主题禁止缩放带来的可访问性问题，并提高触摸目标 */
@media (max-width: 782px) {
	#nav a,
	.mobile-menu a,
	.paginator li a,
	.go_up {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
	}
	.image-preloader {
		display: none !important;
	}
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	*,
	*::before,
	*::after {
		animation-duration: .01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .01ms !important;
	}
}

/* 高对比度偏好 */
@media (prefers-contrast: more) {
	:root {
		--dt-muted: #333;
		--dt-line: rgba(0, 0, 0, .4);
	}
}

/* WordPress 管理栏与固定头部共存 */
.admin-bar #top_bg,
.admin-bar .fixed-header {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar #top_bg,
	.admin-bar .fixed-header {
		top: 46px;
	}
}

/* ------------------------------------------------------------------
 * 侧栏旗帜 / 内页卡片 / 小工具 / 按钮等老布局一律保持浏览器默认的
 * content-box（见本文件开头说明），不要在下方追加全局盒模型覆盖。
 * ------------------------------------------------------------------ */

/* 打印 */
@media print {
	#bottom,
	.image-preloader,
	.go_up,
	.foll,
	.search-f,
	.mobile-menu,
	#nav {
		display: none !important;
	}
	body {
		background: #fff !important;
		color: #000 !important;
	}
	a[href]::after {
		content: " (" attr(href) ")";
		font-size: .85em;
	}
}
