/* INK v2 — Terminal-inspired Ghost Theme */
:root {
    --bg: #0a0a0f; --bg-alt: #12121a; --bg-card: #14141e;
    --text: #e0e0e8; --text-secondary: #7a7a8e; --text-muted: #4a4a5e;
    --accent: var(--ghost-accent-color, #00ffc8);
    --accent-glow: color-mix(in srgb, var(--accent) 30%, transparent);
    --border: #1e1e2e; --code-bg: #0d0d14;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
    --sans: 'Inter', system-ui, -apple-system, sans-serif;
    --max-content: 720px; --max-wide: 960px; --max-full: 1200px;
    --radius: 10px; --header-h: 60px;
}
html:not(.dark) {
    --bg: #fafafe; --bg-alt: #f0f0f5; --bg-card: #ffffff;
    --text: #1a1a2e; --text-secondary: #6a6a7e; --text-muted: #9a9aae;
    --border: #e0e0ea; --code-bg: #f0f0f5;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); line-height: 1.7; -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
main { flex: 1; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }
.scanline { pointer-events: none; position: fixed; inset: 0; z-index: 9999; background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px); }
.container { max-width: var(--max-full); margin: 0 auto; padding: 0 1.5rem; }
/* HEADER */
.site-header { position: sticky; top: 0; z-index: 100; background: rgba(10,10,15,0.9); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); height: var(--header-h); }
html:not(.dark) .site-header { background: rgba(250,250,254,0.9); }
.header-inner { max-width: var(--max-full); margin: 0 auto; padding: 0 1.5rem; height: 100%; display: flex; align-items: center; gap: 2rem; }
.site-logo { font-family: var(--mono); font-size: 1.1rem; font-weight: 700; color: var(--text); text-decoration: none; display: flex; align-items: center; flex-shrink: 0; }
.site-logo img { height: 28px; width: auto; }
.site-logo:hover { text-decoration: none; }
.logo-prompt { color: var(--accent); }
.cursor { color: var(--accent); font-weight: 400; margin-left: 1px; }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: 1.5rem; }
.site-nav a { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); text-transform: lowercase; letter-spacing: 0.02em; padding: 0.25rem 0; border-bottom: 1px solid transparent; transition: all 0.2s; }
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }

.toggle-icon { font-size: 14px; line-height: 1; }

/* INTRO */
.site-intro { padding: 3rem 0 1rem; }
.intro-text { font-family: var(--mono); font-size: 1.1rem; color: var(--text-secondary); line-height: 1.6; }
.prompt { color: var(--accent); font-weight: 700; margin-right: 0.5rem; }
.section-label { font-family: var(--mono); font-size: 0.8rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.5rem; }
.label-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); display: inline-block; animation: glow-pulse 2s ease-in-out infinite; }
@keyframes glow-pulse { 0%, 100% { box-shadow: 0 0 4px var(--accent-glow), 0 0 8px var(--accent-glow); opacity: 0.7; } 50% { box-shadow: 0 0 8px var(--accent), 0 0 16px var(--accent-glow), 0 0 28px var(--accent-glow); opacity: 1; } }
/* POST FEED */
.post-feed-section { padding: 2rem 0 3rem; }
.post-feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
@media (max-width: 768px) { .post-feed { grid-template-columns: 1fr; } }
.post-card { opacity: 0; transform: translateY(20px); transition: opacity 0.5s, transform 0.5s; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post-card.visible, .post-card.hero { opacity: 1; transform: none; }
.post-card:hover { border-color: var(--accent); box-shadow: 0 0 20px var(--accent-glow), 0 8px 32px rgba(0,0,0,0.2); transform: translateY(-3px); }
.post-card-link { display: block; color: var(--text); text-decoration: none; }
.post-card-link:hover { text-decoration: none; }
.post-card-image { aspect-ratio: 16/9; overflow: hidden; position: relative; }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.post-card-link:hover .post-card-image img { transform: scale(1.05); }
.image-overlay { position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0,0,0,0.4)); pointer-events: none; }
.post-card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; }
.post-card-tag { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: 0.5rem; }
.post-card-title { font-size: 1.15rem; font-weight: 600; line-height: 1.35; }
.post-card-excerpt { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.5rem; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card > .post-card-meta { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); padding: 0.5rem 1.25rem 1rem; display: flex; align-items: center; gap: 0.5rem; border-top: 1px solid var(--border); }
.meta-sep { opacity: 0.4; }
/* HERO CARD */
.post-card.hero { grid-column: 1 / -1; display: flex; flex-direction: row; }
.post-card.hero .post-card-link { display: flex; flex-direction: row; flex: 1; }

.post-card.hero .post-card-image { width: 55%; aspect-ratio: auto; flex-shrink: 0; }
.post-card.hero .post-card-body { padding: 2rem; justify-content: center; }
.post-card.hero .post-card-title { font-size: 1.75rem; }
.post-card.hero .post-card-excerpt { -webkit-line-clamp: 3; }
@media (max-width: 768px) { .post-card.hero { flex-direction: column; } .post-card.hero .post-card-link { flex-direction: column; } .post-card.hero .post-card-image { width: 100%; aspect-ratio: 16/9; } .post-card.hero .post-card-title { font-size: 1.35rem; } }
/* POST FULL */
.post-full { padding: 3rem 0 4rem; }
.post-header { max-width: var(--max-content); margin: 0 auto; }
.post-tag { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); background: var(--accent-glow); padding: 0.3rem 0.75rem; border-radius: 50px; display: inline-block; }
.post-title { font-size: 2.75rem; font-weight: 700; line-height: 1.15; margin-top: 1rem; letter-spacing: -0.03em; }
@media (max-width: 768px) { .post-title { font-size: 1.85rem; } }
.post-excerpt { font-size: 1.2rem; color: var(--text-secondary); margin-top: 1rem; line-height: 1.6; }
.post-meta { font-family: var(--mono); font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.post-meta a { color: var(--text-secondary); }
.post-meta a:hover { color: var(--accent); }
.post-feature-image { max-width: var(--max-wide); margin: 2.5rem auto 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post-feature-image img { width: 100%; }
.post-feature-image figcaption { font-family: var(--mono); text-align: center; font-size: 0.75rem; color: var(--text-muted); padding: 0.75rem; }
/* GH-CONTENT */
.post-content { max-width: var(--max-content); margin: 2.5rem auto 0; }
.gh-content > * + * { margin-top: 1.5rem; }
.gh-content h2 { font-size: 1.6rem; font-weight: 700; margin-top: 3rem; letter-spacing: -0.01em; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.gh-content h3 { font-size: 1.3rem; font-weight: 600; margin-top: 2.5rem; }
.gh-content h4 { font-size: 1.1rem; font-weight: 600; margin-top: 2rem; }
.gh-content p { line-height: 1.8; }
.gh-content a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--accent-glow); }
.gh-content a:hover { text-decoration-color: var(--accent); }
.gh-content strong { font-weight: 600; color: var(--text); }
.gh-content ul, .gh-content ol { padding-left: 1.5rem; }
.gh-content li + li { margin-top: 0.5rem; }
.gh-content blockquote { border-left: 3px solid var(--accent); padding: 1rem 1.5rem; margin: 2rem 0; background: var(--bg-alt); border-radius: 0 var(--radius) var(--radius) 0; color: var(--text-secondary); font-style: italic; }
.gh-content pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; overflow-x: auto; font-size: 0.85rem; line-height: 1.65; position: relative; }
.gh-content pre::before { content: '● ● ●'; display: block; font-size: 0.6rem; color: var(--text-muted); letter-spacing: 4px; margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.gh-content code { font-family: var(--mono); font-size: 0.85rem; }
.gh-content :not(pre) > code { background: var(--bg-alt); border: 1px solid var(--border); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.85em; color: var(--accent); }
.gh-content hr { border: none; border-top: 1px solid var(--border); margin: 3rem 0; }
/* GHOST CARD WIDTHS */
.gh-content .kg-width-wide { max-width: var(--max-wide); margin-left: calc((var(--max-content) - var(--max-wide)) / 2); margin-right: calc((var(--max-content) - var(--max-wide)) / 2); }
@media (max-width: 1000px) { .gh-content .kg-width-wide { margin-left: -1.5rem; margin-right: -1.5rem; } }
.gh-content .kg-width-full { max-width: none; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.gh-content .kg-image-card img, .gh-content .kg-gallery-card img { border-radius: var(--radius); }
.gh-content figcaption { font-family: var(--mono); text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 0.75rem; }
/* BOOKMARK */
.gh-content .kg-bookmark-card { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.gh-content .kg-bookmark-container { display: flex; text-decoration: none; color: var(--text); }
.gh-content .kg-bookmark-content { padding: 1rem; flex: 1; }
.gh-content .kg-bookmark-title { font-weight: 600; font-size: 0.95rem; }
.gh-content .kg-bookmark-description { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.5rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gh-content .kg-bookmark-metadata { font-family: var(--mono); font-size: 0.7rem; color: var(--text-muted); margin-top: 0.75rem; }
.gh-content .kg-bookmark-thumbnail { width: 200px; }
.gh-content .kg-bookmark-thumbnail img { height: 100%; object-fit: cover; border-radius: 0; }
/* POST FOOTER/TAGS */
.post-footer { max-width: var(--max-content); margin: 3rem auto 0; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.post-tags a { font-family: var(--mono); font-size: 0.75rem; background: var(--bg-alt); border: 1px solid var(--border); padding: 0.3rem 0.75rem; border-radius: 50px; color: var(--text-secondary); transition: all 0.2s; }
.post-tags a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
/* COMMENTS */
.post-comments { max-width: var(--max-content); margin: 3rem auto 0; }
/* POST NAV */
.post-nav { max-width: var(--max-content); margin: 3rem auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
@media (max-width: 600px) { .post-nav { grid-template-columns: 1fr; } }
.post-nav-item { display: flex; flex-direction: column; gap: 0.25rem; color: var(--text); text-decoration: none; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.2s; }
.post-nav-item:hover { border-color: var(--accent); text-decoration: none; box-shadow: 0 0 12px var(--accent-glow); }
.post-nav-item span { font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); }
.post-nav-item strong { font-size: 0.9rem; font-weight: 600; }
.post-nav-item.next { text-align: right; }
/* ARCHIVE */
.archive-header { padding: 3rem 0 1rem; }
.archive-header h1 { font-size: 2rem; font-weight: 700; }
.archive-header h1 .prompt { font-weight: 400; color: var(--text-muted); }
.archive-header p { color: var(--text-secondary); margin-top: 0.5rem; max-width: 600px; }
.archive-count { font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 0.5rem; }
.author-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 1rem; border: 2px solid var(--border); }
/* PAGINATION */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1.5rem; padding: 2rem 0 3rem; font-family: var(--mono); font-size: 0.85rem; }
.pagination-link { color: var(--accent); }
.pagination-info { color: var(--text-muted); }
/* FOOTER */
.site-footer { border-top: 1px solid var(--border); padding: 1.5rem 0; margin-top: auto; }
.footer-inner { max-width: var(--max-full); margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 0.75rem; color: var(--text-muted); flex-wrap: wrap; gap: 1rem; }
.footer-prompt { color: var(--accent); }
.footer-inner a { color: var(--text-muted); }
.footer-inner a:hover { color: var(--accent); }
.footer-nav ul { list-style: none; display: flex; gap: 1rem; }
/* ERROR */
.error-page { text-align: center; padding: 6rem 0; }
.error-page h1 { font-family: var(--mono); font-size: 8rem; font-weight: 700; color: var(--accent); opacity: 0.15; }
.error-page .error-msg { font-family: var(--mono); font-size: 1rem; color: var(--text-secondary); margin-top: 1rem; }
.error-output { color: var(--accent); }
/* RESPONSIVE */
@media (max-width: 768px) {
    html { font-size: 16px; }
    .site-header { height: auto; }
    .header-inner { flex-wrap: wrap; padding: 0.75rem 1.5rem; gap: 0.5rem; }
    .site-logo { width: 100%; }
    .site-nav { margin-left: 0; }
    .site-nav ul { gap: 0.75rem; }
    .site-nav a { font-size: 0.75rem; }
    .header-actions { margin-left: auto; }
    .post-full { padding: 2rem 0 3rem; }
}
/* Comment count in cards */
.post-card-comments { color: var(--text-muted); font-size: inherit; text-decoration: none; }
.post-card-comments:hover { color: var(--accent); text-decoration: none; }
.post-card-comments:empty { display: none; }
.post-card-comments:empty + .meta-sep { display: none; }

/* Comment count in meta */
.meta-comments { margin-left: auto; }
.meta-comments:empty { display: none; }
.meta-comments a, a.meta-comments { color: var(--text-muted); text-decoration: none; }
.meta-comments:hover, .meta-comments a:hover { color: var(--accent); text-decoration: none; }

/* Matrix mode */
html.matrix {
    --bg: #000000;
    --bg-alt: #0a0a0a;
    --bg-card: rgba(0, 10, 0, 0.85);
    --text: #00ff41;
    --text-secondary: #00cc33;
    --text-muted: #008f22;
    --accent: #00ff41;
    --accent-glow: rgba(0, 255, 65, 0.3);
    --border: #003300;
    --code-bg: #000a00;
}
html.matrix .site-header { background: rgba(0, 0, 0, 0.92); }
html.matrix .post-card-link, html.matrix .post-card { border-color: #003300; }
html.matrix .post-card:hover { border-color: #00ff41; box-shadow: 0 0 30px rgba(0, 255, 65, 0.2); }
html.matrix .image-overlay { background: linear-gradient(transparent 30%, rgba(0, 10, 0, 0.6)); }
html.matrix a { color: #00ff41; }

/* Matrix canvas */
#matrix-rain {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1;
    display: none;
    pointer-events: none;
}
/* Header actions (search + theme toggle) */
.header-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.header-btn { background: none; border: 1px solid var(--border); cursor: pointer; color: var(--text-secondary); width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.header-btn:hover { border-color: var(--accent); color: var(--accent); }
/* Prism.js Syntax Highlighting — Terminal Dark */
code[class*="language-"], pre[class*="language-"] { color: #abb2bf; text-shadow: none; }
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #5c6370; font-style: italic; }
.token.punctuation { color: #abb2bf; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted { color: #e06c75; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #98c379; }
.token.operator, .token.entity, .token.url { color: #56b6c2; }
.token.atrule, .token.attr-value, .token.keyword { color: #c678dd; }
.token.function, .token.class-name { color: #61afef; }
.token.regex, .token.important, .token.variable { color: #d19a66; }
.token.important, .token.bold { font-weight: bold; }
.token.italic { font-style: italic; }
/* Light mode overrides */
html:not(.dark) code[class*="language-"], html:not(.dark) pre[class*="language-"] { color: #383a42; }
html:not(.dark) .token.comment, html:not(.dark) .token.prolog, html:not(.dark) .token.doctype, html:not(.dark) .token.cdata { color: #a0a1a7; }
html:not(.dark) .token.punctuation { color: #383a42; }
html:not(.dark) .token.property, html:not(.dark) .token.tag, html:not(.dark) .token.boolean, html:not(.dark) .token.number, html:not(.dark) .token.constant, html:not(.dark) .token.symbol, html:not(.dark) .token.deleted { color: #e45649; }
html:not(.dark) .token.selector, html:not(.dark) .token.attr-name, html:not(.dark) .token.string, html:not(.dark) .token.char, html:not(.dark) .token.builtin, html:not(.dark) .token.inserted { color: #50a14f; }
html:not(.dark) .token.operator, html:not(.dark) .token.entity, html:not(.dark) .token.url { color: #0184bc; }
html:not(.dark) .token.atrule, html:not(.dark) .token.attr-value, html:not(.dark) .token.keyword { color: #a626a4; }
html:not(.dark) .token.function, html:not(.dark) .token.class-name { color: #4078f2; }
html:not(.dark) .token.regex, html:not(.dark) .token.important, html:not(.dark) .token.variable { color: #986801; }
