/* ==========================================================================
   Spectra — Dark Mint Ghost Theme
   ========================================================================== */

/* 1. Custom Properties
   ========================================================================== */

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-elevated: #1a1a1a;
    --bg-hover: #0d1f16;

    --text-primary: #e0e0e0;
    --text-secondary: #888888;
    --text-muted: #555555;

    --accent-mint: #00d4aa;
    --accent-green: #4ade80;
    --accent-dim: #0a3d2e;

    --border: #1e1e1e;
    --border-hover: #2a3a2a;

    --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", "Cascadia Code", monospace;
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    --content-width: 720px;
    --wide-width: 960px;
    --gap: 1.5rem;
}

/* 2. Reset / Base
   ========================================================================== */

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

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

body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent-mint);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-green);
}

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

ul, ol {
    padding-left: 1.5em;
}

/* 3. Typography
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono);
    font-weight: 500;
    line-height: 1.3;
    color: var(--text-primary);
    margin: 0 0 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p {
    margin: 0 0 1.5em;
}

blockquote {
    margin: 1.5em 0;
    padding: 0.75em 1.25em;
    border-left: 3px solid var(--accent-mint);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-style: italic;
}

blockquote p:last-child {
    margin-bottom: 0;
}

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

/* 4. Layout
   ========================================================================== */

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 2rem var(--gap);
}

.index-container {
    width: 100%;
}

/* 5. Header & Navigation
   ========================================================================== */

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

.header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.25rem var(--gap);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.site-title {
    text-decoration: none;
    color: var(--accent-mint);
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 500;
    white-space: nowrap;
}

.site-title:hover {
    color: var(--accent-green);
}

.site-title img {
    max-height: 28px;
    width: auto;
}

.site-nav .nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1.25rem;
}

.site-nav .nav-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-nav .nav-link:hover,
.site-nav .nav-link.nav-current {
    color: var(--accent-mint);
}

/* 6. Post List (Index)
   ========================================================================== */

.welcome {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.welcome-title {
    font-family: var(--font-mono);
    font-size: 2rem;
    color: var(--accent-mint);
    margin-bottom: 0.5rem;
}

.welcome-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.6;
}

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

.post-row-link {
    display: grid;
    grid-template-columns: 110px 1fr auto;
    gap: 1rem;
    align-items: baseline;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.post-row-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.post-row-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.post-row-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-row-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-dim);
    background: var(--bg-elevated);
    padding: 0.15em 0.5em;
    border-radius: 3px;
    white-space: nowrap;
}

/* 7. Post Content (Single)
   ========================================================================== */

.post {
    width: 100%;
}

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

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-meta .meta-sep {
    color: var(--border);
}

.post-meta .post-tag {
    color: var(--accent-mint);
    font-size: 0.8rem;
}

.post-title {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 0;
    line-height: 1.25;
}

.post-excerpt {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
    line-height: 1.6;
}

.post-image {
    margin: 2rem 0;
}

.post-image img {
    border-radius: 6px;
}

.post-image figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

/* gh-content: Ghost editor output styling */

.gh-content {
    font-size: 1.05rem;
    line-height: 1.8;
}

.gh-content > * + * {
    margin-top: 1.5em;
}

.gh-content h2 {
    margin-top: 2.5em;
    padding-top: 1em;
    border-top: 1px solid var(--border);
}

.gh-content h3 {
    margin-top: 2em;
}

.gh-content a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.gh-content a:hover {
    color: var(--accent-green);
}

.gh-content ul,
.gh-content ol {
    padding-left: 1.5em;
}

.gh-content li {
    margin-bottom: 0.5em;
}

.gh-content figure {
    margin: 2em 0;
}

.gh-content figcaption {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}

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

.gh-content th,
.gh-content td {
    padding: 0.6em 0.8em;
    border: 1px solid var(--border);
    text-align: left;
}

.gh-content th {
    background: var(--bg-secondary);
    font-family: var(--font-mono);
    font-weight: 500;
}

.gh-content td {
    background: var(--bg-primary);
}

/* Ghost card widths */
.gh-content .kg-width-wide {
    max-width: var(--wide-width);
    margin-left: calc((var(--content-width) - var(--wide-width)) / 2);
    margin-right: calc((var(--content-width) - var(--wide-width)) / 2);
}

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

/* Ghost bookmark card */
.gh-content .kg-bookmark-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.gh-content .kg-bookmark-container {
    display: flex;
    text-decoration: none;
    color: var(--text-primary);
}

.gh-content .kg-bookmark-content {
    flex: 1;
    padding: 1rem 1.25rem;
}

.gh-content .kg-bookmark-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
}

.gh-content .kg-bookmark-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gh-content .kg-bookmark-metadata {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.gh-content .kg-bookmark-icon {
    width: 16px;
    height: 16px;
}

.gh-content .kg-bookmark-thumbnail {
    width: 160px;
    min-height: 100%;
}

.gh-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Ghost gallery */
.gh-content .kg-gallery-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gh-content .kg-gallery-row {
    display: flex;
    gap: 0.5rem;
}

.gh-content .kg-gallery-image img {
    display: block;
    width: 100%;
    border-radius: 4px;
}

/* Ghost callout card */
.gh-content .kg-callout-card {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.gh-content .kg-callout-card-grey {
    background: var(--bg-elevated);
}

.gh-content .kg-callout-emoji {
    font-size: 1.2rem;
}

/* Post footer */

.post-footer {
    margin-top: 3rem;
    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(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-mint);
    background: var(--bg-elevated);
    padding: 0.2em 0.6em;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.post-tags a:hover {
    background: var(--accent-dim);
}

/* Related posts */

.related-posts {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.related-posts h3 {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* 8. Page
   ========================================================================== */

.page .post-header {
    margin-bottom: 2rem;
}

.page .post-title {
    font-size: 2rem;
}

/* 9. Tag & Author Archives
   ========================================================================== */

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

.archive-title {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    color: var(--accent-mint);
    margin-bottom: 0.25rem;
}

.archive-description {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
    line-height: 1.6;
}

/* 10. Pagination
   ========================================================================== */

.pagination {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.pagination a {
    color: var(--accent-mint);
}

.pagination a:hover {
    color: var(--accent-green);
}

.page-number {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* 11. Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 1.25rem var(--gap);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer-custom {
    color: var(--text-muted);
}

/* 12. Code Blocks
   ========================================================================== */

.gh-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--bg-elevated);
    color: var(--accent-green);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.gh-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.65;
    margin: 1.5em 0;
}

.gh-content pre code {
    background: none;
    color: var(--text-primary);
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Prism.js dark overrides */

.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #4a5568;
}

.token.punctuation {
    color: #718096;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
    color: var(--accent-mint);
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: var(--accent-green);
}

.token.operator,
.token.entity,
.token.url {
    color: #68d391;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #63b3ed;
}

.token.function,
.token.class-name {
    color: #f6ad55;
}

.token.regex,
.token.important,
.token.variable {
    color: #fc8181;
}

pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
    background: var(--accent-dim);
}

/* Line numbers (if enabled) */
.line-numbers .line-numbers-rows {
    border-right: 1px solid var(--border);
}

.line-numbers-rows > span::before {
    color: var(--text-muted);
}

/* 13. Error Pages
   ========================================================================== */

.error-page {
    text-align: center;
    padding: 4rem 0;
}

.error-page .error-code {
    font-family: var(--font-mono);
    font-size: 6rem;
    font-weight: 700;
    color: var(--accent-mint);
    line-height: 1;
    margin-bottom: 1rem;
}

.error-page .error-message {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.error-page .error-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-mint);
}

/* 14. Utilities
   ========================================================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 15. Media Queries
   ========================================================================== */

@media (max-width: 768px) {
    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.3rem; }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem var(--gap);
    }

    .site-nav .nav-list {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .welcome-title {
        font-size: 1.6rem;
    }

    .post-row-link {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        padding: 0.6rem 0.5rem;
    }

    .post-row-date {
        font-size: 0.7rem;
    }

    .post-row-tag {
        display: none;
    }

    .post-title {
        font-size: 1.6rem;
    }

    .site-main {
        padding: 1.5rem var(--gap);
    }

    .footer-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .gh-content .kg-bookmark-container {
        flex-direction: column;
    }

    .gh-content .kg-bookmark-thumbnail {
        width: 100%;
        min-height: 160px;
    }

    .pagination {
        font-size: 0.8rem;
    }
}
