/* Concept: บันทึกนโยบายการคลังสำหรับนักลงทุน — สงบ ตรวจสอบได้ ตรงไปตรงมา */
:root {
  --bg: #f5f2ea;
  --surface: #fffdf8;
  --text: #1c2323;
  --muted: #4f5a59;
  --border: #d8d1c2;
  --accent: #0e5658;
  --accent-ink: #0b4446;
  --neg: #8f3a1d;
  --pos: #2d5f3a;
  --focus: #b4530a;
  --container: 1120px;
  --read: 720px;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 32px; --s6: 48px; --s7: 64px;
  --radius: 4px;
  --font: "Sarabun", "Sarabun FB1", "Sarabun FB2", system-ui, sans-serif;
  --fs-body: 1.125rem;
  --lh: 1.8;
}
/* fallback faces sized to Sarabun's measured advance width to limit layout shift on font swap */
@font-face { font-family: "Sarabun FB1"; src: local("Leelawadee UI"); size-adjust: 106.1%; }
@font-face { font-family: "Sarabun FB2"; src: local("Tahoma"); size-adjust: 97.1%; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh); font-variant-numeric: tabular-nums; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }
.skip { position: absolute; left: var(--s3); top: -100px; background: var(--surface); padding: var(--s2) var(--s3); z-index: 10; }
.skip:focus { top: var(--s2); }
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 var(--s3); }
.narrow { max-width: calc(var(--read) + 2 * var(--s3)); }

h1, h2, h3 { line-height: 1.4; font-weight: 600; margin: 0; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.4vw, 2.6rem); margin-bottom: var(--s3); }
h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem); margin: var(--s6) 0 var(--s3); }
h3 { font-size: 1.2rem; margin: var(--s4) 0 var(--s2); }
p { margin: 0 0 var(--s3); }
ul, ol { padding-left: 1.4em; margin: 0 0 var(--s3); }
li { margin-bottom: var(--s2); }
.h-small { font-size: 1.15rem; margin-top: 0; }

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

/* breadcrumb */
.crumbs ol { list-style: none; padding: 0; margin: var(--s4) 0 var(--s3); font-size: 0.95rem; color: var(--muted); }
.crumbs li { margin: 0; display: inline; }
.crumbs li + li::before { content: "/"; margin: 0 var(--s2); color: var(--border); }
.crumbs a { padding: var(--s2) 0; }

/* article */
.article > *, .hub > * { max-width: var(--read); }
.article .table-wrap, .hub .entries, .hub .path-grid, .hub .two-col { max-width: none; }
.hub .photo, .article .photo { max-width: 960px; }
.article-head { margin-bottom: var(--s4); }
.kicker { color: var(--muted); font-size: 0.95rem; margin-bottom: var(--s2); }
.byline { color: var(--muted); font-size: 0.95rem; }
.lede { font-size: 1.22rem; line-height: 1.75; }
.note { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); padding: var(--s3); font-size: 1rem; border-radius: var(--radius); }
.note-ymyl { border-left-color: var(--neg); }
.note-stale { border-left-color: var(--focus); }
.photo { margin: var(--s4) 0; max-width: 960px; }
.photo img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); background: #e9e4d8; }
.photo figcaption { font-size: 0.85rem; color: var(--muted); margin-top: var(--s1); }
.takeaways { background: var(--surface); border: 1px solid var(--border); padding: var(--s1) var(--s4) var(--s2); border-radius: var(--radius); }
.takeaways h2 { margin-top: var(--s3); font-size: 1.2rem; }
.toc { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: var(--s5) 0; padding-bottom: var(--s2); }
.toc h2 { font-size: 1.1rem; margin-top: var(--s3); }
.toc li { padding: var(--s1) 0; }
.toc a { display: inline; }
.prose > section > p, .prose > p { max-width: var(--read); }
sup.ref { font-size: 0.72em; line-height: 0; margin-left: 1px; }
sup.ref a { text-decoration: none; padding: 2px 1px; }
a.term { text-decoration-style: dotted; }
.facts dl { margin: 0; border-top: 1px solid var(--border); }
.facts dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: var(--s3); padding: var(--s2) 0; border-bottom: 1px solid var(--border); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.num { font-weight: 600; }
.asof { color: var(--muted); font-size: 0.9rem; }
.table-wrap { overflow-x: auto; margin: var(--s3) 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 1rem; line-height: 1.6; }
caption { text-align: left; padding: var(--s2) var(--s3); color: var(--muted); font-size: 0.95rem; }
th, td { text-align: left; vertical-align: top; padding: var(--s2) var(--s3); border-top: 1px solid var(--border); }
thead th { background: #efe9dc; border-top: 0; }
.na { color: var(--muted); font-style: italic; }
.caveats { border-left: 3px solid var(--neg); padding-left: var(--s3); }
.caveats h2 { margin-top: var(--s5); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { cursor: pointer; padding: var(--s3) 0; font-weight: 600; min-height: 44px; }
.faq details p { margin-top: 0; }
.meta { color: var(--muted); font-size: 0.92rem; }
.list { list-style: none; padding: 0; }
.item { border-top: 1px solid var(--border); padding: var(--s3) 0; margin: 0; }
.item h2, .item h3 { margin: 0 0 var(--s1); font-size: 1.2rem; }
.item p { margin-bottom: var(--s1); }
.refs { font-size: 0.95rem; line-height: 1.7; border-top: 2px solid var(--text); margin-top: var(--s6); }
.refs h2 { font-size: 1.2rem; margin-top: var(--s4); }
.refs li { overflow-wrap: anywhere; }
.refs li:target { background: #f3e6c8; }
.back { padding: 0 var(--s1); }
.tier { font-size: 0.85rem; color: var(--muted); border: 1px solid var(--border); padding: 0 var(--s1); border-radius: var(--radius); white-space: nowrap; }
.tier-t1 { border-color: var(--accent); color: var(--accent-ink); }

/* figures */
.fig { margin: var(--s4) 0; background: var(--surface); border: 1px solid var(--border); padding: var(--s3); border-radius: var(--radius); max-width: var(--read); }
.fig-title { font-weight: 600; margin-bottom: var(--s2); }
.fig-src, .fig-note { font-size: 0.9rem; color: var(--muted); margin: var(--s2) 0 0; }
.bars .lbl, .bars .val { font: 15px var(--font); fill: var(--text); }
.bars .pos { fill: var(--accent); }
.bars .neg { fill: var(--neg); }
.bars .axis { stroke: var(--muted); stroke-width: 1; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--accent); }
.timeline li { padding: 0 0 var(--s3) var(--s3); position: relative; margin: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 0.65em; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline .when { display: block; font-weight: 600; color: var(--accent-ink); }
.timeline .what { display: block; }
.status-tag { display: inline-block; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 var(--s1); margin-top: var(--s1); color: var(--muted); }
.timeline .st-enacted .status-tag { border-color: var(--accent); color: var(--accent-ink); }
.timeline .st-plan::before { border-style: dashed; }
.hbars { list-style: none; padding: 0; margin: 0; }
.hbars li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); margin-bottom: var(--s3); }
.hb-label { grid-column: 1 / -1; font-size: 0.98rem; }
.hb-track { position: relative; height: 18px; background: #efe9dc; border-radius: 2px; }
.hb-bar { position: absolute; top: 0; bottom: 0; left: 0; }
.has-neg .hb-track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; border-left: 1px solid var(--muted); }
.has-neg .hb-bar.pos { left: 50%; }
.has-neg .hb-bar.neg { left: auto; right: 50%; }
.hb-bar.pos { background: var(--accent); }
.hb-bar.neg { background: var(--neg); }
.hb-val { font-weight: 600; min-width: 5.5em; text-align: right; }

/* hub */
.hub-head { padding-top: var(--s5); }
.tagline { font-size: 1.2rem; color: var(--muted); }
.status { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); padding: var(--s3); border-radius: var(--radius); margin-top: var(--s4); }
.status-label { font-weight: 600; color: var(--accent-ink); margin-bottom: var(--s1); font-size: 1rem; }
.status p:last-child { margin-bottom: 0; }
.entries { display: grid; gap: var(--s3); margin: var(--s4) 0 var(--s3); }
.entry { display: flex; flex-direction: column; gap: var(--s1); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--neg); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.entry-pos { border-left-color: var(--pos); }
.entry:hover { border-color: var(--text); }
.entry-label { font-size: 0.95rem; font-weight: 600; color: var(--neg); }
.entry-pos .entry-label { color: var(--pos); }
.entry-title { font-size: 1.25rem; font-weight: 600; line-height: 1.45; }
.entry-text { color: var(--muted); font-size: 1rem; }
.entry-cta { color: var(--accent); text-decoration: underline; font-size: 1rem; margin-top: var(--s1); }
.path-grid { display: grid; gap: var(--s3); }
.path { border-top: 2px solid var(--accent); padding-top: var(--s2); }
.path h3 { margin-top: 0; }
.two-col { display: grid; gap: var(--s4); }
.two-col h3 { margin-top: 0; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s2); }
.filters[hidden], .empty[hidden] { display: none; }
select, button { font: inherit; font-size: 1rem; min-height: 44px; padding: 0 var(--s3); border: 1px solid var(--muted); border-radius: var(--radius); background: var(--surface); color: var(--text); }
button { cursor: pointer; }
.count { margin: 0; color: var(--muted); font-size: 0.95rem; }
.sort-note { color: var(--muted); font-size: 0.95rem; }

/* sources / glossary */
.src-list { list-style: none; padding: 0; }
.src-list li { border-top: 1px solid var(--border); padding: var(--s2) 0; overflow-wrap: anywhere; }
.src-list .meta, .cited { display: block; font-size: 0.92rem; color: var(--muted); }
.glossary > div { border-top: 1px solid var(--border); padding: var(--s3) 0; }
.glossary dt { font-weight: 600; font-size: 1.15rem; }
.glossary dd { margin: var(--s1) 0 0; }
.glossary > div:target { background: #f3e6c8; }

@media (min-width: 760px) {
  .entries { grid-template-columns: 1fr 1fr; max-width: 960px; }
  .path-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 960px; }
  .two-col { grid-template-columns: 1fr 1fr; max-width: 960px; }
}
@media (max-width: 520px) {
  :root { --fs-body: 1.0625rem; }
  .facts dl > div { grid-template-columns: 1fr; gap: 0; }
  .entry { padding: var(--s3); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media print { .site-head nav, .site-foot nav, .skip { display: none; } }
.narrow > h1:first-child { margin-top: var(--s5); }
