/* ------------------------------------
 * Modern International Typecho Theme
 * * Design: Minimalist, Content-First, A11y
 * Font: Inter / System Sans
 * --------------------------------- */

/* ==========================================================================
   1. Variables & Reset (与页头保持一致)
   ========================================================================== */
:root {
    /* 核心调色板 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, Menlo, monospace;
    
    /* 亮色模式 (Light) */
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    --bg-code: #f5f5f7;
    --bg-quote: #f9f9f9;
    --text-main: #111111;
    --text-secondary: #555555;
    --text-muted: #888888;
    --accent: #000000; /* 国际化风格通常使用黑白极致对比，或者一个非常克制的品牌色 */
    --link-color: #000000;
    --border-line: rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.08);
    --selection-bg: rgba(0, 0, 0, 0.1);
}

/* 深色模式 (Dark) - 通过 html.dark-mode 触发 */
html.dark-mode {
    --bg-body: #050505;
    --bg-card: #111111;
    --bg-code: #1a1a1a;
    --bg-quote: #111111;
    --text-main: #ededed;
    --text-secondary: #a1a1a1;
    --text-muted: #666666;
    --accent: #ffffff;
    --link-color: #ffffff;
    --border-line: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.5);
    --selection-bg: rgba(255, 255, 255, 0.2);
}

/* 全局重置 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 16px; /* 提升基准字号 */
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
    background: var(--selection-bg);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: opacity 0.2s ease;
    font-weight: 500;
}

a:hover {
    opacity: 0.7;
}

/* ==========================================================================
   2. Layout & Typography (Main Content)
   ========================================================================== */

/* 布局调整：让阅读区域更集中 */
.container {
    padding-top: 40px; /* 留出页头空间 */
    max-width: 1080px; /* 稍微放宽一点 */
}

#main {
    padding-bottom: 60px;
}

/* 标题系统 */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2em;
    margin-bottom: 0.8em;
    letter-spacing: -0.02em; /* 紧凑字间距显得更现代 */
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; border-bottom: 1px solid var(--border-line); padding-bottom: 0.3em; }
h3 { font-size: 1.4rem; }

/* ==========================================================================
   3. Post List (Article Cards)
   ========================================================================== */

.post {
    padding: 0 0 40px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-line);
    position: relative;
    transition: transform 0.2s ease;
}

/* 移除最后一个文章的底边框 */
.post:last-child {
    border-bottom: none;
}

.post-title {
    margin: 0 0 12px 0;
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.3;
}

.post-title a {
    color: var(--text-main);
    background-image: linear-gradient(var(--text-main), var(--text-main));
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 0% 2px;
    transition: background-size 0.3s;
}

.post-title a:hover {
    opacity: 1;
    background-size: 100% 2px; /* 现代的下划线动效 */
}

.post-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: var(--font-mono); /* 使用等宽字体显示元数据，很有极客感 */
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.post-meta li {
    display: inline-block;
    border: none;
    padding: 0;
}
.post-meta a { color: var(--text-secondary); }

/* 文章摘要/内容 */
.post-content {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.8;
}

/* ==========================================================================
   4. Markdown Content Styling (文章正文美化)
   ========================================================================== */

.post-content p {
    margin-bottom: 1.5em;
}

/* 代码块 - 类似 GitHub/Vercel 的风格 */
pre, code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--bg-code);
    color: var(--text-main);
    padding: 3px 6px;
    border-radius: 4px;
}

pre {
    background: var(--bg-code);
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-line);
    margin: 2em 0;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
    border: none;
}

/* 引用块 */
blockquote {
    margin: 2em 0;
    padding: 1em 1.5em;
    border-left: 3px solid var(--accent);
    background: var(--bg-quote);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* 图片 */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 2em auto;
    box-shadow: var(--shadow-sm);
}

/* 列表 */
.post-content ul, .post-content ol {
    padding-left: 2em;
    margin-bottom: 1.5em;
}

.post-content li {
    margin-bottom: 0.5em;
}

/* 表格 - 空气感设计 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 0.95em;
}

table th, table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-line);
    text-align: left;
}

table th {
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 2px solid var(--border-line);
}

/* 水平线 */
hr {
    border: 0;
    height: 1px;
    background: var(--border-line);
    margin: 4em auto;
    width: 30%;
}

/* ==========================================================================
   5. Comments (评论区)
   ========================================================================== */

#comments {
    padding-top: 40px;
    margin-top: 40px;
    border-top: 1px dashed var(--border-line);
}

.comment-list, .comment-list ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.comment-list li {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-line);
    margin: 0; /* 移除旧的 margin */
    background: transparent; /* 移除旧的背景色 */
    border: none; /* 移除旧边框 */
    border-bottom: 1px solid var(--border-line);
}

/* 评论嵌套缩进 */
.comment-list .children {
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid var(--border-line);
}

.comment-author .avatar {
    float: left;
    margin-right: 12px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
}

.comment-author cite {
    font-style: normal;
    font-weight: 600;
    color: var(--text-main);
}

.comment-meta {
    margin-bottom: 8px;
}

.comment-meta a {
    font-size: 0.8em;
    color: var(--text-muted);
}

.comment-content {
    margin-left: 52px; /* 对齐头像右侧 */
    font-size: 0.95rem;
}

/* 输入框美化 - 类似 Material/iOS 风格 */
#comment-form input[type="text"],
#comment-form input[type="email"],
#comment-form input[type="url"],
#comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-line);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 6px;
    margin-bottom: 10px;
    font-family: var(--font-sans);
    transition: all 0.2s;
}

#comment-form textarea {
    min-height: 120px;
    resize: vertical;
}

#comment-form input:focus,
#comment-form textarea:focus {
    outline: none;
    border-color: var(--text-secondary);
    box-shadow: 0 0 0 2px var(--border-line);
}

#comment-form button {
    background: var(--text-main);
    color: var(--bg-body);
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

#comment-form button:hover {
    opacity: 0.9;
}

/* ==========================================================================
   6. Sidebar / Widgets (侧边栏)
   ========================================================================== */

#secondary {
    padding-left: 20px;
}

.widget {
    margin-bottom: 40px;
}

.widget-title {
    font-size: 0.9rem;
    text-transform: uppercase; /* 国际范儿通常大写标题 */
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 15px;
    font-weight: 700;
}

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

.widget-list li {
    margin-bottom: 10px;
}

.widget-list li a {
    color: var(--text-secondary);
    display: block;
    padding: 4px 0;
    transition: transform 0.2s, color 0.2s;
}

.widget-list li a:hover {
    color: var(--text-main);
    transform: translateX(4px); /* 微交互 */
}

/* ==========================================================================
   7. Footer
   ========================================================================== */
#footer {
    margin-top: 60px;
    padding: 40px 0;
    border-top: 1px solid var(--border-line);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   8. Pagination (翻页)
   ========================================================================== */
.page-navigator {
    list-style: none;
    padding: 0;
    margin: 40px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.page-navigator li {
    display: inline-block;
}

.page-navigator a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    border: 1px solid var(--border-line);
    transition: all 0.2s;
}

.page-navigator a:hover {
    border-color: var(--text-main);
    color: var(--text-main);
    text-decoration: none;
}

.page-navigator .current a {
    background: var(--text-main);
    color: var(--bg-body);
    border-color: var(--text-main);
}

/* ==========================================================================
   9. Like Button (已重写适配新变量)
   ========================================================================== */
.post-like-wrapper {
    text-align: center;
    margin: 60px 0;
}

.post-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-line);
    color: var(--text-main);
    border-radius: 99px; /* Pill shape */
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.post-like-btn i {
    color: #ff4757; /* 更加鲜艳的红 */
    font-size: 1.1em;
    transition: transform 0.2s;
}

.post-like-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
    background: var(--bg-body);
}

.post-like-btn:active {
    transform: scale(0.98);
}

.post-like-btn.liked {
    background: #ff4757;
    border-color: #ff4757;
    color: white;
}

.post-like-btn.liked i {
    color: white;
}

@keyframes heartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.post-like-btn:hover i {
    animation: heartPulse 0.8s infinite;
}

/* ==========================================================================
   10. Utilities & Mobile
   ========================================================================== */

/* 辅助类 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }
    
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.5rem; }
    
    .post-title { font-size: 1.5rem; }
    
    /* 移动端侧边栏通常置于底部或隐藏 */
    #secondary {
        padding-left: 0;
        margin-top: 40px;
        padding-top: 40px;
        border-top: 1px solid var(--border-line);
    }

    .comment-list .children {
        margin-left: 10px;
        padding-left: 10px;
    }
}