/* ============================================
   Minimal Theme - 极简风格 Typecho 主题
   ============================================ */

/* === Reset & Base === */
@font-face {
    font-family: 'Minimal Mono';
    src: local('Consolas'), local('Monaco'), local('Courier New');
    font-display: swap;
}

:root {
    --bg: #fafafa;
    --bg-alt: #ffffff;
    --text: #2c2c2c;
    --text-muted: #888888;
    --text-light: #b0b0b0;
    --border: #e5e5e5;
    --link: #333333;
    --link-hover: #000000;
    --accent: #555555;
    --code-bg: #f4f4f4;
    --radius: 4px;
    --max-width: 700px;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.7;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === Article Content Images === */
.post-content img {
    display: block;
    max-width: 80%;
    height: auto;
    margin: 1.6em auto;
    border-radius: var(--radius);
    cursor: zoom-in;
    transition: opacity 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.post-content img:hover {
    opacity: 0.92;
    box-shadow: 0 2px 12px rgba(0,0,0,0.10);
}

/* === Lightbox === */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: lightbox-fade-in 0.2s ease;
}

@keyframes lightbox-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-overlay img {
    max-width: 92vw;
    max-height: 92vh;
    display: block;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    animation: lightbox-zoom-in 0.25s ease;
}

@keyframes lightbox-zoom-in {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

/* === Container === */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* === Header === */
#header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 32px 0 20px;
}

.site-brand {
    text-align: left;
    margin-bottom: 16px;
}

#logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

#logo:hover {
    text-decoration: none;
    color: var(--accent);
}

.description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

#nav-menu {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

#nav-menu a {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 4px 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

#nav-menu a:hover,
#nav-menu a.current {
    color: var(--text);
    text-decoration: none;
    border-bottom-color: var(--text);
}

.nav-rss {
    font-weight: 600;
    color: #f26522 !important;
    letter-spacing: 0.02em;
}

.nav-rss:hover {
    color: #d4541a !important;
    border-bottom-color: #f26522 !important;
}

/* === Body === */
#body {
    flex: 1;
    padding: 40px 0 60px;
}

/* === Article List (首页) === */
.post-item {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.post-item:first-child {
    padding-top: 0;
}

.post-item:last-child {
    border-bottom: none;
}

.post-title {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.post-title a {
    color: var(--text);
}

.post-title a:hover {
    color: var(--accent);
    text-decoration: none;
}

.post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-meta a {
    color: var(--text-muted);
}

.post-meta a:hover {
    color: var(--text);
}

.post-meta .sep {
    margin: 0 6px;
    color: var(--text-light);
}

/* === Article Detail (文章详细页) === */
.post-detail {
    margin-bottom: 40px;
}

.post-detail .post-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.post-detail .post-meta {
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.post-content {
    font-size: 0.95rem;
    line-height: 1.85;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 文章内容排版 */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 1.8em;
    margin-bottom: 0.6em;
    font-weight: 600;
    line-height: 1.4;
}

.post-content h1 { font-size: 1.5rem; }
.post-content h2 { font-size: 1.3rem; }
.post-content h3 { font-size: 1.1rem; }
.post-content h4 { font-size: 1rem; }

.post-content p {
    margin-bottom: 1.2em;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.2em;
    padding-left: 1.8em;
}

.post-content li {
    margin-bottom: 0.4em;
}

.post-content blockquote {
    margin: 1.2em 0;
    padding: 12px 20px;
    border-left: 3px solid var(--text-muted);
    background: var(--code-bg);
    color: var(--accent);
    font-style: italic;
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: var(--radius);
    color: #1e5fb4;
}

.post-content pre {
    margin: 1.2em 0;
    padding: 16px 20px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.85rem;
    line-height: 1.6;
}

.post-content pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: inherit;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

.post-content a {
    border-bottom: 1px solid var(--border);
}

.post-content a:hover {
    border-bottom-color: var(--text);
    text-decoration: none;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
    font-size: 0.9rem;
}

.post-content th,
.post-content td {
    border: 1px solid var(--border);
    padding: 8px 14px;
    text-align: left;
}

.post-content th {
    background: var(--code-bg);
    font-weight: 600;
}

/* === Tags === */
.tags {
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tags a {
    color: var(--accent);
    background: var(--code-bg);
    padding: 2px 10px;
    border-radius: var(--radius);
    font-size: 0.8rem;
}

.tags a:hover {
    background: var(--text-muted);
    color: #fff;
    text-decoration: none;
}

/* === Comments === */
#comments {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.comments-title,
.respond-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.respond {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.cancel-comment-reply {
    margin-bottom: 12px;
    font-size: 0.85rem;
}

#comment-form p {
    margin-bottom: 14px;
}

#comment-form label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

#comment-form label.required::after {
    content: " *";
    color: #c7254e;
}

#comment-form .text,
#comment-form .textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

#comment-form .text:focus,
#comment-form .textarea:focus {
    border-color: var(--accent);
}

#comment-form .textarea {
    resize: vertical;
    min-height: 120px;
}

#comment-form .submit {
    padding: 10px 24px;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

#comment-form .submit:hover {
    background: var(--accent);
}

.comments-closed {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 评论列表 */
.comment-list,
.comment-list .comment-children {
    list-style: none;
    padding: 0;
}

.comment-body {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.comment-author {
    font-weight: 600;
    margin-bottom: 4px;
}

.comment-author .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}

.comment-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.comment-meta a {
    color: var(--text-muted);
}

.comment-content {
    line-height: 1.7;
}

.comment-content p {
    margin-bottom: 0.6em;
}

.comment-reply {
    font-size: 0.8rem;
    margin-top: 6px;
}

/* === Post Navigation === */
.post-near {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* === Page Navigation === */
.page-nav {
    margin-top: 32px;
    font-size: 0.9rem;
    display: flex;
    gap: 16px;
}

.page-nav ol {
    list-style: none;
    display: flex;
    gap: 8px;
}

.page-nav li a,
.page-nav li span {
    display: inline-block;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.page-nav li span {
    color: var(--text-light);
}

.page-nav li a:hover {
    background: var(--text);
    color: #fff;
    text-decoration: none;
    border-color: var(--text);
}

/* === Archive Title === */
.archive-title {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* === Archives Page (历史归档) === */
.archives {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.archive-year {
    margin-bottom: 32px;
}

.archive-year-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.archive-year-list {
    list-style: none;
    padding-left: 0;
}

.archive-month {
    margin-bottom: 16px;
}

.archive-month-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-left: 8px;
    border-left: 3px solid var(--border);
}

.archive-post-list {
    list-style: none;
    padding-left: 16px;
}

.archive-post-item {
    display: flex;
    align-items: baseline;
    gap: 16px;
    padding: 6px 0;
    font-size: 0.9rem;
}

.archive-post-item time {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    min-width: 42px;
}

.archive-post-item a {
    color: var(--text);
    flex: 1;
}

.archive-post-cats {
    font-size: 0.72rem;
    color: var(--text-light);
    white-space: nowrap;
    margin-left: auto;
}

.archive-post-count {
    font-size: 0.75rem;
    color: var(--text-light);
    white-space: nowrap;
}

.archive-post-item a:hover {
    color: var(--accent);
    text-decoration: none;
}

/* === 404 Page === */
.error-page {
    text-align: center;
    padding: 60px 0;
}

.error-page h1 {
    font-size: 5rem;
    font-weight: 700;
    color: var(--border);
    line-height: 1;
    margin-bottom: 12px;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.search-form input {
    padding: 10px 16px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    outline: none;
    width: 280px;
    max-width: 100%;
}

.search-form input:focus {
    border-color: var(--accent);
}

.search-form button {
    padding: 10px 20px;
    font-size: 0.9rem;
    background: var(--text);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s;
}

.search-form button:hover {
    background: var(--accent);
}

/* === Footer === */
#footer {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

#footer a {
    color: var(--text-muted);
}

#footer a:hover {
    color: var(--text);
}

/* === Custom Shortcode Colors === */
/* 使用 [color-red]文字[/color-red] 或 [color=red]文字[/color] */
.color-red       { color: #e03131; }
.color-blue      { color: #1e5fb4; }
.color-green     { color: #2b8a3e; }
.color-orange    { color: #e8590c; }
.color-purple    { color: #7048e8; }
.color-pink      { color: #c2255c; }
.color-gray      { color: #868e96; }
.color-cyan      { color: #0c8599; }
.color-teal      { color: #087f5b; }

/* [highlight]文字[/highlight] — 背景高亮 */
.highlight {
    background: linear-gradient(180deg, transparent 60%, #ffd43b 60%);
    padding: 0 3px;
}

/* [underline]文字[/underline] — 下划线 */
.underline-text {
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
}

/* === KaTeX Overrides === */
.katex {
    font-size: 1.1em !important;
}

.katex-display {
    margin: 1.2em 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
}

.katex-display > .katex {
    white-space: normal;
}

/* === Timeline (时间线) === */
.timeline {
    position: relative;
    padding-left: 0;
}

.timeline-year {
    position: relative;
    margin-bottom: 32px;
}

/* Year marker */
.timeline-year-marker {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
}

.timeline-year-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text);
    flex-shrink: 0;
    z-index: 2;
    box-shadow: 0 0 0 4px var(--bg-alt);
}

.timeline-year-label {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* Year body */
.timeline-year-body {
    position: relative;
    margin-left: 6px;
    padding-left: 20px;
    border-left: 2px solid var(--border);
}

/* Month marker */
.timeline-month {
    position: relative;
    margin-bottom: 20px;
}

.timeline-month-marker {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.timeline-month-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
    margin-left: -26px;
    z-index: 2;
    box-shadow: 0 0 0 3px var(--bg);
}

.timeline-month-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
}

/* Month body */
.timeline-month-body {
    padding-left: 16px;
}

/* Event list */
.timeline-events {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-events li {
    position: relative;
    padding: 6px 0 6px 18px;
    font-size: 0.9rem;
    line-height: 1.65;
    color: var(--text);
}

.timeline-event-dot {
    position: absolute;
    left: 0;
    top: 13px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-light);
    flex-shrink: 0;
}

.timeline-events li:first-child {
    padding-top: 2px;
}

.timeline-events li:last-child {
    padding-bottom: 0;
}

/* === Friends Links (友链) === */
.friends-notice {
    margin-bottom: 32px;
    padding: 16px 20px;
    background: var(--code-bg);
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--accent);
}

.friends-notice p {
    margin-bottom: 0.6em;
}

.friends-notice p:last-child {
    margin-bottom: 0;
}

.friends-notice a {
    color: var(--text);
    border-bottom: 1px solid var(--border);
}

.friends-notice code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 3px;
    color: #1e5fb4;
}

.friends-notice strong {
    color: var(--text);
}

.friends-list {
    margin-top: 8px;
}

.friends-category {
    margin-bottom: 36px;
}

.friends-category:last-child {
    margin-bottom: 0;
}

.friends-cat-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    letter-spacing: -0.01em;
}

.friends-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.friend-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
    flex: 0 1 calc(50% - 6px);
    min-width: 200px;
}

.friend-card:hover {
    border-color: var(--text-muted);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    text-decoration: none;
}

.friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--code-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    overflow: hidden;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.friend-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.friend-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-desc {
    font-size: 0.78rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Responsive === */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    #header {
        padding: 24px 0 16px;
    }

    #logo {
        font-size: 1.3rem;
    }

    #nav-menu {
        gap: 16px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }

    #nav-menu::-webkit-scrollbar {
        display: none;
    }

    #nav-menu a {
        flex-shrink: 0;
        white-space: nowrap;
    }

    #body {
        padding: 24px 0 40px;
    }

    .post-title {
        font-size: 1.1rem;
    }

    .post-detail .post-title {
        font-size: 1.35rem;
    }

    .post-content {
        font-size: 0.92rem;
    }

    .post-near {
        flex-direction: column;
        gap: 8px;
    }

    .archive-post-item {
        flex-direction: column;
        gap: 2px;
        padding: 8px 0;
    }

    .archive-post-item time {
        min-width: auto;
    }

    .friend-card {
        flex: 0 1 100%;
    }
}
