/*
Theme Name: E-Vod Tutorial
Description: 软件教程主题——图文+视频混合阅读，暖纸护眼配色，三端响应字号，自动目录，懒加载视频。零外部依赖。
Version: 1.0.0
Author: usof
*/

/* ========== 设计变量：暖纸护眼 + 深色模式 ========== */
:root {
	--bg: #FAF8F4;          /* 暖米白，非纯白 */
	--fg: #33302B;          /* 暖炭黑，非纯黑 */
	--muted: #8A8478;       /* 灰褐次要文字 */
	--accent: #1F6E5C;      /* 深青绿主色 */
	--accent-ink: #FFFFFF;
	--accent-soft: #E8F1EE; /* 主色浅底 */
	--border: #E6E1D8;
	--card: #FFFFFF;
	--code-bg: #F1EDE6;
	--code-fg: #3A362F;
	--note-bg: #EDF2F7; --note-ink: #2C5F7C; --note-line: #2C5F7C;
	--warn-bg: #F9F1E4; --warn-ink: #8A6116; --warn-line: #C89A3C;
	--tip-bg: #EBF4EC;  --tip-ink: #2E6B3C;  --tip-line: #4E9460;
	--shadow: 0 1px 3px rgba(60, 50, 30, .06), 0 4px 14px rgba(60, 50, 30, .05);
	--measure: 680px;       /* 正文黄金宽度 */
	--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
html.ev-dark {
	--bg: #202226;
	--fg: #D8D4CC;
	--muted: #9A958B;
	--accent: #5BBFA5;
	--accent-ink: #10201B;
	--accent-soft: #26332F;
	--border: #34373D;
	--card: #26292E;
	--code-bg: #2A2D33;
	--code-fg: #CFCCC4;
	--note-bg: #232B33; --note-ink: #8FB8D4;
	--warn-bg: #2F2A20; --warn-ink: #D4B36A;
	--tip-bg: #222B24;  --tip-ink: #96CBA4;
	--shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* ========== 基础 ========== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--sans);
	font-size: 17px;
	line-height: 1.75;
}
@media (min-width: 1025px) { body { font-size: 18px; line-height: 1.8; } }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, video { max-width: 100%; height: auto; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 601px) { .wrap { padding: 0 28px; } }

/* ========== 顶部导航 ========== */
.ev-header {
	position: sticky; top: 0; z-index: 50;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--border);
}
.ev-header .wrap { display: flex; align-items: center; gap: 22px; height: 56px; }
.ev-logo { font-size: 20px; font-weight: 700; color: var(--fg); letter-spacing: .3px; }
.ev-logo em { color: var(--accent); font-style: normal; }
.ev-nav { display: none; gap: 4px; }
@media (min-width: 769px) { .ev-nav { display: flex; } }
.ev-nav > a, .ev-nav > .ev-cat-item > a {
	padding: 6px 12px; border-radius: 8px; color: var(--fg); font-size: 15px;
}
.ev-nav > a:hover, .ev-nav > .ev-cat-item > a:hover { background: var(--accent-soft); text-decoration: none; }
.ev-cat-item { position: relative; }
.ev-cat-item .ev-sub {
	display: none; position: absolute; top: 100%; left: 0;
	background: var(--card); border: 1px solid var(--border); border-radius: 10px;
	box-shadow: var(--shadow); padding: 6px; min-width: 150px;
}
.ev-cat-item:hover .ev-sub { display: block; }
.ev-sub a { display: block; padding: 7px 12px; border-radius: 7px; color: var(--fg); font-size: 14.5px; white-space: nowrap; }
.ev-sub a:hover { background: var(--accent-soft); text-decoration: none; }
.ev-header-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.ev-icon-btn {
	width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border);
	background: var(--card); color: var(--fg); font-size: 16px; cursor: pointer;
	display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.ev-icon-btn:hover { border-color: var(--accent); }
.ev-search-inline { display: none; }
@media (min-width: 1025px) { .ev-search-inline { display: flex; } }
.ev-search-inline input {
	height: 36px; border: 1px solid var(--border); background: var(--card); color: var(--fg);
	border-radius: 10px; padding: 0 12px; font-size: 14.5px; width: 180px; outline: none;
}
.ev-search-inline input:focus { border-color: var(--accent); }

/* ========== 阅读进度条 ========== */
#evProgress {
	position: fixed; top: 0; left: 0; height: 3px; width: 0;
	background: var(--accent); z-index: 60; transition: width .1s linear;
}

/* ========== 首页：教程卡片流 ========== */
.ev-home { padding: 34px 0 60px; }
.ev-home-head { max-width: var(--measure); margin: 0 auto 26px; }
.ev-home-head h1 { font-size: clamp(24px, 4vw, 30px); margin: 0 0 6px; }
.ev-home-head p { color: var(--muted); margin: 0; font-size: 15.5px; }
.ev-cards { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 601px)  { .ev-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1025px) { .ev-cards { grid-template-columns: repeat(3, 1fr); } }
.ev-card {
	background: var(--card); border: 1px solid var(--border); border-radius: 14px;
	overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
	transition: transform .15s ease, box-shadow .15s ease;
}
.ev-card:hover { transform: translateY(-2px); }
.ev-card-thumb { aspect-ratio: 16 / 9; background: var(--accent-soft); position: relative; display: block; }
.ev-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ev-card-thumb .ev-play-badge {
	position: absolute; right: 10px; bottom: 10px;
	background: rgba(20, 24, 22, .78); color: #fff; font-size: 12px;
	padding: 3px 9px; border-radius: 999px;
}
.ev-card-thumb .ev-thumb-fallback {
	width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
	color: var(--accent); font-size: 34px; font-weight: 700;
}
.ev-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ev-card-cat { font-size: 12.5px; color: var(--accent); font-weight: 600; letter-spacing: .4px; }
.ev-card-title { font-size: 17.5px; font-weight: 650; line-height: 1.45; margin: 0; }
.ev-card-title a { color: var(--fg); }
.ev-card-excerpt { color: var(--muted); font-size: 14.5px; line-height: 1.65; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-card-meta { margin-top: auto; color: var(--muted); font-size: 13px; display: flex; gap: 12px; }

/* ========== 单篇：双栏（正文 + 目录） ========== */
.ev-single { padding: 30px 0 60px; }
.ev-layout { display: grid; grid-template-columns: 1fr; gap: 34px; }
@media (min-width: 1025px) { .ev-layout { grid-template-columns: minmax(0, 1fr) 260px; } }
article.ev-article { max-width: var(--measure); margin: 0 auto; width: 100%; }
@media (min-width: 1025px) { article.ev-article { margin: 0; } }

.ev-crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
h1.ev-title { font-size: clamp(26px, 4.5vw, 34px); line-height: 1.3; margin: 0 0 12px; letter-spacing: .2px; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 26px; }
.ev-meta .ev-pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 10px; font-size: 12.5px; font-weight: 600; }

/* 正文排版：合理分段 + 层级 */
.ev-content p { margin: 0 0 1em; }
.ev-content > p:has(+ h2), .ev-content > p:has(+ h3) { margin-bottom: 1.2em; }
.ev-content h2 {
	font-size: clamp(21px, 3vw, 25px); font-weight: 700; line-height: 1.4;
	margin: 1.9em 0 .7em; padding-left: 14px; border-left: 4px solid var(--accent);
	scroll-margin-top: 74px;
}
.ev-content h3 {
	font-size: clamp(18px, 2.4vw, 20px); font-weight: 600; margin: 1.5em 0 .55em;
	scroll-margin-top: 74px;
}
.ev-content h2 + h3, .ev-content h2:first-child, .ev-content h3:first-child { margin-top: .4em; }
.ev-content ul, .ev-content ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.ev-content li { margin: .35em 0; }

/* 步骤列表：圆底编号 */
.ev-content ol.ev-steps { list-style: none; counter-reset: evstep; padding-left: 0; margin: 1.2em 0; }
.ev-content ol.ev-steps > li {
	counter-increment: evstep; position: relative; padding: 4px 0 14px 52px; margin: 0;
}
.ev-content ol.ev-steps > li::before {
	content: counter(evstep);
	position: absolute; left: 0; top: 4px;
	width: 34px; height: 34px; border-radius: 50%;
	background: var(--accent); color: var(--accent-ink);
	font-weight: 700; font-size: 16px;
	display: flex; align-items: center; justify-content: center;
}
.ev-content ol.ev-steps > li:not(:last-child)::after {
	content: ""; position: absolute; left: 16.5px; top: 42px; bottom: -4px;
	width: 1.5px; background: var(--border);
}

/* 提示块：提示/注意/技巧 */
.ev-note, .ev-warning, .ev-tip {
	border-radius: 10px; padding: 13px 16px 13px 46px; margin: 1.2em 0;
	font-size: .95em; position: relative; line-height: 1.65;
}
.ev-note { background: var(--note-bg); color: var(--note-ink); }
.ev-warning { background: var(--warn-bg); color: var(--warn-ink); }
.ev-tip { background: var(--tip-bg); color: var(--tip-ink); }
.ev-note::before { content: "i"; }
.ev-warning::before { content: "!"; }
.ev-tip::before { content: "✓"; }
.ev-note::before, .ev-warning::before, .ev-tip::before {
	position: absolute; left: 14px; top: 12px; width: 20px; height: 20px; border-radius: 50%;
	background: currentColor; color: var(--bg); font-size: 13px; font-weight: 800;
	display: flex; align-items: center; justify-content: center;
}
.ev-note strong, .ev-warning strong, .ev-tip strong { color: inherit; }

/* 代码块 */
.ev-content :where(pre) {
	background: var(--code-bg); color: var(--code-fg);
	font-family: var(--mono); font-size: 14.5px; line-height: 1.6;
	border-radius: 10px; padding: 15px 16px; overflow-x: auto;
	position: relative; margin: 1.2em 0; border: 1px solid var(--border);
	tab-size: 4;
}
.ev-content code { font-family: var(--mono); font-size: .92em; background: var(--code-bg); border-radius: 5px; padding: 1px 6px; }
.ev-content pre code { background: none; padding: 0; font-size: inherit; }
.ev-code-copy {
	position: absolute; top: 8px; right: 8px;
	background: var(--card); color: var(--muted); border: 1px solid var(--border);
	font-size: 12px; padding: 4px 10px; border-radius: 7px; cursor: pointer; font-family: var(--sans);
}
.ev-code-copy:hover { color: var(--accent); border-color: var(--accent); }

/* 图片/表格 */
.ev-content figure { margin: 1.4em 0; }
.ev-content figcaption { color: var(--muted); font-size: 13.5px; margin-top: 8px; text-align: center; }
.ev-table-scroll { overflow-x: auto; margin: 1.2em 0; border-radius: 10px; border: 1px solid var(--border); }
.ev-content table { border-collapse: collapse; width: 100%; font-size: .92em; background: var(--card); }
.ev-content th { background: var(--accent-soft); color: var(--fg); font-weight: 650; }
.ev-content th, .ev-content td { border-bottom: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.ev-content tr:last-child td { border-bottom: none; }

/* ========== 视频门面（懒加载） ========== */
.ev-video { margin: 1.5em 0; }
.ev-video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #14181A; box-shadow: var(--shadow); }
.ev-video-frame iframe, .ev-video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ev-video-facade { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; background: #14181A; }
.ev-video-facade img { width: 100%; height: 100%; object-fit: cover; opacity: .82; }
.ev-video-facade .ev-video-btn {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
	width: 66px; height: 66px; border-radius: 50%;
	background: rgba(31, 110, 92, .92); color: #fff;
	display: flex; align-items: center; justify-content: center;
	transition: transform .15s ease, background .15s ease;
}
.ev-video-facade:hover .ev-video-btn { transform: translate(-50%, -50%) scale(1.08); background: var(--accent); }
.ev-video-facade .ev-video-btn::after {
	content: ""; display: block; width: 0; height: 0;
	border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent;
	margin-left: 5px;
}
.ev-video-facade .ev-video-tag {
	position: absolute; left: 12px; bottom: 10px; color: #fff; font-size: 12.5px;
	background: rgba(0,0,0,.55); padding: 2px 10px; border-radius: 999px;
}
.ev-video-native { width: 100%; border-radius: 12px; background: #14181A; display: block; }

/* ========== 目录 TOC ========== */
aside.ev-aside { display: none; }
@media (min-width: 1025px) {
	aside.ev-aside { display: block; }
	.ev-toc {
		position: sticky; top: 74px;
		background: var(--card); border: 1px solid var(--border); border-radius: 12px;
		padding: 14px 6px 10px 0; max-height: calc(100vh - 100px); overflow-y: auto;
	}
	.ev-toc-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 1px; padding: 0 16px 8px; }
	.ev-toc a { display: block; color: var(--fg); font-size: 14px; padding: 5px 16px; border-left: 2.5px solid transparent; line-height: 1.45; }
	.ev-toc a.lv3 { padding-left: 32px; font-size: 13.5px; }
	.ev-toc a:hover { text-decoration: none; color: var(--accent); }
	.ev-toc a.on { border-left-color: var(--accent); color: var(--accent); background: var(--accent-soft); border-radius: 0 7px 7px 0; }
}
/* 手机/平板：折叠式目录 */
details.ev-toc-mobile { display: block; margin: 0 0 24px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
@media (min-width: 1025px) { details.ev-toc-mobile { display: none; } }
details.ev-toc-mobile summary {
	cursor: pointer; padding: 12px 16px; font-weight: 650; font-size: 15px; color: var(--fg); list-style: none;
	display: flex; align-items: center; gap: 8px;
}
details.ev-toc-mobile summary::-webkit-details-marker { display: none; }
details.ev-toc-mobile summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
details.ev-toc-mobile[open] summary::after { transform: rotate(180deg); }
details.ev-toc-mobile nav { padding: 2px 6px 10px; }
details.ev-toc-mobile a { display: block; padding: 7px 16px; color: var(--fg); font-size: 14.5px; border-radius: 8px; }
details.ev-toc-mobile a.lv3 { padding-left: 34px; font-size: 14px; color: var(--muted); }
details.ev-toc-mobile a:hover { background: var(--accent-soft); text-decoration: none; }

/* ========== 系列课 + 相关 + 上下篇 ========== */
.ev-series, .ev-related { margin-top: 44px; border-top: 1px solid var(--border); padding-top: 22px; }
.ev-series h2, .ev-related h2 { font-size: 19px; font-weight: 700; margin: 0 0 14px; padding: 0; border: none; }
.ev-series ol { list-style: none; margin: 0; padding: 0; counter-reset: ser; }
.ev-series li { counter-increment: ser; display: flex; gap: 12px; align-items: baseline; padding: 7px 0; }
.ev-series li::before { content: counter(ser, decimal-leading-zero); color: var(--muted); font-family: var(--mono); font-size: 13.5px; }
.ev-series li.cur a { color: var(--accent); font-weight: 650; }
.ev-series li.cur::before { color: var(--accent); }
.ev-related-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 601px) { .ev-related-grid { grid-template-columns: repeat(3, 1fr); } }
.ev-rel-card { background: var(--card); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; }
.ev-rel-card .t { font-weight: 620; line-height: 1.5; margin: 0 0 6px; font-size: 15.5px; }
.ev-rel-card .t a { color: var(--fg); }
.ev-rel-card .m { color: var(--muted); font-size: 13px; }
.ev-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 26px; }
.ev-pn a {
	background: var(--card); border: 1px solid var(--border); border-radius: 11px;
	padding: 12px 15px; font-size: 14.5px; color: var(--fg); line-height: 1.5;
}
.ev-pn a:hover { border-color: var(--accent); text-decoration: none; }
.ev-pn a.next { text-align: right; }
.ev-pn .lab { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }

/* ========== 列表页（分类/搜索/归档） ========== */
.ev-list { padding: 30px 0 60px; max-width: 760px; margin: 0 auto; }
.ev-list h1 { font-size: clamp(22px, 3.6vw, 27px); margin: 0 0 6px; }
.ev-list .ev-list-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 24px; }
.ev-list-item { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.ev-list-item .th { flex: 0 0 132px; aspect-ratio: 16 / 9; border-radius: 9px; overflow: hidden; background: var(--accent-soft); }
.ev-list-item .th img { width: 100%; height: 100%; object-fit: cover; }
.ev-list-item .tt { font-size: 16.5px; font-weight: 640; margin: 0 0 5px; line-height: 1.5; }
.ev-list-item .tt a { color: var(--fg); }
.ev-list-item .ex { color: var(--muted); font-size: 14px; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ev-list-item .mt { color: var(--muted); font-size: 12.5px; }
@media (max-width: 600px) { .ev-list-item { flex-direction: column; gap: 10px; } .ev-list-item .th { flex-basis: auto; } }

/* ========== 页脚 ========== */
.ev-footer { border-top: 1px solid var(--border); margin-top: 30px; padding: 26px 0 34px; }
.ev-footer .wrap { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; color: var(--muted); font-size: 13.5px; }
.ev-footer a { color: var(--muted); }
.ev-footer a:hover { color: var(--accent); }
.ev-footer .cp { margin-left: auto; }

/* ========== 通用 ========== */
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ev-empty { color: var(--muted); padding: 40px 0; text-align: center; }
.ev-pagination { display: flex; gap: 10px; justify-content: center; margin-top: 34px; }
.ev-pagination .page-numbers {
	padding: 7px 14px; border: 1px solid var(--border); border-radius: 9px;
	color: var(--fg); font-size: 14.5px; background: var(--card);
}
.ev-pagination .page-numbers.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ev-pagination .page-numbers:hover { text-decoration: none; border-color: var(--accent); }
::selection { background: var(--accent-soft); }
