/* ===== style.css - 所有样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background-color: #f4f6f8;
    padding: 80px 20px 20px 20px;
}

/* ===== 顶部导航栏 ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background-color: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 0 40px;
    height: auto;
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eaeef2;
    max-width: 100%;
    margin: 0;
    border-radius: 0;
    transition: none; /* ★★★ 去掉延迟 ★★★ */
}

.logo h1 {
    font-size: 32px;
    font-weight: 500;
    color: #1a1a2e;
    letter-spacing: 1px;
}
.logo h1 a {
    color: inherit;
    text-decoration: none;
}

.nav {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 8px;
    transition: none; /* ★★★ 去掉延迟 ★★★ */
    flex-wrap: wrap;
}
.nav li a,
.nav li button {
    display: block;
    padding: 8px 18px;
    font-size: 25px;
    font-weight: 500;
    color: #2c3e50;
    text-decoration: none;
    border-radius: 20px;
    transition: none; /* ★★★ 去掉延迟 ★★★ */
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.nav li a:hover {
    background-color: #f0f3f8;
    color: #1a1a2e;
}

/* ===== 搜索框 ===== */
.search-wrapper {
    display: flex;
    align-items: center;
    background: #f0f3f8;
    border-radius: 20px;
    padding: 4px 8px 4px 16px;
    transition: none; /* ★★★ 去掉延迟 ★★★ */
    border: 2px solid transparent;
}
.search-wrapper:focus-within {
    border-color: #1a1a2e;
    background: #ffffff;
}
.search-wrapper input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 6px 8px;
    width: 80px;
    font-family: inherit;
    color: #1a1a2e;
    transition: width 0.3s ease; /* 保留宽度过渡，不影响暗色模式 */
}
.search-wrapper input::placeholder {
    color: #999;
}
.search-wrapper input:focus {
    width: 200px;
}
.search-wrapper button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: none; /* ★★★ 去掉延迟 ★★★ */
}
.search-wrapper button:hover {
    background: rgba(0, 0, 0, 0.05);
}
.search-wrapper button svg {
    display: block;
    stroke: #555;
    fill: none;
}

/* ===== 三道杠 ===== */
.hamburger {
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    padding: 8px 10px;
    background: none;
    border: none;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}
.hamburger span {
    display: block !important;
    width: 26px;
    height: 3px;
    background-color: #1a1a2e;
    border-radius: 2px;
    transition: all 0.3s ease; /* 保留：三道杠变叉号的动画 */
    flex-shrink: 0;
}
.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}
.hamburger-container {
    display: none !important;
}

/* ===== 移动端/缩放适配 ===== */
body.is-zoomed .header {
    flex-direction: column;
    align-items: stretch;
    padding: 15px 20px;
    gap: 10px;
    border-radius: 0;
    max-width: 100%;
    margin: 0;
}
body.is-zoomed .logo {
    width: 100%;
    text-align: center;
}
body.is-zoomed .logo h1 {
    font-size: 28px;
}
body.is-zoomed .nav {
    display: flex !important;
    width: 100%;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding-top: 8px;
    border-top: 1px solid #eaeef2;
    flex-wrap: wrap;
}
body.is-zoomed .nav li:not(.search-btn):not(.hamburger-container) {
    display: none !important;
}
body.is-zoomed .nav li.search-btn {
    display: flex !important;
    order: 1;
}
body.is-zoomed .hamburger-container {
    display: flex !important;
    order: 2;
}
body.is-zoomed .nav.open {
    flex-direction: column !important;
    align-items: stretch;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid #eaeef2;
    position: relative;
}
body.is-zoomed .nav.open li:not(.search-btn):not(.hamburger-container) {
    display: flex !important;
    width: 100%;
    justify-content: flex-start;
    order: 1;
}
body.is-zoomed .nav.open li a {
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    font-size: 16px;
    border-radius: 8px;
}
body.is-zoomed .nav.open .search-btn {
    display: flex !important;
    order: 3;
    width: 100%;
    justify-content: flex-start;
    border-top: 1px solid #eaeef2;
    padding-top: 6px;
    margin-top: 4px;
    padding-bottom: 0;
}
body.is-zoomed .nav.open .search-btn button {
    padding-left: 14px;
}
body.is-zoomed .nav.open .hamburger-container {
    display: flex !important;
    order: 2;
    position: absolute;
    top: 13px;
    right: 0;
    align-self: flex-end;
    margin: 0;
}

/* ===== 移动端适配（屏幕宽度 ≤ 768px） ===== */
@media (max-width: 768px) {
    body {
        padding: 100px 20px 20px 20px;
    }
    .header {
        flex-direction: column;
        align-items: stretch;
        padding: 15px 20px;
        gap: 10px;
        border-radius: 0;
        max-width: 100%;
        margin: 0;
    }
    .logo {
        width: 100%;
        text-align: center;
    }
    .logo h1 {
        font-size: 28px;
    }
    .nav {
        display: flex !important;
        width: 100%;
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center;
        gap: 0;
        padding-top: 8px;
        border-top: 1px solid #eaeef2;
        flex-wrap: wrap;
    }
    .nav li:not(.search-btn):not(.hamburger-container) {
        display: none !important;
    }
    .nav li.search-btn {
        display: flex !important;
        order: 1;
        transition: margin-top 0.45s ease, opacity 0.45s ease; /* 保留：移动端下拉动画 */
        margin-top: 0;
        opacity: 1;
    }
    .hamburger-container {
        display: flex !important;
        order: 2;
    }
    .nav.open {
        flex-direction: column !important;
        align-items: stretch;
        gap: 4px;
        padding-top: 8px;
        border-top: 1px solid #eaeef2;
        position: relative;
    }
    .nav.open li:not(.search-btn):not(.hamburger-container) {
        display: flex !important;
        width: 100%;
        justify-content: flex-start;
        order: 1;
    }
    .nav.open li a {
        width: 100%;
        text-align: left;
        padding: 8px 14px;
        font-size: 16px;
        border-radius: 8px;
    }
    .nav.open .search-btn {
        display: flex !important;
        order: 3;
        width: 100%;
        justify-content: flex-start;
        border-top: 1px solid #eaeef2;
        padding-top: 6px;
        margin-top: 20px;
    }
    .nav.open .search-btn button {
        padding-left: 14px;
    }
    .nav.open .hamburger-container {
        display: flex !important;
        order: 2;
        position: absolute;
        top: 13px;
        right: 0;
        align-self: flex-end;
        margin: 0;
    }
    .search-wrapper input {
        width: 60px;
        font-size: 14px;
    }
    .search-wrapper input:focus {
        width: 120px;
    }
    .search-wrapper {
        padding: 2px 6px 2px 12px;
    }
}

/* ===== 超小屏优化（≤480px） ===== */
@media (max-width: 480px) {
    body {
        padding: 90px 10px 10px 10px;
    }
    .header {
        padding: 10px 15px;
    }
    .logo h1 {
        font-size: 24px;
    }
    .nav li a,
    .nav li button {
        font-size: 20px;
        padding: 6px 14px;
    }
    .nav.open li a {
        font-size: 14px;
    }
}

/* ===== 博客列表样式 ===== */
.blog-grid {
    max-width: 1200px;
    margin: 20px auto 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}
.post-card {
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* 保留：卡片悬停动画 */
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10);
}
.post-card .thumb {
    width: 100%;
    height: 200px;
    background-color: #eef2f7;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.post-card .thumb .placeholder {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    color: #aaa;
    font-size: 14px;
}
.post-card .content {
    padding: 20px 22px 22px 22px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.post-card .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.post-card .tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: #1a1a2e;
    padding: 2px 14px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    line-height: 24px;
}
.post-card .title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.4;
    margin-bottom: 10px;
}
.post-card .summary {
    font-size: 15px;
    color: #5a6270;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 14px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card .date {
    font-size: 14px;
    color: #98a0b0;
    border-top: 1px solid #f0f2f5;
    padding-top: 14px;
    margin-top: auto;
}
.no-posts {
    max-width: 1200px;
    margin: 30px auto 0 auto;
    text-align: center;
    padding: 60px 20px;
    color: #bbb;
    font-size: 18px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.no-result {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ===== 文章详情页样式 ===== */
.detail-container {
    max-width: 860px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 50px 60px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: #555;
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s; /* 保留：悬停颜色变化 */
}
.back-link:hover {
    color: #000;
}
.back-link::before {
    content: "← ";
}
.detail-container h1 {
    font-size: 34px;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
    margin-bottom: 16px;
}
.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 15px;
    color: #888;
    border-bottom: 1px solid #f0f2f5;
    padding-bottom: 20px;
    margin-bottom: 30px;
}
.detail-body {
    font-size: 17px;
    line-height: 1.9;
    color: #2c3e50;
}
.detail-body h2 {
    font-size: 26px;
    margin-top: 35px;
    margin-bottom: 15px;
    color: #1a1a2e;
    border-bottom: 1px solid #eaeef2;
    padding-bottom: 10px;
}
.detail-body h3 {
    font-size: 20px;
    margin-top: 25px;
    margin-bottom: 12px;
    color: #1a1a2e;
}
.detail-body p {
    margin-bottom: 18px;
}
.detail-body ul,
.detail-body ol {
    margin: 10px 0 18px 30px;
}
.detail-body li {
    margin-bottom: 8px;
}
.detail-body code {
    background: #f4f6f8;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 15px;
    color: #c0392b;
}
.detail-body pre {
    background: #1a1a2e;
    color: #f0f3f8;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 16px 0 24px 0;
    font-size: 15px;
    line-height: 1.7;
}
.detail-body pre code {
    background: none;
    color: inherit;
    padding: 0;
}
.detail-body img {
    max-width: 100%;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.detail-body blockquote {
    border-left: 4px solid #2980b9;
    padding: 12px 20px;
    margin: 16px 0;
    background: #f8faff;
    border-radius: 0 8px 8px 0;
    color: #555;
}
.detail-body hr {
    border: none;
    border-top: 2px dashed #eaeef2;
    margin: 30px 0;
}
#disqus_thread {
    margin-top: 40px;
    border-top: 1px solid #eaeef2;
    padding-top: 30px;
}

@media (max-width: 600px) {
    .detail-container {
        padding: 24px 20px;
    }
    .detail-container h1 {
        font-size: 24px;
    }
    .detail-body {
        font-size: 15px;
    }
    .detail-body h2 {
        font-size: 20px;
    }
}

/* ===== 暗色模式样式 ===== */
body.dark-mode {
    background-color: #121212;
    color: #e0e0e0;
}
body.dark-mode .header {
    background-color: #1e1e1e;
    border-bottom-color: #2c2c2c;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
body.dark-mode .logo h1 {
    color: #ffffff;
}
body.dark-mode .nav li a,
body.dark-mode .nav li button {
    color: #e0e0e0;
}
body.dark-mode .nav li a:hover {
    background-color: #2c2c2c;
    color: #ffffff;
}
body.dark-mode .search-wrapper {
    background: #2c2c2c;
    border-color: transparent;
}
body.dark-mode .search-wrapper:focus-within {
    border-color: #bb86fc;
    background: #1e1e1e;
}
body.dark-mode .search-wrapper input {
    color: #ffffff;
}
body.dark-mode .hamburger span {
    background-color: #ffffff;
}
body.dark-mode .post-card,
body.dark-mode .no-posts,
body.dark-mode .no-result,
body.dark-mode .detail-container {
    background: #1e1e1e;
    color: #e0e0e0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
body.dark-mode .post-card .title,
body.dark-mode .detail-container h1,
body.dark-mode .detail-body h2,
body.dark-mode .detail-body h3 {
    color: #ffffff;
}
body.dark-mode .post-card .summary,
body.dark-mode .detail-body {
    color: #b0b0b0;
}
body.dark-mode .detail-body code {
    background: #2c2c2c;
    color: #ff79c6;
}
body.dark-mode .detail-body pre {
    background: #0f0f0f;
    color: #f8f8f2;
}
body.dark-mode .detail-body blockquote {
    background: #1a1a2e;
    border-left-color: #bb86fc;
    color: #b0b0b0;
}
body.dark-mode .back-link {
    color: #aaa;
}
body.dark-mode .back-link:hover {
    color: #fff;
}