/* ============================================
 * Global Light/Dark Adaptive System
 * 全局智能适配系统
 * 
 * 使用方法：将此文件保存为 adaptive-styles.css
 * 并在 _config.butterfly.yml 的 inject.head 中添加
 * ============================================ */

/* ============================================
 * 平滑过渡
 * ============================================ */
body,
.card-widget,
.article-sort-item,
.recent-post-item,
#page-header,
.year-nav-link,
.article-sort-title,
.category-title-main {
    transition: background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* ============================================
 * 导航栏适配
 * ============================================ */

/* Light 背景 */
body.light-background #nav {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-background #nav .nav-link {
    color: #2a2a2a;
}

body.light-background #nav .nav-link:hover {
    color: var(--theme-color);
}

/* Dark 背景 */
body.dark-background #nav {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-background #nav .nav-link {
    color: #ffffff;
}

body.dark-background #nav .nav-link:hover {
    color: var(--theme-color);
}

/* ============================================
 * 首页文章卡片适配
 * ============================================ */

/* Light 背景 */
body.light-background .recent-post-item {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-background .recent-post-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

body.light-background .recent-post-item .article-title {
    color: #2a2a2a;
}

body.light-background .recent-post-item .content {
    color: #666;
}

/* Dark 背景 */
body.dark-background .recent-post-item {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
}

body.dark-background .recent-post-item:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.18);
}

body.dark-background .recent-post-item .article-title {
    color: #ffffff;
}

body.dark-background .recent-post-item .content {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
 * 侧边栏全局适配
 * ============================================ */

/* Light 背景 */
body.light-background #aside-content .card-widget {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-background #aside-content .card-widget-title {
    color: #2a2a2a;
}

body.light-background #aside-content .card-widget-content {
    color: #666;
}

/* Dark 背景 */
body.dark-background #aside-content .card-widget {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark-background #aside-content .card-widget-title {
    color: #ffffff;
}

body.dark-background #aside-content .card-widget-content {
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
 * 页脚适配
 * ============================================ */

/* Light 背景 */
body.light-background #footer {
    background: rgba(255, 255, 255, 0.85);
    color: #666;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

body.light-background #footer a {
    color: #2a2a2a;
}

/* Dark 背景 */
body.dark-background #footer {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-background #footer a {
    color: rgba(255, 255, 255, 0.9);
}

/* ============================================
 * 分页导航适配
 * ============================================ */

/* Light 背景 */
body.light-background #pagination .page-number {
    background: rgba(255, 255, 255, 0.9);
    color: #2a2a2a;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-background #pagination .page-number:hover,
body.light-background #pagination .page-number.current {
    background: var(--theme-color);
    color: #fff;
}

/* Dark 背景 */
body.dark-background #pagination .page-number {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body.dark-background #pagination .page-number:hover,
body.dark-background #pagination .page-number.current {
    background: var(--theme-color);
    color: #fff;
}

/* ============================================
 * 搜索框适配
 * ============================================ */

/* Light 背景 */
body.light-background .search-input {
    background: rgba(255, 255, 255, 0.95);
    color: #2a2a2a;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-background .search-input::placeholder {
    color: #999;
}

/* Dark 背景 */
body.dark-background .search-input {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body.dark-background .search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
 * Tag 标签适配
 * ============================================ */

/* Light 背景 */
body.light-background .tag-cloud-tags a,
body.light-background .article-meta__tags a {
    background: rgba(255, 255, 255, 0.9);
    color: #2a2a2a;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-background .tag-cloud-tags a:hover,
body.light-background .article-meta__tags a:hover {
    background: var(--theme-color);
    color: #fff;
}

/* Dark 背景 */
body.dark-background .tag-cloud-tags a,
body.dark-background .article-meta__tags a {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

body.dark-background .tag-cloud-tags a:hover,
body.dark-background .article-meta__tags a:hover {
    background: var(--theme-color);
    color: #fff;
}

/* ============================================
 * 确保文字始终清晰可读
 * ============================================ */

/* Light 背景 - 所有主要文字元素 */
body.light-background h1,
body.light-background h2,
body.light-background h3,
body.light-background h4,
body.light-background h5,
body.light-background h6,
body.light-background p,
body.light-background span,
body.light-background div {
    color: inherit;
}

body.light-background {
    --font-color: #2a2a2a;
    --text-secondary: #666;
}

/* Dark 背景 - 所有主要文字元素 */
body.dark-background h1,
body.dark-background h2,
body.dark-background h3,
body.dark-background h4,
body.dark-background h5,
body.dark-background h6 {
    color: #ffffff;
}

body.dark-background p,
body.dark-background span,
body.dark-background div {
    color: rgba(255, 255, 255, 0.9);
}

body.dark-background {
    --font-color: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
}

/* ============================================
 * 通用遮罩增强（确保文字可读性）
 * ============================================ */

/* Light 背景 - 为所有主要内容容器添加轻微遮罩 */
body.light-background #content-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.4);
    pointer-events: none;
    z-index: 0;
}

body.light-background #content-inner>* {
    position: relative;
    z-index: 1;
}

/* Dark 背景 - 为所有主要内容容器添加轻微遮罩 */
body.dark-background #content-inner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 0;
}

body.dark-background #content-inner>* {
    position: relative;
    z-index: 1;
}

/* 强制取消社交图标动画 */
.card-info-social-icons a i,
.card-info-social-icons a:hover i {
    transform: none !important;
    transition: color 0.3s ease !important;
}