/* Blog index and post pages (www/blog/*, generated by scripts/build-blog.mjs) */

.blog-index,
.blog-post {
    max-width: 760px;
    margin: 0 auto;
    padding: 120px 20px 80px;
}

/* Posts are wider than a typical text column, but narrower than the index so lines stay readable. */
.blog-post {
    max-width: 960px;
}

/* The index uses the same width as the site's .container, so it lines up with the nav. */
.blog-index {
    max-width: 1200px;
}

.blog-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}

/* Audience pill: who the post is for */
.blog-pill {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.5;
    white-space: nowrap;
}

.blog-pill-community {
    background: #e8f2ff;
    color: #0062cc;
}

.blog-pill-vendor {
    background: #fff4e5;
    color: #9a4d00;
}

/* ---- Index ---- */
.blog-index-header {
    margin-bottom: var(--space-10);
}

.blog-index-header h1 {
    font-family: var(--font-heading);
    font-size: var(--text-5xl);
    color: #1a1a1a;
    line-height: 1.15;
    margin-bottom: var(--space-3);
}

.blog-index-header p {
    color: var(--color-text-muted);
    font-size: var(--text-lg);
    line-height: 1.6;
}

/* One column on phones, two on tablets, three on desktop. Fixed columns keep cards the same
   size when the filter hides some of them. */
.blog-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}

.blog-card {
    display: flex;
}

.blog-card a {
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
    transition: var(--transition);
}

.blog-card a:hover,
.blog-card a:focus-visible {
    border-color: var(--color-primary-light);
}

.blog-card-thumb {
    aspect-ratio: 16 / 9;
    background: var(--color-bg-alt);
}

.blog-card-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Posts without an image get a brand-colored panel with the logo. */
.blog-card-thumb.is-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #007aff 0%, #58a6ff 100%);
}

.blog-card-thumb.is-placeholder img {
    width: 30%;
    height: auto;
    opacity: 0.95;
}

.blog-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: var(--space-5) var(--space-6) var(--space-6);
}

@media (min-width: 640px) {
    .blog-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .blog-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* The display rules above would otherwise override the hidden attribute. */
.blog-card[hidden],
.blog-filter[hidden] {
    display: none;
}

/* ---- Audience filter on /blog ---- */
.blog-filter {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: calc(-1 * var(--space-4)) 0 var(--space-8);
}

.blog-filter-btn {
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    min-height: 40px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.blog-filter-btn:hover {
    border-color: var(--color-primary-light);
    color: var(--color-primary);
}

.blog-filter-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.blog-filter-btn[aria-pressed="true"] {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
}

.blog-card h2,
.blog-card h3 {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    color: #1a1a1a;
    line-height: 1.3;
    margin: var(--space-2) 0;
}

.blog-card p:not(.blog-meta) {
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* Pin "Read more" to the bottom so cards in a row line up. */
.blog-card-more {
    margin-top: auto;
    padding-top: var(--space-4);
    color: var(--color-primary);
    font-weight: 600;
}

.blog-empty {
    color: var(--color-text-muted);
}

/* ---- Post ---- */
.blog-back {
    margin-bottom: var(--space-6);
    font-size: var(--text-sm);
}

.blog-back a {
    display: inline-block;
    padding: var(--space-2) 0;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 600;
}

.blog-back a:hover {
    text-decoration: underline;
}

.blog-post-header {
    margin-bottom: var(--space-8);
    padding-bottom: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}

.blog-post-header h1 {
    font-family: var(--font-heading);
    font-size: var(--text-5xl);
    color: #1a1a1a;
    line-height: 1.15;
    margin-bottom: var(--space-3);
}

.blog-hero {
    margin: 0 0 var(--space-8);
}

.blog-hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 540px;
    object-fit: cover;
    border-radius: var(--radius-xl);
}

.blog-draft-banner {
    background: #fff7ed;
    border: 1px solid var(--color-accent);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-6);
    font-weight: 600;
}

/* Markdown output */
.blog-prose {
    font-size: var(--text-lg);
    line-height: 1.8;
    color: var(--color-text);
    overflow-wrap: break-word;
}

.blog-prose > * + * {
    margin-top: var(--space-5);
}

.blog-prose h2 {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    color: #1a1a1a;
    line-height: 1.25;
    margin-top: var(--space-12);
}

.blog-prose h3 {
    font-size: var(--text-xl);
    color: #1a1a1a;
    line-height: 1.3;
    margin-top: var(--space-8);
}

.blog-prose a {
    color: var(--color-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-prose a:hover {
    color: var(--color-primary-dark);
}

.blog-prose ul,
.blog-prose ol {
    padding-left: var(--space-6);
}

.blog-prose li + li {
    margin-top: var(--space-2);
}

.blog-prose blockquote {
    border-left: 4px solid var(--color-primary-light);
    background: var(--color-bg-alt);
    padding: var(--space-4) var(--space-6);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--color-text-muted);
}

/* Green "Key takeaways" box under the cover (takeaways in a post's front matter) */
.blog-takeaways {
    margin: 0 0 var(--space-8);
    padding: var(--space-5) var(--space-6);
    background: #effaf3;
    border: 1px solid #bbe5c8;
    border-radius: var(--radius-md);
}

.blog-takeaways-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    font-weight: 700;
    color: #166534;
}

.blog-takeaways-icon {
    flex: none;
    color: #16a34a;
}

.blog-takeaways ul {
    padding-left: var(--space-6);
    font-size: var(--text-lg);
    line-height: 1.7;
    color: var(--color-text);
}

.blog-takeaways li + li {
    margin-top: var(--space-2);
}

.blog-takeaways li::marker {
    color: #16a34a;
}

/* Tip callout: a Markdown quote starting with [!TIP] (see CALLOUTS in build-blog.mjs) */
.blog-prose .blog-callout {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    background: #fff8e1;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
    color: var(--color-text);
}

/* Centered on the first line of text (line height 1.8 x 18px, icon 22px). */
.blog-callout-icon {
    flex: none;
    margin-top: calc((1.8em - 22px) / 2);
    color: #b45309;
}

.blog-callout-body {
    flex: 1;
    min-width: 0;
}

.blog-callout-body p {
    margin: 0;
}

.blog-callout-body > * + * {
    margin-top: var(--space-2);
}

.blog-prose .blog-callout-label {
    font-weight: 700;
    color: #92400e;
}

.blog-prose img {
    max-width: 100%;
    height: auto;
    vertical-align: middle;
}

.blog-prose figure {
    margin-top: var(--space-8);
    margin-bottom: var(--space-8);
}

.blog-prose figure img {
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-lg);
}

.blog-prose figcaption {
    margin-top: var(--space-2);
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    line-height: 1.5;
}

.blog-prose code {
    background: var(--color-bg-alt);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.blog-prose hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: var(--space-10) 0;
}

.blog-prose table {
    width: 100%;
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.blog-prose th,
.blog-prose td {
    border: 1px solid var(--color-border);
    padding: var(--space-2) var(--space-3);
    text-align: left;
}

/* ---- "More for ..." at the end of a post ---- */
.blog-related {
    margin-top: var(--space-16);
}

.blog-related > h2 {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    color: #1a1a1a;
    line-height: 1.25;
    margin-bottom: var(--space-6);
}

.blog-related .blog-card h3 {
    font-size: var(--text-lg);
}

/* ---- End-of-post call to action ---- */
.blog-cta {
    margin-top: var(--space-16);
    padding: var(--space-10) var(--space-6);
    border-radius: var(--radius-xl);
    background: linear-gradient(to bottom, #ffffff 0%, #f6faff 100%);
    border: 1px solid var(--color-border);
    text-align: center;
}

.blog-cta h2 {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    color: #1a1a1a;
    line-height: 1.25;
    margin-bottom: var(--space-3);
}

.blog-cta p {
    color: var(--color-text-muted);
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto var(--space-6);
}

/* The site-wide button style lifts on hover (with !important); keep it still here */
.blog-cta a.vendor-signup-btn:hover {
    transform: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}

/* CTA with no description paragraph: keep the button off the heading */
.blog-cta h2 + a {
    margin-top: var(--space-3);
}

.blog-cta .blog-cta-secondary {
    margin: var(--space-5) auto 0;
}

.blog-cta-secondary a {
    display: inline-block;
    padding: var(--space-2) 0;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
}

.blog-cta-secondary a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    /* Same floor the site uses for small labels on phones (DESIGN.md) */
    .blog-pill {
        font-size: 0.825rem;
    }

    .blog-index,
    .blog-post {
        padding: 96px 16px 56px;
    }

    .blog-index-header h1,
    .blog-post-header h1 {
        font-size: var(--text-4xl);
    }

    .blog-prose h2,
    .blog-cta h2 {
        font-size: var(--text-2xl);
    }
}
