/**
 * Post Page Styles
 * Only loaded on blog post pages
 */

/* Reading progress bar */
#reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #059669);
    z-index: 100;
    transition: width 0.1s ease-out;
}

/* Social share sticky sidebar */
.social-share-sidebar {
    position: sticky;
    top: 8rem;
}

/* Article prose styles */
.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #374151;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    overflow: hidden;
}

.post-content figure,
.post-content img,
.post-content video,
.post-content iframe,
.post-content pre,
.post-content table {
    max-width: 100%;
    overflow-x: auto;
}

.post-content figure > * {
    max-width: 100%;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    color: #111827;
    margin-top: 2em;
    margin-bottom: 0.75em;
    line-height: 1.3;
}

.post-content h1 { font-size: 2.25rem; }
.post-content h2 { font-size: 1.875rem; }
.post-content h3 { font-size: 1.5rem; }
.post-content h4 { font-size: 1.25rem; }

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

.post-content a {
    color: #059669;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s;
}

.post-content a:hover { color: #047857; }

.post-content strong {
    font-weight: 600;
    color: #111827;
}

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

.post-content ul,
.post-content ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.post-content ul { list-style-type: disc; }
.post-content ol { list-style-type: decimal; }
.post-content li { margin-bottom: 0.5em; }

.post-content blockquote {
    border-left: 4px solid #10b981;
    padding: 1.5em;
    margin: 2em 0;
    font-style: italic;
    color: #4b5563;
    background: #f9fafb;
    border-radius: 0 0.75rem 0.75rem 0;
}

.post-content code {
    background: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.9em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.post-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.5em;
    border-radius: 0.75rem;
    overflow-x: auto;
    margin: 2em 0;
}

.post-content pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 2em 0;
}

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

.post-content figcaption {
    text-align: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.75em;
}

.post-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 3em 0;
}

.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
}

/* .post-content th,
.post-content td {
    border: 1px solid #e5e7eb;
    padding: 0.75em 1em;
    text-align: left;
} */

/* .post-content th {
    background: #f9fafb;
    font-weight: 600;
} */

.post-content .kg-image-card img {
    margin: auto;
}

/* Ghost Bookmark Card */
.post-content .kg-bookmark-card {
    margin: 2em 0;
    width: 100%;
}

.post-content .kg-bookmark-container {
    display: flex;
    min-height: 148px;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.post-content .kg-bookmark-container:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    text-decoration: none;
}

.post-content .kg-bookmark-content {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex-grow: 1;
    padding: 1.25rem;
    overflow: hidden;
    min-width: 0;
}

.post-content .kg-bookmark-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content .kg-bookmark-description {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content .kg-bookmark-metadata {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.75rem;
    font-size: 0.8125rem;
    color: #6b7280;
}

.post-content .kg-bookmark-icon {
    width: 20px;
    height: 20px;
    border-radius: 0.25rem;
    margin: 0;
}

.post-content .kg-bookmark-author,
.post-content .kg-bookmark-publisher {
    line-height: 1;
}

.post-content .kg-bookmark-author::after {
    content: "\00b7";
    margin-left: 0.5rem;
}

.post-content .kg-bookmark-thumbnail {
    flex-shrink: 0;
    width: 200px;
}

.post-content .kg-bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

@media (max-width: 640px) {
    .post-content .kg-bookmark-container {
        flex-direction: column;
    }

    .post-content .kg-bookmark-thumbnail {
        width: 100%;
        height: 160px;
        order: -1;
    }
}

/* ============================================
   DARK MODE STYLES FOR POST CONTENT
   ============================================ */

html.dark .post-content {
    color: var(--text-secondary);
}

html.dark .post-content h1,
html.dark .post-content h2,
html.dark .post-content h3,
html.dark .post-content h4,
html.dark .post-content h5,
html.dark .post-content h6 {
    color: var(--text-primary);
}

html.dark .post-content a {
    color: #34d399;
}

html.dark .post-content a:hover {
    color: #10b981;
}

html.dark .post-content strong {
    color: var(--text-primary);
}

html.dark .post-content blockquote {
    background: var(--blockquote-bg);
    color: var(--blockquote-text);
    border-left-color: #10b981;
}

html.dark .post-content code {
    background: var(--code-bg);
    color: var(--code-text);
}

html.dark .post-content pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    border: 1px solid var(--border-primary);
}

html.dark .post-content .kg-code-card pre {
    background: var(--bg-secondary);
}

html.dark .post-content pre code {
    background: transparent;
    color: inherit;
}

html.dark .post-content hr {
    border-top-color: var(--border-primary);
}

html.dark .post-content th,
html.dark .post-content td {
    border-color: var(--table-border);
}

html.dark .post-content th {
    background: var(--table-header-bg);
}

html.dark .post-content tr {
    background-color: transparent !important;
}
html.dark .post-content td {
    color: var(--text-secondary) !important;
}
html.dark .post-content td:first-child {
    color: var(--text-primary) !important;
}

html.dark .post-content figcaption {
    color: var(--text-muted);
}

html.dark .post-content .kg-bookmark-container {
    border-color: var(--border-primary);
    background: var(--bg-secondary);
}

html.dark .post-content .kg-bookmark-container:hover {
    border-color: #10b981;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

html.dark .post-content .kg-bookmark-title {
    color: var(--text-primary);
}

html.dark .post-content .kg-bookmark-description {
    color: var(--text-muted);
}

html.dark .post-content .kg-bookmark-metadata {
    color: var(--text-muted);
}
