/*
Theme Name: Lumivra
Theme URI: https://lumivra.yanqs.me
Author: YanQS
Author URI: https://yanqs.me
Description: Lumivra - 一个干净、现代、富有设计感的 WordPress 主题。专为追求极简美学和优雅排版的用户打造。
Version: 1.2.0
Requires at least: 5.8
Tested up to: 6.4
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: lumivra
Tags: blog, one-column, two-columns, custom-colors, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, full-width-template, theme-options, translation-ready

Lumivra - Where light meets design.
*/

/* ============================================
   CSS 变量定义
   ============================================ */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --transition: all 0.3s ease;
    --max-width: 1200px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, Cambria, "Times New Roman", Times, serif;
}

/* ============================================
   基础样式重置
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   排版
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    color: var(--text-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1.5rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary-color);
}

img, video, canvas, audio, iframe, embed, object {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ============================================
   容器和布局
   ============================================ */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-content {
    flex: 1;
    padding: 2rem 0;
}

/* 主内容区域布局 - 两栏 */
.site-content .container {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.site-main {
    flex: 1;
    min-width: 0;
}

.widget-area {
    width: 320px;
    flex-shrink: 0;
}

/* 侧边栏在左侧 */
.sidebar-left .site-content .container {
    flex-direction: row-reverse;
}

/* 无侧边栏 */
.sidebar-none .widget-area,
.no-sidebar .widget-area {
    display: none;
}

.sidebar-none .site-main,
.no-sidebar .site-main {
    max-width: 100%;
}

/* ============================================
   头部导航
   ============================================ */
.site-header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
}

.site-branding {
    display: flex;
    align-items: center;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

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

.site-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

/* 导航菜单 */
.main-navigation {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 0;
    display: block;
    transition: var(--transition);
}

.main-navigation a:hover {
    color: var(--primary-color);
}

/* 子菜单样式 */
.main-navigation ul ul {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-color);
    min-width: 200px;
    padding: 0.5rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    flex-direction: column;
    gap: 0;
}

.main-navigation li:hover > ul {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-navigation ul ul li {
    width: 100%;
}

.main-navigation ul ul a {
    padding: 0.75rem 1.25rem;
    white-space: nowrap;
}

.main-navigation ul ul a:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* 三级菜单 */
.main-navigation ul ul ul {
    top: 0;
    left: 100%;
    margin-left: 0.5rem;
}

/* 菜单项有子菜单时添加箭头 */
.main-navigation .menu-item-has-children > a::after {
    content: '▼';
    font-size: 0.7em;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.main-navigation ul ul .menu-item-has-children > a::after {
    content: '▶';
    float: right;
    margin-left: 1rem;
}

/* 用户菜单 */
.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录按钮 */
.auth-btn {
    padding: 0;
    margin: 0;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--text-color);
    border: none;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    line-height: 1;
}

.auth-btn svg {
    display: block;
    width: 20px;
    height: 20px;
    margin: auto;
}

.auth-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    transform: scale(1.1);
}

/* 用户头像 */
.user-avatar-wrapper {
    position: relative;
}

.user-avatar-link {
    display: block;
    line-height: 0;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.user-avatar:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* 用户下拉菜单 */
.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-avatar-wrapper:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.user-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
}

.user-dropdown a:last-child {
    border-radius: 0 0 8px 8px;
}

.user-dropdown a:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

/* 移动端菜单切换 */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    font-size: 1.5rem;
    /* 增强触控目标 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
}

/* ============================================
   文章列表
   ============================================ */
.posts-list {
    display: grid;
    gap: 3rem;
}

.post-card {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: row;
    align-items: stretch;
    height: 140px;
}

.post-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.post-thumbnail {
    width: 200px;
    height: 140px;
    min-width: 200px;
    min-height: 140px;
    overflow: hidden;
    flex-shrink: 0;
    background-color: var(--color-light);
}

/* 页面（page）模板不显示特色图片 */
body.page .post-thumbnail {
    display: none !important;
}

/* 移动端隐藏头像与图片上的交互按钮（增强可读性） */
@media (max-width: 768px) {
    /* 用户头像与下拉 */
    .user-avatar,
    .user-avatar-wrapper,
    .user-avatar-link,
    .user-dropdown {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }

    /* 认证/登录按钮、头像占位 */
    .auth-btn,
    .user-menu {
        display: none !important;
    }

    /* 常见图片内按钮/覆盖（主题可能使用不同类名） */
    .post-thumbnail .overlay,
    .post-thumbnail .image-actions,
    .entry-content .image-actions,
    .entry-content .wp-block-image .wp-block-image__button,
    .lightbox .close {
        display: none !important;
        pointer-events: none !important;
    }
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover;
    object-position: center;
    transition: var(--transition);
}

.post-card:hover .post-thumbnail img {
    transform: scale(1.05);
}

.post-content {
    padding: 1rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.post-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    order: -1;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-title a {
    color: var(--text-color);
}

.post-excerpt {
    color: var(--text-light);
    margin-bottom: 0;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box !important;
    -webkit-line-clamp: 1 !important;
    line-clamp: 1 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis;
    max-height: 1.5em;
}

/* ============================================
   单篇文章
   ============================================ */
.single-post .entry-header {
    text-align: center;
    margin-bottom: 3rem;
}

.single-post .entry-title {
    font-size: 3rem;
    margin-bottom: 1.5rem;
}

.single-post .entry-meta {
    font-size: 1rem;
    color: var(--text-light);
}

.entry-content {
    font-size: 1.125rem;
    line-height: 1.8;
    max-width: 800px;
    margin: 0 auto;
    /* 确保长内容不会溢出 */
    overflow-wrap: break-word;
    word-wrap: break-word; /* IE 兼容 */
    word-break: break-word; /* 非标准但有用 */
    hyphens: auto; /* 允许连字符断字 */
}

.entry-content p {
    margin-bottom: 1.75rem;
}

/* 文章内链接美化 */
.entry-content a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid rgba(37, 99, 235, 0.3); /* 浅色下划线 */
    padding-bottom: 1px;
    transition: all 0.2s ease;
    word-break: break-all; /* 防止长链接溢出 */
}

.entry-content a:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
    background-color: rgba(37, 99, 235, 0.1); /* 悬停时添加淡淡的背景色 */
    border-radius: 2px;
}

/* 移除正文中标题的边框（如果有）以及隐藏分隔线 */
.entry-content h1,
.entry-content h2,
.entry-content h3 {
    border: none;
    padding-bottom: 0;
}

.entry-content hr {
    display: none;
}

.entry-content img {
    border-radius: var(--border-radius);
    margin: 2rem auto;
    display: block;
}

/* 列表样式恢复 */
.entry-content ul,
.entry-content ol {
    margin-bottom: 1.75rem;
    padding-left: 2rem;
}

.entry-content ul {
    list-style-type: disc;
}

.entry-content ol {
    list-style-type: decimal;
}

.entry-content li {
    margin-bottom: 0.5rem;
}

.entry-content ul ul,
.entry-content ol ol,
.entry-content ul ol,
.entry-content ol ul {
    margin-bottom: 0;
    margin-top: 0.5rem;
}

/* 代码块自动换行 */
.entry-content pre,
.wp-block-code {
    white-space: pre-wrap;       /* CSS3 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */
    overflow-wrap: break-word;   /* 标准属性 */
    max-width: 100%;             /* 防止溢出容器 */
    overflow-x: hidden;          /* 既然换行了，就不需要横向滚动 */
    
    /* 基础样式，如果还没有定义的话 */
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
    color: var(--text-color);
}

.entry-content pre code,
.wp-block-code code {
    white-space: pre-wrap;       /* 继承换行设置 */
    word-wrap: break-word;
    overflow-wrap: break-word;
    background: transparent;     /* 避免双重背景 */
    padding: 0;
}

/* 图片灯箱（全屏覆盖） */
.lightbox {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.75);
    z-index: 12000;
    padding: 2rem;
}

.lightbox img {
    max-width: calc(100vw - 4rem) !important;
    max-height: calc(100vh - 4rem) !important;
    width: auto !important;
    height: auto !important;
    margin: auto !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6) !important;
    border-radius: 8px !important;
    display: block !important;
    position: relative !important;
    top: auto !important;
    transform: none !important;
}

.lightbox .close {
    position: fixed; /* 固定在视口右上角 */
    top: 1rem;
    right: 1rem;
    z-index: 12001;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
    background: rgba(0,0,0,0.35);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 当灯箱打开时禁止页面滚动（不改变 body 定位以避免定位冲突） */
body.lightbox-open {
    overflow: hidden !important;
}

/* ============================================
   侧边栏
   ============================================ */
.sidebar {
    padding: 0;
}

.widget {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.widget-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary-color);
}

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

.widget li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.widget li:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.widget li a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.95rem;
}

.widget li a:hover {
    color: var(--primary-color);
}

/* 归档小工具样式优化 */
.widget_archive ul,
.wp-block-archives ul {
    margin: 0;
    padding: 0;
}

.widget_archive li,
.wp-block-archives li {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget_archive li:hover,
.wp-block-archives li:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: var(--primary-color);
    transform: translateX(3px);
}

.widget_archive li a,
.wp-block-archives li a {
    color: var(--text-color);
    text-decoration: none;
    flex: 1;
    font-size: 0.95rem;
}

.widget_archive li a:hover,
.wp-block-archives li a:hover {
    color: var(--primary-color);
}

/* 归档文章数量样式 */
.widget_archive li .post-count,
.wp-block-archives li .post-count {
    color: var(--text-light);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    margin-left: 0.5rem;
}

/* 近期文章小工具 */
.widget_recent_entries ul,
.wp-block-latest-posts {
    margin: 0;
    padding: 0;
}

.widget_recent_entries li,
.wp-block-latest-posts li {
    display: flex;
    align-items: center;
}

.widget_recent_entries li a,
.wp-block-latest-posts li a {
    flex: 1;
}

.widget_recent_entries .post-date,
.wp-block-latest-posts time {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-left: 0.5rem;
    white-space: nowrap;
}

/* 近期评论小工具 */
.widget_recent_comments ul,
.wp-block-latest-comments {
    margin: 0;
    padding: 0;
}

.widget_recent_comments li {
    line-height: 1.6;
}

.widget_recent_comments .comment-author-link {
    font-weight: 500;
    color: var(--primary-color);
}

/* 分类小工具 */
.widget_categories ul,
.wp-block-categories ul {
    margin: 0;
    padding: 0;
}

.widget_categories li,
.wp-block-categories li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.widget_categories li a,
.wp-block-categories li a {
    flex: 1;
}

.widget_categories li .post-count,
.wp-block-categories li .post-count {
    color: var(--text-light);
    font-size: 0.85rem;
    background: var(--bg-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    margin-left: 0.5rem;
}

/* 标签云小工具 */
.tagcloud,
.wp-block-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
}

.tagcloud a,
.wp-block-tag-cloud a {
    display: inline-block;
    padding: 0.4rem 0.8rem !important;
    background: var(--bg-color) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    font-size: 0.85rem !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    line-height: 1.4 !important;
}

.tagcloud a:hover,
.wp-block-tag-cloud a:hover {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3) !important;
}

/* 日历小工具 */
.widget_calendar table {
    width: 100%;
    border-collapse: collapse;
}

.widget_calendar caption {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.widget_calendar th,
.widget_calendar td {
    padding: 0.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.widget_calendar th {
    background: var(--bg-secondary);
    font-weight: 500;
    font-size: 0.85rem;
}

.widget_calendar td a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
}

.widget_calendar td a:hover {
    text-decoration: underline;
}

/* 小工具搜索表单 */
.widget .search-form,
.search-form {
    position: relative;
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.widget .search-form label,
.search-form label {
    flex: 1;
    margin: 0;
}

.widget .search-form .search-field,
.search-form .search-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-color);
}

.widget .search-form .search-field:focus,
.search-form .search-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.widget .search-form .search-submit,
.search-form .search-submit {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-weight: 500;
}

.widget .search-form .search-submit:hover,
.search-form .search-submit:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

/* 隐藏屏幕阅读器文本 */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* WordPress 区块搜索样式 */
.wp-block-search {
    display: flex !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    align-items: center !important;
}

.wp-block-search__input {
    flex: 1 !important;
    padding: 0.6rem 1rem !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 6px !important;
    font-size: 0.9rem !important;
    transition: all 0.3s ease !important;
    background: white !important;
    width: auto !important;
    color: var(--text-color) !important;
}

.wp-block-search__input:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08) !important;
}

.wp-block-search__input::placeholder {
    color: #999 !important;
}

.wp-block-search__button {
    padding: 0.6rem 1.2rem !important;
    background: var(--primary-color) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 0.9rem !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    font-weight: 500 !important;
    margin: 0 !important;
    line-height: 1.4 !important;
    min-width: 70px !important;
}

.wp-block-search__button:hover {
    background: #4f46e5 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4) !important;
}

.wp-block-search__button:active {
    transform: translateY(0) !important;
    background: #4338ca !important;
}

/* 确保按钮文字可见 */
.wp-block-search__button svg {
    fill: white !important;
}

.wp-block-search__button .wp-block-search__button-text {
    color: white !important;
}

.wp-block-search__label {
    display: none !important;
}

/* 让搜索表单元素正确占据空间 */
.wp-block-search .wp-block-search__inside-wrapper {
    flex: 1 !important;
    display: flex !important;
    gap: 0.5rem !important;
}

/* ============================================
   页脚
   ============================================ */
.site-footer {
    background: var(--text-color);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-widget h3 {
    color: white;
    margin-bottom: 1rem;
}

.footer-widget a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-widget a:hover {
    color: white;
}

.site-info {
    text-align: center;
    padding: 2rem 0;
    color: rgba(255, 255, 255, 0.7);
}

.site-info .container {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    min-height: 80px; /* 减少高度，因为没有border-top了 */
}

.site-info .container p {
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.site-info .beian-info {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.site-info .beian-info a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.site-info .beian-info a:hover {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

/* ============================================
   分页
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.pagination .prev,
.pagination .next {
    font-weight: 600;
}

.pagination a:hover,
.pagination .current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ============================================
   加载更多按钮
   ============================================ */
.load-more-container {
    text-align: center;
    margin-top: 3rem;
}

#load-more-posts {
    display: inline-block;
    padding: 0.75rem 2rem;
    background-color: var(--surface-color);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

#load-more-posts:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

#load-more-posts:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.load-more-loading {
    display: none;
    margin-top: 1rem;
}

.load-more-loading span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 4px;
    animation: loadingTabs 1.4s infinite ease-in-out both;
}

.load-more-loading span:nth-child(1) { animation-delay: -0.32s; }
.load-more-loading span:nth-child(2) { animation-delay: -0.16s; }

@keyframes loadingTabs {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .main-navigation ul {
        /* 保持在文档流中以便平滑过渡：使用 max-height + opacity */
        display: flex;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-color);
        flex-direction: column;
        padding: 0 1rem;
        box-shadow: var(--shadow-md);
        transform-origin: top center;
        transform: translateY(-6px) scaleY(0.99);
        opacity: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 300ms cubic-bezier(0.2, 0, 0, 1), transform 260ms cubic-bezier(0.2, 0, 0, 1), opacity 200ms ease;
        pointer-events: none;
    }

    /* 切换为覆盖式菜单，避免背景滚动并增强可用性 */
    .main-navigation.toggled ul,
    body.menu-open .main-navigation ul {
        display: flex;
        position: fixed;
        inset: 0; /* top:0; right:0; bottom:0; left:0 */
        padding-top: 5rem; /* 给 header 留出空间 */
        padding-left: 1rem;
        padding-right: 1rem;
        overflow-y: auto;
        z-index: 9999;
        -webkit-overflow-scrolling: touch;
        box-shadow: none;
        /* 更明显的半透明遮罩以便在页面上显著展示 */
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        transform: translateY(0) scaleY(1);
        opacity: 1;
        max-height: 100vh;
        pointer-events: auto;
        align-items: stretch;
        justify-content: flex-start;
    }

    /* 让菜单项在毛玻璃背景下更具触控感 */
    .main-navigation.toggled ul li {
        width: 100%;
    }

    .main-navigation.toggled ul a {
        display: block;
        padding: 0.9rem 1rem;
        border-radius: 8px;
        background: rgba(255,255,255,0.35);
        color: var(--text-color);
        margin-bottom: 0.6rem;
        transition: background 160ms ease, transform 160ms ease;
    }

    .main-navigation.toggled ul a:hover {
        background: rgba(255,255,255,0.55);
        transform: translateY(-2px);
    }
    
    /* 移动端子菜单 */
    .main-navigation ul ul {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
        margin-top: 0.5rem;
        background: rgba(99, 102, 241, 0.05);
        border-radius: 4px;
    }
    
    .main-navigation ul ul a {
        padding: 0.5rem 1rem;
    }
    
    .main-navigation .menu-item-has-children > a::after {
        content: '▼';
        float: right;
    }
    
    .main-navigation ul ul .menu-item-has-children > a::after {
        content: '▼';
    }
    
    /* 移动端用户菜单 */
    .user-menu {
        /* 在窄屏保持右侧对齐并垂直居中 */
        margin-left: auto;
        margin-top: 0;
        display: flex;
        align-items: center;
    }
    
    .auth-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-sizing: border-box;
    }
    
    .user-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        margin-top: 0.5rem;
        box-shadow: none;
        border: none;
        background: transparent;
    }

    /* 打开菜单时禁止页面背景滚动 */
    body.menu-open {
        overflow: hidden;
        touch-action: none;
    }
    
    .single-post .entry-title {
        font-size: 2rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    /* ============================================
       移动端：文章卡片图片优先布局（竖向）
       ============================================ */
    .posts-list {
        gap: 1.25rem;
    }

    .post-card {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        border-radius: 12px;
        overflow: hidden;
        padding: 0;
        background: transparent;
    }

    .post-thumbnail {
        width: 100%;
        height: 200px;
        min-width: auto;
        min-height: auto;
        overflow: hidden;
        border-radius: 12px;
        flex-shrink: 0;
        background-color: #eee;
        box-shadow: var(--shadow-sm);
    }

    .post-thumbnail img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

    .post-content {
        padding: 0.9rem 0.75rem 1rem 0.75rem;
    }

    .post-title {
        font-size: 1.1rem;
        margin: 0.6rem 0 0.4rem 0;
        order: 0;
        white-space: normal;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .post-excerpt {
        -webkit-line-clamp: 2 !important;
        max-height: 3em;
        margin-top: 0.25rem;
        color: var(--text-light);
        font-size: 0.95rem;
    }

    .post-meta {
        display: flex;
        gap: 0.8rem;
        align-items: center;
        margin-top: 0.6rem;
        font-size: 0.85rem;
        color: var(--text-light);
    }

    .post-card + .post-card {
        margin-top: 0.6rem;
    }
}

/* ============================================
   实用工具类
   ============================================ */
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: 2rem; }
.hidden { display: none; }

/* Powered-by (footer) icon and text */
.site-info .powered-by {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    line-height: 1;
}

.site-info .powered-by .wp-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.site-info .powered-by .wp-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    opacity: 0.85;
}

.site-info .powered-by a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-weight: 600;
}

.site-info .powered-by a:hover {
    text-decoration: underline;
    color: #ffffff;
}

/* ============================================
   阅读进度条
   ============================================ */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--primary-color);
    z-index: 99999;
    transition: width 0.1s ease;
}
