/* -------------------------------------------------------
 * Typecho Default Theme (Replica) - ibug.top 最终完美版
 * ------------------------------------------------------- */

/* ================= Section 1: 全局基础 & 排版 ================= */
body {
    background-color: #FFF;
    color: #444;
    font-family: "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 87.5%;
    line-height: 1.5;
}

a { color: #3354AA; text-decoration: none; transition: all 0.2s; }
a:hover { color: #d9534f; }

/* Markdown 核心样式 */
pre, code {
    background: #F6F6F6;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: .92857em;
    border-radius: 4px;
}
code { padding: 2px 4px; color: #d14; }
pre {
    padding: 10px; overflow: auto; max-height: 600px; margin: 1em 0;
}
pre code { display: block; padding: 0; color: #444; background: none; }
blockquote {
    margin: 1em 0; padding-left: 1.5em; border-left: 4px solid #EEE; color: #666;
}
ul, ol { padding-left: 2em; }
h1, h2, h3, h4, h5, h6 { font-weight: bold; color: #333; margin: 1.2em 0 0.6em; }


/* ================= Section 2: 头部、导航与搜索 ================= */
#header { padding: 30px 0 10px; border-bottom: 1px solid #EEE; margin-bottom: 30px; }
#logo { font-size: 2.2em; color: #333; font-weight: bold; }
.description { margin: .5em 0 0; color: #999; font-style: italic; }

#nav-menu { margin-top: 20px; display: block; clear: both; }

/* 导航按钮 (34px高度严格对齐) */
#nav-menu a {
    display: inline-block; height: 34px; line-height: 34px;
    padding: 0 16px; margin-right: 8px;
    background-color: #f4f6f8; color: #444;
    border-radius: 4px; border: none; font-size: 14px; vertical-align: middle;
}
#nav-menu a:hover, #nav-menu .current {
    background-color: #3354AA; color: #fff; text-decoration: none;
}

/* 搜索框 (34px高度严格对齐) */
.nav-search { display: inline-block; vertical-align: middle; margin-left: 8px; }
.nav-search #s {
    width: 120px; height: 34px; line-height: 34px;
    padding: 0 12px; background-color: #f4f6f8;
    border: 1px solid transparent; border-radius: 4px;
    font-size: 13px; outline: none; transition: all 0.3s;
    box-sizing: border-box; vertical-align: middle;
}
.nav-search #s:focus {
    width: 160px; background-color: #fff; border-color: #3354AA;
    box-shadow: 0 2px 6px rgba(51, 84, 170, 0.1);
}


/* ================= Section 3: 主体布局 & 文章 ================= */
#main { padding-right: 20px; box-sizing: border-box; }
#main .post { padding-bottom: 20px; border-bottom: 1px solid #EEE; margin-bottom: 30px; }

.post-content img { max-width: 100%; height: auto; }
.post-content { line-height: 1.6; word-wrap: break-word; }

.post-title { font-size: 1.8em; margin: 0.6em 0; line-height: 1.3; }
.post-title a { color: #333; }
.post-title a:hover { color: #3354AA; }

.post-meta { list-style: none; padding: 0; color: #999; font-size: 0.9em; margin-top: -5px; }
.post-meta li { display: inline-block; margin-right: 8px; padding-left: 12px; border-left: 1px solid #EEE; }
.post-meta li:first-child { margin-left: 0; padding-left: 0; border: none; }

/* 阅读剩余部分按钮 */
.post .more { margin-top: 20px; }
.post .more a {
    display: inline-block; padding: 6px 16px;
    background: #f4f6f8; color: #3354AA;
    border-radius: 4px; font-size: 13px; border: none;
}
.post .more a:hover { background: #3354AA; color: #fff; text-decoration: none; }


/* --- 底部导航 (上一篇/下一篇) --- */
/* 基于 DIV 结构，确保垂直分行 */
.post-footer-nav {
    display: block;                  /* 块级盒子 */
    margin: 0 0 30px 0;              /* 底部留白 */
    border-bottom: 1px solid #eee;   /* 分割线 */
    padding-bottom: 15px;
    width: 100%;
}

.nav-line {
    display: block;                  /* 强制独占一行 */
    width: 100%;                     /* 占满 */
    margin: 8px 0;                   /* 上下行间距 */
    text-align: left;
    color: #666;
    clear: both;
}

.nav-line a {
    color: #3354AA; font-weight: bold; margin-left: 5px;
}
.nav-line a:hover { text-decoration: underline; }


/* 翻页与侧栏杂项 */
.page-navigator { text-align: center; list-style: none; margin: 40px 0; clear: both; }
.page-navigator li { display: inline-block; margin: 0 4px; }
.page-navigator a { display: inline-block; padding: 5px 12px; border: 1px solid #eee; background: #fff; border-radius: 4px; }
.page-navigator .current a { background: #eee; color: #555; }

.widget { margin-bottom: 30px; }
.widget h3 { margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 5px; color: #666; font-size: 1em; }
.widget-list { list-style: none; padding: 0; }
.widget-list li { margin: 5px 0; }


/* ================= Section 4: 评论区 (笛声风格气泡 + 布局修复) ================= */
.comment-list, .comment-list ol { list-style: none; padding: 0; margin: 0; }
.comment-body { margin-bottom: 20px; position: relative; }

/* Flex 容器：允许换行 (修复回复框跑偏的关键) */
.comment-item-body { 
    display: flex; 
    align-items: flex-start; 
    flex-wrap: wrap; /* 允许元素折行，把回复框挤下去 */
}

/* 左侧头像 */
.comment-avatar-box { width: 48px; margin-right: 15px; flex-shrink: 0; }
.comment-avatar-box .avatar {
    width: 48px; height: 48px; border-radius: 50%; transition: transform 0.4s;
}
.comment-avatar-box .avatar:hover { transform: rotate(360deg); }

/* 右侧气泡 */
.comment-main-content {
    flex-grow: 1; position: relative;
    background: #f8f8f8; border-radius: 8px; padding: 15px; border: 1px solid #eee;
}
/* 气泡小三角 */
.comment-main-content::before {
    content: ''; position: absolute; top: 20px; left: -8px;
    width: 0; height: 0;
    border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 8px solid #f8f8f8;
}
.comment-main-content::after {
    content: ''; position: absolute; top: 20px; left: -9px;
    width: 0; height: 0;
    border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-right: 8px solid #eee; z-index: -1;
}

/* 气泡内信息 */
.comment-meta-info {
    margin-bottom: 10px; border-bottom: 1px solid #e0e0e0; padding-bottom: 8px;
    font-size: 13px; color: #999;
}
.comment-meta-info cite { font-style: normal; font-weight: bold; font-size: 15px; color: #333; margin-right: 5px; }
.is-author-badge {
    background: #3354AA; color: #fff; font-size: 10px; padding: 1px 4px;
    border-radius: 3px; margin-right: 10px; vertical-align: text-top;
}
.comment-time { margin-right: 10px; }
.comment-reply-link { float: right; }
.comment-content-text { font-size: 14px; line-height: 1.6; color: #444; }
.comment-content-text p { margin: 5px 0; }
.comment-children { margin-left: 63px; margin-top: 15px; }


/* ================= Section 5: 评论表单与回复逻辑 ================= */

/* 普通输入框美化 */
#comment-form { padding: 20px 0; max-width: 100%; }
#comment-form input[type="text"], #comment-form input[type="email"],
#comment-form input[type="url"], #comment-form textarea {
    display: block; width: 100%; box-sizing: border-box;
    padding: 10px 15px; background: #f4f6f8;
    border: 1px solid transparent; border-radius: 4px;
    font-size: 14px; color: #444; margin-bottom: 15px; outline: none; transition: all 0.2s;
}
#comment-form input:focus, #comment-form textarea:focus {
    background: #fff; border-color: #3354AA; box-shadow: 0 2px 6px rgba(51, 84, 170, 0.1);
}
#comment-form label { display: block; margin-bottom: 6px; font-weight: bold; color: #555; font-size: 13px; }
#comment-form .required:after { content: " *"; color: #d14; }
#comment-form button[type="submit"] {
    cursor: pointer; background: #3354AA; color: #fff;
    border: none; border-radius: 4px; padding: 10px 30px;
    font-size: 14px; font-weight: bold; transition: background 0.2s;
}
#comment-form button[type="submit"]:hover { background: #28448f; }

/* 楼中楼回复框 (嵌入式) */
.comment-list .respond {
    flex-basis: 100%;           /* 强制占满整行，触发换行 */
    width: 100%;
    order: 99;                  /* 保证排在最后 */
    margin-top: 15px;
    margin-left: 63px;          /* 缩进对齐 */
    padding: 20px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    clear: both;
}
.comment-list .respond h3 { display: none; }

/* 取消回复按钮 */
#cancel-comment-reply-link {
    display: inline-block; float: right; margin-bottom: 10px;
    padding: 4px 12px; background: #e0e0e0; color: #666;
    font-size: 12px; border-radius: 4px; transition: all 0.2s;
}
#cancel-comment-reply-link:hover { background: #d9534f; color: #fff; }

/* 修复嵌入表单的边距 */
.comment-list #comment-form { margin: 0; padding: 0; }


/* ================= Section 6: 移动端适配 ================= */
@media (max-width: 767px) {
    #header, #nav-menu { text-align: center; }
    #main { padding-right: 0; }
    .nav-search { display: block; margin: 15px auto; width: 90%; }
    .nav-search #s { width: 100%; height: 38px; text-align: center; }
    #secondary { margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee; }
    
    /* 评论区移动端适配 */
    .comment-children { margin-left: 10px; }
    .comment-list .respond { margin-left: 0; } /* 手机端取消缩进 */
    #comment-form button[type="submit"] { width: 100%; }
}

.clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }