/* ==========================================================================
   VRDevAI — Long-form article layout (insights pages)
   Tokens only; no brand colour is hard-coded here.

   Bilingual body: an article carries both languages in the markup. English is
   visible by default (JS disabled, crawlers); site.js sets <html lang="th">
   when Thai is chosen and these two rules swap the blocks.
   ========================================================================== */

html[lang="th"] .l-en { display: none; }
html:not([lang="th"]) .l-th { display: none; }

.article { max-width: 46rem; margin-inline: auto; }
.article > * + *,
.article > .l-en > * + *,
.article > .l-th > * + * { margin-top: var(--sp-3); }

.article__head { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border); }
.article__head h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.8rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-top: var(--sp-1);
  text-wrap: balance;
}
.article__meta { margin-top: var(--sp-2); color: var(--text-muted); font-size: var(--fs-small); }
.article__lede { margin-top: var(--sp-2); font-size: 1.15rem; line-height: 1.7; }

.article h2 {
  font-size: clamp(1.35rem, 1.1rem + 0.9vw, 1.7rem);
  line-height: 1.3;
  margin-top: var(--sp-5);
  text-wrap: balance;
}
.article h3 { font-size: var(--fs-h3); margin-top: var(--sp-4); }
.article p, .article li { line-height: 1.8; }
.article ul, .article ol { padding-left: 1.3em; display: grid; gap: 0.5rem; }
.article code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.88em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 0.05em 0.4em;
  border-radius: 6px;
}
.article a:not([class]) { color: var(--tech-blue); text-decoration: underline; text-underline-offset: 2px; }
.article a:focus-visible { outline: 2px solid var(--tech-blue); outline-offset: 2px; }

/* Key takeaway */
.callout {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--tech-blue);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
}
.callout--warn { border-left-color: var(--signal-magenta); }

/* Headline numbers */
.figs { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); }
.fig { border-top: 3px solid var(--tech-blue); padding-top: var(--sp-1); }
.fig strong { display: block; font-size: 1.6rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.fig span { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.5; display: block; }

/* Horizontal result bars */
.bars {
  display: grid; gap: var(--sp-2);
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3);
}
.bar { display: grid; grid-template-columns: minmax(9rem, 15rem) 1fr 3.5rem; gap: var(--sp-2); align-items: center; font-size: var(--fs-small); }
.bar__track { height: 12px; background: var(--line-soft); border-radius: var(--r-pill); overflow: hidden; }
.bar__fill { height: 100%; background: var(--slate-gray); border-radius: var(--r-pill); }
.bar__fill--hi { background: var(--grad-accent); }
.bar__v { text-align: right; font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }
@media (max-width: 560px) {
  .bar { grid-template-columns: 1fr 3.5rem; }
  .bar__track { grid-column: 1 / -1; grid-row: 2; }
}
.caption { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.6; }

/* Tables scroll inside their own box on phones, never the page */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-sm); }
.article table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: var(--fs-small); }
.article th, .article td { text-align: left; vertical-align: top; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--border); line-height: 1.6; }
.article th { background: var(--bg-alt); font-weight: var(--fw-semibold); color: var(--text-muted); }
.article tr:last-child td { border-bottom: 0; }

/* Decision flow */
.flow { display: grid; gap: var(--sp-1); grid-template-columns: 1fr; }
@media (min-width: 760px) { .flow { grid-template-columns: repeat(4, 1fr); } }
.flow__step {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: var(--sp-2); font-size: var(--fs-small); line-height: 1.6;
}
.flow__step b { display: block; font-size: 0.95rem; margin-bottom: 0.25rem; }
.flow__step--key { border-color: var(--tech-blue); box-shadow: var(--shadow-sm); }

.sources { font-size: var(--fs-small); color: var(--text-muted); }
/* Source links open in a new tab; the arrow says so before the click.
   The empty alt text keeps screen readers from announcing the glyph. */
.article a[target="_blank"]::after { content: " ↗"; content: " ↗" / ""; }

/* --- Insight cards: the listing page and the "latest" strip on the homepage --- */
.posts { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); }
.post-card {
  display: flex; flex-direction: column; gap: var(--sp-1);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.post-card:hover { border-color: var(--tech-blue); box-shadow: var(--shadow-md); }
.post-card:focus-visible { outline: 2px solid var(--tech-blue); outline-offset: 3px; }
.post-card__tag {
  align-self: flex-start;
  font-size: 0.66rem; font-weight: var(--fw-bold);
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.34em 0.8em; border-radius: var(--r-pill);
  background: var(--bg-alt); color: var(--tech-blue);
  border: 1px solid var(--border);
}
.post-card h3 { font-size: var(--fs-h3); line-height: 1.35; }
.post-card p { color: var(--text-muted); font-size: var(--fs-small); line-height: 1.7; }
.post-card__foot {
  margin-top: auto; padding-top: var(--sp-1);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--sp-1);
  font-size: var(--fs-small);
}
.post-card__meta { color: var(--text-muted); }
.post-card__more { color: var(--tech-blue); font-weight: var(--fw-semibold); }

.latest { margin-top: var(--sp-5); }
.latest__head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--sp-1); margin-bottom: var(--sp-2);
}
.latest__head .section-head__action { margin-top: 0; }
.latest .post-card { max-width: 46rem; }
