:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
}


.blog-main,
.post-main {
    min-height: 100vh;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

.blog-container,
.post-container {
    max-width: 1200px;
    margin: 0 auto;
}

.post-container {
    max-width: 800px;
}


.blog-header {
    text-align: center;
    margin-bottom: 4rem;
}

.blog-header .back-link {
    display: inline-block;
    color: var(--fg-muted);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: color 0.2s;
}

.blog-header .back-link:hover {
    color: var(--fg);
}

.blog-header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #e0f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.blog-subtitle {
    font-size: 1.25rem;
    color: var(--fg-muted);
}


.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-label {
    color: var(--fg);
    font-weight: 500;
}

.tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--fg);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tag:hover,
.tag.active {
    background: var(--primary);
    color: var(--fg);
    border-color: var(--primary);
    transform: translateY(-2px);
}


.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.post-card {
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    transition: all 0.3s;
}

.post-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.post-card-header {
    margin-bottom: 1rem;
}

.post-date {
    color: var(--fg-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.post-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.post-title a {
    color: var(--fg);
    text-decoration: none;
    transition: color 0.2s;
}

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

.post-excerpt {
    color: var(--fg-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

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

.post-tags .tag {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

.post-read-more {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    margin-top: 1rem;
    transition: color 0.2s;
}

.post-read-more:hover {
    color: var(--accent);
}


.post-container .back-link {
    display: inline-block;
    color: var(--fg-muted);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 2rem;
    transition: color 0.2s;
}

.post-container .back-link:hover {
    color: var(--fg);
}

.post-article {
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 3rem;
}

.post-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.post-header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--fg);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.post-meta time {
    color: var(--fg-muted);
    font-size: 0.95rem;
}


.markdown-content,
.markdown-preview {
    color: var(--fg);
    line-height: 1.8;
}

.markdown-content h1,
.markdown-preview h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--fg);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.markdown-content h2,
.markdown-preview h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--fg);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.markdown-content h3,
.markdown-preview h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--fg);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.markdown-content p,
.markdown-preview p {
    margin-bottom: 1.25rem;
}

.markdown-content a,
.markdown-preview a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.markdown-content a:hover,
.markdown-preview a:hover {
    border-bottom-color: var(--primary);
}

.markdown-content ul,
.markdown-content ol,
.markdown-preview ul,
.markdown-preview ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.markdown-content li,
.markdown-preview li {
    margin-bottom: 0.5rem;
}

.markdown-content code,
.markdown-preview code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.markdown-content pre,
.markdown-preview pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.markdown-content pre code,
.markdown-preview pre code {
    background: transparent;
    padding: 0;
}

.markdown-content blockquote,
.markdown-preview blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--fg-muted);
    font-style: italic;
}

.markdown-content img,
.markdown-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

.markdown-content table,
.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.markdown-content th,
.markdown-content td,
.markdown-preview th,
.markdown-preview td {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.markdown-content th,
.markdown-preview th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}


.empty-state,
.error-state {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
}

.empty-state p,
.error-state p {
    color: var(--fg-muted);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.error-state h1 {
    font-size: 2rem;
    color: var(--fg);
    margin-bottom: 1rem;
}


.share-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.share-title {
    font-size: 1.125rem;
    color: var(--fg);
    margin-bottom: 1rem;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--fg);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.share-btn svg {
    width: 18px;
    height: 18px;
}

.share-x:hover {
    background: rgba(0, 0, 0, 0.2);
    border-color: #ffffff;
    color: var(--fg);
}

.share-linkedin:hover {
    background: rgba(0, 119, 181, 0.1);
    border-color: var(--share-linkedin, #005e8f);
    color: var(--share-linkedin, #005e8f);
}

.share-facebook:hover {
    background: rgba(24, 119, 242, 0.1);
    border-color: var(--share-facebook, #0b5ed7);
    color: var(--share-facebook, #0b5ed7);
}

.share-email:hover {
    background: rgba(234, 67, 53, 0.1);
    border-color: var(--share-email, #c5221f);
    color: var(--share-email, #c5221f);
}


.blog-header-top,
.post-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.blog-header-top .contact-btn,
.post-header-top .contact-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}


@media (max-width: 768px) {
    .blog-main,
    .post-main {
        padding: 2rem 1rem;
    }

    .blog-header h1 {
        font-size: 2.5rem;
    }

    .blog-subtitle {
        font-size: 1rem;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .post-article {
        padding: 2rem 1.5rem;
    }

    .post-header h1 {
        font-size: 2rem;
    }

    .tags-filter {
        flex-direction: column;
        align-items: flex-start;
    }

    .blog-header-top,
    .post-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .blog-header h1 {
        font-size: 2rem;
    }

    .post-header h1 {
        font-size: 1.75rem;
    }

    .post-article {
        padding: 1.5rem 1rem;
    }
}



.code-wrap,
.region-wrap {
    position: relative;
    margin: 1.5rem 0;
}

.code-wrap pre {
    margin: 0;
    background: #0f172a;
    color: #e2e8f0;
    padding: 1.25rem;
    padding-top: 2.75rem;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.code-wrap pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
    white-space: pre;
}

.code-copy,
.region-copy {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.code-copy:hover,
.region-copy:hover {
    background: rgba(148, 163, 184, 0.3);
    color: #f8fafc;
}

.code-copy.copied {
    background: #16a34a;
    border-color: #16a34a;
    color: var(--fg);
}


.region-copy {
    color: var(--fg-muted, #475569);
    background: rgba(100, 116, 139, 0.1);
    border-color: rgba(100, 116, 139, 0.25);
    opacity: 0;
}

.region-wrap:hover .region-copy,
.region-copy:focus {
    opacity: 1;
}


.post-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.post-content table td,
.post-content table th {
    border: 1px solid var(--gray-300, #cbd5e1);
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}

.post-content table th {
    background: var(--gray-100, #f1f5f9);
    font-weight: 600;
    text-align: left;
}


.post-content :not(pre) > code {
    background: rgba(100, 116, 139, 0.12);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
}


.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}



.post-cover {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 2rem;
}

.post-card-cover {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 10px 10px 0 0;
    display: block;
    background: var(--gray-100, #f1f5f9);
}



.post-toc {
    background: rgba(100, 116, 139, 0.06);
    border-left: 3px solid var(--primary, #3b82f6);
    border-radius: 0 8px 8px 0;
    padding: 1rem 1.25rem;
    margin: 0 0 2rem;
    font-size: 0.9rem;
}

.post-toc > strong {
    display: block;
    margin-bottom: 0.5rem;
}

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

.post-toc li {
    margin: 0.25rem 0;
}

.post-toc li.toc-h3 {
    padding-left: 1.1rem;
    font-size: 0.85rem;
}

.post-toc a {
    color: inherit;
    text-decoration: none;
    opacity: 0.85;
}

.post-toc a:hover {
    opacity: 1;
    text-decoration: underline;
}



.gdoc-embed {
    margin: 1.5rem 0;
}

.gdoc-embed iframe {
    width: 100%;
    height: min(70vh, 560px);
    border: 1px solid var(--line, #dfe3e8);
    border-radius: 10px;
    background: #fff;
}

.gdoc-embed figcaption {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    text-align: center;
}


.drive-preview-btn {
    margin-left: 0.5rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-family: inherit;
    color: var(--fg-muted, #5b6472);
    background: var(--bg-inset, #eef1f5);
    border: 1px solid var(--line, #dfe3e8);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}

.drive-preview-btn:hover {
    color: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
}

.drive-frame {
    margin: 0.75rem 0 1.25rem;
}

.drive-frame iframe {
    width: 100%;
    height: min(65vh, 520px);
    border: 1px solid var(--line, #dfe3e8);
    border-radius: 10px;
    background: #fff;
}



.post-locked {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-soft, #f6f8fa);
    border: 1px solid var(--line, #dfe3e8);
    border-radius: 12px;
    margin: 1.5rem 0;
}

.post-locked__icon { font-size: 2.5rem; line-height: 1; margin-bottom: 0.75rem; }
.post-locked h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.post-locked p { color: var(--fg-muted, #5b6472); margin: 0 0 1.25rem; }
.post-locked__error { color: var(--danger, #dc2626); font-weight: 600; }

.post-locked__form {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 420px;
    margin: 0 auto;
}

.post-locked__form input {
    flex: 1 1 200px;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--fg, #1a1d23);
    background: var(--surface, #fff);
    border: 1px solid var(--line-strong, #c3c9d2);
    border-radius: 8px;
}

.post-lock { font-size: 0.85em; opacity: 0.75; }

.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;
}


.img-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 5rem;
    margin: 1.25rem 0;
    padding: 1rem;
    font-size: 0.8rem;
    color: var(--fg-subtle, #7d8694);
    background: var(--bg-inset, #eef1f5);
    border: 1px dashed var(--line-strong, #c3c9d2);
    border-radius: 8px;
}
