/* VirtLabs Dark Terminal Theme
   Sidebar layout with nebula background and glassmorphism */

:root {
    --ghost-accent-color: #00ff41 !important;
    --vl-green: #00ff41;
    --vl-green-dim: #00cc33;
    --vl-green-bright: #33ff66;
    --vl-green-glow: rgba(0, 255, 65, 0.15);
    --vl-bg: #0d1117;
    --vl-bg-raised: #161b22;
    --vl-border: #21262d;
    --vl-text: #d4dae0;
    --vl-text-bright: #f0f6fc;
    --vl-text-muted: #8b949e;
    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
    --sidebar-width: 260px;
}

/* ============================================
   BASE
   ============================================ */

html.dark-mode body {
    background-color: #0a0e14;
    color: var(--vl-text);
    font-size: 1.5rem;
    margin: 0;
    overflow-x: hidden;
}

/* ============================================
   NEBULA BACKGROUND
   ============================================ */

html.dark-mode body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url('../images/nebula-bg-opt.jpeg') center center / cover no-repeat fixed;
}

/* ============================================
   VIEWPORT — Sidebar + Main flex layout
   ============================================ */

.viewport {
    display: flex;
    min-height: 100vh;
}

/* Hide Casper's default top header — we use sidebar instead */
#gh-head {
    display: none !important;
}

/* ============================================
   LEFT SIDEBAR
   ============================================ */

.vl-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.5rem;
    background: rgba(22, 27, 34, 0.45);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border-right: 1px solid rgba(0, 255, 65, 0.08);
    overflow-y: auto;
}

.vl-sidebar-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.vl-sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.6rem;
}

.vl-sidebar-logo {
    display: block;
}

.vl-sidebar-icon {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 8px rgba(0, 255, 65, 0.3));
}

.vl-sidebar-title {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--vl-green);
    text-decoration: none;
    text-shadow: 0 0 15px var(--vl-green-glow);
    letter-spacing: -0.5px;
}

.vl-sidebar-title:hover {
    color: var(--vl-green-bright);
}

.vl-sidebar-description {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--vl-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Sidebar navigation */
.vl-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.vl-sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.vl-sidebar-nav li {
    margin: 0;
}

.vl-sidebar-nav a {
    display: block;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--vl-text);
    text-decoration: none;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}

.vl-sidebar-nav a:hover {
    color: var(--vl-green);
    background: rgba(0, 255, 65, 0.05);
    border-left-color: var(--vl-green);
}

/* Sidebar search button */
.vl-sidebar-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--vl-text-muted);
    background: rgba(0, 255, 65, 0.03);
    border: 1px solid var(--vl-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.vl-sidebar-search:hover {
    color: var(--vl-green);
    border-color: rgba(0, 255, 65, 0.2);
}

.vl-sidebar-search svg {
    width: 16px;
    height: 16px;
}

/* Sidebar RSS link */
.vl-sidebar-rss {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--vl-text-muted);
    text-decoration: none;
    text-align: left;
    background: none;
    border-radius: 6px;
    border: 1px solid var(--vl-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.vl-sidebar-rss:hover {
    color: var(--vl-green);
    border-color: rgba(0, 255, 65, 0.2);
    background: rgba(0, 255, 65, 0.05);
}

.vl-sidebar-rss svg {
    flex-shrink: 0;
}

/* Sidebar footer */
.vl-sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid var(--vl-border);
}

.vl-sidebar-copyright {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--vl-text-muted);
}

/* ============================================
   MOBILE HEADER (hidden on desktop)
   ============================================ */

.vl-mobile-header {
    display: none;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.vl-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-content {
    flex: 1;
    padding: 2rem;
}

/* Override Casper's .outer/.inner width constraints */
.site-main.outer,
.site-main {
    padding: 0 !important;
    margin: 0 !important;
}

.site-main .inner,
.posts {
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
}

/* ============================================
   POST FEED — Vertical list of horizontal cards
   ============================================ */

.post-feed {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.2rem !important;
}

/* ============================================
   POST CARDS — Horizontal layout with glass
   ============================================ */

.post-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    background: rgba(22, 27, 34, 0.1);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(0, 255, 65, 0.1);
    border-left: 3px solid transparent;
    border-radius: 10px;
    padding: 1.2rem !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 255, 65, 0.04);
    transition: border-left-color 0.2s ease, box-shadow 0.2s ease;
    margin: 0 !important;
    min-height: auto !important;
    grid-column: unset !important;
}

.post-card:hover {
    border-left-color: var(--vl-green);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.1);
}

.post-card .post-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.post-card .post-card-content-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card .post-card-image-link {
    flex-shrink: 0;
    width: 200px;
    margin-left: 1.2rem;
    border-radius: 6px;
    overflow: hidden;
}

.post-card .post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.post-card-title {
    font-family: var(--font-mono) !important;
    font-size: 1.5rem !important;
    color: var(--vl-text-bright);
    transition: color 0.2s ease;
    margin: 0 !important;
}

.post-card:hover .post-card-title {
    color: var(--vl-green) !important;
}

.post-card-excerpt {
    font-size: 1.3rem !important;
    color: var(--vl-text-muted);
    margin-top: 0.4rem !important;
    -webkit-line-clamp: 2 !important;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags — terminal green, monospace, uppercase */
.post-card-tags,
.post-card-meta {
    color: var(--vl-green) !important;
    font-family: var(--font-mono) !important;
    text-transform: uppercase;
    font-size: 0.75rem !important;
    letter-spacing: 1px;
}

.post-card-meta {
    margin-top: 0.6rem;
    color: var(--vl-text-muted) !important;
}

/* Featured post badge */
.post-card-featured {
    color: var(--vl-green) !important;
}

/* Kill Casper's special first-card / large-card / dynamic layout */
.post-card-large,
.post-card.dynamic,
.post-card.keep-ratio {
    grid-column: unset !important;
    grid-row: unset !important;
}

.post-card-large .post-card-image-link,
.post-card.dynamic .post-card-image-link {
    position: relative !important;
    width: 200px !important;
    margin-left: 1.2rem !important;
    height: auto !important;
    padding-bottom: 0 !important;
}

.post-card-large .post-card-image,
.post-card.dynamic .post-card-image {
    position: relative !important;
}

/* Related posts at bottom of articles — override Casper grid */
.read-more-wrap {
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}

.read-more {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
    grid-template-columns: unset !important;
}

.read-more .post-card {
    display: flex !important;
    flex-direction: row !important;
    grid-column: unset !important;
}

.read-more .post-card:nth-child(n) {
    display: flex !important;
}

.read-more .post-card .post-card-image-link {
    width: 160px !important;
    flex-shrink: 0;
}

.read-more .post-card-tags {
    display: block !important;
}

/* ============================================
   ARTICLE PAGE
   ============================================ */

html.dark-mode .article-header {
    background: rgba(22, 27, 34, 0.45);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(0, 255, 65, 0.08);
    border-radius: 10px;
    padding: 2rem 2.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 1.5rem;
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}

/* Shrink feature image on article pages */
html.dark-mode .article-image {
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}

html.dark-mode .article-image img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
}

html.dark-mode .article-title {
    font-family: var(--font-mono) !important;
    font-size: 2.4rem !important;
    color: var(--vl-green) !important;
    text-shadow: 0 0 15px var(--vl-green-glow);
}

html.dark-mode .article-excerpt {
    color: var(--vl-text-muted);
}

html.dark-mode .article-byline {
    margin: 1rem 0 !important;
    padding: 1rem 0 !important;
}

/* Article content — glass panel (tighter, matches text width) */
html.dark-mode .gh-content {
    background: rgba(22, 27, 34, 0.55);
    backdrop-filter: blur(24px) saturate(1.5);
    -webkit-backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid rgba(0, 255, 65, 0.08);
    border-radius: 10px;
    padding: 2.5rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    color: var(--vl-text);
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
}

html.dark-mode .gh-content h1,
html.dark-mode .gh-content h2,
html.dark-mode .gh-content h3,
html.dark-mode .gh-content h4,
html.dark-mode .gh-content h5,
html.dark-mode .gh-content h6 {
    color: var(--vl-green);
    font-family: var(--font-mono) !important;
}

html.dark-mode .gh-content h2 {
    font-size: 1.8rem !important;
    margin-top: 2rem !important;
}

html.dark-mode .gh-content h3 {
    font-size: 1.5rem !important;
}

html.dark-mode .gh-content h4 {
    font-size: 1.3rem !important;
}

html.dark-mode .gh-content p,
html.dark-mode .gh-content li {
    font-size: 1.5rem !important;
    line-height: 1.65 !important;
}

html.dark-mode .gh-content a {
    color: var(--vl-green);
    text-decoration-color: rgba(0, 255, 65, 0.3);
}

html.dark-mode .gh-content a:hover {
    color: var(--vl-green-bright);
    text-decoration-color: var(--vl-green);
}

html.dark-mode .gh-content strong {
    color: var(--vl-text-bright);
}

/* Code blocks — terminal style */
html.dark-mode .gh-content pre {
    background-color: #0a0e14 !important;
    border: 1px solid var(--vl-border);
    border-left: 3px solid var(--vl-green);
    border-radius: 4px;
}

html.dark-mode .gh-content pre code {
    color: var(--vl-text);
    font-family: var(--font-mono) !important;
    font-size: 1.3rem !important;
}

html.dark-mode .gh-content :not(pre) > code {
    background-color: var(--vl-green-glow) !important;
    color: var(--vl-green) !important;
    font-family: var(--font-mono) !important;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(0, 255, 65, 0.1);
}

/* Blockquotes — green left bar */
html.dark-mode .gh-content blockquote {
    border-left-color: var(--vl-green);
    border-left-width: 3px;
    color: var(--vl-text) !important;
    background-color: rgba(0, 255, 65, 0.05);
    padding: 1em 1.5em;
}

html.dark-mode .gh-content blockquote p {
    color: var(--vl-text) !important;
}

/* HR dividers */
html.dark-mode hr {
    border-color: var(--vl-border);
}

html.dark-mode .gh-content hr:after {
    color: var(--vl-green-dim);
}

/* Lists — green bullets */
html.dark-mode .gh-content ul li::marker,
html.dark-mode .gh-content ol li::marker {
    color: var(--vl-green);
}

/* Ensure all links in content are visible */
html.dark-mode .gh-content p a,
html.dark-mode .gh-content li a {
    color: var(--vl-green) !important;
}

/* ============================================
   TABLES
   ============================================ */

html.dark-mode .gh-content table:not(.gist table) th {
    background-color: rgba(0, 255, 65, 0.08);
    color: var(--vl-green);
    font-family: var(--font-mono) !important;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

html.dark-mode .gh-content table:not(.gist table) th,
html.dark-mode .gh-content table:not(.gist table) td {
    border-color: var(--vl-border);
}

html.dark-mode .gh-content table:not(.gist table) td {
    color: var(--vl-text-bright);
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
    background: rgba(22, 27, 34, 0.1) !important;
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border-top: 1px solid var(--vl-border);
    padding: 1.5rem 2rem !important;
    color: var(--vl-text-muted);
}

.site-footer a {
    color: var(--vl-text-muted);
}

.site-footer a:hover {
    color: var(--vl-green);
}

/* ============================================
   PAGINATION
   ============================================ */

html.dark-mode .pagination a {
    color: var(--vl-text);
}

html.dark-mode .pagination a:hover {
    color: var(--vl-green);
}

/* ============================================
   BUTTONS
   ============================================ */

html.dark-mode .gh-btn-primary,
html.dark-mode [class*="gh-btn"] {
    background-color: var(--vl-green);
    color: var(--vl-bg);
    font-family: var(--font-mono) !important;
}

/* ============================================
   SEARCH
   ============================================ */

html.dark-mode .gh-search svg {
    color: var(--vl-text);
}

html.dark-mode .gh-search:hover svg {
    color: var(--vl-green);
}

/* ============================================
   MISC
   ============================================ */

/* Author byline */
html.dark-mode .article-byline-meta .author-name a {
    color: var(--vl-green) !important;
}

html.dark-mode .author-avatar,
html.dark-mode .author-profile-image {
    border: 2px solid var(--vl-border) !important;
    background-color: var(--vl-bg-raised) !important;
}

html.dark-mode .author-name,
html.dark-mode .author-name a {
    color: var(--vl-green) !important;
}

html.dark-mode .byline-meta-content,
html.dark-mode .byline-meta-date {
    color: var(--vl-text-muted) !important;
}

/* Archive/tag page headers */
html.dark-mode .site-archive-header .no-image {
    background-color: transparent;
}

/* Bookmark cards */
html.dark-mode .kg-bookmark-card a.kg-bookmark-container {
    border-color: var(--vl-border);
    background-color: var(--vl-bg-raised);
}

/* Read-more / related posts section */
html.dark-mode .read-more-wrap {
    background: rgba(22, 27, 34, 0.1) !important;
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(0, 255, 65, 0.08);
    border-radius: 8px;
    border-top: 1px solid var(--vl-border);
}

html.dark-mode .read-more .post-card-excerpt {
    color: var(--vl-text) !important;
}

html.dark-mode .read-more .post-card-title {
    color: var(--vl-text-bright) !important;
}

/* Ghost membership/portal — hide */
html.dark-mode .gh-post-upgrade-cta,
html.dark-mode .gh-post-upgrade-cta-content {
    display: none !important;
}

html.dark-mode [data-portal],
html.dark-mode .gh-portal-triggerbtn-container {
    display: none !important;
}

/* Page content */
html.dark-mode .page-template .gh-content p,
html.dark-mode .page-template .gh-content li,
html.dark-mode .page-template .gh-content h2,
html.dark-mode .page-template .gh-content h3 {
    color: var(--vl-text) !important;
}

html.dark-mode .page-template .gh-content h2,
html.dark-mode .page-template .gh-content h3 {
    color: var(--vl-green) !important;
}

/* KG cards */
html.dark-mode .kg-card {
    color: var(--vl-text) !important;
}

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

::-webkit-scrollbar-track {
    background: #111820;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #30363d;
}

/* Selection highlight */
::selection {
    background-color: var(--vl-green);
    color: var(--vl-bg);
}

/* ============================================
   HOME LAYOUT — Feed + Right Info Panel
   ============================================ */

.vl-home-layout {
    display: block;
}

.vl-home-feed {
    margin-right: calc(260px + 3rem);
}

.vl-home-feed {
    flex: 1;
    min-width: 0;
}

/* Right info panel */
.vl-info-panel {
    width: 260px;
    flex-shrink: 0;
    position: fixed;
    top: 2rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.vl-info-card {
    background: rgba(22, 27, 34, 0.35);
    backdrop-filter: blur(20px) saturate(1.5);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    border: 1px solid rgba(0, 255, 65, 0.08);
    border-radius: 10px;
    padding: 1.2rem;
}

.vl-info-heading {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--vl-green);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 0.8rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--vl-border);
}

.vl-info-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--vl-text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Tag cloud */
.vl-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.vl-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--vl-text);
    background: rgba(0, 255, 65, 0.04);
    border: 1px solid var(--vl-border);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.vl-tag:hover {
    color: var(--vl-green);
    border-color: rgba(0, 255, 65, 0.3);
    background: rgba(0, 255, 65, 0.08);
}

.vl-tag-count {
    font-size: 0.65rem;
    color: var(--vl-text-muted);
    opacity: 0.7;
}

/* Subscribe / search button */
.vl-subscribe-btn {
    display: block;
    width: 100%;
    margin-top: 0.8rem;
    padding: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--vl-bg);
    background: var(--vl-green);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.vl-subscribe-btn:hover {
    background: var(--vl-green-bright);
}

/* ============================================
   RESPONSIVE — Mobile breakpoint
   ============================================ */

@media (max-width: 768px) {
    .vl-sidebar {
        position: fixed;
        left: -280px;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 200;
    }

    body.vl-sidebar-open .vl-sidebar {
        left: 0;
    }

    .vl-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 150;
        padding: 0.8rem 1rem;
        background: rgba(22, 27, 34, 0.6);
        backdrop-filter: blur(16px) saturate(1.4);
        -webkit-backdrop-filter: blur(16px) saturate(1.4);
        border-bottom: 1px solid rgba(0, 255, 65, 0.08);
    }

    .vl-mobile-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        font-family: var(--font-mono);
        font-size: 1.3rem;
        font-weight: 700;
        color: var(--vl-green);
    }

    .vl-mobile-icon {
        width: 28px;
        height: 28px;
    }

    .vl-mobile-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .vl-mobile-menu-btn {
        display: flex;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        padding: 6px;
        cursor: pointer;
    }

    .vl-mobile-menu-btn span {
        display: block;
        width: 20px;
        height: 2px;
        background: var(--vl-text);
        border-radius: 1px;
    }

    .vl-main {
        margin-left: 0;
    }

    .site-content {
        padding: 1rem;
    }

    .post-card {
        flex-direction: column !important;
    }

    .post-card .post-card-image-link {
        width: 100% !important;
        margin-left: 0 !important;
        margin-top: 1rem;
        height: 180px;
    }

    .vl-home-layout .vl-home-feed {
        margin-right: 0;
    }

    .vl-info-panel {
        display: none;
    }

    .post-feed {
        flex-direction: column !important;
    }
}
