@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;700&display=swap');

:root{
  --ink:#000000;
  --paper:#ffffff;
  --gray:#6b6b6b;
  --line:#d8d8d8;
  --wash:#f4f4f4;
  --sans:'Noto Sans Thai',system-ui,-apple-system,'PingFang SC','Microsoft YaHei',sans-serif;
  --serif:Georgia,'Times New Roman','Songti SC','Noto Serif SC',serif;
}

*,*::before,*::after{box-sizing:border-box}

html{
  scroll-behavior:smooth;
  -webkit-text-size-adjust:100%;
}

body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--sans);
  font-size:17px;
  line-height:1.75;
  font-weight:400;
  overflow-x:hidden;
}

img{max-width:100%;height:auto}
a{color:inherit;text-decoration-thickness:1px;text-underline-offset:3px}
body.lock{overflow:hidden}

/* ---------- 页头 ---------- */
.hd{
  position:sticky;
  top:0;
  z-index:60;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 18px;
  background:var(--paper);
  border-bottom:2px solid var(--ink);
}

.brand{
  position:relative;
  z-index:80;
  display:inline-flex;
  align-items:center;
  gap:10px;
  min-height:44px;
  text-decoration:none;
  font-weight:700;
  font-size:1rem;
  letter-spacing:.1em;
}

.logo{display:block;width:28px;height:28px;object-fit:contain}
.mark{display:block;width:14px;height:14px;background:var(--ink);transition:background .3s}

.burger{
  position:relative;
  z-index:80;
  width:48px;
  height:44px;
  padding:0;
  display:grid;
  place-content:center;
  gap:5px;
  border:2px solid var(--ink);
  background:var(--paper);
  cursor:pointer;
  transition:background .3s,border-color .3s;
}
.burger span{display:block;width:20px;height:2px;background:var(--ink);transition:transform .3s,background .3s}

body.lock .burger{background:var(--ink);border-color:var(--paper)}
body.lock .burger span{background:var(--paper)}
body.lock .burger span:first-child{transform:translateY(3.5px) rotate(45deg)}
body.lock .burger span:last-child{transform:translateY(-3.5px) rotate(-45deg)}
body.lock .brand{color:var(--paper)}
body.lock .mark{background:var(--paper)}
body.lock .logo{filter:invert(1)}

/* ---------- 全屏菜单 ---------- */
.menu{
  position:fixed;
  inset:0;
  z-index:70;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:88px 22px;
  background:var(--ink);
  color:var(--paper);
  opacity:0;
  visibility:hidden;
  transition:opacity .32s ease,visibility .32s ease;
}
.menu.open{opacity:1;visibility:visible}

.menu-row{
  display:flex;
  flex-direction:column;
  gap:0;
  margin:0;
  width:min(560px,100%);
}
.menu-row a{
  display:flex;
  align-items:center;
  min-height:54px;
  padding:8px 0;
  color:var(--paper);
  text-decoration:none;
  font-family:var(--serif);
  font-size:clamp(1.15rem,3.6vw,1.85rem);
  line-height:1.3;
  border-bottom:1px solid #2c2c2c;
  transition:padding-left .22s ease,color .22s ease;
}
.menu-row a:first-child{border-top:1px solid #2c2c2c}
.menu-row a:hover,
.menu-row a:focus-visible{padding-left:14px;color:#c9c9c9}

/* ---------- 首屏 ---------- */
.hero{
  position:relative;
  min-height:45vh;
  display:grid;
  place-items:center;
  padding:54px 20px 48px;
  text-align:center;
  border-bottom:2px solid var(--ink);
  overflow:hidden;
}
.hero-in{max-width:34em}
.hero h1{
  margin:.2em 0 .35em;
  font-family:var(--serif);
  font-weight:700;
  font-size:clamp(1.85rem,6.2vw,3.5rem);
  line-height:1.16;
  letter-spacing:-.02em;
}
.hero .lead{
  margin:0 auto;
  max-width:30em;
  color:#333;
  font-size:1rem;
  line-height:1.7;
}
.badges{
  position:absolute;
  top:14px;
  right:14px;
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:6px;
  max-width:62%;
}
.badges span{
  padding:3px 10px;
  border:1px solid var(--ink);
  background:var(--paper);
  font-size:.78rem;
  letter-spacing:.1em;
  line-height:1.6;
}
.hero-ico{
  width:40px;
  height:40px;
  color:var(--ink);
  margin-top:20px;
}

/* ---------- 版心 ---------- */
.wrap{max-width:1140px;margin:0 auto;padding:0 20px}

.grid{
  display:grid;
  grid-template-columns:210px minmax(0,1fr);
  grid-template-areas:"side body";
  gap:0 44px;
  padding:44px 0 0;
}

.body{
  grid-area:body;
  min-width:0;
  max-width:70ch;
}
.body div[id]{scroll-margin-top:88px}

/* ---------- 侧栏 ---------- */
.side{
  grid-area:side;
  align-self:start;
  position:sticky;
  top:88px;
  padding-top:12px;
  border-top:3px solid var(--ink);
}
.side small{
  display:block;
  font-size:.76rem;
  letter-spacing:.26em;
  color:var(--gray);
}
.side h2{
  margin:.25em 0 .9em;
  font-family:var(--serif);
  font-size:1.28rem;
  letter-spacing:.02em;
}

.toc{list-style:none;margin:0;padding:0;counter-reset:toc}
.toc li{counter-increment:toc;border-bottom:1px solid var(--line)}
.toc a{
  display:flex;
  align-items:baseline;
  gap:9px;
  min-height:42px;
  padding:9px 4px;
  text-decoration:none;
  font-size:.98rem;
  line-height:1.5;
  transition:background .2s ease;
}
.toc a::before{
  content:counter(toc,decimal-leading-zero);
  font-size:.72rem;
  letter-spacing:.08em;
  color:var(--gray);
}
.toc a:hover{background:var(--wash)}

/* ---------- 正文排版 ---------- */
.body p{margin:0 0 1.15em}
.body p:first-of-type::first-letter{
  float:left;
  margin:.04em .1em 0 0;
  font-family:var(--serif);
  font-size:3.2em;
  line-height:.86;
  font-weight:700;
}
.body h2{
  margin:2.1em 0 .7em;
  font-family:var(--serif);
  font-size:clamp(1.35rem,3.2vw,1.95rem);
  line-height:1.25;
  letter-spacing:-.01em;
}
.body h3{
  margin:1.7em 0 .5em;
  font-family:var(--serif);
  font-size:1.2rem;
  line-height:1.35;
}
.body small{
  display:block;
  margin-bottom:2px;
  padding-top:8px;
  border-top:2px solid var(--ink);
  font-size:.76rem;
  letter-spacing:.26em;
  color:var(--gray);
}
.body small + h2,
.body small + h3{margin-top:.5em}

.body ul,
.body ol{margin:0 0 1.3em;padding-left:1.25em}
.body li{margin:0 0 .5em}
.body ul li::marker{content:"■ ";font-size:.72em}
.body a:hover{background:var(--wash)}

.body blockquote{
  margin:2em 0;
  padding:.15em 0 .15em 1.1em;
  border-left:6px solid var(--ink);
  font-family:var(--serif);
  font-size:1.15rem;
  line-height:1.62;
}
.body blockquote p:first-of-type::first-letter{float:none;font-size:1em}

.body figure{margin:2em 0;padding:10px;border:1px solid var(--ink)}
.body figure img{display:block;width:100%}
.body figcaption{
  padding-top:8px;
  font-size:.86rem;
  line-height:1.6;
  color:var(--gray);
}

.body table{width:100%;margin:1.6em 0;border-collapse:collapse;font-size:1rem}
.body th,
.body td{padding:8px 10px;border:1px solid var(--ink);text-align:left;vertical-align:top}
.body th{background:var(--wash);font-weight:700}

.body hr{margin:2.2em 0;border:0;border-top:2px solid var(--ink)}

/* ---------- 页脚 ---------- */
.ft{
  display:grid;
  grid-template-columns:1.3fr 1fr 1fr;
  gap:26px;
  max-width:1140px;
  margin:74px auto 0;
  padding:38px 20px 46px;
  border-top:2px solid var(--ink);
}
.ft div{min-width:0}
.ft small{
  display:block;
  margin-bottom:10px;
  font-size:.76rem;
  letter-spacing:.26em;
  color:var(--gray);
}
.ft p{margin:0 0 10px;font-size:.95rem;line-height:1.65;color:#333}
.ft .fname{margin:0 0 8px;font-weight:700;letter-spacing:.1em;color:var(--ink);font-size:1rem}
.ft ul{list-style:none;margin:0;padding:0}
.ft li{border-bottom:1px solid var(--line)}
.ft li:first-child{border-top:1px solid var(--line)}
.ft a{
  display:flex;
  align-items:center;
  min-height:40px;
  padding:6px 0;
  text-decoration:none;
  font-size:.95rem;
}
.ft a:hover{text-decoration:underline}
.ft-c{text-align:center}
.ft-c .top{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:42px;
  margin-top:12px;
  padding:0 16px;
  border:1px solid var(--ink);
  text-decoration:none;
  transition:background .2s ease,color .2s ease;
}
.ft-c .top:hover{background:var(--ink);color:var(--paper)}

/* ---------- 滚动显现 ---------- */
html.js .hero-in,
html.js .body > div,
html.js .side{
  opacity:0;
  transform:translateY(16px);
  transition:opacity .62s ease,transform .62s ease;
}
html.js .on{opacity:1;transform:none}

/* ---------- 响应式 ---------- */
@media (min-width:900px){
  .body ul,
  .body ol{column-count:2;column-gap:2.2em}
  .body li{break-inside:avoid}
}

@media (max-width:860px){
  .grid{
    grid-template-columns:minmax(0,1fr);
    grid-template-areas:"body" "side";
    gap:44px 0;
    padding-top:30px;
  }
  .side{position:static}
  .ft{grid-template-columns:1fr;gap:22px;margin-top:56px}
  .ft-c{text-align:center}
}

@media (max-width:600px){
  body{font-size:16.5px}
  .hero{padding:46px 16px 34px}
  .badges{position:static;justify-content:center;max-width:100%;margin-bottom:16px}
  .hero-ico{width:32px;height:32px;margin-top:16px}
  .body h2{font-size:1.45rem}
  .body p:first-of-type::first-letter{font-size:2.8em}
}

@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  html.js .hero-in,
  html.js .body > div,
  html.js .side{opacity:1;transform:none;transition:none}
  .menu-row a,.toc a,.burger span,.ft-c .top{transition:none}
}

button[aria-expanded]{min-width:44px;min-height:44px}
