/* ==========================================================================
   Yc — 原创单栏阅读主题
   布局：顶部栏 + 左侧抽屉菜单 + 居中窄栏内容
   ========================================================================== */

:root {
    --bg: #ffffff;
    --bg-soft: #f7f8fa;
    --fg: #2c3e50;
    --fg-muted: #7f8c9b;
    --line: #e8ecf0;
    --accent: #2f6fed;
    --accent-soft: rgba(47, 111, 237, 0.08);
    --badge-bg: #ff6b35;
    --badge-fg: #ffffff;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    --content-width: 720px;
    --topbar-h: 52px;
    --drawer-w: 280px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

html[data-night="1"] {
    --bg: #1d2129;
    --bg-soft: #242936;
    --fg: #ccd2da;
    --fg-muted: #77808d;
    --line: #333a48;
    --accent: #5b8ff0;
    --accent-soft: rgba(91, 143, 240, 0.14);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

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

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

.skip-link {
    position: absolute;
    left: -9999px;
}
.skip-link:focus {
    left: 8px;
    top: 8px;
    z-index: 200;
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 4px;
}

/* --------------------------------------------------------------------------
   顶部栏
   -------------------------------------------------------------------------- */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    z-index: 100;
    transition: background-color 0.25s ease;
}

.site-title {
    margin-left: 12px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.menu-toggle {
    width: 40px;
    height: 40px;
    padding: 9px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.menu-toggle:hover { background: var(--accent-soft); }
.menu-toggle-bar {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--fg);
    border-radius: 1px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
    opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.night-toggle {
    margin-left: auto;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--fg);
    font-size: 18px;
    cursor: pointer;
    border-radius: 50%;
}
.night-toggle:hover { background: var(--accent-soft); }

/* --------------------------------------------------------------------------
   左侧抽屉
   -------------------------------------------------------------------------- */

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--drawer-w);
    max-width: 85vw;
    background: var(--bg-soft);
    z-index: 120;
    padding: 24px 20px 40px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.28s ease, background-color 0.25s ease;
}
.drawer.open {
    transform: translateX(0);
    box-shadow: var(--shadow);
}

.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    z-index: 110;
}
.drawer-mask.show {
    opacity: 1;
    visibility: visible;
}

.drawer-brand { margin-bottom: 20px; }
.drawer-brand a {
    font-size: 20px;
    font-weight: 700;
}
.drawer-desc {
    margin: 6px 0 0;
    font-size: 13px;
    color: var(--fg-muted);
}

.drawer-heading {
    margin: 22px 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--fg-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.drawer-section {
    list-style: none;
    margin: 0;
    padding: 0;
}
.drawer-section a {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 15px;
}
.drawer-section a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.drawer-cats a { font-size: 14px; }
.drawer-cats .lvl-1 { padding-left: 22px; }
.drawer-cats .lvl-2 { padding-left: 34px; }

.drawer-social {
    margin-top: 28px;
    display: flex;
    gap: 10px;
}
.drawer-social a {
    padding: 5px 12px;
    font-size: 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
}
.drawer-social a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* --------------------------------------------------------------------------
   主内容区
   -------------------------------------------------------------------------- */

.site-main {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: calc(var(--topbar-h) + 40px) 20px 60px;
    min-height: 70vh;
}

.list-header { margin-bottom: 28px; }
.list-title {
    margin: 0 0 6px;
    font-size: 24px;
}
.list-desc {
    margin: 0;
    color: var(--fg-muted);
    font-size: 14px;
}

/* 列表项 */
.post-item {
    padding: 26px 0;
    border-bottom: 1px solid var(--line);
}
.post-list .post-item:first-child { padding-top: 0; }

.post-item-title {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.4;
}
.post-item-title a:hover { color: var(--accent); }

.sticky-badge {
    display: inline-block;
    vertical-align: 2px;
    margin-right: 8px;
    padding: 1px 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--badge-fg);
    background: var(--badge-bg);
    border-radius: 4px;
}

.post-item-meta {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--fg-muted);
}
.post-item-meta a { color: var(--fg-muted); }
.post-item-meta a:hover { color: var(--accent); }

.post-item-summary {
    font-size: 15px;
    color: var(--fg-muted);
}
.post-item-summary p { margin: 0; }

.post-item-more { margin: 12px 0 0; font-size: 14px; }
.post-item-more a { color: var(--accent); }

.sep { margin: 0 6px; opacity: 0.6; }

/* --------------------------------------------------------------------------
   文章页
   -------------------------------------------------------------------------- */

.post-header { margin-bottom: 32px; }
.post-title {
    margin: 0 0 10px;
    font-size: 28px;
    line-height: 1.35;
}
.post-title a:hover { color: var(--accent); }

.post-meta {
    margin: 0;
    font-size: 14px;
    color: var(--fg-muted);
}

.post-content {
    font-size: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.post-content h2, .post-content h3, .post-content h4 {
    margin: 1.6em 0 0.6em;
    line-height: 1.4;
}
.post-content h2 { font-size: 22px; }
.post-content h3 { font-size: 19px; }
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}
.post-content pre {
    padding: 14px 16px;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.6;
}
.post-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}
.post-content p code,
.post-content li code {
    padding: 2px 6px;
    background: var(--accent-soft);
    border-radius: 4px;
}
.post-content blockquote {
    margin: 1.2em 0;
    padding: 4px 18px;
    border-left: 3px solid var(--accent);
    background: var(--bg-soft);
    color: var(--fg-muted);
}
.post-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    display: block;
    overflow-x: auto;
}
.post-content th, .post-content td {
    border: 1px solid var(--line);
    padding: 8px 12px;
}
.post-content th { background: var(--bg-soft); }

.post-footer { margin-top: 36px; }
.post-tags { font-size: 14px; color: var(--fg-muted); }

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
}
.post-nav-next { text-align: right; }

/* --------------------------------------------------------------------------
   评论
   -------------------------------------------------------------------------- */

.comments-title, .respond-title { font-size: 18px; }

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.comment { padding: 16px 0; border-bottom: 1px solid var(--line); }
.comment-children {
    list-style: none;
    margin: 0;
    padding-left: 24px;
}
.comment-body { font-size: 15px; }
.comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.comment-head img { border-radius: 50%; }
.comment-author { font-style: normal; font-weight: 600; }
.comment-time { font-size: 12px; color: var(--fg-muted); }
.comment-time a { color: var(--fg-muted); }
.comment-text { margin: 8px 0; }
.comment-by-author .comment-author::after {
    content: "博主";
    margin-left: 6px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--badge-fg);
    background: var(--badge-bg);
    border-radius: 3px;
    vertical-align: 1px;
}
.comment-reply-btn {
    border: none;
    background: transparent;
    color: var(--fg-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}
.comment-reply-btn:hover { color: var(--accent); }

.comment-respond { margin-top: 32px; }
.respond-row { margin: 12px 0; }
.respond-row label {
    display: block;
    font-size: 13px;
    color: var(--fg-muted);
    margin-bottom: 4px;
}
.respond-row input.text {
    width: 100%;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    color: var(--fg);
    font-size: 14px;
}
.respond-row textarea.textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    color: var(--fg);
    font-size: 14px;
    min-height: 110px;
    resize: vertical;
    font-family: inherit;
}
.respond-row input:focus, .respond-row textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.submit {
    padding: 8px 22px;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
.submit:hover { opacity: 0.88; }

/* --------------------------------------------------------------------------
   分页
   -------------------------------------------------------------------------- */

.page-navigator {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 30px 0 0;
    margin: 0;
}
.page-navigator li a, .page-navigator li span {
    display: block;
    min-width: 34px;
    padding: 5px 10px;
    text-align: center;
    border-radius: 6px;
    font-size: 14px;
    color: var(--fg-muted);
}
.page-navigator li a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}
.page-navigator li.current span {
    background: var(--accent);
    color: #fff;
}

/* --------------------------------------------------------------------------
   404 / 页脚
   -------------------------------------------------------------------------- */

.not-found { text-align: center; padding: 80px 0; }
.nf-code {
    margin: 0;
    font-size: 88px;
    color: var(--fg-muted);
    font-weight: 700;
}

.site-footer {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 30px 20px 44px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 13px;
    color: var(--fg-muted);
}
.site-footer .icp { margin: 6px 0 0; }
.site-footer a { color: var(--fg-muted); }
.site-footer a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    :root { --topbar-h: 48px; }
    .site-main { padding-left: 16px; padding-right: 16px; }
    .post-title { font-size: 24px; }
    .post-item-title { font-size: 18px; }
    .comment-children { padding-left: 14px; }
    .respond-row input.text { max-width: 100%; }
}
