:root {
    --bg-color: #ffffff;
    --text-color: #1a1a1a;
    --link-color: #333333;
    --link-hover: #cc5200;
    --border-color: #e5e5e5;
    --time-color: #757575;
    --accent-color: #cc5200;
    --accent-light: #fff4ed;
    --hero-title: #0a0a0a;
    --max-width: 650px;
}

[data-theme="dark"] {
    --bg-color: #0a0a0a;
    --text-color: #e5e5e5;
    --link-color: #cccccc;
    --link-hover: #ff7733;
    --border-color: #222222;
    --time-color: #999999;
    --accent-color: #ff7733;
    --accent-light: #331a0d;
    --hero-title: #ffffff;
}

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

html {
    overflow-y: scroll;
}

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


header {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

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

.site-title {
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.site-title:hover {
    opacity: 0.7;
}

.site-logo {
    width: 32px;
    height: 32px;
    color: var(--text-color);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.95rem;
}

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

.social-link {
    display: flex;
    align-items: center;
    padding: 0.25rem;
    transition: opacity 0.2s ease;
}

.social-link:hover {
    opacity: 0.7;
    text-decoration: none !important;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background-color: var(--accent-light);
    transform: rotate(180deg);
}

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

.hero {
    text-align: left;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
    position: relative;
}

.hero h1 {
    font-size: 2.75rem;
    font-weight: 300;
    line-height: 1.15;
    margin-bottom: 2.5rem;
    color: var(--hero-title);
    letter-spacing: -0.04em;
    position: relative;
}

.hero h1::after {
    content: '';
    position: absolute;
    bottom: -0.75rem;
    left: 0;
    width: 60px;
    height: 2px;
    background-color: var(--text-color);
    opacity: 0.2;
}

.hero-content {
    max-width: 90%;
}

.hero-intro {
    font-size: 1.375rem;
    color: var(--text-color);
    line-height: 1.5;
    margin-bottom: 2rem;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.hero-bio {
    font-size: 1.125rem;
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    opacity: 0.85;
    font-weight: 300;
}

.hero-about {
    font-size: 1rem;
    color: var(--time-color);
    line-height: 1.65;
    padding-left: 2rem;
    border-left: 2px solid var(--border-color);
    margin-top: 2rem;
}

.posts {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.post-preview {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    margin: 0 -1.5rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    position: relative;
    border-radius: 8px;
    cursor: pointer;
}

.post-preview:last-child {
    border-bottom: none;
}

.post-preview:hover {
    background-color: var(--accent-light);
    transform: translateX(8px);
}

.post-preview:hover h2 a {
    color: var(--link-hover);
}

.post-preview time {
    font-size: 0.875rem;
    color: var(--time-color);
    font-weight: 500;
    transition: color 0.2s ease;
}

.post-preview:hover time {
    color: var(--link-hover);
    font-weight: 600;
}

.post-preview h2 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.post-preview h2 a {
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.external-link-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: var(--time-color);
}

.external-link-indicator svg {
    width: 14px;
    height: 14px;
}

.post-preview p {
    color: var(--text-color);
    opacity: 0.85;
    line-height: 1.7;
}

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

.post-header {
    margin-bottom: 2rem;
}

.post-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.post-header time {
    font-size: 0.875rem;
    color: var(--time-color);
}

.post-body {
    font-size: 1.125rem;
    line-height: 1.7;
}

.post-body h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 2.5rem 0 1.5rem;
    color: var(--hero-title);
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.post-body h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
}

.post-body p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.post-body p:first-of-type {
    font-size: 1.25rem;
    line-height: 1.7;
    font-weight: 400;
    color: var(--text-color);
    margin-bottom: 2rem;
}

.post-body ul, .post-body ol {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

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

.post-body li strong {
    color: var(--text-color);
}

.post-body a {
    color: var(--link-color);
    text-decoration: underline;
}

.post-body a:hover {
    color: var(--link-hover);
}

.post-body blockquote {
    margin: 2.5rem 0;
    padding: 2rem;
    padding-left: 2.5rem;
    border-left: 4px solid var(--accent-color);
    background-color: var(--accent-light);
    border-radius: 0 8px 8px 0;
    position: relative;
}

.post-body blockquote p {
    font-size: 1.125rem;
    line-height: 1.7;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0;
}

.post-body blockquote::before {
    content: '"';
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    font-size: 3rem;
    color: var(--accent-color);
    opacity: 0.2;
    font-family: Georgia, serif;
}

.table-of-contents {
    background-color: var(--accent-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    margin-bottom: 3rem;
    display: inline-block;
}

.table-of-contents h3 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--time-color);
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.table-of-contents ol {
    margin: 0;
    padding-left: 1.5rem;
    list-style-type: decimal;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.table-of-contents a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.table-of-contents a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.post-body code {
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
    font-size: 0.875em;
    background-color: var(--accent-light);
    color: var(--accent-color);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 500;
}

.post-body pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--accent-light) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.post-body pre code {
    background: none;
    padding: 0;
    color: var(--text-color);
    font-weight: normal;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.archive-year {
    margin-bottom: 1rem;
}

.archive-year h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--time-color);
}

.archive-posts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.archive-post {
    display: flex;
    gap: 1rem;
    align-items: baseline;
    padding: 0.75rem;
    margin: -0.75rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.archive-post:hover {
    background-color: var(--accent-light);
    transform: translateX(8px);
}

.archive-post time {
    font-size: 0.875rem;
    color: var(--time-color);
    min-width: 80px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.archive-post:hover time {
    color: var(--link-hover);
    font-weight: 600;
}

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

.archive-post:hover a {
    color: var(--link-hover);
    font-weight: 600;
}

footer {
    border-top: 1px solid var(--border-color);
    margin-top: 3rem;
    padding: 1.5rem 0;
}

footer p {
    text-align: center;
    font-size: 0.875rem;
    color: var(--time-color);
}

@media (max-width: 640px) {
    body {
        font-size: 15px;
    }
    
    nav {
        padding: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-intro {
        font-size: 1.2rem;
    }
    
    .hero-bio {
        font-size: 1rem;
    }
    
    .hero-about {
        font-size: 0.95rem;
        padding-left: 1.5rem;
    }
    
    .hero-content {
        max-width: 100%;
    }
    
    .post-header h1 {
        font-size: 1.75rem;
    }
    
    .post-body {
        font-size: 1rem;
    }
    
    .archive-post {
        flex-direction: column;
        gap: 0.25rem;
    }
    
}

/* Selection styling */
::selection {
    background-color: var(--accent-color);
    color: white;
}

::-moz-selection {
    background-color: var(--accent-color);
    color: white;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus styling for accessibility */
*:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Loading animation for page transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

main {
    animation: fadeIn 0.5s ease-out;
}