/* Home page subtitle width */
main[aria-role="main"] > div > p {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Fix theme overlay blocking clicks */
.bg:before,
.bg:after {
    pointer-events: none;
}

/* Blog layout with sidebar */
.blog-layout {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: flex-start;
}

.blog-layout > .posts,
.blog-layout > .post {
    flex: 1;
    min-width: 0;
}

.blog-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: relative;
    z-index: 4;
}

.sidebar-profile {
    text-align: center;
    margin-bottom: 1.5rem;
}

.blog-layout > .post ~ .blog-sidebar .sidebar-profile {
    margin-top: 2rem;
}

.sidebar-profile .profile-pic {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.blog-sidebar .sidebar-section {
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.blog-sidebar .sidebar-section h4 {
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Archive list */
.blog-sidebar .archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.blog-sidebar .archive-list li {
    padding: 0.4rem 0;
}

.blog-sidebar .archive-list a {
    text-decoration: none;
    cursor: pointer;
}

.blog-sidebar .archive-list a:hover {
    text-decoration: underline;
}

.blog-sidebar .archive-list a.active {
    font-weight: bold;
    color: #fff;
}

.blog-sidebar .archive-list .count {
    opacity: 0.7;
    font-size: 0.85em;
    margin-left: 0.3rem;
}

/* Tag cloud */
.blog-sidebar .tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-sidebar .tag-cloud .tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85em;
    text-decoration: none;
    cursor: pointer;
}

.blog-sidebar .tag-cloud .tag:hover {
    background: rgba(255, 255, 255, 0.2);
}

.blog-sidebar .tag-cloud .tag.active {
    background: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

/* Responsive */
@media (max-width: 900px) {
    .blog-layout {
        flex-direction: column;
    }

    .blog-sidebar {
        width: 100%;
    }
}

/* Theme transition */
body,
body.bg,
.header,
.content,
.posts,
.blog-sidebar,
.blog-sidebar .sidebar-section,
.blog-sidebar .tag-cloud .tag,
a,
h1, h2, h3, h4, h5, h6 {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.bg:before {
    background-image: none !important;
    background-color: rgba(0, 0, 0, 0.7);
    transition: background-color 0.3s ease;
}

.bg:after {
    transition: opacity 0.3s ease;
}

/* Light theme overrides */
[data-theme="light"] body {
    background-color: #f9f6f1 !important;
}

[data-theme="light"] .bg:before {
    background-color: #f9f6f1;
}

[data-theme="light"] .bg:after {
    opacity: 0;
}

[data-theme="light"] .blog-sidebar .sidebar-section h4 {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .blog-sidebar .tag-cloud .tag {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .blog-sidebar .tag-cloud .tag:hover {
    background: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .blog-sidebar .tag-cloud .tag.active {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .blog-sidebar .archive-list a.active {
    color: #222;
}

/* Terminal window styling */
.terminal-window {
    max-width: 500px;
    margin: 3.5rem auto 2rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.terminal-header {
    background: #3b3d42;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    position: relative;
}

.terminal-controls {
    display: flex;
    gap: 8px;
}

.terminal-control {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-control.close {
    background: #ff5f56;
}

.terminal-control.minimize {
    background: #ffbd2e;
}

.terminal-control.maximize {
    background: #27ca40;
}

.terminal-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #999;
}

.terminal-body {
    background: #1b1c1d;
    padding: 1rem 1.2rem;
    min-height: 80px;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.terminal-prompt {
    color: #56b6c2;
    font-weight: 600;
}

.terminal-arrow {
    color: #27ca40;
    font-weight: bold;
}

.terminal-command {
    color: #e5e5e5;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1rem;
    background: #e5e5e5;
    margin-left: 4px;
    vertical-align: middle;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.terminal-output {
    padding-left: 0;
}

.terminal-link {
    display: inline-block;
    color: #61afef;
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: pre;
    line-height: 1;
    font-size: 14px;
}

.terminal-link:hover {
    color: #98c379;
}

/* Light theme terminal adjustments */
[data-theme="light"] .terminal-header {
    background: #e0e0e0;
}

[data-theme="light"] .terminal-title {
    color: #666;
}

[data-theme="light"] .terminal-body {
    background: #2d2d2d;
}

/* Giscus comments section */
.giscus-comments {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: border-color 0.3s ease;
}

.giscus-comments h3 {
    margin-bottom: 1rem;
}

[data-theme=light] .giscus-comments {
    border-top-color: #222 !important;
}

[data-theme=light] .giscus-comments h3 {
    color: #222;
}
