/* =============================================================================
   Nova — minimal, typographic Ghost theme
   ============================================================================= */

:root {
    --font-sans: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    --color-text:    #111;
    --color-muted:   #666;
    --color-faint:   #999;
    --color-border:  #e5e5e5;
    --color-bg:      #fff;

    --content-width: 640px;
    --wide-width:    900px;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
}

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

a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover { opacity: 0.6; }

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    line-height: 1.25;
}

p { margin: 0; }
button { cursor: pointer; border: none; background: none; padding: 0; font: inherit; color: inherit; }

/* =============================================================================
   Layout
   ============================================================================= */
.site-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main { flex: 1; }

.container {
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container.wide { max-width: var(--wide-width); }

/* =============================================================================
   Header
   ============================================================================= */
.site-header {
    padding: 40px 0 0;
}

.site-header-inner {
    display: flex;
    align-items: baseline;
    gap: 24px;
    flex-wrap: wrap;
}

.site-logo {
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--color-text);
    flex-shrink: 0;
}

.site-logo:hover { opacity: 0.6; }

.site-logo img {
    max-height: 24px;
    width: auto;
    display: block;
}

.site-nav { display: flex; }

.site-nav ul {
    display: flex;
    align-items: center;
    gap: 20px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    font-size: 0.9rem;
    color: var(--color-muted);
    text-decoration: none;
}

.site-nav a:hover { color: var(--color-text); opacity: 1; }

.nav-toggle { display: none; }

@media (max-width: 480px) {
    .nav-toggle {
        display: block;
        margin-left: auto;
        font-size: 0.875rem;
        color: var(--color-muted);
    }

    .site-nav {
        display: none;
        width: 100%;
        flex-basis: 100%;
    }

    .site-header.nav-open .site-nav { display: flex; }
}

/* =============================================================================
   Site Hero
   ============================================================================= */
.site-hero {
    padding: 48px 0 0;
}

.site-hero-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.site-hero-desc {
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* =============================================================================
   Post Feed
   ============================================================================= */
.post-feed-section {
    padding: 48px 0 80px;
}

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

/* =============================================================================
   Post Card (list item)
   ============================================================================= */
.post-card {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border);
}

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

.post-card-title {
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.4;
    flex: 1;
}

.post-card-title a {
    text-decoration: none;
    color: var(--color-text);
}

.post-card-title a:hover { opacity: 0.6; }

.post-card-date {
    font-size: 0.8125rem;
    color: var(--color-faint);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Hide unused elements */
.post-card-image-link,
.post-card-tags,
.post-card-excerpt,
.post-card-reading-time,
.post-card-featured-label { display: none; }

/* =============================================================================
   Taxonomy pages
   ============================================================================= */
.taxonomy-hero {
    padding: 48px 0 0;
}

.taxonomy-label {
    font-size: 0.8125rem;
    color: var(--color-faint);
    margin-bottom: 4px;
}

.taxonomy-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.taxonomy-description {
    font-size: 0.9rem;
    color: var(--color-muted);
}

.taxonomy-count { display: none; }

.taxonomy-author-avatar,
.taxonomy-author-avatar-placeholder { display: none; }

/* =============================================================================
   Article
   ============================================================================= */
.post-article {
    padding: 48px 0 80px;
}

.article-header {
    margin-bottom: 40px;
}

.article-tag-row {
    margin-bottom: 12px;
}

.article-tag-link {
    font-size: 0.8125rem;
    color: var(--color-faint);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
}

.article-tag-link:hover { opacity: 0.6; }

.article-featured-badge { display: none; }

.article-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-bottom: 12px;
}

.article-excerpt {
    font-size: 1rem;
    color: var(--color-muted);
    line-height: 1.6;
    margin-bottom: 16px;
}

.article-byline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.8125rem;
    color: var(--color-faint);
}

.byline-author {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-faint);
    text-decoration: none;
}

.byline-author:hover { opacity: 0.6; }

.byline-avatar,
.byline-avatar-placeholder { display: none; }

.byline-name { font-size: 0.8125rem; }

.byline-sep { color: var(--color-faint); }

.byline-date,
.byline-reading-time {
    font-size: 0.8125rem;
    color: var(--color-faint);
}

/* Feature image */
.article-image {
    margin: 0 0 40px;
}

.article-image img {
    width: 100%;
}

.article-image figcaption {
    font-size: 0.8125rem;
    color: var(--color-faint);
    margin-top: 8px;
    text-align: center;
}

/* =============================================================================
   Article Content
   ============================================================================= */
.article-content {
    font-size: 1rem;
    line-height: 1.75;
    color: var(--color-text);
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    margin: 2em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

.article-content h2 { font-size: 1.2rem; }
.article-content h3 { font-size: 1.05rem; }
.article-content h4 { font-size: 1rem; }

.article-content p { margin: 0 0 1.25em; }
.article-content p:last-child { margin-bottom: 0; }

.article-content a {
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-content a:hover { opacity: 0.6; }

.article-content ul,
.article-content ol {
    margin: 0 0 1.25em;
    padding-left: 1.5em;
}

.article-content li { margin-bottom: 0.3em; }

.article-content blockquote {
    margin: 1.5em 0;
    padding-left: 1em;
    border-left: 2px solid var(--color-border);
    color: var(--color-muted);
    font-style: italic;
}

.article-content blockquote p { margin: 0; }

.article-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

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

.article-content pre {
    margin: 1.25em 0;
    padding: 1em 1.25em;
    background: #f5f5f5;
    border-radius: 4px;
    overflow-x: auto;
}

.article-content pre code {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.65;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.25em 0;
    font-size: 0.9rem;
}

.article-content th,
.article-content td {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    text-align: left;
}

.article-content th {
    background: #f5f5f5;
    font-weight: 600;
}

.article-content strong { font-weight: 600; }

/* =============================================================================
   Ghost Koenig Cards
   ============================================================================= */
.kg-card { margin: 1.5em 0; }

.kg-width-wide {
    position: relative;
    width: min(var(--wide-width), 100vw - 48px);
    margin-left: calc(50% - min(var(--wide-width), 100vw - 48px) / 2);
    margin-right: calc(50% - min(var(--wide-width), 100vw - 48px) / 2);
}

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

.kg-image-card figcaption {
    font-size: 0.8125rem;
    color: var(--color-faint);
    margin-top: 8px;
    text-align: center;
}

.kg-gallery-container { display: flex; flex-direction: column; gap: 6px; }
.kg-gallery-row { display: flex; gap: 6px; }
.kg-gallery-image { flex: 1; min-width: 0; overflow: hidden; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }

.kg-bookmark-card {
    border: 1px solid var(--color-border);
    border-radius: 4px;
    overflow: hidden;
}

.kg-bookmark-container { display: flex; text-decoration: none; color: inherit; }
.kg-bookmark-content { flex: 1; padding: 16px; min-width: 0; }
.kg-bookmark-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.kg-bookmark-description { font-size: 0.8125rem; color: var(--color-muted); line-height: 1.5; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--color-faint); margin-top: 10px; }
.kg-bookmark-icon { width: 14px; height: 14px; }
.kg-bookmark-thumbnail { width: 120px; flex-shrink: 0; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.kg-callout-card {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #f5f5f5;
    border-radius: 4px;
}

.kg-callout-text { font-size: 0.9375rem; line-height: 1.6; }

.kg-code-card pre {
    margin: 0;
    padding: 1em 1.25em;
    background: #f5f5f5;
    border-radius: 4px;
    overflow-x: auto;
}

.kg-code-card code {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.65;
}

.kg-button-card { display: flex; margin: 1.5em 0; }
.kg-btn {
    display: inline-block;
    padding: 9px 18px;
    background: var(--color-text);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 4px;
    text-decoration: none;
}

.kg-btn:hover { opacity: 0.8; }

.kg-divider-card { border: none; border-top: 1px solid var(--color-border); margin: 2em 0; }

/* =============================================================================
   Article Footer
   ============================================================================= */
.article-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.article-tags { display: flex; gap: 8px; flex-wrap: wrap; }

.article-tag-pill {
    font-size: 0.8125rem;
    color: var(--color-faint);
    text-decoration: none;
}

.article-tag-pill:hover { opacity: 0.6; }

.article-share {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.share-label {
    font-size: 0.8125rem;
    color: var(--color-faint);
}

.share-link {
    font-size: 0.8125rem;
    color: var(--color-faint);
    text-decoration: none;
    display: flex;
}

.share-link:hover { opacity: 0.6; }

/* =============================================================================
   Author Card
   ============================================================================= */
.author-card {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.author-card-avatar,
.author-card-avatar-placeholder { display: none; }

.author-card-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 4px;
}

.author-card-name:hover { opacity: 0.6; }

.author-card-bio {
    font-size: 0.875rem;
    color: var(--color-muted);
    line-height: 1.5;
}

/* =============================================================================
   Pagination
   ============================================================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    margin-top: 0;
    font-size: 0.875rem;
}

.older-posts,
.newer-posts {
    color: var(--color-muted);
    text-decoration: none;
}

.older-posts:hover,
.newer-posts:hover { color: var(--color-text); opacity: 1; }

.page-number { color: var(--color-faint); }

/* =============================================================================
   Error pages
   ============================================================================= */
.error-page { padding: 80px 0; }

.error-content { display: flex; flex-direction: column; gap: 12px; }

.error-code {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-faint);
    line-height: 1;
}

.error-title { font-size: 1.25rem; font-weight: 600; }

.error-desc { font-size: 0.9rem; color: var(--color-muted); }

.error-home-link {
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: underline;
    text-underline-offset: 2px;
    width: fit-content;
}

.error-home-link:hover { opacity: 0.6; }

/* =============================================================================
   Footer
   ============================================================================= */
.site-footer {
    padding: 32px 0 40px;
    border-top: 1px solid var(--color-border);
}

.site-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-copy {
    font-size: 0.8125rem;
    color: var(--color-faint);
}

.footer-copy a { color: var(--color-faint); text-decoration: none; }
.footer-copy a:hover { opacity: 0.6; }

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

.footer-nav a {
    font-size: 0.8125rem;
    color: var(--color-faint);
    text-decoration: none;
}

.footer-nav a:hover { opacity: 0.6; }

.footer-ghost {
    font-size: 0.8125rem;
    color: var(--color-faint);
}

.footer-ghost a { color: var(--color-faint); text-decoration: none; }
.footer-ghost a:hover { opacity: 0.6; }

/* =============================================================================
   Ghost Portal — hide floating launcher button
   ============================================================================= */
iframe[title="portal-trigger"] {
    display: none !important;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 640px) {
    .post-card { flex-direction: column; gap: 2px; }
    .article-title { font-size: 1.25rem; }
    .site-footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
    .article-footer { flex-direction: column; align-items: flex-start; }
    .article-share { margin-left: 0; }
}
