:root {
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.1rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border radius */
    --radius-small: 3px;
    --radius-regular: 5px;
    --radius-medium: 8px;
    --radius-large: 12px;
    
    /* Colors - Dark Mode (default) */
    --color-text-primary: #e4e4e4;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #707070;
    --color-text-hover: #fff;
    --color-bg-primary: #1a1a1a;
    --color-bg-secondary: #242424;
    --color-bg-tertiary: #2e2e2e;
    --color-border-light: #2a2a2a;
    --color-border: #333;
    --color-border-medium: #404040;
    
    /* Typography */
    --font-size-small: 0.85rem;
    --font-size-base: 0.9rem;
    --font-size-regular: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 1.75rem;
    --font-size-3xl: 2rem;
    
    /* Transitions */
    --transition-fast: 0.2s;
    --transition-base: cubic-bezier(.5, 0, 0, 1) 0.2s;
}

/* Light Mode Colors */
[data-theme="light"] {
    --color-text-primary: #333;
    --color-text-secondary: #666;
    --color-text-tertiary: #999;
    --color-text-hover: #000;
    --color-bg-primary: #fff;
    --color-bg-secondary: #fafafa;
    --color-bg-tertiary: #f5f5f5;
    --color-border-light: #f0f0f0;
    --color-border: #eee;
    --color-border-medium: #ddd;
}

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

/* Smooth color transitions for theme switching */
body,
header,
nav,
footer,
.header-menu,
.header-menu__item,
article,
.profile-image {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-text-primary);
    color: var(--color-bg-primary);
    padding: 8px;
    text-decoration: none;
    z-index: 100;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link:focus {
    top: 0;
    clip: auto;
    width: auto;
    height: auto;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.7;
    color: var(--color-text-primary);
    max-width: 650px;
    margin: 0 auto;
    padding: var(--spacing-xl);
    background: var(--color-bg-primary);
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-md);
    position: relative;
}

/* Hamburger Menu Toggle Button */
.menu-toggle {
    display: none; /* Hidden on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
    position: absolute;
    top: 0;
    right: 0;
}

.menu-toggle:focus {
    outline: 2px solid var(--color-text-primary);
    outline-offset: 2px;
}

.menu-toggle__bar {
    width: 2rem;
    height: 0.2rem;
    background: var(--color-text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Hamburger animation when active */
.menu-toggle.is-active .menu-toggle__bar:nth-child(1) {
    transform: translateY(0.6rem) rotate(45deg);
}

.menu-toggle.is-active .menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .menu-toggle__bar:nth-child(3) {
    transform: translateY(-0.6rem) rotate(-45deg);
}

nav.header-menu {
    display: flex;
    gap: var(--spacing-xs);
    align-items: center;
    padding: var(--spacing-xs);
    border-radius: var(--radius-large);
    background: var(--color-border);
    width: 100%;
}

.header-menu__item {
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
    padding: 8px 0;
    border-radius: var(--radius-medium);
    flex: 1;
    text-align: center;
    line-height: 100%;
    transition: background var(--transition-base);
    text-decoration: none;
}

.header-menu__item:hover {
    background: var(--color-bg-secondary);
}

.header-menu__item--active {
    background: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

h1 {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    line-height: 1.2;
}

h2 {
    font-size: var(--font-size-xl);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    font-weight: 600;
    line-height: 1.3;
}

h3 {
    font-size: var(--font-size-lg);
    margin-top: var(--spacing-lg);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

h3 + ul.posts.posts-by-year {
    margin-top: var(--spacing-xs);
}

p {
    margin-bottom: var(--spacing-md);
}

ul, ol {
    margin-left: var(--spacing-lg);
    margin-bottom: 1.25rem;
}

ul li, ol li {
    margin-bottom: var(--spacing-sm);
}

ul.posts {
    list-style: none;
    margin-left: 0;
    margin-top: var(--spacing-xl);
}

ul.posts li {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
}

ul.posts li:last-child {
    border-bottom: none;
}

ul.posts.posts-by-year {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
}

ul.posts.posts-by-year li.post-item {
    border-bottom: none;
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
}

ul.posts.posts-by-year li.post-item-last-in-year {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--color-border-light);
}

ul.posts.posts-by-year li.post-item .date,
.date {
    display: inline-block;
    margin-right: 0.75rem;
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
}

ul.posts a {
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: var(--font-size-regular);
    font-weight: 500;
    transition: color var(--transition-fast);
}

ul.posts a:hover {
    color: var(--color-text-hover);
    text-decoration: underline;
}

.home-intro {
    margin-top: var(--spacing-xl);
}

.profile-image {
    max-width: 100%;
    width: 100%;
    max-width: 600px;
    height: auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto var(--spacing-lg);
    display: block;
}

.intro-text {
    margin-top: var(--spacing-md);
}

.intro-text p {
    margin-bottom: var(--spacing-md);
}

.meta {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--color-text-secondary);
    font-size: var(--font-size-small);
}

.meta .separator {
   
    padding-left: 0em;
    padding-right: 0.65em;
}

article {
    margin-top: var(--spacing-xl);
}

article h1 {
    text-align: center;
}

article .content {
    margin-top: var(--spacing-lg);
}

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

article .content ul,
article .content ol {
    margin-left: var(--spacing-lg);
    margin-bottom: 1.25rem;
}

article .content li {
    margin-bottom: var(--spacing-sm);
}

article .content code {
    background: var(--color-bg-tertiary);
    padding: 0.2em 0.4em;
    border-radius: var(--radius-small);
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

article .content pre {
    background: var(--color-bg-tertiary);
    padding: var(--spacing-md);
    border-radius: var(--radius-regular);
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

article .content pre code {
    background: none;
    padding: 0;
}

article .content blockquote {
    border-left: 3px solid var(--color-border-medium);
    padding-left: var(--spacing-md);
    margin-left: 0;
    margin-bottom: 1.25rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

article .content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-regular);
    margin: var(--spacing-lg) 0;
}

article .content a {
    color: var(--color-text-primary);
    text-decoration: underline;
    transition: color var(--transition-fast);
}

article .content a:hover {
    color: var(--color-text-hover);
}

footer {
    margin-top: 4rem;
    padding-top: var(--spacing-md);
    font-size: var(--font-size-base);
    text-align: center;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

footer a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

footer a:hover {
    color: var(--color-text-primary);
}

footer .separator {
    color: var(--color-text-secondary);
}

/* Dark Mode Toggle Text */
.theme-toggle {
    color: var(--color-text-secondary);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: color var(--transition-fast);
    display: inline;
    position: relative;
    user-select: none;
}

.theme-toggle:hover {
    color: var(--color-text-hover);
}



.theme-toggle__text {
    transition: opacity 0.2s ease;
    opacity: 0;
    position: absolute;
    white-space: nowrap;
}

.theme-toggle__text.active {
    opacity: 1;
    position: relative;
}

a {
    color: var(--color-text-primary);
    text-decoration: underline;
}

a:hover {
    color: var(--color-text-hover);
}

@media (max-width: 600px) {
    body {
        padding: var(--spacing-lg);
    }
    
    h1 {
        font-size: var(--font-size-2xl);
    }
    
    /* Show hamburger menu button on mobile */
    .menu-toggle {
        display: flex;
    }
    
    /* Mobile navigation styles */
    nav.header-menu {
        flex-direction: column;
        gap: 0;
        position: absolute;
        top: 3rem;
        left: 0;
        right: 0;
        background: var(--color-bg-primary);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-large);
        padding: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
        z-index: 5;
    }
    
    /* Open state for mobile menu */
    nav.header-menu.is-open {
        max-height: 500px;
        opacity: 1;
        padding: var(--spacing-xs);
    }
    
    .header-menu__item {
        width: 100%;
        padding: 12px 16px;
        margin: 2px 0;
        text-align: left;
        font-size: var(--font-size-regular);
    }
    
    .profile-image {
        width: 100%;
        height: auto;
        aspect-ratio: 4 / 3;
        max-width: 100%;
    }
    
    /* Stack footer on mobile if needed */
    footer {
        flex-direction: column;
        text-align: center;
    }
}
