/* ==========================================================================
   Jeremie Werner — Ultra-minimal Ghost Theme
   Inspired by Vercel's Portfolio Starter Kit
   ========================================================================== */

/* --- Reset & Base --- */

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

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SFMono-Regular", "Consolas", "Liberation Mono", "Menlo", monospace;

    --bg: #fff;
    --fg: #111;
    --gray: #666;
    --border: #eaeaea;
    --accent: #111;

    --max-width: 640px;
    --spacing: 2rem;
}

/* Auto dark mode */
.auto {
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    .auto {
        --bg: #111;
        --fg: #fafafa;
        --gray: #888;
        --border: #333;
        --accent: #fafafa;
    }
}

/* Forced dark mode */
.dark {
    --bg: #111;
    --fg: #fafafa;
    --gray: #888;
    --border: #333;
    --accent: #fafafa;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--fg);
    line-height: 1.7;
}

a {
    color: inherit;
    text-decoration: none;
}

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

/* --- Layout --- */

.site-wrapper {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--spacing);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-main {
    flex: 1;
    padding: 4rem 0;
}

/* --- Header / Nav --- */

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

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.nav-logo {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-link {
    font-size: 0.875rem;
    color: var(--gray);
    transition: color 0.15s ease;
}

.nav-link:hover,
.nav-current {
    color: var(--fg);
}

/* --- Post List (Index) --- */

.post-list {
    display: flex;
    flex-direction: column;
}

.post-item a {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    transition: opacity 0.15s ease;
}

.post-item:first-child a {
    border-top: 1px solid var(--border);
}

.post-item a:hover {
    opacity: 0.7;
}

.post-date {
    font-size: 0.8125rem;
    color: var(--gray);
    white-space: nowrap;
    min-width: 100px;
    font-variant-numeric: tabular-nums;
}

.post-item .post-title {
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
}

/* --- Single Post --- */

.post-header {
    margin-bottom: 3rem;
}

.post-header .post-date {
    display: block;
    margin-bottom: 0.5rem;
}

.post-header .post-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

/* --- Post Content --- */

.post-content {
    font-size: 1rem;
    line-height: 1.8;
}

.post-content > * + * {
    margin-top: 1.5rem;
}

.post-content h2 {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-top: 3rem;
}

.post-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 2.5rem;
}

.post-content a {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--gray);
    transition: text-decoration-color 0.15s ease;
}

.post-content a:hover {
    text-decoration-color: var(--fg);
}

.post-content blockquote {
    border-left: 3px solid var(--border);
    padding-left: 1rem;
    color: var(--gray);
    font-style: italic;
}

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--border);
    padding: 0.15em 0.35em;
    border-radius: 4px;
}

.post-content pre {
    background: var(--border);
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

.post-content ul,
.post-content ol {
    padding-left: 1.5rem;
}

.post-content li + li {
    margin-top: 0.5rem;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
}

.post-content figure {
    margin: 2rem 0;
}

.post-content figcaption {
    font-size: 0.8125rem;
    color: var(--gray);
    text-align: center;
    margin-top: 0.5rem;
}

.post-content .kg-image-card img,
.post-content .kg-gallery-image img {
    border-radius: 8px;
}

/* Ghost card width classes */
.kg-width-wide {
    margin-left: -4rem;
    margin-right: -4rem;
    max-width: calc(100% + 8rem);
    width: calc(100% + 8rem);
}

.kg-width-full {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    max-width: 100vw;
    width: 100vw;
}

.kg-width-wide img,
.kg-width-full img {
    width: 100%;
}

@media (max-width: 480px) {
    .kg-width-wide {
        margin-left: -1.25rem;
        margin-right: -1.25rem;
        max-width: calc(100% + 2.5rem);
        width: calc(100% + 2.5rem);
    }
}

/* --- Tag / Author Headers --- */

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

.tag-title,
.author-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.author-bio {
    margin-top: 0.5rem;
    color: var(--gray);
    font-size: 0.9375rem;
}

/* --- Pagination --- */

.pagination {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border);
}

.pagination-link {
    font-size: 0.875rem;
    color: var(--gray);
    transition: color 0.15s ease;
}

.pagination-link:hover {
    color: var(--fg);
}

/* --- Footer --- */

.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--gray);
}

.footer-links {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--gray);
    transition: color 0.15s ease;
}

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

/* --- Responsive --- */

@media (max-width: 480px) {
    :root {
        --spacing: 1.25rem;
    }

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

    .post-header .post-title {
        font-size: 1.5rem;
    }
}
