:root {
  --paper: #fbfcfe;
  --ink: #15243a;
  --muted: #5c6a7c;
  --line: #d8e0e8;
  --soft: #eef4f8;
  --blue: #135ca5;
  --blue-deep: #0b3158;
  --green: #176b51;
  --amber: #9c6414;
  --max: 1180px;
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.72; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-deep); }
img, svg { max-width: 100%; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 20; padding: .7rem 1rem; background: white; border: 1px solid var(--blue); }

.site-header { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(216,224,232,.94); background: rgba(251,252,254,.94); backdrop-filter: blur(14px); }
.nav { max-width: var(--max); min-height: 72px; margin: auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 22px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 780; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border: 1px solid var(--blue); border-radius: 11px; display: grid; place-items: center; color: var(--blue); font: 800 14px/1 system-ui; background: #fff; }
.menu { display: flex; align-items: center; gap: 23px; font-size: .93rem; }
.menu a { color: var(--muted); text-decoration: none; }
.menu a:hover, .menu a[aria-current="page"] { color: var(--ink); }
.menu-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: .55rem .75rem; color: var(--ink); }

.shell { max-width: var(--max); margin: auto; padding: 0 24px; }
.hero { padding: 76px 0 44px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 64px; align-items: center; }
.eyebrow { margin: 0 0 14px; color: var(--blue); font: 700 .78rem/1.4 system-ui, sans-serif; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.025em; }
h1 { font-size: clamp(2.65rem, 6vw, 5.65rem); margin: 0 0 22px; max-width: 12ch; }
h2 { font-size: clamp(1.8rem, 3vw, 3rem); margin: 0 0 14px; }
h3 { font-size: 1.32rem; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.12rem; max-width: 68ch; margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .7rem 1rem; border-radius: 8px; border: 1px solid var(--blue); background: var(--blue); color: white; text-decoration: none; font-weight: 700; }
.button.secondary { background: white; color: var(--blue); }
.research-note { margin-top: 25px; color: var(--muted); font-size: .85rem; }

.system-map { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 24px 70px rgba(18,45,73,.08); }
.system-map > small { display: block; color: var(--muted); font: 700 .7rem/1.4 system-ui; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 22px; }
.flow-step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; align-items: start; position: relative; padding-bottom: 23px; }
.flow-step:not(:last-child)::after { content: ""; position: absolute; left: 16px; top: 32px; bottom: 1px; width: 1px; background: var(--line); }
.flow-index { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--blue); color: var(--blue); border-radius: 50%; background: white; font: 700 .72rem/1 system-ui; }
.flow-step b { display: block; margin-bottom: 3px; }
.flow-step span { color: var(--muted); font-size: .9rem; }

.section { padding: 68px 0; border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: .75fr 1.25fr; gap: 48px; align-items: end; margin-bottom: 30px; }
.section-head p { color: var(--muted); margin: 0; }
.cluster-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: white; }
.cluster-card { padding: 28px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); position: relative; min-height: 190px; }
.cluster-card:nth-child(odd) { border-right: 1px solid var(--line); }
.cluster-card:nth-last-child(-n+2) { border-bottom: 0; }
.cluster-card:hover { background: var(--soft); color: inherit; }
.cluster-card small { color: var(--blue); font: 700 .72rem/1.4 system-ui; letter-spacing: .08em; text-transform: uppercase; }
.cluster-card h3 { margin-top: 16px; }
.cluster-card p { color: var(--muted); margin: 8px 0 0; }
.cluster-card .arrow { position: absolute; right: 22px; top: 22px; color: var(--blue); }

.evidence-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border: 1px solid var(--line); background: var(--line); border-radius: 14px; overflow: hidden; }
.evidence-row > div { background: white; padding: 23px; }
.evidence-row small { display: block; color: var(--muted); margin-bottom: 8px; }
.evidence-row strong { font-size: 1.28rem; }
.evidence-row span { display: block; color: var(--muted); margin-top: 5px; font-size: .88rem; }

.page-hero { padding: 62px 0 34px; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 22px; color: var(--muted); font-size: .84rem; }
.breadcrumbs a { color: inherit; }
.page-hero h1 { font-size: clamp(2.25rem, 5vw, 4.65rem); max-width: 18ch; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .85rem; }
.meta span + span { position: relative; }
.article-layout { display: grid; grid-template-columns: minmax(0, 760px) 270px; gap: 72px; align-items: start; padding: 48px 0 82px; }
.article-body { font-size: 1.03rem; }
.article-body h2 { font-size: 1.75rem; margin-top: 52px; scroll-margin-top: 96px; }
.article-body h3 { margin-top: 30px; }
.article-body p, .article-body ul, .article-body ol { max-width: 72ch; }
.article-body li { margin-bottom: .55rem; }
.article-body table { width: 100%; border-collapse: collapse; margin: 26px 0; font-size: .92rem; }
.article-body th, .article-body td { text-align: left; vertical-align: top; padding: 13px 12px; border-bottom: 1px solid var(--line); }
.article-body th { background: var(--soft); }
.key-box, .warning-box, .method-box { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 10px; padding: 20px 22px; margin: 28px 0; background: white; }
.warning-box { border-left-color: var(--amber); }
.method-box { border-left-color: var(--green); }
.key-box strong, .warning-box strong, .method-box strong { display: block; margin-bottom: 6px; }
.toc { position: sticky; top: 100px; border-left: 1px solid var(--line); padding-left: 20px; }
.toc strong { display: block; margin-bottom: 12px; font-size: .85rem; }
.toc a { display: block; color: var(--muted); text-decoration: none; font-size: .84rem; padding: 5px 0; }
.toc a:hover { color: var(--blue); }
.sources { margin-top: 54px; padding-top: 28px; border-top: 1px solid var(--line); }
.sources li { font-size: .9rem; }
.related { margin-top: 50px; padding-top: 28px; border-top: 1px solid var(--line); }
.related-links { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.related-links a { border: 1px solid var(--line); padding: 16px; border-radius: 9px; text-decoration: none; background: white; }

.site-footer { border-top: 1px solid var(--line); background: #f3f7fa; }
.footer-grid { max-width: var(--max); margin: auto; padding: 38px 24px; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; }
.footer-grid p { color: var(--muted); max-width: 48ch; font-size: .9rem; }
.footer-grid b { display: block; margin-bottom: 10px; }
.footer-grid a { display: block; color: var(--muted); text-decoration: none; margin: 5px 0; font-size: .88rem; }
.footer-bottom { border-top: 1px solid var(--line); padding: 16px 24px; text-align: center; color: var(--muted); font-size: .76rem; }

@media (max-width: 820px) {
  .nav { min-height: 64px; }
  .menu-toggle { display: block; }
  .menu { display: none; position: absolute; top: 64px; left: 0; right: 0; padding: 18px 24px 22px; background: white; border-bottom: 1px solid var(--line); flex-direction: column; align-items: flex-start; }
  .menu.open { display: flex; }
  .hero { grid-template-columns: 1fr; padding-top: 48px; gap: 36px; }
  .section-head { grid-template-columns: 1fr; gap: 8px; }
  .article-layout { grid-template-columns: 1fr; gap: 30px; }
  .toc { position: static; border-left: 0; border-top: 1px solid var(--line); padding: 20px 0 0; grid-row: 1; }
  .evidence-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 560px) {
  .shell, .nav { padding-left: 17px; padding-right: 17px; }
  h1 { font-size: 2.55rem; }
  .cluster-grid { grid-template-columns: 1fr; }
  .cluster-card, .cluster-card:nth-child(odd), .cluster-card:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .cluster-card:last-child { border-bottom: 0; }
  .related-links { grid-template-columns: 1fr; }
  .article-body table { display: block; overflow-x: auto; }
}

@media print {
  .site-header, .toc, .hero-actions { display: none; }
  body { background: white; font-size: 11pt; }
  .article-layout { display: block; }
  a { color: inherit; }
}
