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

/* Color scheme using CSS custom properties */
:root {
    /* Light mode colors */
    --bg-primary: #fefcf7;      /* Warm cream background */
    --bg-secondary: #f5f2eb;    /* Slightly darker cream for headers */
    --bg-accent: #f0ede6;       /* Code block background */
    
    --text-primary: #2c2c2c;    /* Main text color */
    --text-secondary: #5a5a5a;  /* Secondary text */
    --text-muted: #999999;      /* More muted text for dates, etc. */
    
    --border-primary: #d4c5b0;  /* Main border color */
    
    --accent-primary: #8b4513;  /* Brown accent for links */
    --accent-secondary: #8b7355; /* Lighter brown for blockquotes */
    --accent-hover: #5d2e0a;    /* Darker brown for hovers */
    --accent-code: #b8316b;     /* Code text color */
    
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Dark mode colors */
[data-theme="dark"] {
    --bg-primary: #2a2a2a;      /* Slightly lighter dark background */
    --bg-secondary: #353535;    /* Slightly lighter dark for headers */
    --bg-accent: #404040;       /* Code block background */
    
    --text-primary: #e8e8e8;    /* Light text */
    --text-secondary: #b8b8b8;  /* Secondary light text */
    --text-muted: #777777;      /* More muted light text */
    
    --border-primary: #555555;  /* Slightly lighter dark border */
    
    --accent-primary: #d4a574;  /* Warm orange for links */
    --accent-secondary: #b8956f; /* Muted orange for blockquotes */
    --accent-hover: #e6b885;    /* Lighter orange for hovers */
    --accent-code: #e879b5;     /* Pink for code text */
    
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.4);
}

/* Respect user's system preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #2a2a2a;
        --bg-secondary: #353535;
        --bg-accent: #404040;
        
        --text-primary: #e8e8e8;
        --text-secondary: #b8b8b8;
        --text-muted: #777777;
        
        --border-primary: #555555;
        
        --accent-primary: #d4a574;
        --accent-secondary: #b8956f;
        --accent-hover: #e6b885;
        --accent-code: #e879b5;
        
        --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.4);
    }
}

/* Typography - Following WCAG accessibility guidelines */
html {
    font-size: 16px; /* Base font size for rem calculations */
    scroll-behavior: smooth;
}

body {
    font-family: Arial, Helvetica, sans-serif; /* High readability sans-serif */
    line-height: 1.6; /* WCAG recommended line height */
    color: var(--text-primary);
    background-color: var(--bg-primary);
    letter-spacing: normal; /* Normal letter spacing for readability */
    word-spacing: normal; /* Normal word spacing */
}



/* Header controls container */
.header-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    height: 2.5rem; /* Match site title height for perfect alignment */
}

/* Theme toggle button */
.theme-toggle {
    background: var(--bg-accent);
    border: 2px solid var(--border-primary);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-toggle:hover,
.theme-toggle:focus {
    transform: scale(1.1);
    border-color: var(--accent-primary);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Layout and structure */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 2rem 0;
    position: relative;
}

.site-header .main-content {
    padding: 0 1rem;
}

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
    min-height: 2.5rem; /* Ensure consistent height for alignment */
}

.site-title {
    font-size: 2.5rem; /* 40px */
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1; /* Tighter line height for better alignment */
    display: flex;
    align-items: center;
}

.site-description {
    font-size: 1.125rem; /* 18px - large text */
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.site-header-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.site-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-bottom: 1rem;
}

.home-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    transition: transform 0.2s ease;
}

.home-link:hover, .home-link:focus {
    transform: scale(1.02);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Control links (RSS, GitHub, LinkedIn) */
.control-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--bg-accent);
    border: 2px solid var(--border-primary);
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
}

.control-link:hover,
.control-link:focus {
    transform: scale(1.1);
    border-color: var(--accent-primary);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.control-icon {
    width: 1.25rem;
    height: 1.25rem;
    transition: all 0.2s ease;
    display: block;
}

.main-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Post styles */
.blog-post {
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-light);
    padding: 2rem;
    margin-bottom: 2rem;
}

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

.post-title {
    font-size: 2.25rem; /* 36px */
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.post-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.post-date {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
}



/* Post content typography */
.post-content {
    font-size: 1.125rem; /* 18px - large text for better readability */
    line-height: 1.7;
    color: var(--text-primary);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.post-content h1 {
    font-size: 2.25rem; /* 36px */
    line-height: 1.3;
}

.post-content h2 {
    font-size: 2rem; /* 32px */
    line-height: 1.35;
}

.post-content h3 {
    font-size: 1.75rem; /* 28px */
    line-height: 1.4;
}

.post-content h4 {
    font-size: 1.5rem; /* 24px */
    line-height: 1.45;
}

.post-content h5 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.5;
}

.post-content h6 {
    font-size: 1.125rem; /* 18px */
    line-height: 1.55;
}

.post-content p {
    margin-bottom: 1.5rem;
    /* Removed max-width to allow full container width */
}

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

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

.post-content blockquote {
    border-left: 4px solid var(--accent-secondary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Links with proper contrast and descriptions */
.post-content a,
.post-link,
.back-to-home {
    color: var(--accent-primary);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.post-content a:hover,
.post-content a:focus,
.post-link:hover,
.post-link:focus,
.back-to-home:hover,
.back-to-home:focus {
    color: var(--accent-hover);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Code blocks with proper contrast */
.post-content code {
    background-color: var(--bg-accent);
    color: var(--accent-code);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.9em;
    border: 1px solid var(--border-primary);
}

.post-content pre {
    background-color: var(--bg-accent);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.post-content pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    font-size: inherit;
}

/* Table styles */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 1rem;
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.post-content table thead {
    background-color: var(--bg-secondary);
}

.post-content table th,
.post-content table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-primary);
    vertical-align: top;
}

.post-content table th {
    font-weight: 600;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.post-content table td {
    color: var(--text-primary);
}

.post-content table tbody tr:hover {
    background-color: var(--bg-accent);
    transition: background-color 0.2s ease;
}

.post-content table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive tables */
@media (max-width: 768px) {
    .post-content table {
        font-size: 0.9rem;
    }
    
    .post-content table th,
    .post-content table td {
        padding: 0.5rem 0.75rem;
    }
}

/* Image styles */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-light);
    margin: 1.5rem 0;
    display: block;
}

.post-content img.inline {
    display: inline;
    margin: 0 0.25rem;
    max-height: 1.5em;
    vertical-align: middle;
    border-radius: 0.25rem;
    box-shadow: none;
}

/* Notes section styling */
.notes-section {
    margin-top: 1rem;
    opacity: 0.6; /* More muted */
    font-size: 0.95rem;
}

.notes-section hr {
    display: none; /* Hide the horizontal rule */
}

.notes-section p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    /* Removed max-width to allow full container width */
}

.notes-section em {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 500;
}

.notes-section a {
    color: var(--accent-secondary);
}

.notes-section a:hover,
.notes-section a:focus {
    color: var(--accent-primary);
}


/* Header anchors - hidden by default, visible on hover */
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    position: relative;
}

.header-anchor {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 0.5rem;
    font-weight: normal;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.post-content h1:hover .header-anchor,
.post-content h2:hover .header-anchor,
.post-content h3:hover .header-anchor,
.post-content h4:hover .header-anchor,
.post-content h5:hover .header-anchor,
.post-content h6:hover .header-anchor,
.header-anchor:focus {
    opacity: 1;
}

.header-anchor:hover,
.header-anchor:focus {
    color: var(--accent-primary);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Posts list on homepage */
.posts-section {
    margin-bottom: 2rem;
}

.posts-heading {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.posts-list {
    display: grid;
    gap: 2rem;
}

.post-preview {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: 0.5rem;
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.post-preview:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.post-preview h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.post-preview .post-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
}

.post-preview .post-link:hover,
.post-preview .post-link:focus {
    color: var(--accent-primary);
    text-decoration: underline;
}

.post-preview .post-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: block;
}

.post-preview .post-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Back navigation */
.back-nav {
    margin-bottom: 1rem;
}

.back-arrow {
    display: inline-block;
    font-size: 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
    line-height: 1;
}

.back-arrow:hover,
.back-arrow:focus {
    color: var(--accent-primary);
    background-color: var(--bg-accent);
    transform: translateX(-2px);
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Footer */
.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-primary);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0.5rem;
    }
    
    .blog-post {
        padding: 1.5rem;
    }
    
    .site-title {
        font-size: 2rem;
    }
    
    .post-title {
        font-size: 1.75rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .post-content h1 {
        font-size: 1.75rem;
    }
    
    .post-content h2 {
        font-size: 1.5rem;
    }
    
    .post-content h3 {
        font-size: 1.25rem;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .post-preview {
        padding: 1rem;
    }
    
    .site-nav {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .site-header-top {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .header-controls {
        gap: 0.75rem;
    }
    
    .theme-toggle {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
    }
    
    .control-icon {
        width: 1rem;
        height: 1rem;
    }
    
    .control-link {
        width: 2rem;
        height: 2rem;
    }
}

/* Print styles */
@media print {
    .post-nav,
    .site-footer {
        display: none;
    }
    
    .main-content {
        max-width: none;
        padding: 0;
    }
    
    .blog-post {
        box-shadow: none;
        border: none;
        padding: 0;
    }
    
    .post-content a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* Smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg-primary: #ffffff;
        --bg-secondary: #f0f0f0;
        --bg-accent: #f0f0f0;
        --text-primary: #000000;
        --text-secondary: #000000;
        --text-muted: #333333;
        --border-primary: #000000;
        --accent-primary: #0000ff;
        --accent-secondary: #0000ff;
        --accent-hover: #000080;
        --accent-code: #000000;
    }
    
    [data-theme="dark"] {
        --bg-primary: #000000;
        --bg-secondary: #111111;
        --bg-accent: #111111;
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
        --text-muted: #cccccc;
        --border-primary: #ffffff;
        --accent-primary: #00ffff;
        --accent-secondary: #00ffff;
        --accent-hover: #ffffff;
        --accent-code: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
} 