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

html, body {
    height: 100%;
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f2ed;
    color: #1e1e1e;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh; /* Position content in upper third */
    line-height: 1.6;
}

.container {
    text-align: left;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
}

p {
    text-align: left;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    max-width: 600px;
    width: 100%;
}

h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 400;
}

h2 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

ul {
    list-style: disc;
    padding-left: 1.5rem;
}

.contact {
    margin-top: 3rem;
}

.contact-links {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    padding-left: 0;
    flex-wrap: wrap;
}

.contact-links li {
    margin: 0;
}

li {
    font-size: 1rem;
    margin: -1rem 0;
}

a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    min-height: 44px; /* Minimum touch target size for mobile */
    display: inline-block;
    padding: 0.25rem 0;
}

p a {
    display: inline;
    min-height: auto;
    padding: 0;
}

a:hover {
    text-decoration-thickness: 2px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1e1e1e;
        color: #FFFFFF;
    }
    
    a {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    }
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        padding-top: 5vh;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .container {
        padding: 1.5rem 1rem;
        max-width: 100%;
    }
    
    h1 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }
    
    li {
        font-size: 1rem;
        margin: 0.75rem 0;
    }
    
    a {
        min-height: 44px;
        padding: 0.5rem 0;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    body {
        padding-top: 3vh;
    }
    
    .container {
        padding: 1rem 0.75rem;
    }
    
    h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }
    
    h2 {
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }
    
    p {
        font-size: 0.95rem;
        margin-bottom: 1.25rem;
    }
}

/* Blog Layout Styles */
.blog-container {
    display: flex;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
    position: relative;
}

.blog-content-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    max-width: 600px;
    margin-bottom: 0.5rem;
}

.blog-content-header .blog-post-date {
    margin-bottom: 0;
}

.close-button {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.6);
    text-decoration: none;
    line-height: 1;
    padding: 0;
    transition: color 0.15s ease;
}

.close-button:hover {
    color: rgba(0, 0, 0, 0.9);
    text-decoration: none;
}

.blog-sidebar {
    position: fixed;
    left: max(2rem, calc((100% - 1200px) / 2 + 2rem));
    width: calc(33.333% - 1rem);
    max-width: 400px;
    padding-top: calc(2.5vh + 2.75rem);
    padding-left: 2rem;
    top: 0;
    height: fit-content;
    z-index: 10;
}

.blog-sidebar h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 400;
}

.blog-sidebar h1 a {
    color: inherit;
    text-decoration: none;
}

.blog-sidebar h1 a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.breadcrumb {
    font-size: 1rem;
    margin-top: 0;
    font-weight: 400;
}

.breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.sidebar-subheading {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.5);
    margin-top: 1rem;
    margin-bottom: 0;
    line-height: 1.5;
}

.sidebar-posts {
    list-style: none;
    padding-left: 0;
    margin-top: 1.5rem;
}

.sidebar-posts li {
    font-size: 1rem;
    margin: 0.5rem 0;
}

.sidebar-posts a {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    padding: 0.125rem 0;
    transition: color 0.15s ease;
}

.sidebar-posts a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.sidebar-posts a.active {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.blog-content {
    flex: 0 0 66.666%;
    margin-left: 33.333%;
    padding-top: calc(1.25vh + 0.75rem + 0.125rem + 1rem);
    padding-bottom: 2rem;
}

.blog-listing,
.blog-post,
.blog-post-date {
    max-width: 600px;
}

.blog-listing h2 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.blog-listing ul {
    list-style: none;
    padding-left: 0;
}

.blog-listing li {
    font-size: 1rem;
    margin: 0.4rem 0;
}

/* Blog post date styling */
.blog-post-date {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 0.5rem;
    display: none;
}

/* Markdown content styling */
.blog-post h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 400;
}

.blog-post h2 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.blog-post h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.blog-post p {
    text-align: left;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
}

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

.blog-post li {
    font-size: 1rem;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.blog-post li a {
    display: inline;
    min-height: auto;
    padding: 0;
}

.blog-post code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.blog-post pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 3px;
    overflow-x: auto;
    margin-bottom: 2rem;
}

.blog-post pre code {
    background-color: transparent;
    padding: 0;
}

.blog-post blockquote {
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 2rem;
    font-style: italic;
}

.blog-post a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.blog-post a:hover {
    text-decoration-thickness: 2px;
}

/* Blog responsive styles */
@media (max-width: 768px) {
    .blog-container {
        flex-direction: column;
        padding: 1.5rem 1rem;
        gap: 1.5rem;
    }
    
    .blog-sidebar {
        position: relative;
        left: auto;
        width: 100%;
        max-width: 100%;
        flex: 1;
        padding-top: 2.5vh;
        padding-left: 0;
    }
    
    .breadcrumb {
        margin-top: 0.25rem;
    }
    
    .blog-content {
        flex: 1;
        margin-left: 0;
        padding-top: 0;
    }
    
    .blog-listing,
    .blog-post {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .blog-container {
        padding: 1rem 0.75rem;
    }
    
    .blog-sidebar {
        position: relative;
        left: auto;
        width: 100%;
        max-width: 100%;
        padding-top: 1.5vh;
        padding-left: 0;
    }
    
    .breadcrumb {
        margin-top: 0.25rem;
    }
    
    .blog-content {
        margin-left: 0;
    }
    
    .blog-sidebar h1 {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
}

/* Dark mode for blog */
@media (prefers-color-scheme: dark) {
    .close-button {
        color: rgba(255, 255, 255, 0.6);
    }
    
    .close-button:hover {
        color: rgba(255, 255, 255, 0.9);
    }
    
    .sidebar-subheading {
        color: rgba(255, 255, 255, 0.5);
    }
    
    .sidebar-posts a {
        color: inherit;
    }
    
    .blog-post-date {
        color: rgba(255, 255, 255, 0.6);
    }
    
    .blog-post code {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .blog-post pre {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .blog-post blockquote {
        border-left-color: rgba(255, 255, 255, 0.2);
    }
}

/* Blog Preview Styles */
.blog-preview {
    position: absolute;
    display: none;
    width: 400px;
    max-width: 90vw;
    max-height: 500px;
    overflow-y: auto;
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 
                inset 0 1px 0 rgba(255, 255, 255, 0.5);
    padding: 1.5rem;
    z-index: 1000;
    font-size: 0.95rem;
    line-height: 1.6;
    pointer-events: auto;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-date {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.6);
    margin-bottom: 0.5rem;
}

.preview-header {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.preview-content {
    color: rgba(0, 0, 0, 0.8);
    font-size: 0.9rem;
    line-height: 1.6;
    max-height: calc(1.6em * 6); /* 6 lines based on line-height */
    overflow: hidden;
}

/* Apply blog-post styling to preview content */
.preview-content h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    font-weight: 400;
}

.preview-content h2 {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

.preview-content h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.preview-content p {
    text-align: left;
    margin-bottom: 2rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
}

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

.preview-content li {
    font-size: 1rem;
    margin: 0.5rem 0;
    line-height: 1.6;
}

.preview-content code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.9em;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

.preview-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 1rem;
    border-radius: 3px;
    overflow-x: auto;
    margin-bottom: 2rem;
}

.preview-content pre code {
    background-color: transparent;
    padding: 0;
}

.preview-content blockquote {
    border-left: 2px solid rgba(0, 0, 0, 0.1);
    padding-left: 1rem;
    margin-left: 0;
    margin-bottom: 2rem;
    font-style: italic;
}

.preview-content a {
    color: inherit;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.preview-empty,
.preview-loading,
.preview-error {
    color: rgba(0, 0, 0, 0.6);
    font-style: italic;
    padding: 0.5rem 0;
}

/* Dark mode for preview */
@media (prefers-color-scheme: dark) {
    .blog-preview {
        background-color: rgba(42, 42, 42, 0.75);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-color: rgba(255, 255, 255, 0.25);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
                    inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    
    .preview-date {
        color: rgba(255, 255, 255, 0.6);
    }
    
    .preview-header {
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .preview-content {
        color: rgba(255, 255, 255, 0.8);
    }
    
    .preview-content code {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .preview-content pre {
        background-color: rgba(255, 255, 255, 0.1);
    }
    
    .preview-content blockquote {
        border-left-color: rgba(255, 255, 255, 0.2);
    }
    
    .preview-empty,
    .preview-loading,
    .preview-error {
        color: rgba(255, 255, 255, 0.6);
    }
}

/* Mobile: hide preview on small screens */
@media (max-width: 768px) {
    .blog-preview {
        display: none !important;
    }
}
