/* ===== Base ===== */
:root {
    --bg: #faf9f6;
    --bg-card: #ffffff;
    --bg-nav: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --tag-bg: #f3f4f6;
    --tag-text: #4b5563;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --max-w: 1120px;
    --content-w: 720px;
    --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", Consolas, monospace;
    --transition: 0.2s ease;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ===== Nav ===== */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-logo:hover { color: var(--accent); }
.nav-logo span {
    display: inline-block;
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 32px;
    list-style: none;
}
.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 4px 0;
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width var(--transition);
    border-radius: 1px;
}
.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
}
.nav-toggle svg { display: block; }

/* ===== Hero ===== */
.hero {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===== Container ===== */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Post Grid ===== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.post-card-img {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--accent);
    flex-shrink: 0;
}

.post-card-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.post-card-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.post-card-tags .tag {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 2px 10px;
    background: var(--tag-bg);
    color: var(--tag-text);
    border-radius: 100px;
}

.post-card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}

.post-card h2 a {
    color: var(--text);
}
.post-card h2 a:hover {
    color: var(--accent);
}

.post-card .excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card .meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.post-card .meta .date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-card .meta .read-time {
    display: flex;
    align-items: center;
    gap: 4px;
}

.post-card .meta svg {
    width: 14px;
    height: 14px;
}

/* ===== Featured Post ===== */
.featured {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 40px;
    transition: box-shadow var(--transition);
}

.featured:hover {
    box-shadow: var(--shadow-md);
}

.featured-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.featured-img {
    height: 100%;
    min-height: 320px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.featured-body {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    padding: 4px 12px;
    border-radius: 100px;
    margin-bottom: 16px;
    width: fit-content;
}

.featured h2 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
}

.featured h2 a { color: var(--text); }
.featured h2 a:hover { color: var(--accent); }

.featured .excerpt {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 20px;
}

.featured .meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ===== Section Titles ===== */
.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--accent);
    border-radius: 2px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 48px 0;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
    transition: all var(--transition);
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination .current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 80px;
    padding: 32px 0;
}

.footer-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.footer-links a:hover { color: var(--text); }

/* ===== Post Page ===== */
.post-header {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 48px 24px 32px;
}

.post-header .back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.post-header .back-link:hover { color: var(--accent); }

.post-header .post-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.post-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.post-meta-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.post-meta-bar .author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
}

.post-meta-bar .author-info {
    display: flex;
    flex-direction: column;
}

.post-meta-bar .author-name {
    font-weight: 600;
    color: var(--text);
}

.post-meta-bar .author-meta {
    font-size: 0.8rem;
}

.post-hero-img {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 0 24px 32px;
}

.post-hero-img .img-placeholder {
    width: 100%;
    height: 360px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

/* ===== Post Content ===== */
.post-content {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 0 24px 60px;
}

.post-content p {
    margin-bottom: 1.25em;
}

.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.75em;
    line-height: 1.3;
}

.post-content h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.post-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 1.5em 0;
    padding: 12px 20px;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
    font-style: italic;
}

.post-content blockquote p { margin-bottom: 0; }

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

.post-content li { margin-bottom: 0.5em; }

.post-content pre {
    margin: 1.5em 0;
    padding: 20px 24px;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 2px 6px;
    background: var(--tag-bg);
    border-radius: 4px;
    color: var(--accent);
}

.post-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-content img {
    border-radius: var(--radius-sm);
    margin: 1.5em auto;
}

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

/* ===== Tags Page ===== */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 40px 0;
    justify-content: center;
}

.tags-cloud .tag-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all var(--transition);
}

.tags-cloud .tag-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.tags-cloud .tag-count {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ===== About Page ===== */
.about-page {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 60px 24px;
}

.about-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
    margin: 0 auto 24px;
}

.about-page h1 {
    text-align: center;
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.about-page .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.about-page h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 2em;
    margin-bottom: 0.75em;
}

.about-page p {
    margin-bottom: 1.25em;
    color: var(--text-muted);
    line-height: 1.8;
}

.about-page blockquote {
    border-left: 4px solid var(--accent);
    margin: 1.5em 0;
    padding: 12px 20px;
    background: var(--accent-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.8;
}

.about-social {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 40px;
}

.about-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    transition: all var(--transition);
    font-size: 1.25rem;
}

.about-social a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

/* ===== Post Navigation ===== */
.post-nav {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 32px 24px 48px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 24px;
}

.post-nav a {
    flex: 1;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.post-nav a:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.post-nav .nav-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.post-nav .nav-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.post-nav .nav-next {
    text-align: right;
}

/* ===== 404 ===== */
.not-found {
    text-align: center;
    padding: 120px 24px;
}

.not-found h1 {
    font-size: 6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 16px;
}

.not-found p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.not-found .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.not-found .btn:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* ===== Animation ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeUp 0.5s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.1s; }
.fade-in-delay-2 { animation-delay: 0.2s; }
.fade-in-delay-3 { animation-delay: 0.3s; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg-nav);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px 24px;
        gap: 16px;
        box-shadow: var(--shadow-md);
    }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }

    .hero { padding: 48px 24px 40px; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 1rem; }

    .featured-inner { grid-template-columns: 1fr; }
    .featured-img { min-height: 200px; }
    .featured-body { padding: 24px; }
    .featured h2 { font-size: 1.25rem; }

    .post-grid { grid-template-columns: 1fr; }

    .post-header h1 { font-size: 1.625rem; }

    .post-hero-img .img-placeholder { height: 200px; }

    .footer-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .post-nav { flex-direction: column; }
    .post-nav .nav-next { text-align: left; }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Logs / Archive ===== */
.logs-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.log-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.log-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.2;
    margin-bottom: 4px;
}

.log-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

.logs-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 32px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.logs-toolbar-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-right: 4px;
}

.log-year-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.log-year-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
}

.log-year-link.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.log-year-block {
    margin-bottom: 40px;
}

.log-year-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.log-year-count {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.log-month-block {
    margin-bottom: 24px;
}

.log-month-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 16px;
    padding: 0 0 22px 0;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    padding-top: 2px;
    white-space: nowrap;
}

.timeline-body {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    transition: box-shadow var(--transition);
}

.timeline-body:hover {
    box-shadow: var(--shadow-md);
}

.timeline-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
}

.timeline-title a {
    color: var(--text);
}

.timeline-title a:hover {
    color: var(--accent);
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.timeline-read {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: auto;
}

.logs-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 0;
}

@media (max-width: 768px) {
    .logs-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .timeline {
        padding-left: 26px;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .timeline-read {
        margin-left: 0;
    }
}
