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

:root {
    color-scheme: light;
    --color-bg: #F8F8F8;
    --color-surface: #FFFFFF;
    --color-text: #3B3B3B;
    --color-heading: #1F1F1F;
    --color-muted: #616161;
    --color-subtle: #868686;
    --color-border: #E5E5E5;
    --color-link: #005FB8;
    --color-link-hover: #0258A8;
    --color-code-bg: #F8F8F8;
    --status-shipped-bg: #dcfce7;
    --status-shipped-text: #166534;
    --status-progress-bg: #fef3c7;
    --status-progress-text: #92400e;
    --status-archived-bg: #e2e8f0;
    --status-archived-text: #475569;
    --color-button-bg: #005FB8;
    --color-button-fg: #FFFFFF;
    --color-button-hover: #0258A8;
    --color-focus: #005FB8;
    --shadow-soft: 0 6px 18px rgba(31, 31, 31, 0.08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --color-bg: #1F1F1F;
    --color-surface: #181818;
    --color-text: #CCCCCC;
    --color-heading: #FFFFFF;
    --color-muted: #9D9D9D;
    --color-subtle: #868686;
    --color-border: #2B2B2B;
    --color-link: #4DAAFC;
    --color-link-hover: #85B6FF;
    --color-code-bg: #2B2B2B;
    --status-shipped-bg: #2EA04333;
    --status-shipped-text: #86EFAC;
    --status-progress-bg: #BB800966;
    --status-progress-text: #E2C08D;
    --status-archived-bg: #61616166;
    --status-archived-text: #CCCCCC;
    --color-button-bg: #0078D4;
    --color-button-fg: #FFFFFF;
    --color-button-hover: #026EC1;
    --color-focus: #0078D4;
    --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* System font stack */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
}

/* Container and layout */
.site-header,
.site-footer,
main {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    padding-top: 40px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 60px;
}

.header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.main-nav {
    margin-left: auto;
}

.site-title a {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-heading);
    text-decoration: none;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 24px;
}

.main-nav a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 16px;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--color-heading);
}

.theme-toggle {
    appearance: none;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-heading);
    border-radius: 999px;
    width: 44px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    box-shadow: var(--shadow-soft);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--color-link);
    transform: translateY(-1px);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-focus) 40%, transparent), var(--shadow-soft);
}

.theme-toggle__track {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle__icon {
    font-size: 16px;
    line-height: 1;
}

/* Footer */
.site-footer {
    margin-top: 80px;
    padding-top: 40px;
    padding-bottom: 40px;
    border-top: 1px solid var(--color-border);
}

.footer-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--color-muted);
    text-decoration: none;
    font-size: 15px;
}

.footer-links a:hover {
    color: var(--color-heading);
}

.footer-copyright p {
    color: var(--color-subtle);
    font-size: 14px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-heading);
    margin-bottom: 16px;
}

h1 {
    font-size: 32px;
    margin-bottom: 24px;
}

h2 {
    font-size: 24px;
    margin-top: 40px;
}

h3 {
    font-size: 20px;
}

p {
    margin-bottom: 16px;
}

a {
    color: var(--color-link);
}

a:hover {
    text-decoration: underline;
}

/* Home page */
.hero {
    margin-bottom: 60px;
}

.hero-headline {
    font-size: 28px;
    line-height: 1.4;
    margin-bottom: 16px;
}

.hero-subhead {
    font-size: 18px;
    color: var(--color-muted);
    line-height: 1.6;
}

.proof-points {
    margin-bottom: 60px;
}

.proof-points ul {
    list-style: none;
}

.proof-points li {
    padding-left: 24px;
    position: relative;
    margin-bottom: 12px;
}

.proof-points li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--color-link);
}

.featured-projects,
.featured-writing {
    margin-bottom: 60px;
}

.featured-list {
    list-style: none;
}

.featured-list li {
    margin-bottom: 32px;
}

.featured-list h3 {
    margin-bottom: 8px;
}

.featured-list h3 a {
    color: var(--color-heading);
    text-decoration: none;
}

.featured-list h3 a:hover {
    color: var(--color-link);
}

.featured-list p {
    color: var(--color-muted);
}

.view-all {
    font-size: 16px;
    display: inline-block;
    margin-top: 8px;
}

.cta {
    margin-top: 60px;
    text-align: center;
}

.cta-button {
    display: inline-block;
    padding: 12px 32px;
    background-color: var(--color-button-bg);
    color: var(--color-button-fg);
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}

.cta-button:hover {
    background-color: var(--color-button-hover);
    text-decoration: none;
}

/* Lists */
.list-header {
    margin-bottom: 40px;
}

.list-header .description {
    color: var(--color-muted);
    font-size: 18px;
}

.list,
.project-list,
.writing-list {
    list-style: none;
}

.list-item,
.project-item,
.writing-item {
    margin-bottom: 40px;
}

.list-item h2,
.project-item h3,
.writing-item h3 {
    margin-bottom: 8px;
}

.list-item h2 a,
.project-item h3 a,
.writing-item h3 a {
    color: var(--color-heading);
    text-decoration: none;
}

.list-item h2 a:hover,
.project-item h3 a:hover,
.writing-item h3 a:hover {
    color: var(--color-link);
}

.list-item time,
.project-item time,
.writing-item time {
    color: var(--color-subtle);
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}

.summary {
    color: var(--color-muted);
    margin-top: 8px;
}

/* Projects page */
.projects-section {
    margin-bottom: 60px;
}

.status {
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 3px;
    display: inline-block;
    margin-left: 8px;
}

.status-shipped {
    background-color: var(--status-shipped-bg);
    color: var(--status-shipped-text);
}

.status-in-progress {
    background-color: var(--status-progress-bg);
    color: var(--status-progress-text);
}

.status-archived {
    background-color: var(--status-archived-bg);
    color: var(--status-archived-text);
}

.impact {
    font-size: 13px;
    color: var(--color-subtle);
    margin-left: 8px;
}

/* Writing page */
.writing-section {
    margin-bottom: 60px;
}

.type {
    font-size: 13px;
    color: var(--color-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
}

/* Single pages */
.single-header,
.project-header {
    margin-bottom: 40px;
}

.project-meta {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.project-meta time {
    color: var(--color-subtle);
    font-size: 14px;
}

/* Tags */
.tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.tag {
    font-size: 13px;
    color: var(--color-subtle);
    text-decoration: none;
}

.tag:hover {
    color: var(--color-link);
}

/* Content */
.content {
    line-height: 1.8;
}

.content h2 {
    margin-top: 48px;
    margin-bottom: 20px;
}

.content h3 {
    margin-top: 32px;
    margin-bottom: 16px;
}

.content ul,
.content ol {
    margin-left: 24px;
    margin-bottom: 16px;
}

.content li {
    margin-bottom: 8px;
}

.content pre {
    background-color: var(--color-code-bg);
    padding: 16px;
    overflow-x: auto;
    border-radius: 4px;
    margin-bottom: 16px;
}

.content code {
    font-family: "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 14px;
}

.content blockquote {
    border-left: 3px solid var(--color-link);
    padding-left: 20px;
    color: var(--color-muted);
    margin: 24px 0;
}

.external-link {
    margin-top: 32px;
    padding-top: 32px;
    border-top: 1px solid var(--color-border);
}

/* Responsive */
@media (max-width: 640px) {
    body {
        font-size: 16px;
    }
    
    .header-content {
        gap: 14px;
    }

    .site-title {
        order: 1;
    }

    .theme-toggle {
        order: 2;
        margin-left: auto;
    }

    .main-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
    }
    
    .main-nav ul {
        flex-wrap: wrap;
        gap: 14px;
    }
    
    h1 {
        font-size: 26px;
    }
    
    h2 {
        font-size: 22px;
    }
    
    .hero-headline {
        font-size: 24px;
    }
}
