@import url("https://cdn.jsdelivr.net/gh/mshaugh/nerdfont-webfonts@v3.3.0/build/firacode-nerd-font-mono.css");

:root {
    /* Color Palette */
    --bg-color: #faf9f6;
    --text-color: #1f2937;
    --heading-color: #111827;
    --accent-color: #4f46e5;
    /* Deep Indigo */
    --accent-hover: #4338ca;
    --secondary-color: #6b7280;
    --border-color: #e5e7eb;
    --code-bg: #f3f4f6;
    --quote-bg: #f9fafb;
    --quote-border: #4f46e5;

    /* Typography */
    --font-heading: "Outfit", sans-serif;
    --font-body: "Inter", sans-serif;
    --font-mono: "FiraCode Nerd Font Mono", "Fira Code", monospace;

    /* Table Headers */
    --table-header-bg: #111827;
    --table-header-text: #ffffff;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.75;
    font-size: 1.125rem;
    /* 18px */
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease, border-bottom 0.2s ease;
    font-weight: 500;
}

a:hover {
    color: var(--accent-hover);
    border-bottom: 2px solid var(--accent-hover);
}

html,
button,
input,
select,
textarea {
    color: var(--text-color);
    font-family: var(--font-body);
}

::-moz-selection {
    background: var(--accent-color);
    text-shadow: none;
    color: #fff;
}

::selection {
    background: var(--accent-color);
    text-shadow: none;
    color: #fff;
}

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 3rem 0;
    padding: 0;
}

img {
    margin: 2rem auto;
    max-width: 100%;
    display: block;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

a img {
    border: none;
}

figure {
    margin: 2rem 0;
    text-align: center;
}

fieldset {
    border: 0;
    margin: 0;
    padding: 0;
}

table {
    -ms-overflow-style: -ms-autohiding-scrollbar;
    -webkit-overflow-scrolling: touch;
    background-color: transparent;
    margin-bottom: 2rem;
    overflow-x: auto;
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

table th,
table td {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    vertical-align: top;
    font-size: 0.95rem;
}

table th {
    background-color: var(--table-header-bg);
    color: var(--table-header-text);
    font-weight: 600;
    text-align: left;
}

tbody tr:nth-child(even) {
    background-color: var(--code-bg);
}

textarea {
    resize: vertical;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
}

blockquote {
    margin: 2rem 0;
    font-style: italic;
    font-size: 1.25rem;
    font-family: var(--font-heading);
    /* Using Outfit for quotes adds character */
    border-left: 4px solid var(--quote-border);
    background: var(--quote-bg);
    padding: 1.5rem 2rem;
    border-radius: 0 8px 8px 0;
    color: var(--heading-color);
}

blockquote cite {
    font-size: 0.875rem;
    opacity: .8;
    display: block;
    margin-top: 0.5rem;
    font-family: var(--font-body);
}

blockquote em {
    font-weight: 600;
}

blockquote code {
    font-size: 0.9rem;
}


h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    color: var(--heading-color);
    font-weight: 700;
    line-height: 1.25;
    margin: 2.5rem 0 1rem 0;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 3rem;
    margin-top: 0;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1rem;
}

.align-center {
    text-align: center;
}

.align-left {
    text-align: left;
}

.align-right {
    text-align: right;
}

ul {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

ul li {
    margin-bottom: 0.5rem;
}

ul.flat {
    margin: 0;
    padding: 0;
}

ul.flat li {
    display: block;
    list-style: none;
    margin-left: 0;
    margin-bottom: 0;
}

.prevent-collapse {
    min-height: .1rem
}

.smaller {
    font-size: 80%;
}

.post {
    max-width: 800px;
    margin: 0 auto;
}

/* Code */
.highlight pre {
    margin: 0;
    padding: 1.5rem;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre-wrap;
    /* Enables word wrapping */
    word-wrap: break-word;
    /* For older browsers */
    overflow-wrap: break-word;
    /* Standard property */
}

/* Inline Line Numbers Styling (VS Code style) */
.highlight code>span {
    display: flex;
    /* Ensure flex layout is respected if inline style missing */
}

.highlight code>span>span:first-child {
    user-select: none;
    margin-right: 1em !important;
    padding-right: 0.5em;
    width: 2.5em;
    display: inline-block;
    text-align: right;
    color: var(--secondary-color);
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

.highlight {
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wrapper {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 20px;
}

.container {
    margin-top: 80px;
}

.container-wide {
    max-width: 1100px;
    margin-top: 80px;
}

.header {
    margin-bottom: 60px;
    padding-bottom: 20px;
    border-bottom: 1px solid transparent;
    /* Placeholder for scroll effect if needed */
}

.header .avatar {
    float: left;
    margin: -15px 20px 0 0;
}

.header .avatar img {
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 12px;
    /* Softer square */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.header .avatar img:hover {
    transform: scale(1.05);
}

.header .site-title {
    margin: 0 0 5px 0;
    line-height: 1;
    font-size: 2.5rem;
}

.site-title a {
    color: var(--heading-color);
    text-decoration: none !important;
    background: linear-gradient(to right, var(--heading-color), var(--heading-color) 50%, var(--accent-color) 50%);
    background-size: 200% 100%;
    background-position: 0;
    -webkit-background-clip: text;
    /* Optional: text gradient effect on hover */
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Fallback */
    transition: background-position 0.3s ease;
    /* Simplify for now, let's just do color */
    -webkit-text-fill-color: initial;
    -webkit-background-clip: initial;
    color: var(--heading-color);
    background: none;
}

.site-title a:hover {
    color: var(--accent-color);
    border-bottom: none;
}

.header .site-description {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.header nav {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.header nav ul,
.header nav li {
    margin: 0;
    padding: 0;
}

.header nav li {
    display: inline-block;
    list-style: none;
    margin: 0 2rem 0 0;
    font-family: var(--font-heading);
    font-weight: 500;
}

.header nav.social a {
    color: var(--secondary-color);
    transition: color 0.2s;
}

.header nav.social a:hover {
    color: var(--accent-color);
}

.header .site-description nav {
    margin: 0;
    padding: 0;
    border: none;
    min-width: 50px;
    margin-left: 15px;
}

.header .site-description nav ul svg {
    max-height: 20px;
    stroke-width: 2px;
}

.header .site-description .scheme-toggle {
    height: 100%;
    display: flex;
    align-items: center;
}

.header .site-description .scheme-toggle a svg {
    max-height: 20px;
    fill: var(--text-color);
    color: var(--text-color);
    transition: transform 0.5s ease;
}

.header .site-description .scheme-toggle a:hover svg {
    transform: rotate(180deg);
}


.section .section-header {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 30px;
    letter-spacing: 0.1em;
}

.recent-posts .posts .post {
    margin-bottom: 60px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 60px;
}

.recent-posts .posts .post:last-child {
    border-bottom: none;
}


.post-header {
    display: flex;
    flex-direction: column;
    /* Modern stack */
}

.post-header .meta {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    font-family: var(--font-heading);
}

.post-header .meta .date .day {
    font-size: 1.2em;
    /* Simplified date */
    font-weight: 600;
}

.post-header h1.title {
    margin: 0 0 1rem 0;
}

.post .title.small {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
}

.post .post-header {
    margin-bottom: 40px;
}

.post .draft-label {
    color: var(--accent-color);
    background-color: var(--code-bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    vertical-align: middle;
}

.post .tags a {
    display: inline-block;
    background: var(--code-bg);
    border-radius: 20px;
    /* Pill shape */
    padding: 4px 12px;
    color: var(--secondary-color);
    font-size: 0.85rem;
    text-decoration: none;
    margin: 0 8px 8px 0;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.post .tags a:hover {
    background: var(--accent-color);
    color: #fff;
    transform: translateY(-1px);
}

.footer {
    text-align: center;
    /* Center footer */
    font-size: 0.9rem;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    margin-top: 80px;
    padding: 40px 0;
}

.footer a {
    color: var(--text-color);
    font-weight: 600;
}

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

.tag-cloud {
    margin-top: 30px;
}

.tag-cloud a {
    margin-right: 10px;
    margin-bottom: 10px;
    display: inline-block;
}

.pagination {
    margin: 4rem 0;
    padding: 0;
    display: flex;
    justify-content: space-between;
}

.pagination li {
    list-style: none;
}

.pagination a {
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--heading-color);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}


@media (max-width: 900px) {
    body {
        padding: 0;
        /* Reset padding */
    }

    .wrapper {
        padding: 0 20px;
    }

    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .header .nav li {
        margin: 0 15px 10px 0;
        /* Wrap nav items */
    }

    .post-header .meta {
        flex-wrap: wrap;
    }
}

.tag-li {
    display: inline !important;
}

.back {
    margin-top: 2rem;
    display: inline-block;
}


.inline-img {
    margin: 0 !important;
    display: inline-block !important;
}

.figcaption-img {
    margin-bottom: 0.5rem;
}

figcaption {
    font-size: 0.9rem;
    text-align: center;
    color: var(--secondary-color);
    margin-bottom: 2rem;
}

code:not(pre *) {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background-color: var(--code-bg);
    /* Use variable */
    color: var(--accent-color);
    /* Highlight inline code */
    padding: 2px 6px;
    border-radius: 4px;
    white-space: normal;
}

code {
    font-family: var(--font-mono);
}

.footer-separator {
    display: none;
    /* Cleaner footer */
}

/* TOC */
.toc {
    background: var(--bg-color);
    padding: 1rem 0;
}

.toc a {
    color: var(--secondary-color);
    font-size: 0.95rem;
    line-height: 1.6;
    border-left: 2px solid var(--border-color);
    padding-left: 1rem;
    display: block;
}

.toc a:hover,
.toc a:focus {
    color: var(--accent-color);
    border-left-color: var(--accent-color);
}


/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Post Preview Image */
.post-image {
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.post-image img {
    margin: 0;
    width: 100%;
    height: auto;
    object-fit: cover;
    max-height: 400px;
    transition: transform 0.3s ease;
}

.post-image a {
    display: block;
    border-bottom: none;
}

.post-image:hover img {
    transform: scale(1.02);
}

/* Automatic Article Heading Numbering */
.post.numbered-content {
    counter-reset: h2counter;
}

.post.numbered-content h2 {
    counter-increment: h2counter;
    counter-reset: h3counter;
}

.post.numbered-content h2::before {
    content: counter(h2counter) ". ";
    color: var(--accent-color);
    margin-right: 0.5rem;
    font-weight: bold;
}

.post.numbered-content h3 {
    counter-increment: h3counter;
    counter-reset: h4counter;
}

.post.numbered-content h3::before {
    content: counter(h2counter) "." counter(h3counter) ". ";
    color: var(--accent-color);
    margin-right: 0.5rem;
    font-weight: bold;
}

.post.numbered-content h4 {
    counter-increment: h4counter;
}

.post.numbered-content h4::before {
    content: counter(h2counter) "." counter(h3counter) "." counter(h4counter) ". ";
    color: var(--accent-color);
    margin-right: 0.5rem;
    font-weight: bold;
}

/* Exclude TOC from numbering */
/* Exclude TOC from numbering */
.toc h3::before {
    content: none !important;
}

/* Slide-out Right Sidebar TOC */
.right-sidebar-toc {
    position: fixed;
    top: 20%;
    right: -260px;
    /* Hidden by default, leaving icon visible */
    width: 300px;
    height: 60vh;
    background-color: var(--bg-color);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    border-radius: 8px 0 0 8px;
    border: 1px solid var(--border-color);
    border-right: none;
    display: flex;
    overflow: hidden;
}

.right-sidebar-toc:hover {
    right: 0;
    /* Slide out on hover */
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
}

/* Container for the icon that's always visible */
.right-sidebar-toc .toc-icon {
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-color);
    border-right: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--secondary-color);
}

.right-sidebar-toc:hover .toc-icon {
    color: var(--accent-color);
    background-color: var(--code-bg);
}

/* The actual TOC content area */
.right-sidebar-toc .toc-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1.5rem;
    opacity: 0;
    /* Hide content when collapsed */
    transition: opacity 0.2s ease;
}

.right-sidebar-toc:hover .toc-content {
    opacity: 1;
}

/* Custom Scrollbar for sidebar */
.right-sidebar-toc .toc-content::-webkit-scrollbar {
    width: 4px;
}

.right-sidebar-toc .toc-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.right-sidebar-toc nav ul {
    list-style: none;
    padding-left: 0.5rem;
    margin: 0;
}

.right-sidebar-toc nav ul li {
    margin-bottom: 0.5rem;
}

.right-sidebar-toc nav a {
    display: block;
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    line-height: 1.5;
    border-left: 2px solid transparent;
    /* Prepare for active state */
    padding-left: 0.5rem;
}

.right-sidebar-toc nav a:hover,
.right-sidebar-toc nav a.active {
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    transform: translateX(3px);
    /* Subtle movement */
}

/* Hide on mobile devices */
@media (max-width: 900px) {
    .hide-on-mobile {
        display: none !important;
    }
}