/* ============================================
   DevToolbox Theme — Dark Developer
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0a0a0f;
    --card-bg: #111118;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-faint: #64748b;
    --brand: #2563EB;
    --brand-light: #60a5fa;
    --border: #1e293b;
    --radius: 12px;
    --max-width: 1200px;
    --content-width: 720px;
}

body {
    font-family: "Inter", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* --- Header / Nav --- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
}

.logo-accent { color: var(--brand); }

.site-nav { display: flex; gap: 0; }

.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 24px;
}

.site-nav li { margin: 0; padding: 0; }

.site-nav a, .nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.2s;
}

.site-nav a:hover, .nav-link:hover, .nav-link.active { color: var(--text); }

/* --- Reading Progress Bar --- */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: var(--brand);
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --- Table of Contents --- */
.toc-container {
    max-width: var(--content-width);
    margin: 0 auto 2em;
    padding: 0 24px;
}
.toc-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand);
    font-family: Georgia, serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.toc-arrow { transition: transform 0.2s; }
.toc-open .toc-arrow { transform: rotate(90deg); }
.toc-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
}
.toc-open .toc-nav { max-height: 500px; }
.toc-nav ul { list-style: none; margin: 0; padding: 12px 16px; }
.toc-nav li { margin: 0; padding: 6px 0; }
.toc-nav li.toc-sub { padding-left: 1.2em; }
.toc-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    transition: color 0.2s;
}
.toc-nav a:hover { color: var(--brand); }

/* --- Share Buttons --- */
.share-buttons {
    max-width: var(--content-width);
    margin: 2em auto 0;
    padding: 1.5em 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}
.share-label { font-size: 0.85rem; color: var(--text-faint); font-weight: 500; }
.share-links { display: flex; gap: 8px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    font-family: inherit;
    padding: 0;
}
.share-btn svg { width: 18px; height: 18px; }
.share-btn:hover { border-color: var(--brand); color: var(--brand); }
.share-twitter:hover { color: #e7e9ea; border-color: #e7e9ea; }
.share-facebook:hover { color: #1877F2; border-color: #1877F2; }
.share-linkedin:hover { color: #0A66C2; border-color: #0A66C2; }
.share-reddit:hover { color: #FF4500; border-color: #FF4500; }
.share-pinterest:hover { color: #E60023; border-color: #E60023; }
.share-whatsapp:hover { color: #25D366; border-color: #25D366; }
.share-bluesky:hover { color: #0085FF; border-color: #0085FF; }

/* --- Author Bio --- */
.author-bio {
    max-width: var(--content-width);
    margin: 2em auto;
    padding: 1.5em 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-top: 1px solid var(--border);
}
.author-avatar img, .author-initials {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}
.author-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}
.author-name { font-weight: 600; color: var(--text); text-decoration: none; }
.author-name:hover { color: var(--brand); }
.author-bio-text { font-size: 0.85rem; color: var(--text-muted); margin: 4px 0 0; }

/* --- Bento Grid --- */
.home-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.card:hover { border-color: #2a3a4b; }

.card-link {
    display: block;
    padding: 24px;
    height: 100%;
}

.card-featured { grid-row: span 2; }

.card-featured .card-title {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 10px;
}

.card-featured .card-excerpt {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.card-small .card-title {
    font-family: "JetBrains Mono", monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 8px;
}

/* --- Category Badges (translucent/glowing) --- */
.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
    background: rgba(37,99,235,0.15);
    color: #60a5fa;
}

.badge-comparison, .badge-comparisons { background: rgba(37,99,235,0.15); color: #60a5fa; }
.badge-guide, .badge-guides { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-roundup, .badge-roundups { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-deep-dive, .badge-deep-dives { background: rgba(168,85,247,0.15); color: #c084fc; }
.badge-news { background: rgba(239,68,68,0.15); color: #f87171; }

/* --- Tags --- */
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

.tag-pill {
    display: inline-block;
    background: var(--border);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.7rem;
}

/* --- Card Meta --- */
.card-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-faint);
}

/* --- Posts Grid (after bento) --- */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.card-grid img.card-image {
    border-radius: var(--radius) var(--radius) 0 0;
    margin: -24px -24px 16px;
    max-width: none;
    width: calc(100% + 48px);
    height: 220px;
    object-fit: cover;
}

.card-grid .card-title {
    font-family: "JetBrains Mono", monospace;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 6px;
}

.card-grid .card-excerpt {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 24px 0;
}

.page-link { color: var(--brand-light); font-weight: 600; font-size: 0.875rem; }
.page-number { color: var(--text-faint); font-size: 0.85rem; }

/* --- Post Article --- */
.post-article {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 48px 24px;
}

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

.post-title {
    font-family: "JetBrains Mono", monospace;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin: 12px 0 16px;
}

.post-excerpt {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-faint);
}

.meta-separator { color: var(--border); }

.post-feature-image { margin-bottom: 32px; border-radius: var(--radius); overflow: hidden; }
.post-feature-image figcaption { font-size: 0.8rem; color: var(--text-faint); margin-top: 8px; text-align: center; }

/* --- Post Body --- */
.post-body,
.post-body p,
.post-body li,
.post-body td,
.post-body article,
.post-body article p,
.post-body article li {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #e2e8f0;
}

.post-body p { margin-bottom: 1.5em; }
.post-body h2 { font-family: "JetBrains Mono", monospace; color: var(--text); margin: 2.5em 0 0.8em; font-size: 1.4rem; }
.post-body h3 { font-family: "JetBrains Mono", monospace; color: var(--text); margin: 2em 0 0.6em; font-size: 1.15rem; }
.post-body ul, .post-body ol { margin: 1em 0 1.5em 1.5em; }
.post-body li { margin-bottom: 0.5em; }
.post-body blockquote { border-left: 3px solid var(--brand); padding-left: 1em; margin: 1.5em 0; color: var(--text-muted); font-style: italic; }
.post-body a { color: var(--brand-light); text-decoration: underline; text-underline-offset: 3px; }
.post-body a:hover { color: var(--brand); }
/* Code blocks with Prism syntax highlighting */
.post-body pre, .post-body pre[class*="language-"] {
    background: #0d1117 !important;
    color: #e6edf3;
    padding: 1.4em 1.6em;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.8em 0;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.85em;
    line-height: 1.7;
    border: 1px solid #21262d;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.post-body pre code, .post-body pre code[class*="language-"] {
    font-family: "JetBrains Mono", monospace;
    font-size: 1em;
    background: none !important;
    padding: 0;
    border-radius: 0;
    color: inherit;
}
.post-body code { font-family: "JetBrains Mono", monospace; font-size: 0.9em; }
.post-body :not(pre) > code {
    background: #1e293b;
    padding: 0.2em 0.5em;
    border-radius: 5px;
    color: #7dd3fc;
    font-size: 0.88em;
}
/* Prism overrides for GitHub-dark style */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8b949e; }
.token.punctuation { color: #c9d1d9; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #79c0ff; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #a5d6ff; }
.token.operator, .token.entity, .token.url { color: #d2a8ff; }
.token.atrule, .token.attr-value, .token.keyword { color: #ff7b72; }
.token.function, .token.class-name { color: #d2a8ff; }
.token.regex, .token.important, .token.variable { color: #ffa657; }
.post-body img { border-radius: 8px; margin: 1.5em 0; }
.post-body .kg-width-wide { margin-left: -4vw; margin-right: -4vw; width: calc(100% + 8vw); }
.post-body .kg-width-full { margin-left: calc(-50vw + 50%); margin-right: calc(-50vw + 50%); width: 100vw; }
.post-body .kg-width-wide img,
.post-body .kg-width-full img { width: 100%; }

/* --- Post Footer --- */
.post-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }

/* --- Comments --- */
.gh-comments { max-width: var(--content-width); margin: 0 auto; padding: 0 24px 48px; }
.gh-comments iframe { background: var(--bg) !important; border-radius: var(--radius); }

/* --- Related Posts --- */
.related-posts { max-width: var(--content-width); margin: 0 auto; padding: 0 24px 48px; }
.related-title { font-family: "JetBrains Mono", monospace; color: var(--text); font-size: 1.1rem; margin-bottom: 16px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* --- Tag Page --- */
.tag-page { max-width: var(--max-width); margin: 0 auto; padding: 32px 24px; }
.tag-header { margin-bottom: 32px; }
.tag-name { font-family: "JetBrains Mono", monospace; color: var(--text); font-size: 1.8rem; }
.tag-description { color: var(--text-muted); margin-top: 8px; }

/* --- Error Page --- */
.error-page { text-align: center; padding: 120px 24px; }
.error-code { font-family: "JetBrains Mono", monospace; font-size: 6rem; color: var(--brand); }
.error-message { color: var(--text-muted); font-size: 1.2rem; margin: 16px 0 32px; }
.error-link { color: var(--brand-light); font-weight: 600; text-decoration: underline; }

/* --- Footer --- */
.site-footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; }
.footer-copyright { font-size: 0.8rem; color: var(--text-faint); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .bento-grid { grid-template-columns: 1fr; }
    .card-featured { grid-row: auto; }
    .posts-grid { grid-template-columns: 1fr; }
    .related-grid { grid-template-columns: 1fr; }
    .site-nav { display: none; }
    .post-article { padding: 24px 16px; }
}

/* --- Homelab Hub --- */
.hub-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 32px 24px;
}

.hub-hero {
    margin-bottom: 40px;
    padding: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.hub-hero h1 {
    font-family: "JetBrains Mono", monospace;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}

.hub-hero p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.hub-section {
    margin-bottom: 48px;
}

.hub-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.hub-section-head h2 {
    font-family: "JetBrains Mono", monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.hub-view-all {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
}

.hub-view-all:hover {
    color: var(--brand);
}

@media (max-width: 768px) {
    .hub-section-head { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* --- Homelab sub-tag badges (palette extends comparisons/guides/etc.) --- */
.badge-homelab        { background: rgba(99,102,241,0.15);  color: #a5b4fc; }
.badge-self-hosting   { background: rgba(20,184,166,0.15);  color: #5eead4; }
.badge-networking     { background: rgba(14,165,233,0.15);  color: #7dd3fc; }
.badge-nas-hardware   { background: rgba(217,119,6,0.15);   color: #fbbf24; }
.badge-backups        { background: rgba(132,204,22,0.15);  color: #bef264; }
.badge-monitoring     { background: rgba(236,72,153,0.15);  color: #f9a8d4; }
