/*
 * V.BuildCC — Blog (blog.php) and article page (blog-details.php). Loaded after assets/css/home.css; prefix bl-.
 * Colours and fonts come from the shared tokens; the values the Blog brief fixes are set on .bl below.
 */
.bl {
  --bl-dark: #16513B;            /* buttons: dark green with white text */
  --bl-dark-hover: #0F3D2C;
  --bl-on-dark: #FFFFFF;
  --bl-text: #172033;
  --bl-muted: #526071;
  --bl-border: #E5E9ED;
  --bl-tint: #F6F7F3;
  --bl-card: #FFFFFF;
  --bl-space: clamp(2rem, 5.5vw, 5rem);        /* 32px mobile → 80px desktop */
  color: var(--bl-text);
}
:root[data-theme="dark"] .bl {
  --bl-dark: #86C440; --bl-dark-hover: #9AD357; --bl-on-dark: #10210A;
  --bl-text: var(--vb-text); --bl-muted: var(--vb-text-muted); --bl-border: var(--vb-border);
  --bl-tint: var(--vb-bg-alt); --bl-card: var(--vb-card);
}

/* ---------- type ---------- */
.bl-h1 { font-family: var(--font-heading); font-size: clamp(1.75rem, 1.25rem + 2.4vw, 3.25rem); font-weight: 700; line-height: 1.14; letter-spacing: -0.025em; color: var(--bl-text); margin: 0.6rem 0 0.9rem; text-wrap: balance; }
.bl-h2 { font-family: var(--font-heading); font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--bl-text); margin: 0 0 0.6rem; text-wrap: balance; }
.bl-h3 { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600; line-height: 1.35; color: var(--bl-text); margin: 0 0 0.4rem; }
.bl-lead { font-size: clamp(1rem, 0.95rem + 0.35vw, 1.125rem); line-height: 1.65; color: var(--bl-muted); max-width: 60ch; margin: 0; }
.bl-kicker { font-family: var(--font-heading); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vb-green-ink); margin: 0 0 0.6rem; }
.bl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.5rem; font-size: 0.875rem; line-height: 1.6; color: var(--bl-muted); margin: 0; }
.bl-dot { color: var(--vb-border-strong); }
.bl-tag { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 999px; border: 1px solid var(--bl-border); background: var(--bl-tint); color: var(--bl-muted); font-size: 0.78rem; font-weight: 600; line-height: 1.6; white-space: nowrap; }
/* Khmer: its own fonts, no tight tracking, taller lines so stacked marks are never clipped */
html.lang-km .bl :is(.bl-h1, .bl-h2, .bl-h3, .bl-kicker, .bl-card__title, .bl-feature__title, .bl-btn, .bl-field label, .bl-share__title), .bl :is(h1, h2, h3, h4)[lang="km"], .bl [lang="km"] :is(h1, h2, h3, h4), .bl a[lang="km"] { font-family: var(--font-heading-km); letter-spacing: normal; }
html.lang-km .bl .bl-h1, .bl .bl-h1[lang="km"] { line-height: 1.5; }
html.lang-km .bl :is(.bl-h2, .bl-h3), .bl :is(.bl-card__title, .bl-feature__title) [lang="km"] { line-height: 1.6; }
html.lang-km .bl :is(.bl-lead, .bl-meta, .bl-tag, .bl-count, .bl-state p, .bl-toc, .bl-langnote, .bl-source p), .bl p[lang="km"], .bl-content[lang="km"], .bl-content__km { font-family: var(--font-body-km); line-height: 1.95; letter-spacing: normal; }

/* ---------- sections ---------- */
.bl-section { padding-block: var(--bl-space); }
.bl-section--flush { padding-top: 0; }
.bl-section--tint { background: var(--bl-tint); }
.bl-intro { padding-block: clamp(1.75rem, 4vw, 3.25rem) clamp(1.5rem, 3vw, 2.5rem); }
.bl-narrow { max-width: 792px; }                    /* 760px reading column + gutters */

/* ---------- buttons ---------- */
.bl-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 48px; padding: 0.7rem 1.4rem; border: 1px solid var(--bl-dark); border-radius: 12px; background: var(--bl-dark); color: var(--bl-on-dark); font-family: var(--font-heading); font-size: 0.95rem; font-weight: 600; line-height: 1.3; text-decoration: none; cursor: pointer; transition: background-color var(--transition-fast), border-color var(--transition-fast); }
.bl-btn:hover { background: var(--bl-dark-hover); border-color: var(--bl-dark-hover); color: var(--bl-on-dark); }
.bl-btn--ghost { background: transparent; color: var(--bl-text); border-color: var(--vb-border-strong); }
.bl-btn--ghost:hover { background: var(--bl-tint); color: var(--bl-text); border-color: var(--bl-text); }
.bl-btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.bl :is(.bl-btn, .bl-chip, .bl-card__title a, .bl-feature__title a, .vb-link, .bl-crumbs a, .bl-toc a, summary):focus-visible { outline: 3px solid var(--bl-dark); outline-offset: 3px; border-radius: 8px; }
.bl [hidden] { display: none !important; }

/* ---------- latest article ---------- */
.bl-feature { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); background: var(--bl-card); border: 1px solid var(--bl-border); border-radius: 18px; overflow: hidden; }
.bl-feature__media { display: block; aspect-ratio: 16 / 10; background: var(--bl-tint); overflow: hidden; }
.bl-feature__media img, .bl-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease; }
.bl-feature:hover .bl-feature__media img, .bl-card:hover .bl-card__media img { transform: scale(1.04); }
.bl-feature__body { display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; padding: clamp(1.25rem, 3vw, 2.5rem); min-width: 0; }
.bl-feature__title { font-family: var(--font-heading); font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; margin: 0; overflow-wrap: anywhere; }
.bl-feature__title a, .bl-card__title a { color: var(--bl-text); text-decoration: none; }
.bl-feature__title a:hover, .bl-card__title a:hover { color: var(--vb-green-ink); }
.bl-feature__excerpt { margin: 0; font-size: 1.0625rem; line-height: 1.65; color: var(--bl-muted); }
.bl-feature__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.4rem 0 0; }
.bl-noimage { display: block; width: 100%; height: 100%; min-height: 100%; background: var(--bl-tint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA5B1' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='16' rx='2'/%3E%3Ccircle cx='8.5' cy='9.5' r='1.5'/%3E%3Cpath d='m21 15-5-5L5 20'/%3E%3C/svg%3E") center / 48px no-repeat; }

/* ---------- search ---------- */
.bl-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem; padding: 1rem; background: var(--bl-tint); border: 1px solid var(--bl-border); border-radius: 16px; }
.bl-field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; flex: 0 1 190px; }
.bl-field--grow { flex: 1 1 280px; }
.bl-field label { font-family: var(--font-heading); font-size: 0.875rem; font-weight: 600; line-height: 1.5; color: var(--bl-text); }
.bl-field input, .bl-field select { width: 100%; min-height: 48px; padding: 0.65rem 0.9rem; border: 1px solid #C4CCD4; border-radius: 10px; background: var(--bl-card); color: var(--bl-text); font: inherit; font-size: 1rem; line-height: 1.5; }
:root[data-theme="dark"] .bl-field :is(input, select) { border-color: var(--vb-border-strong); }
html.lang-km .bl-field :is(input, select) { font-family: var(--font-body-km); line-height: 1.8; }
.bl-field :is(input, select):focus-visible { outline: none; border-color: var(--bl-dark); box-shadow: 0 0 0 3px rgba(22, 81, 59, 0.28); }
html.js .bl-tools__go { display: none; }            /* with scripts on, the list updates as you type */
.bl-count { margin: 1rem 0 1.25rem; font-size: 0.95rem; color: var(--bl-muted); min-height: 1.6em; }

/* ---------- article cards ---------- */
.bl-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(1rem, 2vw, 1.75rem); }
.bl-card { display: flex; flex-direction: column; background: var(--bl-card); border: 1px solid var(--bl-border); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(23, 32, 51, 0.04); min-width: 0; }
.bl-card__media { display: block; aspect-ratio: 16 / 10; background: var(--bl-tint); overflow: hidden; }
.bl-card__body { display: flex; flex-direction: column; gap: 0.6rem; padding: 1.15rem 1.25rem 1.25rem; flex: 1; min-width: 0; }
.bl-card__title { font-family: var(--font-heading); font-size: clamp(1.2rem, 1.1rem + 0.4vw, 1.4rem); font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.bl-card__excerpt { margin: 0; font-size: 1rem; line-height: 1.65; color: var(--bl-muted); }
.bl-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; margin: auto 0 0; padding-top: 0.4rem; }
.bl-card__more { min-height: 44px; margin-left: auto; }
.bl-card--skeleton { pointer-events: none; }
.bl-skel { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--bl-border) 25%, var(--bl-tint) 50%, var(--bl-border) 75%); background-size: 200% 100%; animation: bl-skel 1.2s linear infinite; }
@keyframes bl-skel { to { background-position: -200% 0; } }
.bl-state { padding: clamp(1.75rem, 4vw, 3rem) 1.25rem; text-align: center; border: 1px dashed var(--vb-border-strong); border-radius: 16px; color: var(--bl-muted); }
.bl-state p { margin: 0 auto 1rem; max-width: 46ch; }
.bl-state--error { border-style: solid; border-color: #FECDCA; background: #FEF3F2; color: #912018; }
.bl-state--error .bl-h3 { color: #912018; }
:root[data-theme="dark"] .bl-state--error { background: rgba(240, 68, 56, 0.12); border-color: rgba(240, 68, 56, 0.4); color: #FDA29B; }
:root[data-theme="dark"] .bl-state--error .bl-h3 { color: #FDA29B; }
.bl-more { display: flex; justify-content: center; margin: clamp(1.5rem, 3vw, 2.5rem) 0 0; }

/* ---------- call to action ---------- */
.bl-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem 2rem; padding: clamp(1.5rem, 4vw, 3rem); background: var(--bl-tint); border: 1px solid var(--bl-border); border-radius: 18px; }
.bl-cta > div:first-child { flex: 1 1 340px; min-width: 0; }
.bl-cta__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.bl-section--tint + .bl-section .bl-cta { background: var(--bl-card); }

/* ---------- article page ---------- */
.bl-article__head { padding-block: clamp(1.5rem, 3.5vw, 3rem) clamp(1.25rem, 2.5vw, 2rem); }
.bl-crumbs ol { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.875rem; color: var(--bl-muted); }
.bl-crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--vb-border-strong); }
.bl-crumbs a { color: var(--bl-muted); text-decoration: none; display: inline-block; padding-block: 0.7rem; min-height: 44px; }
.bl-crumbs a:hover { color: var(--bl-text); text-decoration: underline; }
.bl-crumbs li[aria-current] { padding-block: 0.7rem; color: var(--bl-text); overflow-wrap: anywhere; }
.bl-article__title { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); overflow-wrap: anywhere; }
.bl-langnote { display: none; margin: 1rem 0 0; padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--bl-tint); border: 1px solid var(--bl-border); color: var(--bl-muted); font-size: 0.9375rem; }
html.lang-km .bl-langnote[data-article-lang="en"], html:not(.lang-km) .bl-langnote[data-article-lang="km"] { display: block; }
.bl-article__cover { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.bl-article__cover img { display: block; width: 100%; height: auto; max-height: 620px; object-fit: cover; border-radius: 18px; background: var(--bl-tint); }
.bl-toc { margin: 0 0 2rem; padding: 0.4rem 1.1rem; border: 1px solid var(--bl-border); border-radius: 14px; background: var(--bl-tint); }
.bl-toc summary { cursor: pointer; padding-block: 0.7rem; font-family: var(--font-heading); font-weight: 600; color: var(--bl-text); }
.bl-toc ol { margin: 0 0 0.8rem; padding-left: 1.3rem; display: grid; gap: 0.1rem; }
.bl-toc li.is-sub { margin-left: 1rem; list-style: circle; }
.bl-toc a { display: inline-block; padding-block: 0.35rem; color: var(--bl-text); text-decoration: none; }
.bl-toc a:hover { color: var(--vb-green-ink); text-decoration: underline; }

/* the article text: spacing only — the editor's own structure and formatting are left alone */
.bl-content { font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem); line-height: 1.75; color: var(--bl-text); overflow-wrap: break-word; }
.bl-content > :first-child { margin-top: 0; }
.bl-content :is(p, ul, ol, blockquote, figure, table, pre) { margin: 0 0 1.35em; }
.bl-content :is(h2, h3, h4) { font-family: var(--font-heading); color: var(--bl-text); line-height: 1.3; margin: 2em 0 0.6em; scroll-margin-top: calc(var(--header-h, 80px) + 16px); letter-spacing: -0.01em; }
.bl-content h2 { font-size: 1.6em; } .bl-content h3 { font-size: 1.3em; } .bl-content h4 { font-size: 1.1em; }
.bl-content[lang="km"] :is(h2, h3, h4), .bl-content__km :is(h2, h3, h4) { line-height: 1.6; letter-spacing: normal; }
.bl-content :is(ul, ol) { padding-left: 1.4em; }
.bl-content li { margin-bottom: 0.45em; }
.bl-content a { color: var(--vb-green-ink); text-decoration: underline; text-underline-offset: 3px; }
.bl-content :is(img, video, iframe) { max-width: 100%; border-radius: 12px; }
.bl-content img { height: auto; }                       /* whole image, own proportions */
.bl-content iframe { display: block; width: 100%; }
.bl-content figcaption { margin-top: 0.5em; font-size: 0.875em; color: var(--bl-muted); text-align: center; }
.bl-content blockquote { padding: 0.2em 0 0.2em 1.1em; border-left: 3px solid var(--vb-green); color: var(--bl-text); font-size: 1.08em; }
.bl-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.bl-content :is(th, td) { border: 1px solid var(--bl-border); padding: 0.5em 0.75em; }
.bl-content pre { overflow-x: auto; padding: 1em; background: var(--bl-tint); border-radius: 12px; }
html.lang-km .bl-content__en, html:not(.lang-km) .bl-content__km { display: none; }

.bl-source { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; margin: 2.5rem 0 0; padding: 1.25rem 1.4rem; border: 1px solid var(--bl-border); border-radius: 16px; background: var(--bl-tint); }
.bl-source p { margin: 0; color: var(--bl-muted); }
.bl-share { margin: 2.5rem 0 var(--bl-space); padding-top: 1.5rem; border-top: 1px solid var(--bl-border); }
.bl-share__title { font-family: var(--font-heading); font-size: 1rem; font-weight: 600; margin: 0 0 0.75rem; color: var(--bl-text); }
.bl-share__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bl-chip { display: inline-flex; align-items: center; min-height: 44px; padding: 0.5rem 1rem; border: 1px solid var(--vb-border-strong); border-radius: 999px; background: var(--bl-card); color: var(--bl-text); font: 600 0.9rem/1.3 var(--font-heading); text-decoration: none; cursor: pointer; }
.bl-chip:hover { border-color: var(--bl-text); background: var(--bl-tint); }
.bl-chip.is-done { border-color: var(--vb-green); background: var(--vb-green-tint); color: var(--vb-green-ink); }
.bl-back { margin: 1.5rem 0 0; }
.bl-back .vb-link { min-height: 44px; }

/* ---------- responsive ---------- */
@media (max-width: 1023px) { .bl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .bl-feature { grid-template-columns: minmax(0, 1fr); } .bl-feature__media { aspect-ratio: 16 / 9; max-height: 340px; } }
@media (max-width: 639px) {
  .bl-grid { grid-template-columns: minmax(0, 1fr); }
  .bl-field, .bl-field--grow { flex: 1 1 100%; }
  .bl-tools .bl-btn, .bl-cta__actions, .bl-cta__actions .bl-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .bl-feature__media img, .bl-card__media img, .bl-btn { transition: none; }
  .bl-feature:hover .bl-feature__media img, .bl-card:hover .bl-card__media img { transform: none; }
  .bl-skel { animation: none; }
}
