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

:root {
    --bg: #fcfdfe;
    --text: #1a1a1a;
    --text-secondary: #666666;
    --accent: #0066cc;
    --accent-light: #e6f2ff;
    --border: #e5e5e5;
    --code-bg: #f4f8fc;
    --code-text: #243040;
    --success: #16a34a;
    --warning: #ea580c;

    --syntax-comment: #6b7280;
    --syntax-keyword: #7c3aed;
    --syntax-string: #15803d;
    --syntax-number: #c2410c;
    --syntax-function: #2563eb;
    --syntax-type: #0f766e;
    --syntax-variable: #334155;
    --syntax-operator: #0891b2;
    --syntax-prompt: #dc2626;
    --syntax-error: #dc2626;
    --syntax-inserted: #15803d;
    --syntax-deleted: #b91c1c;
}

html[data-theme="dark"] {
    --bg: #0f1419;
    --text: #e5e5e5;
    --text-secondary: #999999;
    --accent: #4d9fff;
    --accent-light: #1a2332;
    --border: #2a2a2a;
    --code-bg: #1a1b26;
    --code-text: #c0caf5;
    --success: #22c55e;
    --warning: #fb923c;

    --syntax-comment: #565f89;
    --syntax-keyword: #bb9af7;
    --syntax-string: #9ece6a;
    --syntax-number: #ff9e64;
    --syntax-function: #7aa2f7;
    --syntax-type: #2ac3de;
    --syntax-variable: #c0caf5;
    --syntax-operator: #89ddff;
    --syntax-prompt: #f7768e;
    --syntax-error: #f7768e;
    --syntax-inserted: #9ece6a;
    --syntax-deleted: #f7768e;
}

/* Still respect system preference as default */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg: #0f1419;
        --text: #e5e5e5;
        --text-secondary: #999999;
        --accent: #4d9fff;
        --accent-light: #1a2332;
        --border: #2a2a2a;
        --code-bg: #1a1f26;
        --success: #22c55e;
        --warning: #fb923c;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

header {
    padding: 4rem 0 3rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 3rem;
    position: relative;
}

header::before {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 120px;
    height: 3px;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

header h1 a {
    color: var(--text);
    text-decoration: none;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

nav {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s ease;
    position: relative;
}

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

nav a:hover::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.posts {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 4rem;
    padding-left: 0;
}

.posts article {
    padding-left: 0;
    margin-left: 0;
}

article {
    transition: transform 0.2s ease;
    position: relative;
    padding-left: 1rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.post-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--accent-light);
    border-radius: 4px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

h2 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
    background: linear-gradient(to right, var(--accent), var(--accent)) no-repeat;
    background-size: 0% 2px;
    background-position: left bottom;
    transition: background-size 0.3s ease, color 0.2s ease;
}

h2 a:hover {
    color: var(--accent);
    background-size: 100% 2px;
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Post content styling */
.post-content {
    margin-bottom: 3rem;
}

.post-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.post-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent);
}

.post-content h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

.post-content h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

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

/* Inline code only */
.post-content :not(pre) > code {
    background: var(--code-bg);
    color: var(--accent);
    padding: 0.08em 0.32em;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    line-height: 1;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Reset generic pre styling so Rouge owns block code appearance */
.post-content pre {
    background: transparent;
    padding: 0;
    margin: 0 0 1.25rem 0;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.post-content pre code {
    display: block;
    background: transparent;
    color: inherit;
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

/* Make nested syntax-highlighting spans inherit readable color unless overridden intentionally */
.post-content pre code,
.post-content pre code span,
.post-content pre span {
    color: inherit;
}

.post-content ul, .post-content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

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

.post-content a {
    color: var(--accent);
    text-decoration: none;
}

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

/* Add to the .post-content section */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 1.5rem 0;
    display: block;
}

/* Optional: Add subtle shadow */
.post-content img {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustment */
@media (prefers-color-scheme: dark) {
    .post-content img {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

/* For images with captions using figure/figcaption */
.post-content figure {
    margin: 1.5rem 0;
}

.post-content figcaption {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.post-nav {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    margin-bottom: 3rem;
    gap: 1rem;
}

.post-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.post-nav a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.1);
}

@media (prefers-color-scheme: dark) {
    .post-nav a:hover {
        box-shadow: 0 4px 8px rgba(77, 159, 255, 0.15);
    }
}

.post-nav .prev {
    margin-left: auto;
}

.view-all-posts {
    text-align: center;
    margin: 2rem 0 3rem;
}

.btn-view-all {
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.75rem 1.25rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
}

.btn-view-all:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.1);
}

@media (prefers-color-scheme: dark) {
    .btn-view-all:hover {
        box-shadow: 0 4px 8px rgba(77, 159, 255, 0.15);
    }
}

/* Projects */
.projects {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 4rem;
}

.project-card,
.skill-item {
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--code-bg);
}


.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 102, 204, 0.1);
}

@media (prefers-color-scheme: dark) {
    .project-card:hover {
        box-shadow: 0 8px 16px rgba(77, 159, 255, 0.15);
    }
}

.project-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.project-desc {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.project-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: var(--code-bg);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, color 0.2s ease;
}

.project-card:hover .tag {
    border-color: var(--accent);
    color: var(--accent);
}

footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.875rem;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
}

.social-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.social-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    position: relative;
}

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

.social-links a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.2s ease;
}

.social-links a:hover::before {
    width: 80%;
}

@media (max-width: 640px) {
    .container {
        padding: 1.5rem 1rem;
    }

    header {
        padding: 2rem 0 2rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .post-content h1 {
        font-size: 1.75rem;
    }

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

/* About page styling */
.about-page h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--success) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.about-page h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 4rem;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 0.75rem;
}

.about-page h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent);
}

.about-page p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* Contact section email link styling */
.about-page a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.about-page a:hover {
    text-decoration: underline;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.skill-item:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 102, 204, 0.1);
}

@media (prefers-color-scheme: dark) {
    .skill-item:hover {
        box-shadow: 0 8px 16px rgba(77, 159, 255, 0.15);
    }
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.skill-tag {
    padding: 0.25rem 0.65rem;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.skill-item:hover .skill-tag {
    border-color: var(--accent);
    color: var(--accent);
}

.skill-icon {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 8px;
    letter-spacing: -0.02em;
}

.skill-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.skill-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* General list styling for all pages */
main ul, main ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

main li {
    margin-bottom: 0.5rem;
}

main > h1,
.about-page h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

main > h2,
.about-page h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 4rem;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
    position: relative;
    padding-bottom: 0.75rem;
}

main > h2::after,
.about-page h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--accent);
}

/* Update mobile styles */
@media (max-width: 640px) {
    main > h1,
    .about-page h1 {
        font-size: 1.75rem;
    }

    main > h2,
    .about-page h2 {
        font-size: 1.5rem;
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 3rem 0;
    gap: 1rem;
}

.pagination-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--accent);
    transition: all 0.2s ease;
    font-weight: 500;
}

.pagination-btn:hover:not(.disabled) {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.1);
}

.pagination-btn.disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (prefers-color-scheme: dark) {
    .pagination-btn:hover:not(.disabled) {
        box-shadow: 0 4px 8px rgba(77, 159, 255, 0.15);
    }
}

@media (max-width: 640px) {
    .pagination {
        flex-direction: column;
    }

    .pagination-btn {
        width: 100%;
        text-align: center;
    }
}

/* Theme toggle button */
#theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

#theme-toggle:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.theme-icon {
    font-size: 1.5rem;
    display: none;
    color: var(--text);
    transition: color 0.2s ease;
}

#theme-toggle:hover .theme-icon {
    color: var(--accent);
}

/* Show light icon in dark mode, dark icon in light mode */
html[data-theme="dark"] .light-icon,
html[data-theme="light"] .dark-icon {
    display: block;
}

@media (max-width: 640px) {
    #theme-toggle {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 45px;
        height: 45px;
    }
}

/* Show sun icon in dark mode, moon icon in light mode */
html[data-theme="dark"] .light-icon,
html[data-theme="light"] .dark-icon {
    display: block;
}

/* Blockquote styling for all content */
.content blockquote,
.post-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--accent-light);
    padding: 0.75rem 1.25rem;
    border-radius: 0 6px 6px 0;
}

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

/* Table styling */
.content table,
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.content table th,
.post-content table th {
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text);
}

.content table td,
.post-content table td {
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
}

.content table tr:hover,
.post-content table tr:hover {
    background: var(--accent-light);
}

/* Lists in content */
.content ul, .content ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.content li {
    margin-bottom: 0.5rem;
}
