/* Papermod-inspired refined styles */
:root {
    --bg: #f5f5f7;
    --muted: #6b7280;
    --accent: #209460;
    --surface: #ffffff;
    --muted-bg: #e5e7eb;
    --card: #ffffff;
    --text: #111827;
    --divider: #e5e7eb;
}

* {
    box-sizing: border-box
}

html[data-theme='dark'] {
    --bg: #020617;
    --muted: #9ca3af;
    --accent: #209460;
    --surface: #020617;
    --card: #020617;
    --text: #e5e7eb;
    --divider: #0f172a;
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
    line-height: 1.75;
    background: var(--bg);
    color: var(--text);
    margin: 0
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem
}

.pm-header {
    background: #ffffff;
    color: #111827;
    border-bottom: 1px solid #e5e7eb;
}

html[data-theme='dark'] .pm-header {
    background: #020617;
    color: #e5e7eb;
    border-bottom-color: #0f172a;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0
}

.logo {
    font-weight: 700;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem
}

.logo-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover
}

.nav-links {
    display: flex;
    gap: 1rem;
    list-style: none
}

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

.menu-toggle {
    display: none
}

.theme-toggle {
    background: none;
    border: 0;
    color: inherit;
    cursor: pointer
}

.hero {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0 0 1rem 0;
    box-shadow: none;
}

.hero-title {
    font-size: 2.25rem;
    margin: 0
}

.hero-subtitle {
    color: var(--muted);
    margin-top: 0.5rem
}

.content-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    margin-top: 1.5rem
}

.posts-list .post {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0 0 1.25rem 0;
    box-shadow: none;
    border-bottom: 1px solid var(--divider);
    padding-bottom: 1.25rem;
}

.post-title {
    color: var(--accent);
    margin: 0 0 .5rem 0;
    font-weight: 600
}

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

.post-title a:hover {
    color: #1b7f52;
    text-decoration: none
}

.post-meta {
    color: #9aa3af;
    font-size: 0.9rem;
    margin-bottom: 1rem
}

.post-summary {
    color: #374151;
    margin-bottom: 0.8rem
}

.read-more {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    text-decoration: none
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2rem 0 1rem 0;
    color: var(--accent);
    font-weight: 600
}

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

.pagination-status {
    color: var(--accent)
}

.pagination .disabled {
    color: #9aa3af
}

/* Minimal search input (no border box) */
#site-search {
    width: 100%;
    max-width: 520px;
    background: transparent;
    border: none;
    outline: none;
    border-bottom: 1px solid var(--divider);
    padding: 0.6rem 0;
    color: var(--text);
}

.sidebar .author-card {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--surface);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.sidebar .author-card p,
.about-content p {
    white-space: pre-line;
    text-align: left
}

.sidebar .author-card p {
    font-size: 0.95rem;
    color: #4b5563
}

html[data-theme='dark'] .sidebar .author-card p {
    color: #cbd5e1
}

.tag {
    display: inline-block;
    background: rgba(32, 148, 96, 0.08);
    border: 1px solid rgba(32, 148, 96, 0.18);
    color: var(--accent);
    padding: 0.2rem .45rem;
    border-radius: 6px;
    margin-right: 0.3rem;
    text-decoration: none
}

.tag:hover {
    color: #1b7f52;
    border-color: rgba(32, 148, 96, 0.32);
    background: rgba(32, 148, 96, 0.12)
}

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

.about-link a:hover {
    color: #1b7f52
}

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

.post-content a:hover {
    color: #1b7f52
}

html[data-theme='dark'] .post-meta {
    color: #94a3b8
}

html[data-theme='dark'] .post-summary {
    color: #cbd5e1
}

html[data-theme='dark'] .tag {
    background: rgba(32, 148, 96, 0.12);
    border-color: rgba(32, 148, 96, 0.24)
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem
}

.post.full-post {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    align-items: start
}

.post.full-post .toc {
    grid-column: 1
}

.post.full-post>main {
    grid-column: 2
}

.post-content {
    line-height: 1.85;
    color: var(--text);
    font-size: 16.5px
}

.post-content h1 {
    font-size: 2rem;
    margin-top: 0
}

.post-content h2 {
    font-size: 1.25rem;
    margin-top: 1.6rem;
    margin-bottom: 0.6rem
}

.post-content h3 {
    font-size: 1.05rem;
    margin-top: 1.2rem
}

.toc {
    background: var(--surface);
    border: 1px solid var(--divider);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
    font-size: 0.95rem;
    position: sticky;
    top: 1.5rem;
    align-self: start
}

.toc h4 {
    margin: 0 0 0.8rem 0;
    color: var(--accent);
    font-weight: 600
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0
}

.toc-item {
    margin-bottom: 0.5rem
}

.toc-item.toc-level-2 {
    padding-left: 1rem
}

.toc-link {
    color: #6b7280;
    text-decoration: none;
    font-weight: 600
}

.toc-link:hover {
    color: #4b5563
}

html[data-theme='dark'] .toc-link {
    color: #e5e7eb
}

.toc-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px
}

/* Sticky sidebar */
.sidebar {
    position: sticky;
    top: 1.5rem;
    align-self: start
}

.content-grid .sidebar {
    position: sticky !important;
    top: 1.5rem;
    align-self: start
}

/* Code block refinement */
.post-content pre {
    background: #f5f2f0;
    color: #111827;
    padding: 1rem;
    border-radius: 8px;
    overflow: auto
}

html[data-theme='dark'] .post-content pre {
    background: #0b1220;
    color: #e6eef8
}

.post-content code {
    background: rgba(15, 23, 42, 0.04);
    padding: 0.2em 0.4em;
    border-radius: 4px
}

html[data-theme='dark'] .post-content code {
    background: rgba(15, 23, 42, 0.6);
    color: #e6eef8
}

.post-content pre>code {
    background: transparent;
    padding: 0
}

/* Override Prism specifics inside posts for better contrast */
.post-content pre[class*="language-"],
.post-content code[class*="language-"] {
    text-shadow: none;
}

html[data-theme='dark'] .post-content pre[class*="language-"],
html[data-theme='dark'] .post-content code[class*="language-"] {
    text-shadow: none;
}

html[data-theme='dark'] .post-content .token.entity,
html[data-theme='dark'] .post-content .token.operator,
html[data-theme='dark'] .post-content .token.url {
    background: transparent;
}

.pm-footer {
    background: #ffffff;
    color: #6b7280;
    padding: 1rem;
    margin-top: 3rem;
    border-top: 1px solid #e5e7eb;
}

html[data-theme='dark'] .pm-footer {
    background: #020617;
    color: #9ca3af;
    border-top-color: #0f172a;
}

.w {
    max-width: 640px;
    margin: 0 auto;
    padding: 4rem 1rem
}

.about-content {
    margin-top: 1rem
}

@media(max-width:900px) {

    .content-grid,
    .post.full-post {
        grid-template-columns: 1fr
    }

    .posts-list {
        order: 1
    }

    .sidebar {
        order: 2
    }

    .post.full-post {
        display: flex;
        flex-direction: column
    }

    .nav-links {
        display: none
    }

    .menu-toggle {
        display: block
    }

    .sidebar {
        position: static;
        margin-top: 0;
        margin-bottom: 1.5rem
    }

    .toc {
        display: none
    }
}