/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header and navigation */
header {
    border-bottom: 1px solid #ddd;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

nav {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

nav a {
    color: #0066cc;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

/* Search */
.search-container {
    position: relative;
    margin-top: 1rem;
}

#search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: #0066cc;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-results.hidden {
    display: none;
}

.search-results-header {
    padding: 0.75rem 1rem;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #f9f9f9;
}

.search-result-date {
    font-size: 0.85rem;
    color: #0066cc;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.search-result-excerpt {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

.search-result-excerpt mark {
    background-color: #ffeb3b;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
    font-weight: 600;
}

.search-no-results {
    padding: 1.5rem;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Typography */
h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

/* Main content */
main {
    min-height: 60vh;
}

section {
    margin-top: 2rem;
}

/* Timeline layout */
.timeline {
    margin-top: 2rem;
}

.note-entry {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #e0e0e0;
}

.note-entry:last-child {
    border-bottom: none;
}

.note-entry time {
    display: block;
    color: #666;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #0066cc;
    display: inline-block;
}

.note-content {
    color: #333;
}

.note-content h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    margin-top: 1rem;
}

.note-content h2 {
    font-size: 1.4rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.note-content h3 {
    font-size: 1.2rem;
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.note-content p {
    margin-bottom: 2rem;
    line-height: 1.7;
}

.note-content ul,
.note-content ol {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* 当列表紧跟在段落后面时（Markdown中无空行），使用更小的间距 */
.note-content p + ul,
.note-content p + ol {
    margin-top: 0.3rem !important;
}

/* 段落结尾如果紧接列表，减少段落的下边距 */
.note-content p:has(+ ul),
.note-content p:has(+ ol) {
    margin-bottom: 0.3rem;
}

.note-content li {
    margin-bottom: 0.3rem;
    line-height: 1.6;
}

.note-content code {
    background-color: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.note-content pre {
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.note-content pre code {
    background-color: transparent;
    padding: 0;
}

.note-content blockquote {
    border-left: 4px solid #0066cc;
    margin-left: 0;
    padding-left: 1rem;
    color: #666;
    font-style: italic;
    margin-bottom: 1rem;
}

.note-content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 2rem 0;
}

.note-content a {
    color: #0066cc;
    text-decoration: none;
}

.note-content a:hover {
    text-decoration: underline;
}

.note-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
}

.note-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.note-content th,
.note-content td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
}

.note-content th {
    background-color: #f5f5f5;
    font-weight: 600;
}

/* Note list (legacy, kept for compatibility) */
.note-list {
    list-style: none;
}

.note-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
}

.note-list time {
    color: #666;
    font-size: 0.9rem;
    margin-right: 1rem;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #ddd;
    color: #666;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }
}
