/*
Theme Name: CaptWang
Theme URI: https://www.captwang.com/
Author: Capt. Wang
Author URI: https://www.captwang.com/
Description: 为 captwang.com 定制的清新博客主题，参考 alright 主题版式设计：左侧博主资料栏 + 文章信息流 + 暗色模式 + 阅读进度条。轻量、无框架依赖，兼容 WordPress 6.x / 7.x。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: captwang
Tags: blog, two-columns, right-sidebar, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ============================================================
   设计变量（亮色 / 暗色）
   ============================================================ */
:root {
    --bg: #f5f6f8;
    --card: #ffffff;
    --text: #1d2129;
    --text-2: #4e5969;
    --text-3: #86909c;
    --border: #e5e6eb;
    --accent: #3a6ff5;
    --accent-hover: #2f5ee0;
    --accent-weak: rgba(58, 111, 245, 0.08);
    --accent-tint: linear-gradient(135deg, rgba(58,111,245,.10), rgba(58,111,245,.03));
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .02), 0 4px 16px rgba(0, 0, 0, .05);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, .04), 0 10px 28px rgba(0, 0, 0, .09);
    --font-body: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
    --header-h: 64px;
    --container: 1180px;
}

[data-scheme="dark"] {
    --bg: #17181c;
    --card: #212227;
    --text: #e8e9ec;
    --text-2: #b8bcc4;
    --text-3: #7d828c;
    --border: #2e3138;
    --accent: #6d95f8;
    --accent-hover: #85a7fa;
    --accent-weak: rgba(109, 149, 248, 0.12);
    --accent-tint: linear-gradient(135deg, rgba(109,149,248,.14), rgba(109,149,248,.04));
    --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .4);
}

/* ============================================================
   基础
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    transition: background-color .25s ease, color .25s ease;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--accent); color: #fff;
    padding: 8px 16px; border-radius: 0 0 8px 0; z-index: 999;
}
.skip-link:focus { left: 0; color: #fff; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 16px; }

/* ============================================================
   头部导航
   ============================================================ */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.site-header .container {
    display: flex; align-items: center; gap: 20px;
    height: var(--header-h);
}

.site-branding { display: flex; flex-direction: column; flex-shrink: 0; }
.site-title {
    margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2;
}
.site-title a { color: var(--text); }
.site-title a:hover { color: var(--accent); }
.custom-logo { max-height: 44px; width: auto; }
.site-description {
    margin: 0; font-size: 12px; color: var(--text-3); line-height: 1.3;
}

.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-nav li { position: relative; }
.main-nav a {
    display: block; padding: 8px 14px; border-radius: 999px;
    color: var(--text-2); font-size: 15px;
}
.main-nav a:hover,
.main-nav .current-menu-item > a,
.main-nav .current_page_item > a {
    color: var(--accent); background: var(--accent-weak);
}
/* 二级菜单 */
.main-nav .sub-menu {
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
    display: none; flex-direction: column; gap: 2px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover); padding: 6px; min-width: 150px; z-index: 50;
}
.main-nav li:hover > .sub-menu,
.main-nav li:focus-within > .sub-menu { display: flex; }
.main-nav .sub-menu a { padding: 7px 14px; font-size: 14px; white-space: nowrap; }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    border: none; background: transparent; color: var(--text-2);
    cursor: pointer; transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--accent-weak); color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; }

/* 搜索 */
.search-toggle-wrap { position: relative; }
.header-search {
    position: absolute; right: 0; top: calc(100% + 10px);
    display: none; width: 280px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover); padding: 8px;
}
.header-search.is-open { display: block; }
.header-search input[type="search"] {
    width: 100%; border: none; outline: none; background: transparent;
    font-family: inherit; font-size: 15px; color: var(--text); padding: 6px 10px;
}
.header-search form { display: flex; align-items: center; gap: 6px; }

/* 移动端菜单按钮 */
.menu-toggle { display: none; }

/* ============================================================
   布局骨架
   ============================================================ */
.site-main { padding: 24px 0 40px; }

.layout-grid {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

/* ============================================================
   侧边栏（博主资料 + 小工具）
   ============================================================ */
.sidebar { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 16px; }

.widget-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
}

.profile-card { text-align: center; padding: 28px 20px; }
.profile-avatar {
    width: 84px; height: 84px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 34px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, #3a6ff5, #6d95f8);
    overflow: hidden; margin-bottom: 12px;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { margin: 0 0 6px; font-size: 19px; font-weight: 700; }
.profile-name a { color: var(--text); }
.profile-badge {
    display: inline-block; font-size: 12px; color: var(--accent);
    background: var(--accent-weak); border-radius: 999px; padding: 2px 12px; margin-bottom: 10px;
}
.profile-bio { margin: 0; font-size: 13.5px; color: var(--text-3); line-height: 1.7; }

.profile-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    border-top: 1px dashed var(--border); margin-top: 16px; padding-top: 16px;
}
.profile-stats .stat { display: flex; flex-direction: column; }
.profile-stats .stat b { font-size: 20px; color: var(--text); line-height: 1.3; }
.profile-stats .stat span { font-size: 12px; color: var(--text-3); }

.widget-title {
    margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--text-2);
    display: flex; align-items: center; gap: 8px;
}
.widget-title::before {
    content: ""; width: 4px; height: 14px; border-radius: 2px;
    background: var(--accent); display: inline-block;
}

.widget ul { list-style: none; margin: 0; padding: 0; }
.widget li + li { border-top: 1px solid var(--border); }
.widget li a {
    display: block; padding: 9px 2px; font-size: 14px; color: var(--text-2);
}
.widget li a:hover { color: var(--accent); }
.widget .hot-posts li { display: flex; align-items: baseline; gap: 8px; }
.widget .hot-posts .rank {
    flex-shrink: 0; width: 20px; height: 20px; border-radius: 6px;
    background: var(--accent-weak); color: var(--accent);
    font-size: 12px; display: inline-flex; align-items: center; justify-content: center;
    align-self: center;
}
.widget .hot-posts li:nth-child(1) .rank { background: #ff4d4f; color: #fff; }
.widget .hot-posts li:nth-child(2) .rank { background: #ff7d49; color: #fff; }
.widget .hot-posts li:nth-child(3) .rank { background: #ffb14d; color: #fff; }
.hot-posts { counter-reset: item; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 8px; }
.tagcloud a {
    font-size: 13px !important; padding: 3px 12px; border-radius: 999px;
    background: var(--accent-weak); color: var(--text-2); border: 1px solid transparent;
}
.tagcloud a:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   首页 Hero
   ============================================================ */
.hero-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 28px 32px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 24px;
    background-image: var(--accent-tint);
}
.hero-card .profile-avatar { width: 72px; height: 72px; font-size: 30px; margin-bottom: 0; }
.hero-text { flex: 1; min-width: 0; }
.hero-greet { margin: 0 0 4px; font-size: 21px; font-weight: 700; }
.hero-greet .wave { display: inline-block; animation: wave 2.4s infinite; transform-origin: 70% 70%; }
@keyframes wave { 0%,60%,100% { transform: rotate(0); } 10%,30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
.hero-sub { margin: 0; color: var(--text-3); font-size: 14px; }
.hero-links { display: flex; gap: 8px; flex-shrink: 0; }
.hero-links .icon-btn { background: var(--accent-weak); }

/* ============================================================
   文章列表
   ============================================================ */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
}
.section-head h2, .section-head h1 {
    margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px;
}
.section-head .more-link { font-size: 13px; color: var(--text-3); }

.post-list { display: flex; flex-direction: column; gap: 14px; }

.post-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 20px 24px;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
    display: flex; gap: 20px; align-items: flex-start;
}
.post-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

.post-card .entry-thumb { flex-shrink: 0; width: 180px; }
.post-card .entry-thumb img {
    width: 180px; height: 120px; object-fit: cover; border-radius: var(--radius-sm);
    display: block;
}
.post-card .entry-thumb .thumb-ph {
    width: 180px; height: 120px; border-radius: var(--radius-sm);
    background: var(--accent-tint); border: 1px dashed color-mix(in srgb, var(--accent) 30%, var(--border));
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 32px; font-weight: 700;
}
.post-card.has-thumb { padding: 16px 20px; }

.entry-body { flex: 1; min-width: 0; }
.entry-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; line-height: 1.5; }
.entry-title a { color: var(--text); }
.entry-title a:hover { color: var(--accent); }
.entry-summary {
    margin: 0 0 10px; color: var(--text-3); font-size: 14.5px; line-height: 1.8;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13px; color: var(--text-3); }
.entry-meta a { color: var(--text-3); }
.entry-meta a:hover { color: var(--accent); }
.entry-meta .cat-link { color: var(--accent); background: var(--accent-weak); padding: 1px 10px; border-radius: 999px; }
.entry-meta .meta-item { display: inline-flex; align-items: center; gap: 5px; }
.entry-meta svg { width: 15px; height: 15px; }
.sticky-flag { font-size: 12px; color: #d48806; }

/* 分页 */
.pagination { margin-top: 26px; text-align: center; }
.pagination .nav-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.pagination .page-numbers {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 12px; border-radius: 10px;
    background: var(--card); border: 1px solid var(--border); color: var(--text-2); font-size: 14px;
}
.pagination .page-numbers.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination .page-numbers:hover:not(.current) { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   归档 / 搜索页头
   ============================================================ */
.archive-head {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 22px 26px; margin-bottom: 20px;
}
.archive-head h1 { margin: 0 0 6px; font-size: 22px; }
.archive-head .archive-desc { margin: 0; color: var(--text-3); font-size: 14px; }
.archive-head .crumb { font-size: 13px; color: var(--text-3); margin: 0 0 8px; }
.archive-head .crumb a { color: var(--text-3); }
.archive-head .crumb a:hover { color: var(--accent); }

/* ============================================================
   文章页
   ============================================================ */
.single-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 32px 38px;
}
.entry-header-single .entry-title { font-size: 26px; margin-bottom: 12px; }
.entry-header-single .entry-meta { padding-bottom: 18px; border-bottom: 1px solid var(--border); margin-bottom: 26px; }

/* 正文排版 */
.entry-content { font-size: 16.5px; line-height: 1.95; color: var(--text); word-wrap: break-word; }
.entry-content p { margin: 0 0 1.15em; }
.entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4 {
    font-weight: 700; line-height: 1.4; margin: 1.6em 0 .7em;
}
.entry-content h2 { font-size: 1.42em; padding-left: 12px; border-left: 4px solid var(--accent); }
.entry-content h3 { font-size: 1.22em; }
.entry-content h4 { font-size: 1.08em; }
.entry-content a { border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.entry-content img { border-radius: var(--radius-sm); }
.entry-content blockquote {
    margin: 1.5em 0; padding: 14px 20px; border-left: 4px solid var(--accent);
    background: var(--accent-weak); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-2);
}
.entry-content blockquote p { margin: 0 0 .5em; }
.entry-content blockquote p:last-child { margin: 0; }
.entry-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em; background: var(--accent-weak); color: var(--accent-hover);
    padding: 2px 7px; border-radius: 6px; word-break: break-all;
}
[data-scheme="dark"] .entry-content code { color: var(--accent); }
.entry-content pre {
    background: #1e1f24; color: #e8e9ec; border-radius: var(--radius-sm);
    padding: 18px 20px; overflow: auto; line-height: 1.6; font-size: 14px;
}
.entry-content pre code { background: none; color: inherit; padding: 0; }
.entry-content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 14.5px; }
.entry-content th, .entry-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.entry-content th { background: var(--accent-weak); font-weight: 700; }
.entry-content ul, .entry-content ol { padding-left: 1.6em; }
.entry-content hr { border: none; border-top: 1px dashed var(--border); margin: 2em 0; }
.wp-block-image figcaption, .entry-content figcaption { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 8px; }
.entry-content .wp-caption { max-width: 100%; }

/* 文末标签 / 作者 / 上下篇 */
.entry-footer { margin-top: 30px; }
.entry-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.entry-tags a {
    font-size: 13px; color: var(--text-2); background: var(--accent-weak);
    padding: 3px 14px; border-radius: 999px;
}
.entry-tags a:hover { color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.author-box {
    display: flex; gap: 16px; align-items: flex-start;
    background: var(--accent-weak); border-radius: var(--radius-sm);
    padding: 18px 20px; margin-bottom: 20px;
}
.author-box .profile-avatar { width: 52px; height: 52px; font-size: 22px; margin: 0; }
.author-box .author-name { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.author-box .author-desc { margin: 0; font-size: 13px; color: var(--text-3); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 26px; }
.post-nav a {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 12px 16px; font-size: 14px; color: var(--text-2);
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.post-nav a:hover { border-color: var(--accent); color: var(--accent); }
.post-nav .nav-label { font-size: 12px; color: var(--text-3); }
.post-nav .nav-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-nav .next { text-align: right; }

/* 相关文章 */
.related-posts { margin-top: 8px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.related-grid a {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 16px; font-size: 14px; color: var(--text-2); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-grid a:hover { border-color: var(--accent); color: var(--accent); }

/* 评论 */
.comments-area { margin-top: 26px; }
.comments-area h2, .comment-reply-title { font-size: 17px; font-weight: 700; margin: 0 0 16px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-list .comment { border-top: 1px solid var(--border); padding: 18px 0 4px; }
.comment-list .children { list-style: none; margin: 0; padding-left: 26px; }
.comment-list .children .comment { border-top: none; border-left: 2px solid var(--border); padding-left: 18px; }
.comment-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.comment-author img { border-radius: 50%; width: 36px; height: 36px; }
.comment-author .fn { font-size: 14px; font-weight: 700; font-style: normal; }
.comment-metadata { font-size: 12px; color: var(--text-3); }
.comment-metadata a { color: var(--text-3); }
.comment-content { font-size: 15px; color: var(--text-2); }
.comment-content p { margin: 0 0 .6em; }
.comment-reply-link { font-size: 13px; }
.comment-awaiting-moderation { font-size: 13px; color: #d48806; }

.comment-form label { display: block; font-size: 13px; color: var(--text-3); margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"],
.comment-form textarea {
    width: 100%; border: 1px solid var(--border); background: var(--bg);
    border-radius: var(--radius-sm); padding: 10px 14px;
    font-family: inherit; font-size: 15px; color: var(--text); outline: none;
    transition: border-color .15s ease;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }
.comment-form-author, .comment-form-email, .comment-form-url { display: inline-block; width: 32%; min-width: 200px; margin-right: 2%; }
.comment-form .submit {
    background: var(--accent); color: #fff; border: none; border-radius: 999px;
    padding: 9px 30px; font-family: inherit; font-size: 15px; cursor: pointer;
    transition: background .15s ease;
}
.comment-form .submit:hover { background: var(--accent-hover); color: #fff; }
.comment-form-cookies-consent label { display: inline; }
.logged-in-as { font-size: 13px; color: var(--text-3); }

/* ============================================================
   404
   ============================================================ */
.error-404 { text-align: center; padding: 70px 20px; }
.error-404 .code { font-size: 88px; font-weight: 700; color: var(--accent); line-height: 1; margin-bottom: 10px; }
.error-404 p { color: var(--text-3); margin: 0 0 24px; }
.error-404 .btn-home {
    display: inline-block; background: var(--accent); color: #fff;
    padding: 9px 32px; border-radius: 999px; font-size: 15px;
}
.error-404 .btn-home:hover { background: var(--accent-hover); color: #fff; }

/* ============================================================
   页脚 / 返回顶部 / 进度条
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--border); background: var(--card);
    padding: 28px 0; text-align: center; font-size: 13.5px; color: var(--text-3);
}
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }
.site-footer p { margin: 4px 0; }

.back-to-top {
    position: fixed; right: 22px; bottom: 30px; z-index: 90;
    width: 42px; height: 42px; border-radius: 50%;
    background: var(--card); border: 1px solid var(--border); color: var(--text-2);
    box-shadow: var(--shadow-hover); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transform: translateY(10px);
    transition: all .25s ease;
}
.back-to-top.is-show { opacity: 1; visibility: visible; transform: none; }
.back-to-top:hover { color: var(--accent); border-color: var(--accent); }

.reading-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0;
    background: linear-gradient(90deg, #3a6ff5, #6d95f8); z-index: 200;
    transition: width .1s linear;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1080px) {
    .layout-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }
    .post-card .entry-thumb { width: 140px; }
    .post-card .entry-thumb img, .post-card .entry-thumb .thumb-ph { width: 140px; height: 96px; }
}

@media (max-width: 900px) {
    .layout-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; }
    /* 移动端：资料卡片折叠为横向 */
    .profile-card { padding: 20px; }
    .hero-card { flex-direction: column; text-align: center; }
    .hero-links { justify-content: center; }

    .menu-toggle { display: inline-flex; }
    .main-nav {
        display: none; position: absolute; top: var(--header-h); left: 0; right: 0;
        background: var(--card); border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-hover); padding: 10px 16px 16px;
        margin: 0; max-height: 70vh; overflow-y: auto;
    }
    .main-nav.is-open { display: block; }
    .main-nav ul { flex-direction: column; gap: 2px; }
    .main-nav a { padding: 10px 14px; border-radius: 10px; }
    .main-nav .sub-menu {
        position: static; transform: none; display: flex; box-shadow: none;
        border: none; border-left: 2px solid var(--border); margin-left: 18px; padding: 0 0 0 4px;
    }
    .header-search { position: fixed; left: 16px; right: 16px; top: calc(var(--header-h) + 8px); width: auto; }
}

@media (max-width: 640px) {
    .site-description { display: none; }
    .single-card { padding: 22px 18px; }
    .post-card { flex-direction: column; padding: 18px; }
    .post-card .entry-thumb, .post-card .entry-thumb img, .post-card .entry-thumb .thumb-ph { width: 100%; height: 170px; }
    .related-grid { grid-template-columns: 1fr; }
    .post-nav { grid-template-columns: 1fr; }
    .post-nav .next { text-align: left; }
    .comment-form-author, .comment-form-email, .comment-form-url { width: 100%; margin-right: 0; }
    .profile-stats .stat b { font-size: 17px; }
}

/* 无障碍：焦点可见 */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px;
}

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