/* Almost Autonomous — Custom Theme
   Dark, minimal, technical. The writing is the design. */

/* ============================================
   VARIABLES
   ============================================ */
:root {
    --bg: #0d0f11;
    --bg-raised: #14171b;
    --bg-hover: #1a1e23;
    --text: #c8cdd3;
    --text-bright: #e4e8ec;
    --text-muted: #6b7280;
    --accent: #d4915e;
    --accent-dim: #a06b3f;
    --border: #1e2329;
    --code-bg: #111419;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --content-width: 720px;
    --wide-width: 960px;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    -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;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    color: var(--text-bright);
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
}

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

.site-title {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    letter-spacing: -0.02em;
    text-transform: lowercase;
}

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

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

.site-nav a {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: lowercase;
    letter-spacing: 0.03em;
}

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

/* ============================================
   MAIN CONTENT
   ============================================ */
.site-content {
    flex: 1;
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 3rem 2rem;
    width: 100%;
}

/* ============================================
   HOME / INDEX
   ============================================ */
.home-container {
    max-width: var(--content-width);
}

.site-description {
    font-family: var(--font-ui);
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
    line-height: 1.5;
}

/* ============================================
   POST CARDS (index)
   ============================================ */
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post-card {
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

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

.post-card-title {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

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

.post-card-title a:hover {
    color: var(--accent);
}

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

.post-card-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 1.5rem;
}

/* ============================================
   POST (full)
   ============================================ */
.post-full {
    max-width: var(--content-width);
}

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

.post-title {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-bright);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.post-meta {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 1.5rem;
}

/* Post body content */
.post-content {
    font-size: 1rem;
    line-height: 1.8;
}

.post-content h2 {
    font-family: var(--font-mono);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 3rem 0 1rem;
    letter-spacing: -0.02em;
}

.post-content h3 {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-bright);
    margin: 2.5rem 0 0.75rem;
}

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

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

.post-content em {
    font-style: italic;
}

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

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

.post-content li::marker {
    color: var(--accent-dim);
}

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

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

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

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

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

/* Images */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1.5rem 0;
}

/* Links within content */
.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-dim);
    text-underline-offset: 2px;
}

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

/* ============================================
   POST FOOTER (tags)
   ============================================ */
.post-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.post-tags .tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-raised);
    padding: 0.25rem 0.75rem;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.post-tags .tag:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
}

/* ============================================
   AUTHOR / TAG HEADERS
   ============================================ */
.author-header,
.tag-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.author-name,
.tag-name {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}

.author-bio,
.tag-description {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.pagination a {
    color: var(--text-muted);
}

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

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--wide-width);
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-text {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    html {
        font-size: 16px;
    }

    .header-inner {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .site-content {
        padding: 2rem 1.25rem;
    }

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

    .post-content h2 {
        font-size: 1.2rem;
    }
}

/* ============================================
   GHOST-SPECIFIC OVERRIDES
   ============================================ */

/* Ghost membership/subscribe forms */
.gh-portal-triggerbtn-container,
.footer-cta {
    display: none !important;
}

/* Ghost notification bar */
.gh-notification {
    font-family: var(--font-ui);
}

/* ============================================
   GHOST KOENIG CARD OVERRIDES
   ============================================ */

/* Card widths */
.kg-width-wide {
    max-width: var(--wide-width);
    margin-left: calc(50% - var(--wide-width) / 2);
    margin-right: calc(50% - var(--wide-width) / 2);
}

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

/* Image cards */
.kg-image-card {
    margin: 1.5rem 0;
}

.kg-image-card img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.kg-image-card figcaption {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.75rem;
}

/* Bookmark cards */
.kg-bookmark-card {
    margin: 1.5rem 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

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

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

.kg-bookmark-title {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 0.5rem;
}

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

.kg-bookmark-metadata {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

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

/* Callout cards */
.kg-callout-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    display: flex;
    gap: 0.75rem;
}

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

.kg-callout-text {
    color: var(--text);
    line-height: 1.6;
}

/* Toggle/accordion cards */
.kg-toggle-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 1.5rem 0;
    padding: 1.25rem;
}

.kg-toggle-heading {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-bright);
    cursor: pointer;
}

.kg-toggle-content {
    margin-top: 1rem;
    color: var(--text);
}

/* Gallery cards */
.kg-gallery-card {
    margin: 1.5rem 0;
}

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

.kg-gallery-image img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

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

.kg-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--accent);
    color: var(--bg);
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

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

/* Header cards */
.kg-header-card {
    background: var(--bg-raised);
    padding: 3rem 2rem;
    margin: 1.5rem 0;
    text-align: center;
    border-radius: 4px;
}

.kg-header-card h2 {
    font-family: var(--font-mono);
    color: var(--text-bright);
}

/* ============================================
   POST CARD IMAGES
   ============================================ */
.post-card.has-image {
    display: flex;
    flex-direction: column;
}

.post-card-image-link {
    display: block;
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: 4px;
}

.post-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.post-card-image:hover {
    opacity: 0.85;
}

.post-card-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent-dim);
}

.post-card-tag:hover {
    color: var(--accent);
}

/* ============================================
   POST FEATURE IMAGE (full post)
   ============================================ */
.post-feature-image {
    margin-bottom: 2.5rem;
    border-radius: 4px;
    overflow: hidden;
}

.post-feature-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}
