/* ========================================
   LOFTER 风格主题 - 主样式表
   ======================================== */

/* CSS Reset & 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #5c5c5c;
    --accent-color: #e74c3c;
    --text-color: #333333;
    --text-light: #666666;
    --text-lighter: #999999;
    --border-color: #e8e8e8;
    --bg-color: #f8f8f8;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-color);
    background: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

ul, ol {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ========================================
   容器布局
   ======================================== */

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

.lofter-header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* 头部阅读进度条 */
.header-progress-wrapper {
    width: 100%;
    height: 3px;
    background: transparent;
}

.header-progress-bar {
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    overflow: hidden;
}

.header-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent-color), #e67e22);
    transition: width 0.1s ease;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-branding {
    display: flex;
    flex-direction: column;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    height: 36px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    line-height: 1.2;
    text-decoration: none;
}

.logo-text:hover {
    color: var(--accent-color);
}

.site-description {
    font-size: 0.9rem;
    color: var(--text-light);
    letter-spacing: 0.5px;
}

.site-navigation {
    display: flex;
    gap: 2rem;
}

.site-navigation a {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    padding: 0.5rem 0;
    position: relative;
}

.site-navigation a.active,
.site-navigation a:hover {
    color: var(--accent-color);
}

.site-navigation a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: var(--transition);
}

.site-navigation a.active::after,
.site-navigation a:hover::after {
    width: 100%;
}

/* ========================================
   主布局
   ======================================== */

.lofter-wrapper {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    display: flex;
    gap: 2rem;
    position: relative;
}

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

.lofter-single {
    max-width: 800px;
    margin: 0 auto;
}

/* ========================================
   文章列表
   ======================================== */

.archive-title {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.archive-title h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    font-weight: 600;
}

.post-list {
    display: grid;
    gap: 1.5rem;
}

.post-item {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
}

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

.post-thumbnail {
    width: 300px;
    flex-shrink: 0;
    overflow: hidden;
}

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

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

.post-inner {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
}

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

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

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

.post-meta i {
    margin-right: 0.3rem;
}

.post-excerpt {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.8;
    flex: 1;
}

.post-excerpt img {
    max-width: 100%;
    margin: 1rem 0;
    border-radius: 4px;
}

.post-more {
    margin-top: auto;
}

.read-more {
    display: inline-block;
    color: var(--accent-color);
    font-weight: 600;
    transition: var(--transition);
}

.read-more:hover {
    color: var(--text-color);
}

.read-more .arrow {
    margin-left: 0.3rem;
    transition: var(--transition);
}

.read-more:hover .arrow {
    margin-left: 0.5rem;
}

/* ========================================
   单篇文章
   ======================================== */

.single-post,
.single-page {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 3rem;
    margin-bottom: 2rem;
}

.single-post .post-header {
    text-align: center;
    margin-bottom: 3rem;
}

.single-post .post-title {
    font-size: 2.5rem;
    line-height: 1.3;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.post-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.post-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-meta-item i {
    color: var(--accent-color);
}

.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.post-tags {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.post-tags i {
    color: var(--accent-color);
}

.post-tags a {
    color: var(--text-light);
    margin-right: 0.5rem;
}

.post-tags a:hover {
    color: var(--accent-color);
}

.post-content {
    margin-top: 2rem;
    line-height: 1.9;
    color: var(--text-color);
    font-size: 1.05rem;
}

.post-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--primary-color);
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.post-content h2 {
    font-size: 1.8rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 1rem;
}

.post-content h3 {
    font-size: 1.5rem;
    border-left: 3px solid var(--accent-color);
    padding-left: 0.8rem;
}

.post-content h4 {
    font-size: 1.3rem;
}

.post-content h5 {
    font-size: 1.1rem;
}

.post-content h6 {
    font-size: 1rem;
    color: var(--text-light);
}
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h2 {
    font-size: 1.8rem;
}

.post-content h3 {
    font-size: 1.5rem;
}

.post-content blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--bg-color);
    color: var(--text-light);
}

.post-content pre {
    background: #2d2d2d;
    color: #ccc;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
}

.post-content code {
    background: var(--bg-color);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

.post-content pre code {
    background: transparent;
    padding: 0;
}

.post-tags {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.post-tags a {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--bg-color);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: var(--transition);
}

.post-tags a:hover {
    background: var(--accent-color);
    color: var(--white);
}

.post-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
}

.nav-prev,
.nav-next {
    flex: 1;
    padding: 1.5rem;
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.nav-prev:hover,
.nav-next:hover {
    box-shadow: var(--shadow-hover);
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
}

/* ========================================
   分页
   ======================================== */

.pagination {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding: 2rem 0;
}

.pagination a {
    padding: 0.7rem 1.5rem;
    background: var(--white);
    border-radius: 6px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--accent-color);
    color: var(--white);
}

.pagination .current {
    background: var(--accent-color);
    color: var(--white);
}

/* ========================================
   侧边栏
   ======================================== */

.lofter-sidebar {
    width: 320px;
    flex-shrink: 0;
}

.widget {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.widget-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--border-color);
}

.widget-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.widget-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.widget-list li:last-child {
    border-bottom: none;
}

.widget-list a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    transition: var(--transition);
}

.widget-list a:hover {
    color: var(--accent-color);
    padding-left: 0.3rem;
}

.category-count,
.archive-count {
    font-size: 0.85rem;
    color: var(--text-lighter);
}

.widget-comments a {
    display: block;
}

.comment-author {
    color: var(--primary-color);
    font-weight: 500;
    margin-right: 0.3rem;
}

.widget-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.widget-tag-cloud a {
    padding: 0.4rem 1rem;
    background: var(--bg-color);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: var(--transition);
}

.widget-tag-cloud a:hover {
    background: var(--accent-color);
    color: var(--white);
}

/* 博主简介 */
.widget-profile {
    text-align: center;
}

.profile-inner {
    padding: 1rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.profile-bio {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.profile-social {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.profile-social a {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    border-radius: 50%;
    transition: var(--transition);
}

.profile-social a:hover {
    background: var(--accent-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* ========================================
   文章页面侧边栏
   ======================================== */

.lofter-sidebar-post {
    position: sticky;
    top: 80px;
    align-self: flex-start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* 阅读进度已移至文章内容顶部 */
.widget-toc {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.widget-toc .widget-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

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

.toc-item {
    margin: 0.5rem 0;
}

.toc-item a {
    display: block;
    padding: 0.5rem 0.8rem;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 4px;
    transition: var(--transition);
    font-size: 0.95rem;
}

.toc-item a:hover {
    background: var(--bg-color);
    color: var(--accent-color);
    padding-left: 1rem;
}

.toc-item a.active {
    background: var(--accent-color);
    color: var(--white);
    font-weight: 600;
}

/* ========================================
   评论
   ======================================== */

#comments {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

#comments h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

/* 评论列表 */
.comment-list,
.comment-children {
    margin-top: 1.5rem;
}

/* 嵌套评论样式 */
.comment-children {
    margin-left: 2rem;
    padding-left: 1.5rem;
    border-left: 3px solid var(--accent-color);
    margin-top: 1rem;
}

.comment-children .comment-body {
    background: rgba(231, 76, 60, 0.05);
    border: 1px solid rgba(231, 76, 60, 0.1);
}

.comment-body {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
}

.comment-author a {
    color: var(--accent-color);
    text-decoration: none;
}

.comment-author a:hover {
    text-decoration: underline;
}

.comment-content {
    color: var(--text-light);
    line-height: 1.7;
}

/* 评论区表单 */
.respond {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-top: 2rem;
}

.respond h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.respond p {
    margin-bottom: 1rem;
}

.respond label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.respond label.required::after {
    content: " *";
    color: var(--accent-color);
}

.respond input[type="text"],
.respond input[type="email"],
.respond input[type="url"],
.respond textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: var(--transition);
}

.respond input:focus,
.respond textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.respond textarea {
    min-height: 150px;
    resize: vertical;
}

.respond .submit,
.respond button {
    background: var(--accent-color);
    color: var(--white);
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.respond .submit:hover,
.respond button:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* 评论分页 */
.comments-navigate {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
}

/* 侧边栏评论样式 */
.comments-list {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.comments-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.comment-body {
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 8px;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.comment-author {
    font-weight: 600;
    color: var(--primary-color);
}

.comment-content {
    color: var(--text-light);
    line-height: 1.7;
}

.comments-navigate {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
}

.respond {
    background: var(--white);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 2rem;
}

.respond-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.comment-form-fields {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group .text,
.form-group .textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-group .text:focus,
.form-group .textarea:focus {
    border-color: var(--accent-color);
}

.form-group .textarea {
    min-height: 150px;
    resize: vertical;
}

.form-submit {
    text-align: right;
}

.submit-btn {
    padding: 0.8rem 2rem;
    background: var(--accent-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ========================================
   页脚
   ======================================== */

.lofter-footer {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copyright p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.footer-copyright a {
    color: var(--accent-color);
}

.footer-info {
    color: var(--text-lighter);
    font-size: 0.85rem;
}

/* ========================================
   返回顶部
   ======================================== */

.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--accent-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9999;
    font-size: 24px;
    font-weight: bold;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
}

.back-to-top:hover {
    background: #c0392b;
    transform: translateY(-3px);
}

/* ========================================
   404 页面
   ======================================== */

.lofter-error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.error-page {
    text-align: center;
    padding: 3rem;
}

.error-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.error-title {
    font-size: 6rem;
    font-weight: 900;
    color: var(--accent-color);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-description {
    color: var(--text-light);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ========================================
   无内容页面
   ======================================== */

.no-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.no-content-inner {
    text-align: center;
}

.no-content-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.no-content h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.no-content p {
    color: var(--text-light);
}

/* ========================================
   图标（使用CSS绘制）
   ======================================== */

.icon-time::before {
    content: '🕐';
}

.icon-folder::before {
    content: '📁';
}

.icon-comment::before {
    content: '💬';
}

.icon-user::before {
    content: '👤';
}

.icon-github::before {
    content: '🐙';
}

.icon-weibo::before {
    content: '🐦';
}

.icon-arrow-left::before {
    content: '←';
}

.icon-arrow-right::before {
    content: '→';
}

.icon-arrow-up::before {
    content: '↑';
}

/* ========================================
   响应式设计
   ======================================== */

@media (max-width: 1024px) {
    .header-inner {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .site-navigation {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .lofter-wrapper {
        flex-direction: column;
    }

    .lofter-sidebar {
        width: 100%;
    }

    .post-item {
        flex-direction: column;
    }

    .post-thumbnail {
        width: 100%;
        height: 250px;
    }

    .comment-form-fields {
        grid-template-columns: 1fr;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .lofter-wrapper {
        padding: 1rem;
    }

    .single-post,
    .single-page {
        padding: 1.5rem;
    }

    .single-post .post-title {
        font-size: 1.8rem;
    }

    .post-content {
        font-size: 1rem;
    }

    .post-navigation {
        flex-direction: column;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
}
