/* ============================================================
   Blog Post Content — scoped; uses PyGuru design tokens
   ============================================================ */

article.article--rich-content {
    overflow: visible;
}

/* ---- CKEditor admin preview ---- */
body.blog-post-content.cke_editable {
    max-width: 820px;
    margin: 0 auto;
    padding: 24px 16px 48px;
    background: #ffffff;
}

/* ---- Wrapper ---- */
.blog-post-content {
    font-family: var(--font-primary, 'Fira Code', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 17.5px;
    line-height: 1.9;
    color: var(--color-body-white);
    padding: 0 !important;
    text-align: left !important;
}

.blog-post-content > article {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 24px 8px 48px !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: var(--color-body-white) !important;
}

/* ---- Typography (override inline indigo from automation HTML) ---- */
.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3,
.blog-post-content h4 {
    color: var(--color-heading-wv) !important;
    font-family: var(--font-primary, inherit);
}

.blog-post-content h1 {
    font-size: 2.35em;
    font-weight: 800;
    margin: 0.1em 0 0.6em;
    line-height: 1.22;
    letter-spacing: -0.025em;
}

.blog-post-content h2 {
    font-size: 1.7em;
    font-weight: 700;
    margin: 2.8em 0 0.8em;
    line-height: 1.3;
    padding-bottom: 0.45em;
    border-bottom: 3px solid var(--color-primary) !important;
    letter-spacing: -0.015em;
}

.blog-post-content h3 {
    font-size: 1.28em;
    font-weight: 700;
    margin: 2.2em 0 0.55em;
    line-height: 1.4;
}

.blog-post-content h4 {
    font-size: 1.08em;
    font-weight: 600;
    margin: 1.8em 0 0.4em;
}

.blog-post-content p {
    margin: 0 0 1.5em;
    color: var(--color-body-white) !important;
    text-align: justify;
    text-justify: inter-word;
    hyphens: auto;
    -webkit-hyphens: auto;
    line-height: 1.9;
    font-size: 1em;
}

.blog-post-content strong,
.blog-post-content b {
    font-weight: 700;
    color: var(--color-heading-wv) !important;
}

.blog-post-content ul,
.blog-post-content ol {
    margin: 0.5em 0 1.6em 0;
    padding: 0 0 0 1.6em;
    color: var(--color-body-white);
}

.blog-post-content li {
    margin: 0.55em 0;
    color: var(--color-body-white) !important;
    line-height: 1.8;
    text-align: justify;
}

.blog-post-content hr {
    border: none;
    border-top: 2px solid var(--color-border);
    margin: 3em 0;
}

/* ---- Inline code ---- */
.blog-post-content p code,
.blog-post-content li code,
.blog-post-content div code:not(pre code) {
    background: rgba(255, 1, 79, 0.06) !important;
    color: var(--color-primary) !important;
    padding: 2px 7px !important;
    border-radius: 5px !important;
    font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace !important;
    font-size: 0.875em !important;
    border: 1px solid rgba(255, 1, 79, 0.16) !important;
    word-break: break-word;
}

/* ---- Cover figure (site accent) ---- */
.blog-post-content figure {
    margin: 2em 0 2.8em;
    padding: 6px;
    /*background: linear-gradient(155deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%) !important;*/
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
}

/* Keep content images responsive when editors add fixed dimensions */
.blog-post-content img {
    max-width: 100%;
    height: auto;
}

.blog-post-content figure > div {
    border-radius: 12px;
    overflow: hidden;
    background: #0f3460;
    aspect-ratio: 16 / 9;
    position: relative;
}

.blog-post-content figure img,
.blog-post-content img.blog-post-content__cover-img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100%;
    min-height: 0;
    max-height: none;
    object-fit: cover;
    object-position: center;
    display: block;
    border-radius: 16px;
    /*box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);*/
}

.blog-post-content img.blog-post-content__cover-img:not(figure img) {
    aspect-ratio: 16 / 9;
    height: auto;
}

/* ---- FAQ ---- */
.blog-post-content section[itemtype*="FAQPage"],
.blog-post-content section {
    margin: 3.5em 0 1em;
}

/* ---- Code blocks ---- */
.blog-post-content .code-block-wrap {
    position: relative;
    margin: 2em 0;
    border-radius: 0 12px 12px 12px;
    overflow: visible;
}

.blog-post-content .code-block-wrap > div:first-child:not(.code-block-inner) {
    display: inline-block;
    background: var(--color-primary) !important;
    color: #fff !important;
    font-size: 0.68em;
    padding: 3px 9px;
    border-radius: 5px 5px 0 0;
    font-family: 'Fira Code', Consolas, monospace;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 9px !important;
    line-height: 1.8;
    user-select: none;
}

.blog-post-content .code-block-inner {
    position: relative !important;
    overflow: visible;
    display: block;
}

.blog-post-content pre {
    position: relative;
    z-index: 1;
    background: #0d1013 !important;
    color: #c4cfde !important;
    padding: 3rem 4.5rem 1.6em 1.75em !important;
    border-radius: 12px !important;
    overflow-x: auto !important;
    font-family: 'Fira Code', Consolas, monospace !important;
    font-size: 0.875em !important;
    line-height: 1.75 !important;
    border: 1px solid #212428 !important;
    white-space: pre !important;
    word-break: normal !important;
    word-wrap: normal !important;
    margin: 0 !important;
}

.blog-post-content pre code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-size: 1em !important;
    border: none !important;
    white-space: pre !important;
    word-break: normal !important;
    display: block;
}

/* ---- Copy button ---- */
.blog-post-content .code-copy-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    z-index: 10 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-width: 76px;
    height: 34px;
    margin: 0 !important;
    padding: 0 14px !important;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    color: #f0f6fc !important;
    background: rgba(13, 16, 19, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    border-radius: 8px !important;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    -webkit-font-smoothing: antialiased;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    white-space: nowrap;
    user-select: none;
    float: none !important;
    width: auto !important;
    max-width: none !important;
    transform: none;
}

.blog-post-content .code-copy-btn::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f0f6fc' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
    opacity: 0.9;
}

.blog-post-content .code-copy-btn:hover {
    background: var(--color-primary) !important;
    border-color: rgba(255, 1, 79, 0.5) !important;
    box-shadow: 0 4px 18px rgba(255, 1, 79, 0.35);
    color: #ffffff !important;
}

.blog-post-content .code-copy-btn:active {
    transform: scale(0.97);
}

.blog-post-content .code-copy-btn.copied {
    background: #16a34a !important;
    border-color: rgba(134, 239, 172, 0.55) !important;
    box-shadow: 0 4px 18px rgba(22, 163, 74, 0.35);
    color: #ffffff !important;
}

.blog-post-content .code-copy-btn.copied::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* ---- FAQ items ---- */
.blog-post-content [itemscope][itemtype*="Question"] {
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin: 1em 0;
    overflow: hidden;
    box-shadow: var(--shadow-white-3);
    background: var(--gradient-box-w);
    transition: box-shadow 0.2s ease;
}

.blog-post-content [itemscope][itemtype*="Question"]:hover {
    box-shadow: 0 8px 28px rgba(255, 1, 79, 0.1);
}

.blog-post-content [itemprop="name"] {
    background: rgba(255, 1, 79, 0.05);
    padding: 1em 1.4em;
    font-weight: 600;
    color: var(--color-heading-wv) !important;
    margin: 0;
    font-size: 0.98em;
    line-height: 1.6;
    border-bottom: 1px solid var(--color-border);
}

.blog-post-content [itemprop="acceptedAnswer"] {
    padding: 1em 1.4em;
    color: var(--color-body-white);
    line-height: 1.8;
    text-align: justify;
    text-justify: inter-word;
}

.blog-post-content [itemprop="acceptedAnswer"] p {
    margin: 0;
    color: var(--color-body-white) !important;
}

/* ---- Scrollbar ---- */
.blog-post-content pre::-webkit-scrollbar {
    height: 6px;
}

.blog-post-content pre::-webkit-scrollbar-track {
    background: #161b22;
    border-radius: 0 0 12px 12px;
}

.blog-post-content pre::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 3px;
}

.blog-post-content pre::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .blog-post-content {
        font-size: 15.5px;
    }

    .blog-post-content > article {
        padding: 12px 0 32px !important;
    }

    .blog-post-content h1 {
        font-size: 1.75em;
    }

    .blog-post-content h2 {
        font-size: 1.4em;
    }

    .blog-post-content h3 {
        font-size: 1.15em;
    }

    .blog-post-content pre {
        font-size: 0.8em !important;
        padding: 2.75rem 3.5rem 1.2em 1.2em !important;
    }

    .blog-post-content .code-copy-btn {
        top: 10px !important;
        right: 10px !important;
        min-width: 68px;
        height: 30px;
        padding: 0 10px !important;
        font-size: 11px;
    }

    .blog-post-content .code-copy-btn::before {
        width: 12px;
        height: 12px;
    }

    .blog-post-content figure img,
    .blog-post-content img.blog-post-content__cover-img {
        min-height: 0;
        max-height: none;
    }
}
