/* วารสารสถิติ: ตัวเลขนำ เส้นคั่นบาง สี accent ใช้กับเงินบาทและลิงก์เท่านั้น */
:root {
  --bg: #f5f3ee;
  --surface: #fffefb;
  --text: #1b2330;
  --muted: #535c68;
  --border: #d6d1c4;
  --rule: #e6e1d6;
  --accent: #a3401c;
  --accent-soft: #f6e6dd;
  --focus: #1f5fbf;
  --t1: #2f5d50;
  --t2: #5a4b86;
  --t3: #7a5a12;
  --gray-bar: #858d98;
  --container: 1120px;
  --reading: 720px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --radius: 3px;
  --font: Anuphan, "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1.09375rem/1.8 var(--font); }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.35; font-weight: 600; margin: 0 0 var(--s3); }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.6rem); letter-spacing: -0.005em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); margin-top: var(--s7); }
h3 { font-size: 1.12rem; margin-top: var(--s5); }
p { margin: 0 0 var(--s4); }
.h-small { font-size: 1rem; margin: 0 0 var(--s3); color: var(--muted); }
.num, .big, .chart, .facts dd, table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.skip { position: absolute; left: var(--s2); top: -60px; background: var(--surface); padding: var(--s2) var(--s4); z-index: 10; border: 2px solid var(--focus); }
.skip:focus { top: var(--s2); }
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--s4); }
.narrow { max-width: calc(var(--reading) + 2 * var(--s4)); }

/* header / footer */
.site-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-top: var(--s2); padding-bottom: var(--s2); }
.brand { font-weight: 600; color: var(--text); text-decoration: none; padding: var(--s2) 0; min-height: 44px; display: inline-flex; align-items: center; }
.brand::before { content: ""; width: 10px; height: 10px; background: var(--accent); margin-right: var(--s2); display: inline-block; }
.site-head nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 var(--s4); }
.site-head nav a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.site-head nav a:hover, .site-head nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.site-foot { margin-top: var(--s8); border-top: 1px solid var(--border); background: var(--surface); padding: var(--s6) 0 var(--s7); font-size: 0.92rem; color: var(--muted); }
.site-foot ul { list-style: none; padding: 0; margin: 0 0 var(--s4); display: flex; flex-wrap: wrap; gap: 0 var(--s5); }
.site-foot a { display: inline-flex; min-height: 44px; align-items: center; }
.foot-ymyl { color: var(--text); }

main { display: block; padding-bottom: var(--s6); }
main:focus { outline: none; }

/* hub */
.hub-head { padding: var(--s7) 0 var(--s4); max-width: 860px; }
.tagline { font-size: 1.15rem; color: var(--muted); margin: 0; }
.lead { border-top: 2px solid var(--text); border-bottom: 1px solid var(--border); padding: var(--s4) 0 var(--s5); margin-top: var(--s4); }
.lead-grid { display: grid; grid-template-columns: 1fr; gap: var(--s4) var(--s6); margin: 0; }
.lead-grid > div { border-left: 3px solid var(--rule); padding-left: var(--s4); }
.lead-grid > div:first-child { border-left-color: var(--accent); }
.lead-grid dt { font-size: 0.95rem; color: var(--muted); }
.lead-grid dd { margin: 0; }
.lead-grid .big { font-size: clamp(1.7rem, 5vw, 2.3rem); font-weight: 600; line-height: 1.25; color: var(--text); }
.lead-grid .sub { display: block; font-size: 0.95rem; color: var(--muted); }
.lead-note { margin: var(--s4) 0 0; font-size: 0.97rem; max-width: var(--reading); }
.lead-links { display: flex; flex-wrap: wrap; gap: var(--s3); margin: var(--s4) 0 0; }
.cta { display: inline-flex; align-items: center; min-height: 44px; padding: var(--s2) var(--s4); border: 1px solid var(--accent); border-radius: var(--radius); text-decoration: none; font-weight: 600; }
.cta-main { background: var(--accent); color: #fff; }
.cta-main:hover { background: #873416; }
.lead-fig .fig { margin-top: var(--s5); }

/* images */
.photo { margin: var(--s5) 0; }
.photo img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--rule); border-radius: var(--radius); }
.hub .photo img { max-height: min(45vh, 440px); }
.photo figcaption { font-size: 0.85rem; color: var(--muted); margin-top: var(--s2); }

/* reading column */
.prose { max-width: var(--reading); }
.prose p { margin-bottom: var(--s4); }
.article .prose h2 { padding-top: var(--s2); }
.lede { font-size: 1.15rem; color: var(--text); max-width: var(--reading); }

/* paths */
.path-grid { display: grid; grid-template-columns: 1fr; gap: var(--s5); }
.path { border-top: 1px solid var(--text); padding-top: var(--s3); }
.path h3 { margin-top: 0; }
.path p { color: var(--muted); font-size: 0.97rem; }
.path ol { padding-left: 1.3em; margin: 0; }
.path li { margin-bottom: var(--s2); }

/* facts */
.facts dl { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; max-width: 900px; }
.facts dl > div { display: grid; grid-template-columns: 1fr; gap: var(--s1); padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.facts dt { color: var(--muted); font-size: 0.97rem; }
.facts dd { margin: 0; }
.facts .num { font-weight: 600; font-size: 1.1rem; }
.asof { color: var(--muted); font-size: 0.9rem; }

/* article list + filters */
.sort-note { color: var(--muted); font-size: 0.95rem; }
.filters { display: flex; flex-wrap: wrap; gap: var(--s3) var(--s4); align-items: flex-end; padding: var(--s3) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-bottom: var(--s4); }
.filters[hidden] { display: none; }
.f-field { display: flex; flex-direction: column; }
.f-field label { font-size: 0.9rem; color: var(--muted); }
.filters select { font: inherit; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.count { margin: 0; font-size: 0.95rem; color: var(--muted); align-self: center; }
.list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr; gap: 0 var(--s6); }
.item { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.item[hidden] { display: none; }
.item h3, .item h2 { margin: 0 0 var(--s2); font-size: 1.12rem; }
.item h3 a, .item h2 a { color: var(--text); text-decoration: none; }
.item h3 a:hover, .item h2 a:hover { color: var(--accent); text-decoration: underline; }
.item p { margin: 0 0 var(--s2); }
.meta { color: var(--muted); font-size: 0.9rem; }
.empty button { font: inherit; min-height: 44px; padding: 0 var(--s4); border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: var(--radius); cursor: pointer; }

/* agree / unknown */
.two-col { display: grid; grid-template-columns: 1fr; gap: var(--s5); }
.two-col > div { border-top: 1px solid var(--text); padding-top: var(--s3); }
.two-col h3 { margin-top: 0; }
.two-col ul { padding-left: 1.2em; margin: 0; }
.two-col li { margin-bottom: var(--s3); }

/* faq */
.faq details { border-bottom: 1px solid var(--rule); max-width: var(--reading); }
.faq summary { cursor: pointer; padding: var(--s3) 0; min-height: 44px; font-weight: 600; list-style-position: outside; }
.faq details p { margin: 0 0 var(--s4); }

/* article */
.crumbs ol { list-style: none; padding: 0; margin: var(--s5) 0 var(--s3); display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); font-size: 0.92rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: var(--s2); color: var(--border); }
.crumbs a { display: inline-flex; min-height: 44px; align-items: center; }
.article-head { max-width: 860px; }
.kicker { color: var(--muted); font-size: 0.95rem; margin-bottom: var(--s2); }
.byline { color: var(--muted); font-size: 0.95rem; }
.note { background: var(--surface); border-left: 3px solid var(--border); padding: var(--s3) var(--s4); max-width: var(--reading); font-size: 0.97rem; }
.note-ymyl { border-left-color: var(--t3); }
.note-stale { border-left-color: var(--accent); }
.takeaways { max-width: var(--reading); border-top: 2px solid var(--text); margin-top: var(--s5); padding-top: var(--s2); }
.takeaways h2 { margin-top: var(--s2); font-size: 1.1rem; }
.takeaways ul { padding-left: 1.2em; margin: 0; }
.takeaways li { margin-bottom: var(--s3); }
.toc { max-width: var(--reading); margin-top: var(--s5); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--rule); }
.toc h2 { margin: 0 0 var(--s2); font-size: 1rem; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.3em; }
.toc li { padding: var(--s1) 0; }
.toc a { display: inline; }
.caveats { max-width: var(--reading); background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); padding: var(--s2) var(--s5) var(--s3); margin-top: var(--s7); }
.caveats h2 { margin-top: var(--s3); font-size: 1.15rem; }
.caveats ul { padding-left: 1.2em; margin: 0; }
.caveats li { margin-bottom: var(--s3); }
.further ul, .related .list { max-width: var(--reading); }
.further ul { padding-left: 1.2em; }
.further li { margin-bottom: var(--s3); }

/* references */
sup.ref { line-height: 0; font-size: 0.72em; }
sup.ref a { display: inline-block; padding: 6px 2px; text-decoration: none; font-weight: 600; }
.refs ol { padding-left: 1.6em; font-size: 0.93rem; max-width: var(--reading); overflow-wrap: anywhere; }
.refs li { margin-bottom: var(--s3); }
.back { display: inline-block; padding: 2px 6px; text-decoration: none; }
.tier { font-size: 0.82rem; padding: 0 6px; border: 1px solid currentColor; border-radius: var(--radius); white-space: nowrap; }
.tier-t1 { color: var(--t1); }
.tier-t2 { color: var(--t2); }
.tier-t3 { color: var(--t3); }
a.term { color: inherit; text-decoration-style: dotted; }

/* figures (SVG) */
.fig { margin: var(--s5) 0; padding: var(--s4); background: var(--surface); border: 1px solid var(--rule); max-width: 780px; }
.fig-title { font-weight: 600; margin-bottom: var(--s3); }
.chart { width: 100%; }
.chart-bar { max-width: 560px; }
.chart-line { max-width: 640px; }
.chart text { font-family: var(--font); font-size: 17px; fill: var(--text); }
.chart .axis { font-size: 16px; fill: var(--muted); }
.chart-line text { font-size: 19px; }
.chart-bar text { font-size: 19px; }
.chart-line .axis { font-size: 18px; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .gapline { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke: var(--text); stroke-width: 2; }
.chart .pt { fill: var(--text); }
.chart .pt.hi, .chart .bar.hi { fill: var(--accent); }
.chart .val.hi, .chart .lab.hi { fill: var(--accent); font-weight: 600; }
.chart .bar { fill: var(--gray-bar); }
.chart .bar.b2 { fill: #555e6b; }
.chart .na { fill: var(--muted); font-style: italic; }
.fig-note { font-size: 0.88rem; color: var(--muted); margin: var(--s3) 0 0; }
.fig-data summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 0.93rem; color: var(--accent); }

/* tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table-wrap:focus-visible { outline: 3px solid var(--focus); }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
caption { text-align: left; font-weight: 600; padding-bottom: var(--s2); }
th, td { text-align: left; vertical-align: top; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--rule); }
thead th { border-bottom: 2px solid var(--text); font-size: 0.9rem; color: var(--muted); }
.na { color: var(--muted); font-style: italic; }
.compare .table-wrap { max-width: 900px; }

/* sources & glossary */
.src-list { list-style: none; padding: 0; overflow-wrap: anywhere; }
.src-list li { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); }
.src-list .meta, .cited { display: block; font-size: 0.9rem; color: var(--muted); }
.glossary > div { padding: var(--s3) 0; border-bottom: 1px solid var(--rule); scroll-margin-top: var(--s4); }
.glossary dt { font-weight: 600; }
.glossary dd { margin: var(--s1) 0 0; }

@media (min-width: 700px) {
  .lead-grid { grid-template-columns: repeat(3, 1fr); }
  .path-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr 1fr; }
  .facts dl > div { grid-template-columns: 1fr 1.2fr; gap: var(--s4); }
}
@media (min-width: 1000px) {
  .list { grid-template-columns: 1fr 1fr; }
  .related .list { grid-template-columns: 1fr; }
  .path-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  body { font-size: 1.0625rem; }
  .fig { padding: var(--s3); margin-left: calc(-1 * var(--s2)); margin-right: calc(-1 * var(--s2)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
