/*
 * Public blog (blog.php, blog-entry.php). Loaded via $page_stylesheets = ['blog'] after main.css.
 * Scoped to .blog-* classes so it never needs a Tailwind rebuild. Light + dark (.dark on <html>).
 */

/* ---------- Long-form reading column ---------- */
.blog-entry-body {
    width: 100%;
    max-width: 44rem;            /* ~70-75 characters per line at 17px */
    margin-inline: auto;
    font-size: 1.0625rem;
    line-height: 1.75;
    text-align: left;
    overflow-wrap: break-word;
    word-break: normal;
}
.blog-entry-body > :first-child { margin-top: 0 !important; }
.blog-entry-body p { margin: 0 0 1.15em; }
.blog-entry-body > p:first-of-type { font-size: 1.15rem; line-height: 1.7; }
.blog-entry-body ul,
.blog-entry-body ol { margin: 0 0 1.15em; padding-left: 1.5em; }
.blog-entry-body ul { list-style: disc; }
.blog-entry-body ol { list-style: decimal; }
.blog-entry-body li { margin: 0.4em 0; padding-left: 0.2em; }
.blog-entry-body li > ul,
.blog-entry-body li > ol { margin-top: 0.4em; margin-bottom: 0.4em; }
.blog-entry-body h2 { font-size: 1.45rem !important; font-weight: 700 !important; margin: 2em 0 0.7em; line-height: 1.3; }
.blog-entry-body h3 { font-size: 1.2rem !important; font-weight: 600 !important; margin: 1.6em 0 0.55em; line-height: 1.35; }
.blog-entry-body h4 { font-size: 1.05rem !important; font-weight: 600 !important; margin: 1.3em 0 0.4em; line-height: 1.4; }
.blog-entry-body .blog-heading-anchor { scroll-margin-top: 5.5rem; }
.blog-entry-body strong,
.blog-entry-body b { font-weight: 700; }
.blog-entry-body hr { margin: 2em 0; }

/* Links: distinguishable from text, AA contrast in both themes */
.blog-entry-body a { color: #1a6e17; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(26, 110, 23, 0.45); }
.blog-entry-body a:hover { text-decoration-color: currentColor; }
.dark .blog-entry-body a { color: #a3e635; text-decoration-color: rgba(163, 230, 53, 0.45); }
.blog-entry-body a:focus-visible,
.blog-toc a:focus-visible,
.blog-share-btn:focus-visible,
.blog-postnav a:focus-visible,
.blog-card:focus-visible,
.blog-chip:focus-visible { outline: 2px solid #4d8f00; outline-offset: 2px; border-radius: 2px; }
.dark .blog-entry-body a:focus-visible,
.dark .blog-toc a:focus-visible,
.dark .blog-share-btn:focus-visible,
.dark .blog-postnav a:focus-visible,
.dark .blog-card:focus-visible,
.dark .blog-chip:focus-visible { outline-color: #a3e635; }

/* Quill alignment overrides stay left-biased for reading */
.blog-entry-body p.ql-align-left, .blog-entry-body .ql-align-left { text-align: left !important; }
.blog-entry-body p.ql-align-center, .blog-entry-body .ql-align-center { text-align: center !important; }
.blog-entry-body p.ql-align-right, .blog-entry-body .ql-align-right { text-align: right !important; }
.blog-entry-body p.ql-align-justify, .blog-entry-body .ql-align-justify { text-align: justify !important; }

/* Code */
.blog-entry-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; padding: 0.12em 0.4em; border-radius: 4px; background: rgba(120, 113, 108, 0.22); overflow-wrap: anywhere; }
.blog-entry-body pre { overflow-x: auto; margin: 1.5em 0; padding: 1em 1.15em; border-radius: 6px; background: #1c1917; color: #e7e5e4; font-size: 0.9rem; line-height: 1.55; border: 1px solid rgba(120, 113, 108, 0.4); }
.blog-entry-body pre code { padding: 0; background: none; color: inherit; font-size: inherit; overflow-wrap: normal; }

/* Quotes */
.blog-entry-body blockquote { border-left: 4px solid #7ccf00; padding: 0.4em 0 0.4em 1.1em; margin: 1.5em 0; font-style: italic; color: #44403c; }
.blog-entry-body blockquote > :last-child { margin-bottom: 0; }
.dark .blog-entry-body blockquote { color: #d6d3d1; }

/* Media */
.blog-entry-body img { max-width: 100%; height: auto; border-radius: 4px; }
.blog-entry-body .blog-figure { margin: 1.75em 0; }
.blog-entry-body .blog-figure img { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid rgba(120, 113, 108, 0.3); }
.blog-entry-body figcaption,
.blog-entry-body .blog-figure figcaption { font-size: 0.875rem; line-height: 1.5; color: #57534e; margin-top: 0.55em; text-align: center; }
.dark .blog-entry-body figcaption,
.dark .blog-entry-body .blog-figure figcaption { color: #a8a29e; }
.blog-entry-body .blog-video-block { margin: 1.75em 0; }
.blog-entry-body .blog-video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 0; border-radius: 4px; border: 1px solid rgba(120, 113, 108, 0.4); }
.blog-entry-body .blog-video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.blog-entry-body iframe { max-width: 100%; }
.blog-entry-body .blog-video-caption { font-size: 0.875rem; color: #57534e; margin: 0.5em 0 0; text-align: center; }
.dark .blog-entry-body .blog-video-caption { color: #a8a29e; }
.blog-entry-body .blog-video-channel { font-weight: 400; }

/* Tables (scroll horizontally on small screens) */
.blog-entry-body .blog-table-wrap { margin: 1.75em 0; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 6px; border: 1px solid rgba(120, 113, 108, 0.35); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); }
.blog-entry-body table.blog-table { width: 100%; min-width: 30rem; border-collapse: collapse; margin: 0; font-size: 0.9rem; line-height: 1.5; }
.blog-entry-body table.blog-table th,
.blog-entry-body table.blog-table td { border-bottom: 1px solid rgba(120, 113, 108, 0.25); padding: 0.65em 1em; text-align: left; vertical-align: top; }
.blog-entry-body table.blog-table th { background: rgba(124, 207, 0, 0.16); font-weight: 700; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.blog-entry-body table.blog-table tr:last-child td { border-bottom: 0; }
.blog-entry-body table.blog-table tr:nth-child(even) td { background: rgba(120, 113, 108, 0.07); }

/* Content blocks produced by the editor / AI writer */
.blog-entry-body .blog-takeaways { margin: 1.75em 0 2em; padding: 1.1em 1.35em; border: 1px solid rgba(77, 143, 0, 0.35); border-radius: 8px; background: rgba(124, 207, 0, 0.09); }
.blog-entry-body .blog-takeaways-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.6em; color: #2f6b00; display: flex; align-items: center; gap: 0.4em; }
.dark .blog-entry-body .blog-takeaways-title { color: #a3e635; }
.blog-entry-body .blog-takeaways-list { margin: 0; padding-left: 1.25em; }
.blog-entry-body .blog-takeaways-list li { margin: 0.4em 0; font-weight: 500; }
.blog-entry-body .blog-callout { margin: 1.75em 0; padding: 1em 1.25em; border-left: 4px solid #4d8f00; background: rgba(124, 207, 0, 0.1); border-radius: 0 8px 8px 0; display: flex; gap: 0.75em; align-items: flex-start; }
.blog-entry-body .blog-callout-icon { font-size: 1.25rem; line-height: 1; flex-shrink: 0; }
.blog-entry-body .blog-callout-body { flex: 1; min-width: 0; }
.blog-entry-body .blog-mockup { margin: 1.75em 0; padding: 1.25em 1.5em; border: 2px dashed rgba(120, 113, 108, 0.5); border-radius: 8px; background: rgba(120, 113, 108, 0.07); }
.blog-entry-body .blog-mockup-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.75em; text-transform: uppercase; letter-spacing: 0.04em; color: #57534e; }
.dark .blog-entry-body .blog-mockup-title { color: #d6d3d1; }
.blog-entry-body .blog-mockup-list { margin: 0; padding-left: 1.25em; }
.blog-entry-body .blog-stats { display: flex; flex-wrap: wrap; gap: 1em; margin: 1.75em 0; }
.blog-entry-body .blog-stat { flex: 1; min-width: 120px; text-align: center; padding: 1em; border-radius: 8px; background: rgba(124, 207, 0, 0.12); border: 1px solid rgba(77, 143, 0, 0.3); }
.blog-entry-body .blog-stat-num { display: block; font-size: 1.5rem; font-weight: 800; color: #2f6b00; line-height: 1.2; }
.dark .blog-entry-body .blog-stat-num { color: #a3e635; }
.blog-entry-body .blog-stat-label { display: block; font-size: 0.8rem; color: #57534e; margin-top: 0.25em; }
.dark .blog-entry-body .blog-stat-label { color: #a8a29e; }

/* Numbered step lists (ol.blog-steps had list-style:none with no counters -> numbers were invisible) */
.blog-entry-body ol.blog-steps { margin: 1.25em 0; padding-left: 0; counter-reset: blogstep; list-style: none; }
.blog-entry-body ol.blog-steps > li { counter-increment: blogstep; position: relative; margin: 0.9em 0; padding-left: 2.6rem; min-height: 1.9rem; }
.blog-entry-body ol.blog-steps > li::before { content: counter(blogstep); position: absolute; left: 0; top: 0.1em; width: 1.8rem; height: 1.8rem; display: flex; align-items: center; justify-content: center; border-radius: 4px; background: #7ccf00; color: #1c1917; font-weight: 700; font-size: 0.85rem; line-height: 1; }

/* FAQ (main.css provides the dark panels; keep the grid readable inside the narrower column) */
.blog-entry-body .blog-faq { margin: 2.25em 0 1em; }
.blog-entry-body .blog-faq-item:not(.ml-faq__item) { margin: 0; padding: 1.1rem 1.15rem; border-bottom: 0; }
.blog-entry-body .blog-faq:not(:has(.ml-faq)) { grid-template-columns: 1fr; }
.blog-entry-body .blog-faq-q { font-size: 1rem !important; font-weight: 400 !important; margin: 0 0 0.5em !important; }
.blog-entry-body .blog-faq-a { margin: 0; }

/* ---------- Table of contents ---------- */
.blog-toc { width: 100%; max-width: 44rem; margin: 0 auto 2.25rem; padding: 1.1rem 1.4rem; border: 1px solid rgba(120, 113, 108, 0.4); border-radius: 8px; background: rgba(120, 113, 108, 0.08); }
.blog-toc-title { margin: 0 0 0.6rem; font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: #44403c; }
.dark .blog-toc-title { color: #d6d3d1; }
.blog-toc-list { margin: 0; padding-left: 1.4rem; list-style: decimal; font-size: 0.95rem; line-height: 1.5; }
.blog-toc-list li { margin: 0.35rem 0; padding-left: 0.15rem; }
.blog-toc-list a { font-weight: 500; text-decoration: none; color: #1a6e17; }
.blog-toc-list a:hover { text-decoration: underline; text-underline-offset: 3px; }
.dark .blog-toc-list a { color: #a3e635; }

/* ---------- Post header / meta ---------- */
.blog-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.25rem 0.6rem; font-size: 0.875rem; color: #44403c; }
.dark .blog-meta { color: #d6d3d1; }
.blog-meta-author { display: inline-flex; align-items: center; justify-content: center; flex-basis: 100%; gap: 0.45rem; font-weight: 600; }
/* Dot separators only where the row stays on one line (they look orphaned when wrapped on phones) */
@media (min-width: 640px) {
    .blog-meta-author { flex-basis: auto; }
    .blog-meta > * + *::before { content: "\00b7"; margin-right: 0.6rem; opacity: 0.7; }
}
.blog-meta-author img { border-radius: 9999px; }
.blog-hero-img { display: block; width: 100%; height: auto; border-radius: 4px; border: 1px solid rgb(168 162 158); }
.dark .blog-hero-img { border-color: rgb(87 83 78); }
.blog-crumb-current { display: inline-block; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (min-width: 768px) { .blog-crumb-current { max-width: 28rem; } }

/* ---------- Share ---------- */
.blog-share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.blog-share-label { font-weight: 700; font-size: 0.875rem; margin-right: 0.25rem; }
.blog-share-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-width: 2.25rem; height: 2.25rem; padding: 0 0.6rem; border: 0; border-radius: 4px; background: #44403c; color: #fff; font-size: 0.8125rem; font-weight: 600; line-height: 1; text-decoration: none; cursor: pointer; transition: opacity 0.15s; }
.blog-share-btn:hover { opacity: 0.88; }
.blog-share-btn svg { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
.blog-share-btn[data-network="facebook"] { background: #3b5998; }
.blog-share-btn[data-network="x"] { background: #000; }
.blog-share-btn[data-network="reddit"] { background: #c93a00; }
.blog-share-btn[data-network="copy"] { background: #3f6212; }
.dark .blog-share-btn[data-network="x"] { background: #292524; border: 1px solid #57534e; }
.blog-share-status { font-size: 0.8125rem; min-height: 1.2em; }

/* ---------- Author, prev/next, related ---------- */
.blog-author { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 1.75rem; margin-top: 2rem; border-top: 1px solid rgba(120, 113, 108, 0.4); }
.blog-author-head { display: flex; align-items: center; gap: 0.6rem; }
.blog-author-head img { border-radius: 9999px; border: 1px solid rgb(120 113 108); }
.blog-author-name { font-size: 1rem; }
.blog-author-bio { margin: 0; font-size: 0.95rem; line-height: 1.6; color: #44403c; }
.dark .blog-author-bio { color: #d6d3d1; }

.blog-postnav { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-top: 2rem; }
@media (min-width: 640px) { .blog-postnav { grid-template-columns: 1fr 1fr; } }
.blog-postnav a { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 1.1rem; border: 1px solid rgb(168 162 158); border-radius: 4px; background: rgba(168, 162, 158, 0.15); text-decoration: none; color: inherit; transition: background-color 0.15s; }
.dark .blog-postnav a { border-color: rgb(87 83 78); background: rgba(87, 83, 78, 0.25); }
.blog-postnav a:hover { background: rgba(168, 162, 158, 0.3); }
.dark .blog-postnav a:hover { background: rgba(87, 83, 78, 0.45); }
.blog-postnav-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: #57534e; }
.dark .blog-postnav-label { color: #a8a29e; }
.blog-postnav-title { font-weight: 600; line-height: 1.35; }
.blog-postnav-next { text-align: right; }

.blog-related { margin-top: 0.5rem; }
.blog-related-title { font-size: 1.25rem; margin: 0 0 1rem; }
.blog-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .blog-grid--related { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .blog-grid--related { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Index: cards, filters, pagination, empty ---------- */
.blog-card-img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; object-position: top; }
.blog-card-noimg { height: auto; }
@media (prefers-reduced-motion: reduce) {
    .blog-card:hover .blog-card-img { transform: none !important; }
    .blog-card-img { transition: none !important; }
}
.blog-chip--active,
.blog-chip[aria-current="true"] { background: #7ccf00 !important; color: #1c1917 !important; border-color: #4d8f00 !important; }
.blog-page-current { background: #7ccf00; color: #1c1917; }
.blog-page-gap { padding: 0 0.25rem; color: #78716c; }
.blog-filter-note { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; font-size: 0.9rem; color: #44403c; }
.dark .blog-filter-note { color: #d6d3d1; }
.blog-filter-note a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.blog-empty { text-align: center; padding: 3rem 1rem; border: 1px dashed rgb(168 162 158); border-radius: 4px; }
.dark .blog-empty { border-color: rgb(87 83 78); }
.blog-empty h2 { font-size: 1.25rem; margin: 0 0 0.5rem; }
.blog-empty p { margin: 0 0 1rem; color: #57534e; }
.dark .blog-empty p { color: #a8a29e; }
