:root {
    --primary-color: #333;
    --secondary-color: #666;
    --accent-color: #007bff;
    --bg-color: #fff;
    --card-bg: #f8f9fa;
    --border-color: #e5e5e5;
    --max-width: 1000px;
    --modal-width: 800px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--primary-color);
    background-color: var(--bg-color);
}

header {
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--accent-color);
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.hero p {
    color: var(--secondary-color);
    font-size: 1.2rem;
}

.posts-section {
    padding: 2rem 0;
}

.posts-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.posts-grid {
    display: grid;
    gap: 1.5rem;
}

.post-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post-card h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.post-card .date {
    color: var(--secondary-color);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.post-card .excerpt {
    color: var(--secondary-color);
}

.about-section {
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
}

.about-section h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.about-content p {
    color: var(--secondary-color);
}

footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    color: var(--secondary-color);
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: var(--bg-color);
    max-width: 720px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.05);
}

.modal-header {
    padding: 2.5rem 3rem 0;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border: none;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
}

.modal-content h1 {
    font-size: 2.25rem;
    margin: 0;
    padding-right: 3rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.modal-date {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-date::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 2px;
    background: var(--accent-color);
}

.modal-divider {
    height: 1px;
    background: linear-gradient(to right, var(--accent-color), var(--border-color), transparent);
    margin: 2rem 3rem;
}

.modal-body {
    color: var(--primary-color);
    line-height: 1.9;
    font-size: 1.05rem;
    padding: 0 3rem 3rem;
}

.markdown-body h1 {
    font-size: 1.5rem;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
}

.markdown-body h1:first-child {
    margin-top: 0;
}

.markdown-body h2 {
    font-size: 1.25rem;
    margin: 2rem 0 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
}

.markdown-body p {
    margin-bottom: 1.25rem;
    line-height: 1.85;
}

.markdown-body ul, .markdown-body ol {
    margin: 1.25rem 0;
    padding-left: 1.75rem;
}

.markdown-body li {
    margin-bottom: 0.6rem;
    line-height: 1.7;
}

.markdown-body code {
    background: var(--card-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid var(--border-color);
}

.markdown-body pre {
    background: #1e1e1e;
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.markdown-body pre code {
    background: none;
    padding: 0;
    color: #d4d4d4;
    font-size: 0.95rem;
    line-height: 1.6;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent-color);
    padding: 0.75rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--card-bg);
    border-radius: 0 8px 8px 0;
    color: var(--secondary-color);
    font-style: italic;
}

.markdown-body strong {
    font-weight: 600;
    color: var(--primary-color);
}

.two-column-bottom {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
}

.archive-section,
.notes-section {
    padding: 0;
}

.archive-section h2,
.notes-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 1.25rem;
    width: 8px;
    height: 8px;
    background: var(--accent-color);
    border-radius: 50%;
}

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

.timeline-date {
    color: var(--secondary-color);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.timeline-title {
    color: var(--primary-color);
    font-weight: 500;
}

.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.note-card {
    background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    user-select: none;
}

.note-card:active {
    cursor: grabbing;
}

.note-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.note-card.drag-over {
    transform: translateY(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.note-card p {
    color: #713f12;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    word-break: break-word;
}

.note-card:nth-child(2) {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}

.note-card:nth-child(2) p {
    color: #14532d;
}

.note-card:nth-child(3) {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
}

.note-card:nth-child(3) p {
    color: #3730a3;
}

.note-card .note-text {
    min-height: 1.5em;
}

.delete-zone {
    height: 60px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s, border-color 0.3s, background 0.3s;
}

.delete-zone.active {
    opacity: 1;
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
    color: #dc2626;
}

.delete-zone.drag-over {
    background: rgba(220, 38, 38, 0.1);
    border-style: solid;
}

.note-edit-input {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
}

@media (max-width: 768px) {
    .two-column-bottom {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 600px) {
    .hero h1 {
        font-size: 2rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .modal-overlay {
        padding: 1rem;
    }

    .modal-content {
        max-height: 90vh;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 0;
    }

    .modal-content h1 {
        font-size: 1.5rem;
    }

    .modal-divider {
        margin: 1.5rem;
    }

    .modal-body {
        padding: 0 1.5rem 1.5rem;
    }
}