/* Article template — shared by tech-planter-2026, news-silkworm-egg-quality, case-silkworm-hatching
   (Figma 229:17141 / 229:17225 / 229:17334, 1440 wide). Sidebar 300 + gap 35 + body 914 = 1249. */

/* ---------- hero band ---------- */
.article-hero { color: var(--bg); background: #05041a url("../../img/article/hero-bg.webp") center 50%/cover no-repeat; }
.article-hero__inner { padding-top: 16px; padding-bottom: 28px; }
.article-hero .breadcrumb { color: var(--bg); padding: 0; font: 400 15px/1.4 var(--font-en); }
.breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; }
.breadcrumb li { display: flex; align-items: center; }
.breadcrumb li + li::before { content: ""; width: 12px; height: 12px; margin: 0 7px; background: url("../../img/common/chevron.svg") center/6px auto no-repeat; filter: brightness(0) invert(1); opacity: .9; }
.article-hero .breadcrumb [aria-current] { color: var(--red); font-weight: 600; }
.article-hero__tag { margin-top: 34px; background: var(--red); font: 500 15px/22px var(--font-en); padding: 0 5px; }
.article-hero__title { font: 600 clamp(26px, 2.8vw, 40px)/1.45 var(--font-th); max-width: 1250px; margin-top: 0; }
.article-meta { display: flex; align-items: center; gap: 12px; margin-top: 4px; font: 300 15px/1.4 var(--font-en); }
.article-meta__time { display: inline-flex; align-items: center; gap: 2px; }
.article-meta__time img { width: 15px; height: 15px; }

/* ---------- layout ---------- */
.article-wrap { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 35px; align-items: start; padding-top: 51px; padding-bottom: 61px; }
.article-aside { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow-y: auto; scrollbar-width: thin; }

/* ---------- table of contents ---------- */
.side-title { font: 700 20px/1.5 var(--font-th); letter-spacing: .33em; color: var(--red-dark); text-transform: uppercase; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin: 0 0 6px; }
.toc > summary { list-style: none; cursor: default; }
.toc > summary::-webkit-details-marker { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.toc a { display: flex; align-items: center; min-height: 66px; padding: 4px 11px 4px 22px; border-left: 4px solid var(--muted); color: var(--muted); font: 400 18px/1.505 var(--font-th); text-decoration: none; transition: color .15s, border-color .15s; }
.toc a b { font-weight: 700; }
.toc a:hover, .toc a.is-active { color: var(--ink); border-left-color: var(--red); }

/* ---------- related articles (sidebar) ---------- */
.related { margin-top: 60px; }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.related a { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; background: #f2f2ef; text-decoration: none; color: #000; transition: background .15s; }
.related a:hover { background: #e9e9e4; }
.related img { width: 140px; aspect-ratio: 16/9; object-fit: cover; }
.related .cat { display: block; font: 400 12px/1.3 var(--font-th); }
.related__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font: 400 13px/1.35 var(--font-th); padding-right: 8px; }

/* ---------- body ---------- */
.article-body { font-size: 20px; line-height: 1.5; font-weight: 300; }
.article-cover { width: 100%; aspect-ratio: 914/514; object-fit: cover; margin-bottom: 24px; }
.article-body p { margin: 0 0 12px; }
.article-body .article-lead { font-weight: 500; margin-bottom: 24px; }
.article-body h2 { position: relative; font: 600 35px/1.3 var(--font-th); margin: 40px 0 22px; padding-bottom: 18px; scroll-margin-top: calc(var(--header-h) + 24px); }
.article-body h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 87px; height: 3px; background: var(--red-dark); }
.article-body--h40 h2 { font-size: 40px; }
.article-body h2 + p { margin-top: 0; }
.article-body ul { margin: 0 0 12px; padding-left: 30px; }
.article-body li { margin: 0; }
.article-body figure { margin: 36px 0; }
.article-body figure img { width: 100%; }
.article-body figure.is-narrow { max-width: 768px; margin-left: auto; margin-right: auto; }
.article-body .spacer { margin-bottom: 30px; }

.article-back { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--muted); }
.back-link { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; color: #636363; font: 400 15px/1.5 var(--font-th); text-decoration: none; }
.back-link img { width: 20px; height: 15px; transform: rotate(180deg); }
.back-link:hover { color: var(--red); }

/* ---------- phone / tablet ---------- */
@media (max-width: 960px) {
  .article-wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 24px; padding-bottom: 40px; }
  .article-aside { display: contents; }
  .toc { order: -1; border: 1px solid var(--line); background: #fff; }
  .toc > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; padding: 0 16px; cursor: pointer; }
  .toc > summary .side-title { border: 0; padding: 0; margin: 0; font-size: 16px; }
  .toc > summary::after { content: ""; width: 12px; height: 12px; background: url("../../img/common/chevron.svg") center/7px auto no-repeat; filter: brightness(0); transform: rotate(90deg); transition: transform .2s; }
  .toc[open] > summary::after { transform: rotate(270deg); }
  .toc ol { padding: 0 16px 16px; }
  .toc a { min-height: 44px; font-size: 16px; padding-left: 14px; }
  .related { order: 1; margin-top: 16px; }
  .article-body { font-size: 17px; }
  .article-body h2, .article-body--h40 h2 { font-size: clamp(24px, 6vw, 30px); margin-top: 32px; }
  .article-body figure { margin: 24px 0; }
  .article-hero__tag { margin-top: 20px; }
}

/* ---------- Thai page labels (English output unchanged) ---------- */
html[lang="th"] .article-hero .breadcrumb, html[lang="th"] .article-hero__tag { font-family: var(--font-th); }
html[lang="th"] .side-title { letter-spacing: .02em; }

/* ======================================================================================
   Long-form case report (case-silkworm-hatching). Additive only: every rule is scoped to
   classes used only on that page (.cs on <article>, .cs-hero-eyebrow, .cs-lightbox), so the
   other article pages render exactly as before.
   ====================================================================================== */
.article-hero .cs-hero-eyebrow { margin: 14px 0 4px; color: #ff8a8f; }

/* nine-section report: tighter TOC rows so the related list stays in view on a laptop screen */
@media (min-width: 961px) {
  .cs-aside .toc a { min-height: 44px; font-size: 17px; line-height: 1.4; }
  .cs-aside .related { margin-top: 28px; }
}

/* section heads: English eyebrow + Thai/English h2; the wrapper carries the TOC anchor */
.cs .cs-head { margin: 64px 0 22px; scroll-margin-top: calc(var(--header-h) + 24px); }
.cs .cs-head .eyebrow-en { margin: 0 0 8px; }
.cs .cs-head h2 { margin: 0; }
.cs h3 { font: 600 24px/1.4 var(--font-th); margin: 36px 0 12px; }
.cs .cs-cite { font-size: .62em; font-weight: 500; line-height: 0; vertical-align: super; color: var(--red-dark); text-decoration: none; white-space: nowrap; }
.cs .cs-cite:hover { text-decoration: underline; }

/* figures, captions, click-to-enlarge */
.cs figure { margin: 32px 0; }
.cs figure img { display: block; height: auto; background: #e9e9e4; }
.cs figcaption { margin-top: 10px; font: 400 15px/1.6 var(--font-th); color: #555; }
.cs .cs-credit { display: block; margin-top: 2px; font-size: 13px; color: #7a7a7a; }
.cs .cs-zoom { display: block; cursor: zoom-in; }
.cs .cs-cover { margin: 0 0 24px; }
.cs .cs-cover .article-cover { margin-bottom: 0; }
.cs .cs-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 32px 0; align-items: start; }
.cs .cs-pair--lp { grid-template-columns: 16fr 9fr; }
.cs .cs-pair figure { margin: 0; }
.cs .cs-split { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; align-items: start; margin: 8px 0 24px; }
.cs .cs-split figure { margin: 6px 0 0; }

/* notes, pull line, key fact */
.cs .cs-note { margin: 24px 0; padding: 16px 20px; border-left: 4px solid var(--red); background: #f0eee8; font-size: 17px; font-weight: 400; line-height: 1.6; }
.cs .cs-note > :last-child { margin-bottom: 0; }
.cs .cs-note__title { display: block; margin-bottom: 4px; font: 600 17px/1.5 var(--font-th); color: var(--red-dark); }
.cs .cs-note ul { margin: 6px 0 0; padding-left: 22px; }
.cs .cs-note li + li { margin-top: 6px; }
.cs .cs-pull { margin: 28px 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--purple); font: 500 22px/1.55 var(--font-th); color: var(--ink); }
.cs .cs-fact { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 28px; align-items: center; margin: 4px 0 28px; padding: 24px 26px; color: #fff; background: var(--dark-grad); }
.cs .cs-fact__label { display: block; font: 500 14px/1.4 var(--font-th); color: #cfc8ff; }
.cs .cs-fact__num { display: block; font: 700 46px/1.15 var(--font-en); }
.cs .cs-fact__unit { display: block; font: 400 16px/1.4 var(--font-th); }
.cs .cs-fact p { margin: 0; font-size: 17px; font-weight: 300; }
.cs .cs-fact .cs-fact__caveat { margin-top: 8px; font-size: 14px; color: #d7d3ea; }
.cs .cs-fact .cs-cite { color: #ff8a8f; }

/* numbered cards (steps, beneficiaries, next steps) */
.cs .cs-steps { list-style: none; margin: 24px 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cs .cs-steps > li { padding: 18px 18px 20px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--red-dark); font-size: 16px; line-height: 1.6; }
.cs .cs-steps__no { display: block; font: 700 14px/1.4 var(--font-en); color: var(--red); letter-spacing: .06em; }
.cs .cs-steps__title { display: block; margin: 2px 0 6px; font: 600 18px/1.45 var(--font-th); color: var(--ink); }
.cs .cs-steps__kicker { display: block; font: 500 13px/1.4 var(--font-th); color: #7a7a7a; }

/* project facts */
.cs .cs-facts { display: grid; grid-template-columns: 210px minmax(0, 1fr); margin: 24px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.6; }
.cs .cs-facts dt, .cs .cs-facts dd { margin: 0; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cs .cs-facts dt { font-weight: 600; padding-right: 16px; }
.cs .cs-facts dd { font-weight: 300; }

/* tables (stack into cards on phones) */
.cs .cs-table { width: 100%; margin: 28px 0; border-collapse: collapse; background: #fff; font-size: 16px; line-height: 1.55; }
.cs .cs-table th, .cs .cs-table td { padding: 11px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.cs .cs-table thead th { background: var(--ink); color: #fff; font-weight: 600; }
.cs .cs-table tbody th { width: 22%; background: #f2f2ef; font-weight: 600; }
.cs .cs-table td { font-weight: 300; }
.cs .cs-table .cs-table__q td { font-weight: 500; }
.cs .cs-table caption { caption-side: bottom; padding-top: 8px; text-align: left; font: 400 14px/1.5 var(--font-th); color: #555; }

/* video */
.cs .cs-video video { display: block; width: 100%; height: auto; aspect-ratio: 16/9; background: #000; }
.cs .cs-video__title { margin: 0 0 10px; font: 600 18px/1.45 var(--font-th); }

/* result stat cards */
.cs .cs-stats-head { margin: 28px 0 10px; font: 500 15px/1.5 var(--font-th); color: #555; }
.cs .cs-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 0 12px; }
.cs .cs-stat { padding: 22px 24px; color: #fff; background: var(--dark-grad); }
.cs .cs-stat__label { display: block; font: 500 15px/1.4 var(--font-th); color: #cfc8ff; }
.cs .cs-stat__num { display: block; margin: 4px 0 2px; font: 700 clamp(44px, 5.4vw, 64px)/1.1 var(--font-en); color: #fff; }
.cs .cs-stat__sub { display: block; font: 400 17px/1.45 var(--font-th); }

/* goal cards */
.cs .cs-goals { margin: 24px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cs .cs-goal { padding: 18px 18px 20px; background: #fff; border: 1px dashed #b9b9b4; font-size: 16px; line-height: 1.6; }
.cs .cs-goal p { margin: 0; }
.cs .cs-goal__tag { display: inline-block; margin-bottom: 8px; padding: 0 8px; font: 500 13px/24px var(--font-th); color: var(--purple-2); background: #efe8ff; }
.cs .cs-goal__title { display: block; margin-bottom: 6px; font: 600 18px/1.45 var(--font-th); }

/* references */
.cs .cs-refs-intro { font-size: 16px; line-height: 1.6; color: #444; }
.cs .cs-refs { margin: 18px 0 0; padding-left: 34px; font-size: 15px; line-height: 1.6; font-weight: 400; }
.cs .cs-refs li { margin: 0 0 10px; padding-left: 4px; overflow-wrap: anywhere; scroll-margin-top: calc(var(--header-h) + 24px); }
.cs .cs-refs li:target { background: #fff5d6; }
.cs .cs-refs a { color: var(--red-dark); }
.cs .cs-refs-credit { margin-top: 18px; font-size: 14px; line-height: 1.6; color: #666; }

/* lightbox (native <dialog>, no library) */
.cs-lightbox { max-width: min(1200px, 94vw); max-height: 94vh; padding: 0; border: 0; background: #111; color: #eee; overflow: auto; }
.cs-lightbox::backdrop { background: rgba(0, 0, 0, .78); }
.cs-lightbox img { display: block; max-width: 100%; max-height: calc(94vh - 80px); margin: 0 auto; object-fit: contain; }
.cs-lightbox__cap { margin: 0; padding: 10px 52px 12px 16px; font: 400 14px/1.5 var(--font-th); }
.cs-lightbox__close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }

@media (max-width: 960px) {
  .cs .cs-head { margin-top: 48px; }
  .cs h3 { font-size: 20px; }
  .cs .cs-pull { font-size: 19px; }
  .cs .cs-note, .cs .cs-facts { font-size: 16px; }
}
@media (max-width: 700px) {
  .cs .cs-steps, .cs .cs-goals { grid-template-columns: minmax(0, 1fr); }
  .cs .cs-pair, .cs .cs-pair--lp, .cs .cs-split { grid-template-columns: minmax(0, 1fr); }
  .cs .cs-split figure { max-width: 320px; }
  .cs .cs-fact { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .cs .cs-facts { grid-template-columns: minmax(0, 1fr); }
  .cs .cs-facts dt { padding-bottom: 0; border-bottom: 0; }
  .cs .cs-facts dd { padding-top: 2px; }
  .cs .cs-stat { padding: 16px; }
  .cs .cs-stat__sub { font-size: 15px; }
  .cs .cs-table, .cs .cs-table tbody, .cs .cs-table tr, .cs .cs-table th, .cs .cs-table td { display: block; width: auto; }
  .cs .cs-table { background: none; }
  .cs .cs-table caption { display: block; padding: 0 0 10px; }
  .cs .cs-table thead { display: none; }
  .cs .cs-table tr { margin-bottom: 12px; background: #fff; border: 1px solid var(--line); }
  .cs .cs-table th, .cs .cs-table td { border: 0; }
  .cs .cs-table tbody th { width: auto; }
  .cs .cs-table td[data-label]::before { content: attr(data-label); display: block; font: 600 13px/1.4 var(--font-th); color: var(--red-dark); }
}

/* Rounded corners */
.article-cover, .article-body figure img, .cs .cs-video video { border-radius: var(--r); }
.cs .cs-zoom { border-radius: var(--r); overflow: hidden; }
.cs .cs-zoom img { border-radius: 0; }
.cs .cs-note, .cs .cs-fact, .cs .cs-stat, .cs .cs-goal, .cs .cs-steps > li { border-radius: var(--r); }
.cs .cs-goal__tag { border-radius: 999px; }
.cs-lightbox { border-radius: var(--r); }
.related a { border-radius: var(--r-sm); overflow: hidden; }
/* table: separate borders so the outer corners can round */
.cs .cs-table { border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cs .cs-table th, .cs .cs-table td { border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cs .cs-table tr > :last-child { border-right: 0; }
.cs .cs-table tbody tr:last-child > * { border-bottom: 0; }
@media (max-width: 960px) {
  .cs .cs-table { border: 0; border-radius: 0; overflow: visible; }
  .cs .cs-table th, .cs .cs-table td { border: 0; }
  .cs .cs-table tr { border-radius: var(--r); overflow: hidden; }
}
.article-source { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.6; color: #666; }
.article-source a { color: inherit; }
