/*
Theme Name: ClearSky 晴空
Description: 清新蓝色调单栏博客主题，响应式、深浅色、SEO 友好
Version: 1.0.0
Author: sheep5.net
*/

/* ============ 设计变量 ============ */
:root {
    --accent: #2f6fed;
    --accent-hover: #1d5cd6;
    --accent-soft: #e9f1fe;
    --accent-border: #c3d8fb;

    --bg: #f4f8fd;
    --surface: #ffffff;
    --text: #1c2b3a;
    --text-2: #5b6b7c;
    --text-3: #8fa0b0;
    --border: #e2ecf6;
    --code-bg: #eef4fb;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(23, 63, 120, .05), 0 6px 20px rgba(23, 63, 120, .06);

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
            "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;

    --container: 780px;
}

[data-accent="lake"] {
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-soft: #e2f4fd;
    --accent-border: #b6e2f7;
}
[data-accent="deep"] {
    --accent: #1e40af;
    --accent-hover: #1a3590;
    --accent-soft: #e6ebfa;
    --accent-border: #c1cdf0;
}
[data-accent="teal"] {
    --accent: #0d9488;
    --accent-hover: #0b7c72;
    --accent-soft: #e0f3f1;
    --accent-border: #b5e0db;
}

[data-theme="dark"] {
    --accent: #6ea3ff;
    --accent-hover: #8dbaff;
    --accent-soft: rgba(110, 163, 255, .14);
    --accent-border: rgba(110, 163, 255, .32);

    --bg: #0f1b2a;
    --surface: #172536;
    --text: #dce7f2;
    --text-2: #9db0c2;
    --text-3: #6d8194;
    --border: #24374d;
    --code-bg: #1d2f43;

    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .22);
}

/* ============ 基础 ============ */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    transition: background-color .3s ease, color .3s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .2s ease;
}
a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }

.theme-transition, .theme-transition *, .theme-transition *::before, .theme-transition *::after {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease !important;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 100;
    border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

/* ============ 页头 ============ */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 62px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.site-logo img {
    height: 34px;
    width: auto;
    border-radius: 6px;
    display: block;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: .3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.site-title:hover { color: var(--accent); }

.site-nav { display: flex; align-items: center; }

.nav-toggle-input { display: none; }
.nav-toggle-label {
    display: none;
    cursor: pointer;
    color: var(--text-2);
    padding: 8px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-menu > li > a {
    display: block;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-size: .95rem;
    font-weight: 500;
}
.nav-menu > li > a:hover { color: var(--accent); background: var(--accent-soft); }
.nav-menu > li > a.active { color: var(--accent); background: var(--accent-soft); }

.search-form {
    display: flex;
    align-items: center;
    position: relative;
}
.search-icon {
    position: absolute;
    left: 9px;
    width: 15px;
    height: 15px;
    color: var(--text-3);
    pointer-events: none;
}
.search-input {
    width: 132px;
    padding: 7px 10px 7px 30px;
    font-size: .9rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    outline: none;
    transition: border-color .2s ease, width .25s ease, box-shadow .2s ease;
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
    width: 180px;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: color .2s ease, border-color .2s ease;
}
.theme-switch:hover { color: var(--accent); border-color: var(--accent); }

/* ============ 主体 ============ */
.site-main { padding: 36px 20px 56px; }

.archive-head { margin-bottom: 24px; }
.archive-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}
.archive-title::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 1.05em;
    margin-right: 10px;
    vertical-align: -0.12em;
    background: var(--accent);
    border-radius: 3px;
}

/* ---- 列表卡片 ---- */
.post-list { display: flex; flex-direction: column; gap: 22px; }

.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 28px;
    box-shadow: var(--shadow);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.post-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-border);
    box-shadow: 0 4px 8px rgba(23, 63, 120, .06), 0 12px 28px rgba(23, 63, 120, .09);
}

.post-title {
    margin: 0 0 10px;
    font-size: 1.32rem;
    line-height: 1.5;
    font-weight: 700;
}
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--accent); }

.post-single .post-title { font-size: 1.72rem; margin-bottom: 14px; }

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    list-style: none;
    margin: 0 0 14px;
    padding: 0;
    font-size: .85rem;
    color: var(--text-3);
}
.post-meta li { display: flex; align-items: center; gap: 5px; }
.post-meta a { color: var(--text-3); }
.post-meta a:hover { color: var(--accent); }
.post-meta svg { flex: none; }

.post-excerpt { color: var(--text-2); font-size: .98rem; }
.post-excerpt p { margin: 0 0 .8em; }
.post-excerpt p:last-child { margin-bottom: 0; }

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-size: .92rem;
    font-weight: 600;
}
.read-more svg { transition: transform .2s ease; }
.read-more:hover svg { transform: translateX(3px); }

.empty-state {
    text-align: center;
    padding: 64px 0;
    color: var(--text-3);
}
.empty-icon { font-size: 2.6rem; margin: 0 0 10px; }

/* ---- 单篇正文 ---- */
.post-single {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 34px 36px;
    box-shadow: var(--shadow);
}

.post-content {
    font-size: 1.02rem;
    line-height: 1.85;
    overflow-wrap: break-word;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    margin: 1.8em 0 .7em;
    line-height: 1.5;
    font-weight: 700;
    color: var(--text);
}
.post-content h2 {
    font-size: 1.42rem;
    padding-bottom: .35em;
    border-bottom: 2px solid var(--accent-soft);
}
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1.05rem; }

.post-content p { margin: 0 0 1.15em; }

.post-content a {
    color: var(--accent);
    border-bottom: 1px solid var(--accent-border);
}
.post-content a:hover { border-bottom-color: var(--accent); }

.post-content blockquote {
    margin: 1.4em 0;
    padding: 12px 20px;
    border-left: 4px solid var(--accent);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-2);
}
.post-content blockquote p:last-child { margin-bottom: 0; }

.post-content code {
    font-family: var(--mono);
    font-size: .88em;
    background: var(--code-bg);
    padding: .15em .45em;
    border-radius: 5px;
}
.post-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 18px;
    overflow-x: auto;
    line-height: 1.65;
}
.post-content pre code {
    background: none;
    padding: 0;
    font-size: .86rem;
}

.post-content ul, .post-content ol { padding-left: 1.5em; margin: 0 0 1.15em; }
.post-content li { margin: .35em 0; }

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    font-size: .93rem;
    display: block;
    overflow-x: auto;
}
.post-content th, .post-content td {
    border: 1px solid var(--border);
    padding: 9px 13px;
    text-align: left;
}
.post-content th { background: var(--accent-soft); font-weight: 600; }

.post-content img { display: block; margin: 1.4em auto; }

.post-content hr {
    border: none;
    border-top: 1px dashed var(--border);
    margin: 2.2em 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 26px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    font-size: .88rem;
}
.tags a {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 3px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
}
.tags a:hover { border-color: var(--accent-border); }

/* ---- 上一篇 / 下一篇 ---- */
.post-near {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 22px 0;
}
.post-near-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    font-size: .92rem;
    min-width: 0;
}
.post-near-item.next { text-align: right; }
.near-label {
    display: block;
    font-size: .78rem;
    color: var(--text-3);
    margin-bottom: 3px;
}
.near-title {
    display: block;
    color: var(--text);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.post-near-item a:hover .near-title { color: var(--accent); }
.near-none { color: var(--text-3); }

/* ============ 评论 ============ */
.comments-area {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 36px;
    margin-top: 22px;
    box-shadow: var(--shadow);
}

.comments-header {
    font-size: 1.12rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.comment-body { margin: 0 0 18px; }
.comment-children { margin-left: 46px; }

.comment-inner {
    display: flex;
    gap: 13px;
    padding: 15px 17px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.comment-by-author .comment-inner { border-color: var(--accent-border); background: var(--accent-soft); }

.comment-author-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex: none;
}

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

.comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin-bottom: 6px;
    font-size: .85rem;
    color: var(--text-3);
}
.comment-author { font-style: normal; font-weight: 600; color: var(--text); font-size: .92rem; }
.comment-author a { color: var(--text); }
.comment-author a:hover { color: var(--accent); }
.comment-reply a { font-size: .82rem; }

.comment-content {
    font-size: .95rem;
    line-height: 1.8;
    overflow-wrap: break-word;
}
.comment-content p { margin: 0 0 .7em; }
.comment-content p:last-child { margin-bottom: 0; }

.comments-body .pagination-area { margin-top: 18px; }

/* ---- 评论表单 ---- */
.respond { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); }
.respond-title { margin: 0 0 16px; font-size: 1.12rem; font-weight: 700; }
.respond-login { font-size: .9rem; color: var(--text-2); margin: 0 0 14px; }
.respond-login a { font-weight: 600; }

.respond-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.form-group { margin-bottom: 12px; }

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: .95rem;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea.form-input { min-height: 110px; resize: vertical; }

.form-submit { text-align: right; margin-bottom: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: .95rem;
    font-weight: 600;
    font-family: var(--font);
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color .2s ease, transform .15s ease;
}
.btn:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); }

.respond-closed {
    margin: 22px 0 0;
    padding: 16px;
    text-align: center;
    color: var(--text-3);
    font-size: .9rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
}

.cancel-comment-reply:empty { display: none; }
.cancel-comment-reply a { font-size: .85rem; }

/* ============ 分页 ============ */
.pagination-area { margin: 32px 0 0; }

.page-navigator {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.page-navigator li {
    display: inline-flex;
    margin: 0;
    padding: 0;
    list-style: none;
}
.page-navigator a, .page-navigator span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-2);
    font-size: .9rem;
}
.page-navigator a:hover {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
.page-navigator .current,
.page-navigator .current a {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* ============ 404 ============ */
.not-found {
    text-align: center;
    padding: 72px 0 56px;
}
.not-found-code {
    margin: 0;
    font-size: 5.5rem;
    font-weight: 300;
    line-height: 1.1;
    color: var(--accent-border);
    letter-spacing: 4px;
}
.not-found-text {
    margin: 12px 0 30px;
    font-size: 1.1rem;
    color: var(--text-2);
}
.not-found-search {
    display: flex;
    justify-content: center;
    gap: 10px;
}
.not-found-search .search-input {
    width: min(300px, 60vw);
    padding: 10px 16px;
    font-size: 16px;
    border-radius: var(--radius-sm);
}

/* ============ 页脚 ============ */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 30px 0;
    text-align: center;
    color: var(--text-3);
    font-size: .88rem;
}
.site-footer p { margin: 6px 0; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--accent); }
.footer-custom { margin: 8px 0; }
.footer-custom a { color: var(--text-2); }

/* ============ 回到顶部 ============ */
.back-top {
    position: fixed;
    right: 22px;
    bottom: 26px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease, color .2s ease;
}
.back-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-top:hover { color: var(--accent); border-color: var(--accent-border); }

/* ============ 响应式 ============ */
@media (max-width: 720px) {
    .header-inner { min-height: 56px; }

    .nav-toggle-label { display: flex; }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px 16px 16px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        display: none;
    }
    .nav-toggle-input:checked ~ .nav-menu { display: flex; }

    .nav-menu > li > a { padding: 11px 14px; }

    .search-input { width: 100%; }
    .search-form { width: 100%; margin: 6px 0; }
    .search-input:focus { width: 100%; }

    .site-main { padding: 24px 16px 44px; }

    .post-card { padding: 20px 18px; }
    .post-title { font-size: 1.16rem; }
    .post-single .post-title { font-size: 1.42rem; }
    .post-single { padding: 22px 18px; }

    .post-near { grid-template-columns: 1fr; }
    .post-near-item.next { text-align: left; }

    .comments-area { padding: 20px 18px; }
    .comment-children { margin-left: 20px; }

    .not-found-code { font-size: 4rem; }
    .not-found-search { flex-direction: column; align-items: stretch; padding: 0 30px; }

    .back-top { right: 16px; bottom: 18px; width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}
