/* Article pages share the app's system fonts, palette, branding, and footer. */
body.blog-page {
    --article-background: #f5f5f5;
    --article-panel: #ffffff;
    --article-text: #333333;
    --article-muted: #666666;
    --article-border: #e0e0e0;
    --article-link: #0066cc;
    --article-tint: #f2f7fc;
    --article-notice: #eef3f7;
    --article-notice-accent: #8fa6b8;
    background: var(--article-background);
    color: var(--article-text);
    overflow-wrap: break-word;
}

body.blog-page.dark-mode {
    --article-background: #2a2a2a;
    --article-panel: #3a3a3a;
    --article-text: #ffffff;
    --article-muted: #c0c0c0;
    --article-border: #4a4a4a;
    --article-link: #8fc5ff;
    --article-tint: #303b46;
    --article-notice: #303942;
    --article-notice-accent: #7891a5;
}

.blog-container {
    max-width: 900px;
    min-height: calc(100vh - 80px);
    margin: 0 auto;
    padding: 40px 20px 80px;
}

.blog-page a:not(.header-brand-link):not(.footer-link):not(.blog-primary-link) {
    color: var(--article-link);
    text-underline-offset: 3px;
}

.blog-page a:focus-visible,
.blog-page button:focus-visible {
    outline: 3px solid var(--article-link);
    outline-offset: 4px;
}

.blog-skip-link {
    position: absolute;
    top: 12px;
    left: 12px;
    transform: translateY(-200%);
    padding: 12px;
    background: var(--article-panel);
    z-index: 1000;
}

.blog-skip-link:focus {
    transform: none;
}

.blog-page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 40px;
}

.blog-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.blog-header-controls .theme-toggle-btn {
    min-height: 44px;
}

.blog-back-link {
    font-size: 16px;
    text-decoration: none;
}

.blog-article-header {
    margin-bottom: 28px;
}

.blog-eyebrow,
.blog-image-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--article-muted);
}

.blog-article-header h1 {
    max-width: 760px;
    margin: 12px 0 16px;
    font-size: clamp(30px, 4.5vw, 40px);
    line-height: 1.18;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-bottom: 22px;
    color: var(--article-muted);
    font-size: 14px;
    line-height: 1.6;
}

.blog-page p,
.blog-page li,
.blog-page dd {
    font-size: 16px;
    line-height: 1.75;
}

.blog-article-header .blog-lead {
    font-size: clamp(21px, 2.5vw, 24px);
    line-height: 1.55;
    color: var(--article-text);
}

.blog-article-header .blog-lead + .blog-lead {
    margin-top: 16px;
}

.blog-section,
.blog-takeaway,
.blog-contents,
.blog-cta {
    margin-bottom: 24px;
    padding: 25px;
    border: 1px solid var(--article-border);
    border-radius: 8px;
    background: var(--article-panel);
}

.blog-page h2 {
    margin-bottom: 16px;
    font-size: 24px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.blog-page h3 {
    margin-bottom: 10px;
    font-size: 18px;
    line-height: 1.4;
}

.blog-section p,
.blog-cta p {
    margin-bottom: 16px;
    color: var(--article-muted);
}

.blog-section p:last-child,
.blog-cta p:last-child {
    margin-bottom: 0;
}

.blog-section strong {
    color: var(--article-text);
}

.blog-export-notice {
    background: var(--article-notice);
    border-color: var(--article-notice-accent);
    border-left-width: 4px;
}

.blog-info-callout {
    display: grid;
    margin-top: 16px;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--article-border);
    border-left: 4px solid var(--article-link);
    border-radius: 8px;
    background: var(--article-tint);
}

.blog-callout-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid currentColor;
    border-radius: 50%;
    color: var(--article-link);
    font-weight: 700;
}

.blog-info-callout p {
    color: var(--article-text);
}

.blog-takeaway {
    background: var(--article-tint);
    border-left: 3px solid var(--article-link);
}

.blog-takeaway h2,
.blog-contents h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.blog-contents ol,
.blog-section > ul,
.blog-section > ol {
    padding-left: 24px;
}

.blog-contents li,
.blog-section li {
    padding-left: 3px;
    margin-bottom: 8px;
    color: var(--article-muted);
}

.blog-image {
    margin: 0 0 28px;
}

.blog-image-placeholder {
    display: flex;
    width: 100%;
    min-height: 180px;
    aspect-ratio: 16 / 5;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    border: 1px dashed #999999;
    border-radius: 8px;
    background: var(--article-panel);
    text-align: center;
    color: var(--article-muted);
}

.blog-image-placeholder svg {
    width: 40px;
    height: 40px;
}

/* Replace the placeholder div with a locally hosted img; retain the figure. */
.blog-image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* Match screenshots to the selected site theme, including saved preferences. */
.blog-image-themed img {
    max-width: 100%;
    margin-inline: auto;
}

.blog-image-themed .blog-image-dark,
.dark-mode .blog-image-themed .blog-image-light {
    display: none;
}

.dark-mode .blog-image-themed .blog-image-dark {
    display: block;
}

.blog-image figcaption {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--article-muted);
}

.blog-image-comparison {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
}

.blog-example {
    padding: 18px;
    border: 1px solid var(--article-border);
    border-radius: 6px;
    background: var(--article-background);
}

.blog-example dt {
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--article-muted);
}

.blog-example dd + dt {
    margin-top: 16px;
}

.blog-page sup {
    font-size: 0.75em;
    line-height: 0;
}

.blog-page sup a {
    padding: 2px;
}

.blog-page [id] {
    scroll-margin-top: 24px;
}

.blog-page :target:not(sup) {
    outline: 2px solid var(--article-link);
    outline-offset: 5px;
}

.blog-references li {
    margin-bottom: 22px;
    font-size: 14px;
    line-height: 1.7;
}

.blog-reference-links {
    display: block;
    margin-top: 5px;
}

.blog-cta {
    background: var(--article-tint);
}

.blog-page a.blog-primary-link {
    display: inline-block;
    padding: 11px 18px;
    border-radius: 5px;
    background: #1565c0;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
}

.blog-page a.blog-primary-link:hover {
    background: #0d47a1;
}

.blog-cta .blog-privacy-note {
    margin: 16px 0 0;
    font-size: 14px;
}

.blog-affiliation {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 24px;
    padding: 12px 16px;
    border: 1px solid var(--article-border);
    border-radius: 8px;
    background: var(--article-tint);
    color: var(--article-muted);
    font-size: 14px;
    line-height: 1.6;
}

.blog-affiliation > span {
    flex: 1;
}

.blog-info-trigger {
    display: inline-flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    height: 32px;
    border: 1px solid var(--article-border);
    border-radius: 50%;
    background: var(--article-panel);
    color: var(--article-link);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.blog-affiliation .blog-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    width: min(420px, 100%);
    margin: 0;
    padding: 16px;
    border: 1px solid var(--article-border);
    border-radius: 8px;
    background: var(--article-panel);
    color: var(--article-text);
    font-size: 14px;
    line-height: 1.6;
    box-shadow: 0 6px 18px rgb(0 0 0 / 15%);
}

.blog-step-label {
    display: block;
    margin-bottom: 8px;
    color: var(--article-link);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.blog-section .blog-image {
    margin: 22px 0 0;
}

.blog-section .blog-image:not(:last-child) {
    margin-bottom: 22px;
}

.blog-image-screenshot .blog-image-placeholder {
    aspect-ratio: 16 / 8;
}

.blog-prompt-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin-top: 16px;
}

.blog-copy-prompt-btn {
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid var(--article-link);
    border-radius: 5px;
    background: var(--article-tint);
    color: var(--article-link);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.blog-copy-prompt-btn:hover {
    background: var(--article-panel);
}

.blog-copy-status {
    color: var(--article-muted);
    font-size: 14px;
}

.blog-page pre {
    margin: 16px 0;
    padding: 18px;
    border: 1px solid var(--article-border);
    border-radius: 6px;
    background: var(--article-background);
    color: var(--article-text);
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.blog-page code {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.blog-related {
    padding-top: 8px;
    margin: 0 0 28px;
}

.blog-related ul {
    padding-left: 24px;
}

.blog-related li {
    margin-bottom: 8px;
}

.blog-post-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.blog-post-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 25px;
    border: 1px solid var(--article-border);
    border-radius: 8px;
    background: var(--article-panel);
}

.blog-post-card h2 {
    margin: 0;
}

.blog-post-card p {
    color: var(--article-muted);
}

.blog-post-card .blog-post-link {
    margin-top: auto;
    font-weight: 600;
}

/* The article footer wraps naturally, including at narrow screen widths. */
.blog-page .footer.footer-split .footer-content {
    gap: 16px 32px;
}

.blog-page .footer.footer-split .footer-left {
    position: static;
    transform: none;
}

.blog-page .footer-links {
    justify-content: center;
    gap: 12px;
}

/* Keep the feedback control available without covering the article text. */
.blog-page .feedback-btn {
    position: static;
    min-height: 32px;
    padding: 6px 12px;
    box-shadow: none;
}

@media (max-width: 600px) {
    .blog-image-comparison {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }

    .blog-post-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .blog-container {
        padding: 24px 16px 48px;
    }

    .blog-page-header {
        margin-bottom: 30px;
    }

    .blog-section,
    .blog-takeaway,
    .blog-contents,
    .blog-cta {
        padding: 20px;
    }

    .blog-page h2 {
        font-size: 22px;
    }

}

@media print {
    body.blog-page,
    body.blog-page.dark-mode {
        --article-background: #ffffff;
        --article-panel: #ffffff;
        --article-text: #000000;
        --article-muted: #333333;
        --article-border: #cccccc;
        --article-link: #000000;
        --article-tint: #ffffff;
        --article-notice: #ffffff;
        --article-notice-accent: #cccccc;
    }

    .blog-container {
        max-width: none;
        padding: 0;
    }

    .blog-page-header,
    .blog-page .footer,
    .blog-contents,
    .blog-image,
    .blog-cta,
    .blog-related,
    .blog-affiliation,
    .blog-skip-link {
        display: none;
    }

    .blog-section {
        border: 0;
        padding: 0;
    }

    .blog-page h2,
    .blog-page h3 {
        break-after: avoid;
    }

    .blog-references li {
        break-inside: avoid;
    }
}
