:root {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --text-tertiary: #636366;
    --accent: #007aff;
    --accent-hover: #0056b3;
    --border: #38383a;
    --blur-bg: rgba(28, 28, 30, 0.8)
}

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

body {
    font-family: SF Pro Text, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px
}

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all .2s ease
}

.card:hover {
    border-color: var(--text-tertiary)
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: SF Pro Display, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -.02em;
    margin-bottom: 16px;
    word-wrap: break-word;
    -webkit-hyphens: auto;
    hyphens: auto
}

h1 {
    font-size: 48px;
    line-height: 1.2
}

h2 {
    font-size: 36px;
    line-height: 1.3
}

h3 {
    font-size: 24px;
    line-height: 1.4
}

p {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.6
}

a {
    color: var(--accent);
    text-decoration: none
}

a:hover {
    color: var(--accent-hover)
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    /* margin-right: 8px; Removed in favor of gap */
}

.btn-primary,
.tag {
    font-weight: 500;
    display: inline-block
}

.btn-primary {
    background: var(--accent);
    color: white;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s ease
}

.btn-primary:hover {
    background: var(--accent-hover);
    color: white
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background .2s ease
}

.btn-secondary:hover {
    background: var(--text-tertiary);
    color: var(--text-primary)
}

.grid {
    display: grid;
    grid-gap: 24px;
    gap: 24px
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr))
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    margin-top: 48px;
    margin-bottom: 16px;
    color: var(--text-primary);
    clear: both;
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child {
    margin-top: 0
}

.prose p {
    margin-bottom: 16px;
    line-height: 1.7;
    color: var(--text-secondary)
}

.prose pre {
    padding: 16px;
    overflow-x: auto;
    margin: 0;
}

.prose div.highlighter-rouge {
    width: fit-content;
    max-width: 100%;
    float: left;
    clear: left;
    margin-right: 24px;
    margin-bottom: 24px;
    margin-top: 24px;
    border-radius: 24px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.prose::after {
    content: "";
    display: table;
    clear: both;
}

.prose pre {
    background: var(--bg-tertiary);
    font-size: 14px
}

.prose code {
    font-family: SF Mono, Monaco, Cascadia Code, Roboto Mono, Consolas, Courier New, monospace;
    color: #ff4d4d !important;
    background: rgba(255, 255, 255, 0.15) !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    font-size: 0.85em !important;
    border: none !important;
    display: inline !important;
    line-height: inherit !important;
    vertical-align: baseline !important;
    margin: 0 !important;
}

.prose pre code {
    background: none !important;
    padding: 0 !important;
    color: var(--text-primary) !important;
    border: none !important;
    font-size: inherit !important;
    display: block !important;
    line-height: 1.5 !important;
    margin: 0 !important;
}

.prose blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin: 24px 0;
    color: var(--text-secondary);
    font-style: italic;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.prose ol,
.prose ul {
    margin: 16px 0;
    padding-left: 24px;
    color: var(--text-secondary)
}

.prose li {
    margin-bottom: 8px
}

.prose img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0;
}

.prose figure {
    margin: 24px 0;
    text-align: center;
}

.prose figcaption {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 8px;
    line-height: 1.4;
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0
}

.prose td,
.prose th {
    border: 1px solid var(--border);
    padding: 12px;
    text-align: left
}

.prose th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600
}

.prose td {
    color: var(--text-secondary)
}

.prose a {
    color: var(--accent)
}

.prose a:hover {
    color: var(--accent-hover)
}

.prose strong {
    color: var(--text-primary)
}

/* TOC Styles - Notion-like */
#toc-container {
    display: none;
    /* Hidden by default */
    position: fixed;
    top: 110px;
    left: calc(50% - 600px - 260px);
    /* Center - half container - gap/width */
    width: 240px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    z-index: 10;

    /* Notion Card Style */
    background: var(--bg-secondary);
    /* or #ffffff in light mode if preferred, but bg-secondary matches the theme */
    border-radius: 12px;
    padding: 16px;
    /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); */
    /* Optional: add shadow if needed, but flat is also nice */
}

/* Scrollbar styling for TOC */
#toc-container::-webkit-scrollbar {
    width: 4px;
}

#toc-container::-webkit-scrollbar-track {
    background: transparent;
}

#toc-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.toc-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    font-weight: 600;
    padding-left: 8px;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-left: none;
    /* Removed border */
}

.toc-item {
    margin: 2px 0;
}

.toc-link {
    display: block;
    padding: 6px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    line-height: 1.4;
    border-left: none;
    /* Removed border */
}

.toc-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.toc-link.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.toc-h1 {
    margin-top: 8px;
}

.toc-h2 {
    margin-left: 0;
}

.toc-h3 {
    margin-left: 12px;
    font-size: 13px;
}

/* Show on laptop screens with reduced container width */
@media (min-width: 1250px) and (max-width: 1750px) {
    #toc-container {
        display: block;
        left: calc(50% - 540px);
        /* Align closer to content, 1080px effective width */
    }

    .post-layout main .container {
        max-width: 800px;
        margin: 0 calc(50% - 540px) 0 auto;
        /* Align with right edge of 1080px effective width */
    }
}

/* Show only on large screens */
@media (min-width: 1750px) {
    #toc-container {
        display: block;
        left: calc(50% - 600px - 250px);
        /* Center - half 1200px container - gap/width */
    }
}

@media (max-width:768px) {
    .container {
        padding: 0 16px
    }

    h1 {
        font-size: 32px;
        line-height: 1.25
    }

    h2 {
        font-size: 24px;
        line-height: 1.3
    }

    .grid-2 {
        grid-template-columns: 1fr
    }

    .prose h1 {
        font-size: 24px !important
    }

    .prose h2 {
        font-size: 20px !important
    }

    .prose h3 {
        font-size: 18px !important
    }

    .prose h4 {
        font-size: 16px !important
    }
}

/* Navbar Styles (Dark Theme) */
.site-header {
    background: var(--blur-bg);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-title {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
    margin: 0;
    padding: 0;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 16px;
    transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .site-title {
        display: block;
        width: min-content;
        line-height: 1.1;
    }

    .nav-links {
        gap: 20px;
    }
}