/*!
 * 窗 Window —— 一个像浏览器窗口一样的极简 Typecho 主题
 */

:root {
    --paper: #faf6ee;
    --paper-2: #fffdf8;
    --line: #e4ddce;
    --line-2: #d5cdb9;
    --ink: #1d1d1b;
    --ink-2: #5d594f;
    --ink-3: #928c7e;

    --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC", "Times New Roman", Georgia, serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    font-family: var(--font-sans);
    color: var(--ink);
    background: radial-gradient(130% 110% at 50% 0%, #f0f5fd 0%, #dfe9f8 45%, #cfdff3 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: inherit;
}

/* ---------- 窗口 ---------- */
.window {
    width: 100%;
    max-width: 615px;
    height: min(calc(100vh - 64px), 720px);
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: 0 26px 70px rgba(52, 74, 120, .18), 0 3px 10px rgba(52, 74, 120, .07);
    overflow: hidden;
}

/* 顶部工具条 */
.window-top {
    padding: 2px 3px 10px;
}

.win-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.win-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 27px;
    min-width: 27px;
    padding: 0 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1;
    color: #3a382f;
    background: #fdfbf5;
    border: 1px solid var(--line-2);
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.win-btn:hover {
    background: #fff;
    border-color: #b3a88f;
    color: #000;
}

.win-btn:active {
    transform: translateY(1px);
}

.win-link {
    gap: 6px;
    padding: 0 10px;
}

.win-link .star {
    width: 13px;
    height: 13px;
}

.win-link span {
    letter-spacing: .5px;
}

.win-note {
    margin-left: auto;
    padding-left: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .3px;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 搜索框 */
.win-search {
    position: relative;
    margin-top: 9px;
}

.win-search .search-icon {
    position: absolute;
    top: 50%;
    left: 11px;
    width: 15px;
    height: 15px;
    max-width: 15px;
    max-height: 15px;
    color: var(--ink-3);
    transform: translateY(-50%);
    pointer-events: none;
}

.win-search input {
    width: 100%;
    padding: 8px 12px 8px 31px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    outline: none;
    transition: border-color .15s ease;
}

.win-search input::placeholder {
    color: var(--ink-3);
}

.win-search input:focus {
    border-color: var(--ink-2);
}

/* 内容面板 */
.window-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--paper-2);
    border: 1.5px solid var(--line-2);
    border-radius: 9px;
}

.window-panel::-webkit-scrollbar {
    width: 8px;
}

.window-panel::-webkit-scrollbar-track {
    background: transparent;
}

.window-panel::-webkit-scrollbar-thumb {
    background: #d9d2c2;
    border-radius: 8px;
}

.window-panel::-webkit-scrollbar-thumb:hover {
    background: #c7bfab;
}

/* 底部状态栏 */
.window-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 4px 2px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1px;
    color: var(--ink-3);
}

.win-count {
    white-space: nowrap;
}

.win-foot-right {
    text-align: right;
}

.foot-sep {
    margin: 0 6px;
    color: var(--line-2);
}

.win-foot-right a {
    color: var(--ink-2);
    text-decoration: none;
}

.win-foot-right a:hover {
    color: #000;
    text-decoration: underline;
}

/* ---------- 首页：分类 ---------- */
.filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 7px;
    padding: 20px 24px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filters::-webkit-scrollbar {
    display: none;
}

.filter {
    flex: 0 0 auto;
    padding: 5px 11px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .4px;
    color: #4d493f;
    background: var(--paper-2);
    border: 1px solid var(--line-2);
    border-radius: 4px;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.filter:hover {
    border-color: #b3a88f;
    color: #000;
}

.filter.active {
    color: #fdfbf5;
    background: var(--ink);
    border-color: var(--ink);
}

/* ---------- 首页：站名 ---------- */
.brand {
    padding: 26px 24px 8px;
    text-align: center;
}

.site-title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 46px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 3px;
    color: var(--ink);
}

.site-title a {
    color: inherit;
    text-decoration: none;
}

.site-tagline {
    max-width: 92%;
    margin: 12px auto 0;
    font-size: 13px;
    line-height: 1.6;
    letter-spacing: .3px;
    color: var(--ink-3);
}

/* ---------- 首页：文章列表 ---------- */
.post-list {
    padding: 14px 24px 6px;
}

.post-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 15px 0;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.post-row:last-child {
    border-bottom: none;
}

.post-row:hover .post-title {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.thumb {
    position: relative;
    flex: 0 0 112px;
    width: 112px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    overflow: hidden;
    color: rgba(28, 28, 26, .5);
}

.thumb svg {
    width: 26px;
    height: 26px;
}

.thumb .tlabel {
    position: absolute;
    left: 9px;
    bottom: 7px;
    max-width: calc(100% - 18px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
    font-size: 7.5px;
    letter-spacing: .9px;
    text-transform: uppercase;
    color: rgba(28, 28, 26, .6);
}

.g1 { background: linear-gradient(135deg, #d2cbf1, #b3bdec); }
.g2 { background: linear-gradient(135deg, #c9efe6, #a2dbeb); }
.g3 { background: linear-gradient(135deg, #e2d0f2, #becbf2); }
.g4 { background: linear-gradient(135deg, #f6e0cd, #efc7b1); }
.g5 { background: linear-gradient(135deg, #dbebcd, #bad9b0); }

.post-main {
    min-width: 0;
}

.post-title {
    display: block;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    letter-spacing: .1px;
    color: var(--ink);
}

.post-date {
    display: block;
    margin-top: 9px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: var(--ink-3);
}

.empty-tip {
    padding: 42px 0;
    text-align: center;
    font-size: 13px;
    color: var(--ink-3);
}

/* ---------- 分页 ---------- */
.page-navigator {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin: 14px 24px 22px;
    padding: 0;
    list-style: none;
}

.page-navigator a {
    display: inline-block;
    min-width: 30px;
    padding: 5px 9px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #4d493f;
    border: 1px solid var(--line-2);
    border-radius: 4px;
    text-decoration: none;
}

.page-navigator a:hover {
    border-color: #b3a88f;
    color: #000;
}

.page-navigator .current a {
    color: #fdfbf5;
    background: var(--ink);
    border-color: var(--ink);
}

/* ---------- 单篇文章 / 页面 ---------- */
.post-single {
    padding: 22px 24px 26px;
}

.back-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .5px;
    color: var(--ink-3);
    text-decoration: none;
}

.back-link:hover {
    color: #000;
}

.single-title {
    margin: 16px 0 10px;
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .5px;
    color: var(--ink);
}

.single-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.1px;
    text-transform: uppercase;
    color: var(--ink-3);
}

.single-meta .dot {
    margin: 0 7px;
}

.single-body {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-top: 26px;
}

.single-content {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15.5px;
    line-height: 1.9;
    color: var(--ink);
}

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

.single-content h1,
.single-content h2,
.single-content h3,
.single-content h4,
.single-content h5,
.single-content h6 {
    margin: 1.6em 0 .7em;
    font-family: var(--font-serif);
    font-weight: 600;
    line-height: 1.4;
    scroll-margin-top: 16px;
}

.single-content h2 { font-size: 1.35em; }
.single-content h3 { font-size: 1.15em; }

.single-content a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.single-content a:hover {
    color: #000;
}

.single-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.single-content blockquote {
    margin: 1.4em 0;
    padding: 2px 0 2px 16px;
    border-left: 2px solid var(--ink-2);
    color: var(--ink-2);
}

.single-content blockquote p {
    margin: .4em 0;
}

.single-content ul,
.single-content ol {
    padding-left: 1.5em;
}

.single-content li {
    margin: .3em 0;
}

.single-content hr {
    margin: 2em 0;
    border: none;
    border-top: 1px solid var(--line-2);
}

.single-content code {
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: .88em;
    background: rgba(0, 0, 0, .05);
    border-radius: 4px;
}

.single-content pre {
    margin: 1.4em 0;
    padding: 14px 16px;
    overflow-x: auto;
    background: #f5f1e7;
    border: 1px solid var(--line);
    border-radius: 8px;
    line-height: 1.6;
}

.single-content pre code {
    padding: 0;
    background: none;
}

.single-content table {
    width: 100%;
    margin: 1.4em 0;
    border-collapse: collapse;
    font-size: 13px;
}

.single-content th,
.single-content td {
    padding: 7px 10px;
    text-align: left;
    border: 1px solid var(--line-2);
}

.single-content th {
    background: #f5f1e7;
}

/* 文章目录 */
.toc {
    flex: 0 0 116px;
    align-self: flex-start;
    position: sticky;
    top: 14px;
    padding-left: 13px;
    border-left: 1px solid var(--line);
}

.toc-title {
    margin-bottom: 9px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--ink-3);
}

.toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 1.5;
}

.toc-list li {
    margin: 0 0 7px;
}

.toc-list a {
    display: block;
    color: var(--ink-2);
    text-decoration: none;
    transition: color .15s ease;
}

.toc-list a:hover {
    color: #000;
}

/* 标签 */
.single-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.single-tags a {
    padding: 4px 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .5px;
    color: var(--ink-2);
    border: 1px solid var(--line-2);
    border-radius: 999px;
    text-decoration: none;
}

.single-tags a:hover {
    border-color: #b3a88f;
    color: #000;
}

/* 版权信息 */
.post-copyright {
    margin: 0 24px 22px;
    padding: 14px 16px;
    background: #f6f2e9;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.85;
    color: var(--ink-2);
}

.post-copyright p {
    margin: 2px 0;
    word-break: break-word;
}

.cp-label {
    color: var(--ink-3);
}

.post-copyright a {
    color: var(--ink);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}

/* 上一篇 / 下一篇 */
.single-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0 24px 22px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 11px;
}

.single-nav a {
    color: var(--ink-2);
    text-decoration: none;
}

.single-nav a:hover {
    color: #000;
}

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

/* ---------- 评论 ---------- */
.comments {
    margin: 0 24px 26px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.comments-title,
.respond-title {
    margin: 0 0 16px;
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 600;
}

.comment {
    padding: 14px 0;
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}

.comment-child {
    margin-left: 18px;
    padding-left: 14px;
    border-bottom: none;
    border-left: 2px solid var(--line-2);
}

.comment-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
}

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

.comment-time {
    color: var(--ink-3);
    text-decoration: none;
}

.comment-time:hover {
    color: #000;
}

.comment-content {
    margin-top: 6px;
    font-size: 13.5px;
    line-height: 1.75;
    color: var(--ink);
    word-wrap: break-word;
}

.comment-content p {
    margin: .35em 0;
}

.comment-reply {
    margin-top: 5px;
    font-family: var(--font-mono);
    font-size: 10px;
}

.comment-reply a {
    color: var(--ink-3);
    text-decoration: none;
}

.comment-reply a:hover {
    color: #000;
}

/* 评论表单 */
.respond {
    margin-top: 26px;
}

.cancel-reply {
    margin-bottom: 6px;
    text-align: right;
    font-size: 11px;
}

.cancel-reply a {
    color: var(--ink-3);
}

.comment-logged {
    font-size: 12px;
    color: var(--ink-2);
}

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

.comment-fields input,
.respond textarea {
    width: 100%;
    padding: 9px 11px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    outline: none;
    transition: border-color .15s ease;
}

.comment-fields input:focus,
.respond textarea:focus {
    border-color: var(--ink-2);
}

.respond textarea {
    min-height: 96px;
    margin-bottom: 9px;
    resize: vertical;
}

.btn {
    display: inline-block;
    padding: 8px 22px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #fdfbf5;
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 6px;
    cursor: pointer;
}

.btn:hover {
    opacity: .88;
}

.comments-closed {
    font-size: 13px;
    color: var(--ink-3);
}

/* ---------- 404 ---------- */
.error-page {
    padding: 60px 24px;
    text-align: center;
}

.error-code {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 64px;
    line-height: 1;
    color: var(--line-2);
}

.error-text {
    margin: 14px 0 22px;
    font-size: 14px;
    color: var(--ink-3);
}

/* ---------- 响应式 ---------- */
@media (max-width: 700px) {
    body {
        padding: 14px 12px;
    }

    .window {
        height: calc(100vh - 28px);
        padding: 8px;
        border-radius: 11px;
    }

    .filters {
        padding: 16px 16px 4px;
    }

    .brand {
        padding: 20px 16px 6px;
    }

    .site-title {
        font-size: 34px;
        letter-spacing: 2px;
    }

    .post-list {
        padding: 10px 16px 6px;
    }

    .thumb {
        flex-basis: 92px;
        width: 92px;
        height: 70px;
    }

    .post-title {
        font-size: 15.5px;
    }

    .post-single {
        padding: 18px 16px 22px;
    }

    .single-title {
        font-size: 26px;
    }

    .single-body {
        display: block;
    }

    .toc {
        display: none;
    }

    .post-copyright {
        margin: 0 16px 18px;
    }

    .comments {
        margin: 0 16px 20px;
    }

    .page-navigator {
        margin: 10px 16px 18px;
    }

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

    .single-nav {
        margin: 0 16px 18px;
    }
}

/* ---------- 打印 ---------- */
@media print {
    body {
        padding: 0;
        background: #fff;
    }

    .window {
        max-height: none;
        border: none;
        box-shadow: none;
    }

    .window-top,
    .window-bottom,
    .filters,
    .post-nav,
    .comments {
        display: none;
    }
}
