/* === SHARED STYLES === */
.container { position: relative; z-index: 1; }

/* === INDEX VIEW STYLES === */
body.blog-index {
    /* Standard site background */
    font-family: var(--font-mono) !important;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-top: 60px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.blog-index-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    width: 100%;
    view-transition-name: blog-container;
}

.blog-controls {
    margin-bottom: 40px;
    border-bottom: none;
    padding-bottom: 0;
}

.post-list-index {
    list-style: none;
    padding: 0;
    margin: 0;
    transition: opacity 0.3s ease;
}

.post-list-index li {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    animation: fadeIn 0.5s forwards;
}

.post-list-index li:last-child {
    border-bottom: none;
}

.post-list-index a {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
    transition: color 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.post-list-index a:hover {
    color: #fff;
}

.post-list-index .meta {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-mono);
}

/* Tag cloud styles */
.tag-cloud { margin: 10px 0 20px 0; line-height: 2; font-size: 0.8rem; }
.tag-cloud .tag {
    display: inline-block;
    margin-right: 10px;
    color: #fff;
    text-decoration: none;
    opacity: 0.85;
    transition: opacity 0.2s ease, text-decoration-color 0.2s ease;
    border-bottom: 1px dashed transparent;
}
.tag-cloud .tag:hover { opacity: 1; border-bottom-color: rgba(255,255,255,0.7); }
.tag-cloud .tag.active { opacity: 1; text-decoration: underline; }
.tag-cloud .hidden-tag { display: none !important; }
.toggle-tags-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
}
.toggle-tags-btn:hover {
    color: rgba(255,255,255,0.9);
}

/* Pagination styles */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    padding: 15px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.pagination a {
    background: transparent;
    border: none;
    color: #fff;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.pagination a:hover:not(.disabled) {
    opacity: 1;
    text-decoration: underline;
}
.pagination a.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}
.pagination .page-info {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
}

/* Fallback for browsers without backdrop-filter */
@supports not ((-webkit-backdrop-filter: none) or (backdrop-filter: none)) {
    pre {
        background: rgba(30, 32, 40, 0.85) !important;
    }
}

/* === SINGLE POST VIEW STYLES (Typewriter Aesthetic) === */
body.blog-view {
    background: #1a1a1a;
    height: auto;
    overflow: visible;
    font-family: var(--font-mono) !important;
}
html.blog-view-html { overflow: visible; height: auto; }

/* Hide animated background on single post view */
body.blog-view .bg-anim { display: none; }

/* Paper texture overlay */
body.blog-view::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.01) 0px, rgba(255, 255, 255, 0.01) 1px, transparent 1px, transparent 2px);
    pointer-events: none;
    z-index: 0;
}

.blog-single-layout {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 140px 40px 100px;
    gap: 80px;
    width: 100%;
    align-items: stretch;
    box-sizing: border-box;
    overflow: visible;
}

.blog-single-sidebar {
    width: 240px;
    height: auto;
    flex-shrink: 0;
    padding-top: 0;
}

.blog-single-sidebar a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.blog-single-sidebar a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.blog-single-content {
    flex: 1;
    min-width: 0;
    padding-top: 8px;
}

.blog-single-sidebar h1 {
    display: block;
    font-size: 1.5rem;
    font-weight: normal;
    line-height: 1.2;
    margin: 0 0 0 0;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.blog-meta-sidebar {
    margin-top: 40px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.blog-meta-sidebar .label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 5px;
    margin-top: 20px;
    font-size: 0.75rem;
}

.blog-meta-sidebar a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-bottom: 1px dotted rgba(255,255,255,0.3);
}
.blog-meta-sidebar a:hover { color: #fff; border-bottom-style: solid; }

.blog-meta-sidebar a.thread-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}
.blog-meta-sidebar a.thread-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 1024px) {
    .blog-single-layout {
        flex-direction: column;
        gap: 20px;
        padding: 100px 20px 60px;
    }
    .blog-single-sidebar {
        width: 100%;
        border-bottom: none;
        padding-bottom: 30px;
        position: static;
        max-height: none;
    }
    .blog-single-content {
        padding-top: 0;
    }
    .toc-container { position: static; }
    .blog-meta-sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 20px;
        margin-top: 20px;
    }
    .blog-meta-sidebar .label { margin-top: 0; }
}

/* TOC Styles */
.toc-list { list-style: none; padding: 0; margin: 0; font-size: 0.85rem; }
.toc-list li { margin-bottom: 6px; }
.toc-list a {
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: all 0.2s;
    display: block;
    padding: 4px 8px;
    border-left: 2px solid transparent;
    margin-left: -8px;
}
.toc-list a:hover {
    color: rgba(255,255,255,0.9);
    border-left-color: rgba(255,255,255,0.3);
}
.toc-list a.active {
    color: #fff;
    font-weight: 500;
    border-left-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}
.toc-list .toc-h3 { padding-left: 23px; font-size: 0.8rem; opacity: 0.8; }

/* Scroll offset for TOC links - prevents headers from being hidden under sticky elements */
.blog-body h2, .blog-body h3 {
    scroll-margin-top: 120px;
}
.toc-container { 
    margin-top: 40px; 
    padding-top: 20px; 
    border-top: none;
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}
.toc-container .label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.5);
    margin-bottom: 5px;
    font-size: 0.75rem;
}

.blog-hero {
    margin-bottom: 40px;
    border-bottom: none;
    padding-bottom: 0;
}

.blog-hero h1 {
    display: none;
}

.blog-nav {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin-top: 100px;
    padding-top: 60px;
    border-top: none;
}

.blog-nav-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    padding: 20px;
    border: none;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
    flex: 1;
    max-width: 100%;
}
.blog-nav-link:hover { background: rgba(255, 255, 255, 0.05); }

.blog-nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
}
.blog-nav-title {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
}
.blog-nav-link:hover .blog-nav-title { color: #fff; }

.blog-nav-prev { align-items: flex-start; }
.blog-nav-next { align-items: flex-end; margin-left: auto; }

/* Related Posts */
.related-posts {
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.related-posts h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.4;
    margin: 0 0 12px 0;
    font-weight: normal;
}
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 30px; }
.related-card {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    transition: color 0.2s;
    background: transparent;
    color: rgba(255,255,255,0.5);
}
.related-card:hover { background: transparent; color: #fff; }
.related-title { font-size: 0.85rem; font-weight: normal; color: inherit; transition: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 10px; flex: 1; }
.related-date { font-size: 0.75rem; color: rgba(255,255,255,0.4); margin-left: 0; flex-shrink: 0; transition: color 0.2s; }
.related-card:hover .related-date { color: rgba(255,255,255,0.6); }

/* Webmentions */
.webmentions-list { margin-top: 20px; font-size: 0.85rem; color: rgba(255,255,255,0.8); }

@media (max-width: 768px) {
    .blog-single-container { padding: 100px 20px 60px; }
    .blog-nav { flex-direction: row; flex-wrap: wrap; gap: 12px; margin-top: 60px; padding-top: 40px; }
    .blog-nav-link { flex: 1 1 calc(50% - 6px); max-width: none; padding: 16px 12px; }
}

/* Share & Comments */
.blog-footer-actions { display: none; margin: 40px 0; padding-top: 30px; border-top: none; animation: fadeIn 0.5s ease; }
.discussion-btn {
    display: inline-block;
    margin-top: 40px;
    background: rgba(255,255,255,0.05);
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 10px 20px;
    cursor: pointer;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    transition: all 0.2s;
    border-radius: 0;
}
.discussion-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.comment-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 0;
    padding: 2px 6px;
    margin-left: 8px;
}
.share-buttons { display: flex; gap: 15px; margin-bottom: 40px; flex-wrap: wrap; }
.share-btn { background: rgba(255,255,255,0.05); border: none; color: rgba(255,255,255,0.8); padding: 10px 20px; text-decoration: none; font-size: 0.75rem; transition: all 0.2s; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-family: inherit; text-transform: uppercase; letter-spacing: 0.1em; border-radius: 0; }
.share-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.share-btn i { font-size: 0.9rem; }

.comments-section { margin-top: 60px; }
.comments-header { font-size: 1.25rem; margin-bottom: 30px; color: #e0e0e0; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: none; padding-bottom: 10px; }
.comment-list { list-style: none; padding: 0; margin: 0 0 40px 0; }
.comment-item { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px solid rgba(255,255,255,0.03); animation: fadeIn 0.5s ease; }
.comment-meta { font-size: 0.8rem; color: rgba(255,255,255,0.4); margin-bottom: 8px; }
.comment-author { color: #fff; font-weight: bold; margin-right: 10px; }
.comment-body { font-size: 1rem; line-height: 1.6; color: rgba(255,255,255,0.8); white-space: pre-wrap; }

.comment-form { background: rgba(255,255,255,0.02); padding: 25px; border: none; }
.comment-form h3 { font-size: 1rem; margin: 0 0 20px 0; text-transform: uppercase; color: #ccc; }
.form-group { margin-bottom: 15px; }
.form-input { width: 100%; background: rgba(255,255,255,0.03); border: none; color: #fff; padding: 15px; font-family: inherit; font-size: 0.9rem; box-sizing: border-box; border-radius: 0; }
.form-input:focus { outline: none; background: rgba(255,255,255,0.06); }
textarea.form-input { min-height: 100px; resize: vertical; }
.submit-btn { background: rgba(255,255,255,0.15); color: #fff; border: none; padding: 10px 20px; font-weight: normal; cursor: pointer; text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; transition: background 0.2s; font-family: inherit; border-radius: 0; }
.submit-btn:hover { background: rgba(255,255,255,0.25); }
.hp-field { display: none; }

/* Fix for sticky sidebar */
body.blog-view .container {
    height: auto;
    justify-content: flex-start;
    overflow: visible;
    display: block;
    padding: 0;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    border-radius: 0;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    z-index: 1000;
    font-family: var(--font-mono);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(0);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}