/*
 * retro theme for jameskersey.com
 * Dark terminal aesthetic meets pixel art game dev culture.
 * Monospace throughout. Warm amber accent. Sharp edges. No fuss.
 */

:root,
[data-theme="dark"] {
    --bg:        #0e0e0e;
    --bg-alt:    #161616;
    --fg:        #b8b4ad;
    --fg-em:     #e8e4dd;
    --fg-muted:  #5a5650;
    --orange:    #e8853d;
    --cyan:      #5dbccc;
    --green:     #7ec86e;
    --border:    #252525;
    --font-mono: "Berkeley Mono", "Iosevka", "Fira Code", "Cascadia Code",
                 "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

/* Light mode — warm paper, dark ink, same amber accent */
[data-theme="light"] {
    --bg:        #f5f0e8;
    --bg-alt:    #ede8df;
    --fg:        #3a3530;
    --fg-em:     #1a1510;
    --fg-muted:  #8a8078;
    --orange:    #c06820;
    --cyan:      #2a7a8a;
    --green:     #4a8a3a;
    --border:    #d0c8bc;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background-color: var(--bg);
    color: var(--fg);
    line-height: 1.65;
    min-height: 100vh;
}

a {
    color: var(--orange);
    text-decoration: none;
}

a:hover {
    background-color: var(--orange);
    color: var(--bg);
}

/* ── Layout ───────────────────────────────────────────────── */

.site-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ───────────────────────────────────────────────── */

.site-header {
    padding: 2rem 0 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

.header-top {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.site-title {
    font-size: 1.55rem;
    font-weight: bold;
    color: var(--fg-em);
    letter-spacing: 0.04em;
    text-transform: lowercase;
}

.site-title:hover {
    background: none;
    color: var(--orange);
}

.site-subtitle {
    color: var(--fg-muted);
    font-size: 0.82rem;
}

/* ── Navigation ───────────────────────────────────────────── */

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
}

.main-nav a {
    color: var(--fg-muted);
    font-size: 0.82rem;
    padding: 2px 3px;
}

.main-nav a:hover {
    color: var(--bg);
    background-color: var(--orange);
}

/* ── Main content ─────────────────────────────────────────── */

.site-main {
    min-height: 60vh;
}

/* ── Typography ───────────────────────────────────────────── */

h1 {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--fg-em);
    margin-bottom: 0.5rem;
    padding-left: 0.7rem;
    border-left: 3px solid var(--orange);
    line-height: 1.3;
}

h1 a {
    color: inherit;
}

h1 a:hover {
    background: none;
    color: var(--orange);
}

h2 {
    font-size: 1.05rem;
    font-weight: bold;
    color: var(--fg-em);
    margin-top: 2rem;
    margin-bottom: 0.5rem;
}

h2::before {
    content: '## ';
    color: var(--fg-muted);
}

h3 {
    font-size: 0.95rem;
    font-weight: bold;
    color: var(--fg-em);
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
}

h3::before {
    content: '### ';
    color: var(--fg-muted);
}

p {
    margin-bottom: 1rem;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    color: var(--cyan);
    background: var(--bg-alt);
    padding: 0.1em 0.35em;
    border: 1px solid var(--border);
}

pre {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-left: 3px solid var(--fg-muted);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--fg);
}

blockquote {
    border-left: 3px solid var(--fg-muted);
    padding-left: 1rem;
    color: var(--fg-muted);
    margin: 1rem 0;
    font-style: italic;
}

ul, ol {
    margin: 0.75rem 0 0.75rem 1.5rem;
}

li {
    margin-bottom: 0.3rem;
}

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

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

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.88rem;
}

th {
    text-align: left;
    color: var(--fg-em);
    border-bottom: 1px solid var(--border);
    padding: 0.4rem 0.75rem;
    font-weight: bold;
}

td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
}

/* ── Index page ───────────────────────────────────────────── */

.index-header {
    color: var(--fg-muted);
    font-size: 0.82rem;
    margin-bottom: 1.25rem;
}

.post-list {
    list-style: none;
    padding: 0;
}

.post-item {
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.post-item:last-child {
    border-bottom: none;
}

.post-item time {
    color: var(--fg-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    min-width: 6rem;
    flex-shrink: 0;
}

.post-item a {
    color: var(--fg);
    font-size: 0.88rem;
}

.post-item a:hover {
    color: var(--bg);
    background-color: var(--orange);
}

.post-category {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--fg-muted);
    background: var(--bg-alt);
    padding: 0.1rem 0.5rem;
    border: 1px solid var(--border);
    flex-shrink: 0;
    text-transform: lowercase;
}

/* ── Article / Page ───────────────────────────────────────── */

.post-header,
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* Override h1 styles for the main article/page title */
.post-header h1,
.page-header h1 {
    font-size: 1.55rem;
    border-left: 3px solid var(--orange);
    padding-left: 0.7rem;
    margin-bottom: 0;
}

.post-meta {
    color: var(--fg-muted);
    font-size: 0.78rem;
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.post-content,
.page-content {
    line-height: 1.75;
}

/* Reset h1 inside content body (not the page header) */
.post-content h1,
.page-content h1 {
    font-size: 1.2rem;
    border-left: none;
    padding-left: 0;
    margin-top: 2rem;
}

.post-content h1::before,
.page-content h1::before {
    content: '# ';
    color: var(--fg-muted);
}

.post-content img,
.page-content img {
    max-width: 100%;
    height: auto;
}

/* ── Pagination ───────────────────────────────────────────── */

.pagination {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    font-size: 0.85rem;
}

/* ── Footer ───────────────────────────────────────────────── */

.site-footer {
    margin-top: 4rem;
    padding: 1.25rem 0 2rem;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--fg-muted);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--fg-muted);
}

.footer-links a:hover {
    color: var(--bg);
    background-color: var(--orange);
}

.footer-copy {
    color: var(--fg-muted);
    margin: 0;
}

.footer-copy a {
    color: var(--fg-muted);
}

/* ── Theme toggle ─────────────────────────────────────────── */

.theme-toggle {
    margin-left: auto;
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--fg-muted);
    cursor: pointer;
    padding: 2px 3px;
    line-height: 1;
}

.theme-toggle:hover {
    background-color: var(--orange);
    color: var(--bg);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 640px) {
    .header-top {
        flex-direction: column;
        gap: 0.2rem;
    }

    .main-nav {
        gap: 0.4rem 1rem;
    }

    .post-item {
        flex-direction: column;
        gap: 0.15rem;
    }

    .post-category {
        margin-left: 0;
    }
}
