/* ============================================================
   Joy.pm — One Dark / Doom Emacs terminal theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono&display=swap');

:root {
    --font-mono: 'IBM Plex Mono', monospace;
    --color-bg: #282c34;
    --color-text: #ffb300;
    --color-text-strong: #FED36D;
    --color-header-bg: #000;
    --color-link: #9AB8FA;
    --color-h1: #51afef;
    --color-h2: #98be65;
    --color-h3: #ff6c6b;
    --color-code-bg: #1e2127;
    --color-border: #3a3f4b;
    --color-muted: #abb2bf;
    --color-branch: #080;
    --spacing-side: 3.75rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; }

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 1.125rem;
    line-height: 1.7em;
    margin: 5rem 0 3rem;
    padding: 1.25rem var(--spacing-side);
}

a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { color: var(--color-text-strong); }

img { max-width: 100%; height: auto; }

.post-content img, .page-content img {
    display: block;
    min-width: 40%;
    max-width: 80%;
    margin: 0 auto;
}

.post-content figure, .page-content figure {
    text-align: center;
    margin: 1.5rem auto;
}

/* ============================================================
   Fixed header
   ============================================================ */

.site-header {
    background-color: var(--color-header-bg);
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    min-height: 3.3125rem;
    z-index: 1000;
    padding: 0.875rem var(--spacing-side) 0;
}

.site-nav { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }

.site-nav a {
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 1rem;
    text-decoration: none;
}
.site-nav a:hover { color: var(--color-link); text-decoration: none; }
.site-nav i { font-size: 1.2rem; vertical-align: middle; }

/* ============================================================
   Fixed footer — vim/Emacs statusline aesthetic
   ============================================================ */

.site-footer {
    background-color: var(--color-header-bg);
    position: fixed;
    bottom: 0; left: 0;
    width: 100%;
    padding: 0.4rem var(--spacing-side);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.site-footer .branch { color: var(--color-branch); }
.site-footer .filetype { margin-left: auto; margin-right: 200px; }

/* ============================================================
   Homepage — two-column layout
   ============================================================ */

.home-container { display: flex; gap: 2rem; }
.home-left { flex-grow: 1; }
.home-right {
    text-align: right;
    max-width: 400px;
}

.home-right img {
    width: 25%;
    margin-bottom: 1rem;
}

.home-right h1 {
    font-size: 2em;
    line-height: 1.2em;
    margin: 0 0 0.5rem;
}

.home-right .site-description {
    color: var(--color-text);
    font-size: 0.95rem;
    margin: 0;
}

/* Post list */
.post-feed { list-style: none; padding: 0; margin: 0 0 40px; }
.post-feed li { margin-bottom: 0.5rem; }

.post-date { color: var(--color-h2); margin-right: 1rem; }

/* ============================================================
   Headings
   ============================================================ */

h1 { color: var(--color-h1); font-size: 2em; line-height: 1.3em; margin: 0.5em 0; }
h2 { color: var(--color-h2); font-size: 1.5em; margin: 1.5rem 0 0.5rem; }
h3 { color: var(--color-h3); font-size: 1.1em; margin: 1.25rem 0 0.4rem; }
h4, h5, h6 { color: var(--color-text-strong); margin: 1rem 0 0.4rem; }

/* ============================================================
   Post / page content
   ============================================================ */

.post, .page { width: 80%; }

.post-meta {
    color: var(--color-muted);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.post-date-display { color: var(--color-h2); }

/* Tags — [bracket] style */
.post-tags { margin-top: 0.5rem; }
.post-tags a {
    color: var(--color-link);
    font-size: 1em;
    margin-right: 0.75rem;
    text-decoration: none;
}
.post-tags a::before { content: "["; color: var(--color-muted); margin-right: 2px; }
.post-tags a::after  { content: "]"; color: var(--color-muted); margin-left: 2px; }
.post-tags a:hover { text-decoration: none; color: var(--color-h1); }

.post-content p,
.page-content p { margin: 0 0 1.1rem; }

.post-content ul,
.post-content ol,
.page-content ul,
.page-content ol { padding-left: 1.5rem; margin: 0 0 1.1rem; }

.post-content blockquote,
.page-content blockquote {
    border-left: 3px solid var(--color-border);
    margin: 1.25rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    color: var(--color-muted);
}

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 1em;
    background-color: var(--color-code-bg);
    padding: 2px 4px;
    border-radius: 3px;
}

pre, div.sourceCode {
    background-color: var(--color-code-bg);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    margin: 0 auto 1.25rem;
    line-height: 1.5;
    width: 80%;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.9rem;
}

div.sourceCode pre {
    background: none;
    padding: 0;
    margin: 0;
    width: 100%;
    border-radius: 0;
}

/* Syntax highlighting (Pandoc breezedark) */
code span { color: #cfcfc2; }
code span.al { color: #95da4c; background-color: #4d1f24; font-weight: bold; }
code span.an { color: #3f8058; }
code span.at { color: #2980b9; }
code span.bn { color: #f67400; }
code span.bu { color: #7f8c8d; }
code span.cf { color: #fdbc4b; font-weight: bold; }
code span.ch { color: #3daee9; }
code span.cn { color: #27aeae; font-weight: bold; }
code span.co { color: #7a7c7d; }
code span.cv { color: #7f8c8d; }
code span.do { color: #a43340; }
code span.dt { color: #2980b9; }
code span.dv { color: #f67400; }
code span.er { color: #da4453; text-decoration: underline; }
code span.ex { color: #0099ff; font-weight: bold; }
code span.fl { color: #f67400; }
code span.fu { color: #8e44ad; }
code span.im { color: #27ae60; }
code span.in { color: #c45b00; }
code span.kw { color: #cfcfc2; font-weight: bold; }
code span.op { color: #cfcfc2; }
code span.ot { color: #27ae60; }
code span.pp { color: #27ae60; }
code span.re { color: #2980b9; background-color: #153042; }
code span.sc { color: #3daee9; }
code span.ss { color: #da4453; }
code span.st { color: #f44f4f; }
code span.va { color: #27aeae; }
code span.vs { color: #da4453; }
code span.wa { color: #da4453; }

hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2rem 0;
}

/* ============================================================
   Archive page
   ============================================================ */

.archive h1 { margin-bottom: 1.5rem; }

.archive-list { list-style: none; padding: 0; margin: 0; }
.archive-item { margin-bottom: 0.5rem; }
.archive-item .post-date { color: var(--color-h2); margin-right: 1rem; }
.archive-item a { color: var(--color-link); }

.archive-tags { margin-left: 0.5rem; }
.archive-tags a {
    color: var(--color-muted);
    font-size: 0.85rem;
    margin-right: 0.4rem;
    text-decoration: none;
}
.archive-tags a::before { content: "["; }
.archive-tags a::after  { content: "]"; }
.archive-tags a:hover { color: var(--color-h1); }

/* ============================================================
   Book / cognitive orchestration
   ============================================================ */

.book-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 3rem;
    align-items: start;
}

.book-toc {
    position: sticky;
    top: 5rem;
    font-size: 0.875rem;
}

.book-toc h2 {
    color: var(--color-h2);
    font-size: 0.85rem;
    margin: 0 0 0.75rem;
}

.book-toc .toc-part { margin-bottom: 1rem; }
.book-toc .toc-part-title { color: var(--color-h1); margin-bottom: 0.25rem; font-size: 0.9rem; }

.book-toc .toc-chapters { list-style: none; padding: 0; margin: 0; }
.book-toc .toc-chapters li { padding: 0.15rem 0 0.15rem 0.75rem; }
.book-toc .toc-chapters a { color: var(--color-muted); }
.book-toc .toc-chapters a:hover { color: var(--color-link); text-decoration: none; }
.book-toc .toc-chapters .current a { color: var(--color-text); }

.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
}
.chapter-nav a { color: var(--color-muted); }
.chapter-nav a:hover { color: var(--color-link); text-decoration: none; }

/* Image captions */
figcaption { color: var(--color-muted); font-size: 0.75em; margin-top: 0.4rem; text-align: center; }

/* Ghost image cards */
.kg-image-card img { max-width: 80%; margin: 1rem auto; display: block; }
.kg-card { margin: 1.5rem 0; }

/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 768px) {
    :root { --spacing-side: 1rem; }
    .home-container { flex-direction: column; }
    .home-right { order: -1; text-align: left; }
    .post, .page { width: 100%; }
    .book-layout { grid-template-columns: 1fr; }
    .book-toc { position: static; }
    .site-footer .filetype { display: none; }
    .post-content img, .page-content img { min-width: unset; max-width: 100%; }
}
