/* ==========================================================================
   sgit-dark — Ghost Theme for blog.sgit.space
   Terminal/Hacker aesthetic, dark mode, minimal, professional
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0d2008;
    --surface: #1a4510;
    --surface-hover: #245a16;
    --accent: #43b02a;
    --accent-dim: rgba(67, 176, 42, 0.15);
    --text: #e8f5e8;
    --text-muted: #c8e6c8;
    --text-dim: #6b7f68;
    --code-bg: #0a1a06;
    --border: rgba(67, 176, 42, 0.2);
    --font-head: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 1200px;
    --content-width: 720px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.7;
    min-height: 100vh;
}

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

a:hover {
    color: #5cd43e;
}

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

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

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

/* ---------- Header ---------- */
.site-header {
    border-bottom: 1px solid var(--border);
    background: rgba(13, 32, 8, 0.95);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.site-logo {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0;
}

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

.logo-prompt {
    color: var(--accent);
    margin-right: 0.35rem;
}

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

.site-nav a {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

.site-nav a:hover {
    color: var(--accent);
}

.nav-blog-link {
    color: var(--accent) !important;
    font-weight: 600 !important;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    transition: 0.2s;
}

/* ---------- Hero / Section Header ---------- */
.site-hero {
    text-align: center;
    padding: 3rem 0 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.site-hero-title {
    font-family: var(--font-head);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.site-hero-description {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.site-hero-meta {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ---------- Author Hero ---------- */
.author-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.author-hero-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.author-hero-location {
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ---------- Post Feed (Grid) ---------- */
.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* ---------- Post Card ---------- */
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.post-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(67, 176, 42, 0.1);
}

.post-card-link {
    display: block;
    color: inherit;
}

.post-card-link:hover {
    color: inherit;
}

.post-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-content {
    padding: 1.25rem;
}

.post-card-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-card-title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.5rem 0;
    line-height: 1.3;
}

.post-card-excerpt {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.post-card-reading-time::before {
    content: "\00b7";
    margin-right: 0;
}

/* ---------- Featured Post Card ---------- */
.post-card--featured {
    border-color: var(--accent);
}

.post-card--featured .post-card-tag::before {
    content: "\2605 ";
}

/* ---------- Pagination ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 3rem 0 1rem;
    font-size: 0.9rem;
}

.pagination a {
    font-weight: 500;
}

.pagination-info {
    color: var(--text-dim);
}

/* ---------- Post Full (Single Post) ---------- */
.post-full {
    max-width: var(--content-width);
    margin: 0 auto;
}

.post-full-header {
    text-align: center;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.post-full-tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.post-full-title {
    font-family: var(--font-head);
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0.75rem 0 1rem;
}

.post-full-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.post-full-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-full-author a {
    color: var(--text-muted);
    font-weight: 500;
}

.post-full-author-image {
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

.post-full-reading-time::before {
    content: "\00b7";
    margin-right: 0;
}

/* ---------- Feature Image ---------- */
.post-full-image {
    margin: 0 0 2rem;
    border-radius: 8px;
    overflow: hidden;
}

.post-full-image img {
    width: 100%;
}

/* ---------- Post Content ---------- */
.post-full-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-muted);
}

.post-full-content h1,
.post-full-content h2,
.post-full-content h3,
.post-full-content h4,
.post-full-content h5,
.post-full-content h6 {
    font-family: var(--font-head);
    color: var(--text);
    margin: 2rem 0 0.75rem;
    line-height: 1.3;
}

.post-full-content h2 { font-size: 1.75rem; }
.post-full-content h3 { font-size: 1.4rem; }
.post-full-content h4 { font-size: 1.15rem; }

.post-full-content p {
    margin-bottom: 1.25rem;
}

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

.post-full-content strong {
    color: var(--text);
    font-weight: 600;
}

.post-full-content ul,
.post-full-content ol {
    margin: 0 0 1.25rem 1.5rem;
}

.post-full-content li {
    margin-bottom: 0.4rem;
}

.post-full-content blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}

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

.post-full-content img {
    border-radius: 6px;
    margin: 1.5rem 0;
}

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

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

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

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

.post-full-content th {
    background: var(--code-bg);
    color: var(--text);
    font-weight: 600;
}

.post-full-content td {
    background: rgba(22, 27, 34, 0.5);
}

/* ---------- Code ---------- */
.post-full-content code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--code-bg);
    color: var(--accent);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.post-full-content pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.5;
}

.post-full-content pre code {
    background: none;
    color: var(--text-muted);
    padding: 0;
    font-size: 0.85rem;
}

/* ---------- Post Footer ---------- */
.post-full-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-full-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.post-tag {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: var(--accent-dim);
    color: var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.post-tag:hover {
    background: rgba(67, 176, 42, 0.25);
    color: var(--accent);
}

/* ---------- Author Card ---------- */
.post-full-author-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.author-card-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}

.author-card-content h4 {
    font-family: var(--font-head);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.author-card-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---------- Related Posts ---------- */
.post-related {
    max-width: var(--content-width);
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-related-title {
    font-family: var(--font-head);
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.post-related-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* ---------- Error Page ---------- */
.error-page {
    text-align: center;
    padding: 6rem 1.5rem;
}

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

.error-message {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.error-link {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    background: var(--accent);
    color: var(--bg);
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.2s;
}

.error-link:hover {
    background: #5cd43e;
    color: var(--bg);
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.5rem;
    text-align: center;
    margin-top: auto;
}

.site-footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.site-footer-tagline {
    font-family: var(--font-head);
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.site-footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.site-footer-nav a {
    font-size: 0.85rem;
    color: var(--text-dim);
}

.site-footer-nav a:hover {
    color: var(--accent);
}

.site-footer-copy {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.site-footer-copy a {
    color: var(--text-dim);
}

.site-footer-copy a:hover {
    color: var(--accent);
}

/* ---------- Ghost-specific: kg-cards ---------- */
.kg-width-wide {
    margin-left: -5vw;
    margin-right: -5vw;
    max-width: calc(var(--content-width) + 10vw);
}

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

.kg-width-full img {
    border-radius: 0;
}

.kg-bookmark-card {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin: 1.5rem 0;
}

.kg-bookmark-card a {
    display: flex;
    text-decoration: none;
    color: inherit;
}

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

.kg-bookmark-title {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.kg-bookmark-description {
    font-size: 0.85rem;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kg-bookmark-metadata {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}

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

.kg-bookmark-thumbnail {
    width: 160px;
    flex-shrink: 0;
}

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

.kg-gallery-card {
    margin: 1.5rem 0;
}

.kg-gallery-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kg-gallery-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.kg-gallery-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.kg-callout-card {
    background: var(--code-bg);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.kg-callout-emoji {
    font-size: 1.2em;
}

.kg-callout-text {
    flex: 1;
}

.kg-button-card {
    margin: 1.5rem 0;
    text-align: center;
}

.kg-btn {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.kg-btn-accent {
    background: var(--accent);
    color: var(--bg);
}

.kg-btn-accent:hover {
    background: #5cd43e;
    color: var(--bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .site-nav a:not(:last-child) {
        display: none;
    }

    .site-nav {
        gap: 0;
    }

    .nav-toggle {
        display: flex;
    }

    /* Mobile nav open state (toggled via JS if needed) */
    .site-nav.is-open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 1.5rem;
        z-index: 200;
    }

    .site-nav.is-open a {
        display: block;
        font-size: 1.25rem;
    }

    .site-hero-title {
        font-size: 1.75rem;
    }

    .post-full-title {
        font-size: 1.75rem;
    }

    .post-feed {
        grid-template-columns: 1fr;
    }

    .post-related-feed {
        grid-template-columns: 1fr;
    }

    .kg-bookmark-card a {
        flex-direction: column;
    }

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

@media (max-width: 480px) {
    .site-main {
        padding: 1.25rem 1rem;
    }

    .post-card-content {
        padding: 1rem;
    }

    .error-code {
        font-size: 4rem;
    }
}

/* ---------- Selection ---------- */
::selection {
    background: rgba(67, 176, 42, 0.3);
    color: var(--text);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(67, 176, 42, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
