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

:root{
  --paper:#f5e6c8;
  --paper-2:#fbf1de;
  --paper-3:#eed9b3;
  --ink:#262117;
  --ink-soft:#4a3d2c;
  --tan:#d4a574;
  --tan-deep:#b9854e;
  --line:rgba(38,33,23,.16);
  --shadow:0 8px 22px rgba(38,33,23,.11);
  --r:4px;
}
*,*::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:'Noto Sans Thai','PingFang SC','Hiragino Sans GB','Microsoft YaHei',system-ui,sans-serif;
  font-size:17px;
  line-height:1.78;
  -webkit-font-smoothing:antialiased;
}
body::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:60;
  pointer-events:none;
  background:
    radial-gradient(70% 55% at 100% 0%,rgba(212,165,116,.42),rgba(212,165,116,0) 62%),
    radial-gradient(55% 45% at 0% 12%,rgba(255,247,226,.75),rgba(255,247,226,0) 65%);
  opacity:.85;
}
body::after{
  content:"";
  position:fixed;
  inset:-50px;
  z-index:61;
  pointer-events:none;
  opacity:.2;
  mix-blend-mode:multiply;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)'/%3E%3C/svg%3E");
  animation:grain 1.6s steps(3) infinite;
}
@keyframes grain{
  0%{transform:translate3d(0,0,0)}
  33%{transform:translate3d(-6px,5px,0)}
  66%{transform:translate3d(5px,-6px,0)}
  100%{transform:translate3d(0,0,0)}
}
img{max-width:100%}
a{color:#8a5f31}
::selection{background:var(--tan);color:#2c2418}
:focus-visible{outline:2px solid var(--tan-deep);outline-offset:3px}

/* ---------- 顶部两行导航 ---------- */
.site-head{
  border-bottom:1px solid var(--line);
  background:linear-gradient(180deg,#f9eed6,#f5e6c8);
  box-shadow:0 2px 0 rgba(38,33,23,.05);
}
.brand-row{
  max-width:1120px;
  margin:0 auto;
  padding:1.05rem 1.2rem .65rem;
  display:flex;
  align-items:center;
  gap:.7rem;
}
.logo-mark{
  width:40px;
  height:40px;
  border-radius:50%;
  border:2px solid var(--tan-deep);
  object-fit:cover;
  filter:sepia(.35) contrast(1.05) saturate(.85);
  box-shadow:var(--shadow);
}
.brand-link{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:.2rem .1rem;
  font-size:1.4rem;
  font-weight:700;
  letter-spacing:.09em;
  color:var(--ink);
  text-decoration:none;
  line-height:1.2;
}
.menu-wrap{
  max-width:1120px;
  margin:0 auto;
  padding:0 1.2rem .75rem;
  display:flex;
  align-items:center;
  gap:1rem;
  flex-wrap:wrap;
  border-top:1px dashed var(--line);
  padding-top:.55rem;
}
.menu-rail{flex:1 1 320px;min-width:0}
.menu-list{
  display:flex;
  flex-wrap:wrap;
  gap:.2rem;
  list-style:none;
  margin:0;
  padding:0;
}
.menu-list a{
  display:flex;
  align-items:center;
  gap:.5rem;
  min-height:40px;
  padding:.45rem .7rem;
  font-size:.95rem;
  color:var(--ink-soft);
  text-decoration:none;
  border:1px solid transparent;
  border-radius:var(--r);
  transition:background .18s ease,color .18s ease,border-color .18s ease;
}
.menu-list a::before{
  content:"";
  width:9px;
  height:9px;
  border:1.5px solid var(--tan-deep);
  border-radius:2px;
  flex:none;
  transition:background .18s ease;
}
.menu-list a:hover,
.menu-list a:focus-visible{
  background:var(--paper-2);
  border-color:var(--line);
  color:var(--ink);
  box-shadow:var(--shadow);
}
.menu-list a:hover::before,
.menu-list a:focus-visible::before{background:var(--tan-deep)}

.search-box{
  display:flex;
  align-items:center;
  gap:.35rem;
  padding:.15rem .15rem .15rem .75rem;
  background:var(--paper-2);
  border:1px solid var(--line);
  border-radius:999px;
  box-shadow:inset 0 1px 3px rgba(38,33,23,.07);
}
.search-box input{
  border:0;
  background:transparent;
  font:inherit;
  font-size:.92rem;
  color:var(--ink);
  width:7.5rem;
  min-height:40px;
  padding:0;
  outline:none;
}
.search-box button{
  font:inherit;
  font-size:.85rem;
  min-height:40px;
  padding:0 .95rem;
  border:0;
  border-radius:999px;
  background:var(--tan);
  color:#3a2c1a;
  cursor:pointer;
  transition:background .18s ease;
}
.search-box button:hover{background:var(--tan-deep);color:#2c2418}

/* ---------- 首屏 ---------- */
.hero{
  position:relative;
  display:grid;
  grid-template-rows:1fr auto;
  justify-items:center;
  min-height:min(70vh,660px);
  padding:clamp(2rem,7vh,3.4rem) 1.2rem 0;
  overflow:hidden;
  text-align:center;
  background:radial-gradient(125% 100% at 50% 0%,#fdf3dc,#f5e6c8 65%);
}
.hero-copy{align-self:center;max-width:780px}
.hero h1{
  margin:0;
  font-size:clamp(2rem,6.2vw,3.8rem);
  line-height:1.16;
  letter-spacing:.03em;
  font-weight:700;
  animation:rise .75s ease-out both;
}
.hero-rule{
  display:block;
  width:92px;
  height:3px;
  margin:1.6rem auto 0;
  background:var(--tan-deep);
  opacity:.8;
}
.hero-media{
  position:relative;
  width:100%;
  max-width:1120px;
  margin-top:2.2rem;
  animation:track 7s steps(14) infinite;
}
.hero-media:empty{
  height:min(36vh,330px);
  border-radius:var(--r) var(--r) 0 0;
  background:repeating-linear-gradient(135deg,#efdcbb 0 14px,#e6cda3 14px 28px);
}
.hero-media img{
  display:block;
  width:100%;
  height:min(36vh,330px);
  object-fit:cover;
  filter:sepia(.4) contrast(1.06) saturate(.75);
  border-radius:var(--r) var(--r) 0 0;
}
.slant-band{
  position:absolute;
  left:-4%;
  right:-4%;
  bottom:-2px;
  height:56px;
  background:var(--tan);
  opacity:.95;
  clip-path:polygon(0 70%,100% 5%,100% 100%,0 100%);
  pointer-events:none;
}
@keyframes track{
  0%,90%,100%{transform:none}
  91%{transform:translateX(-2px) skewX(.5deg)}
  94%{transform:translateX(3px)}
  97%{transform:translateX(-1px) skewX(-.4deg)}
}

/* ---------- 主体：左栏目录 + 正文 ---------- */
.page-body{
  max-width:1120px;
  margin:0 auto;
  padding:clamp(2rem,5vw,3.4rem) 1.2rem 2rem;
  display:grid;
  grid-template-columns:230px minmax(0,1fr);
  gap:clamp(1.4rem,3vw,2.6rem);
  align-items:start;
}
.side-rail{
  position:sticky;
  top:1rem;
  border-left:3px solid var(--tan);
  padding-left:.95rem;
}
.side-label{
  margin:0 0 .5rem;
  font-size:.78rem;
  letter-spacing:.28em;
  color:var(--tan-deep);
  text-transform:uppercase;
}
.side-nav ul{list-style:none;margin:0;padding:0}
.side-nav li + li{border-top:1px dashed var(--line)}
.side-nav a{
  display:flex;
  align-items:center;
  min-height:40px;
  padding:.45rem .15rem;
  font-size:.94rem;
  color:var(--ink-soft);
  text-decoration:none;
  transition:color .18s ease,padding-left .18s ease;
}
.side-nav a:hover,
.side-nav a:focus-visible{color:var(--ink);padding-left:.4rem}
.side-nav li.is-hide{display:none}

.prose{min-width:0}
.prose > *{animation:rise .55s ease-out both}
.prose > *:nth-child(2){animation-delay:.06s}
.prose > *:nth-child(3){animation-delay:.12s}
.prose > *:nth-child(4){animation-delay:.18s}
.prose > *:nth-child(5){animation-delay:.24s}
.prose > *:nth-child(6){animation-delay:.3s}
.prose > *:nth-child(n+7){animation-delay:.34s}
@keyframes rise{
  from{opacity:0;transform:translateY(16px)}
  to{opacity:1;transform:none}
}

.intro{padding:0 0 1.5rem;margin:0 0 2.2rem;border-bottom:2px solid var(--tan)}
.intro h2{margin:0 0 .7rem;font-size:clamp(1.4rem,3vw,1.95rem);letter-spacing:.04em;line-height:1.3}
.subtitle{margin:0;color:#6d5b41;font-size:1.02rem}

.prose > section{
  margin:0 0 2.2rem;
  padding:1.35rem 1.35rem 1.55rem;
  background:var(--paper-2);
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  scroll-margin-top:1rem;
}
.prose > .intro{
  background:transparent;
  border:0;
  border-bottom:2px solid var(--tan);
  box-shadow:none;
  padding:0 0 1.5rem;
}
.prose h2{
  position:relative;
  margin:0 0 .85rem;
  padding-left:1.05rem;
  font-size:clamp(1.28rem,2.5vw,1.68rem);
  line-height:1.38;
  letter-spacing:.03em;
}
.prose h2::before{
  content:"";
  position:absolute;
  left:0;
  top:.42em;
  width:5px;
  height:1.05em;
  background:var(--tan);
  border-radius:2px;
}
.prose > .intro h2{padding-left:0}
.prose > .intro h2::before{display:none}
.prose h3{
  margin:1.6rem 0 .6rem;
  font-size:1.08rem;
  letter-spacing:.04em;
  color:#3b2f21;
}
.prose p{margin:0 0 1rem}
.prose p:last-child{margin-bottom:0}
.prose ul,.prose ol{margin:0 0 1rem;padding-left:1.3rem}
.prose li{margin:.3rem 0}
.prose li::marker{color:var(--tan-deep)}
.prose blockquote{
  margin:1.2rem 0;
  padding:.7rem 0 .7rem 1rem;
  border-left:4px solid var(--tan);
  background:#f8ecd4;
  color:#4c3f2e;
  border-radius:0 var(--r) var(--r) 0;
}
.prose blockquote p:last-child{margin-bottom:0}
.prose code{
  font-family:'Courier New',monospace;
  font-size:.92em;
  background:#efdcbb;
  padding:.1em .35em;
  border-radius:2px;
}
.prose pre{
  overflow-x:auto;
  padding:.9rem 1rem;
  background:#2b2419;
  color:#f3e6cb;
  border-radius:var(--r);
}
.prose pre code{background:transparent;color:inherit;padding:0}
.prose table{width:100%;border-collapse:collapse;font-size:.95rem;margin:0 0 1rem}
.prose th,.prose td{border:1px solid var(--line);padding:.5rem .6rem;text-align:left}
.prose th{background:var(--paper-3)}
.prose img{
  display:block;
  height:auto;
  margin:1rem 0;
  padding:6px;
  background:#fdf7e9;
  border:1px solid var(--line);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  filter:sepia(.28) contrast(1.04) saturate(.85);
}
.prose figure{margin:1rem 0}
.prose figcaption{font-size:.86rem;color:#6d5b41;text-align:center}

/* ---------- 页脚 ---------- */
.site-foot{
  position:relative;
  margin-top:3rem;
  background:#241f16;
  color:#e6d7b6;
  padding:clamp(2rem,5vw,3rem) 0 0;
}
.site-foot::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:6px;
  background:linear-gradient(90deg,var(--tan),#a97741,var(--tan));
}
.foot-top{
  max-width:1120px;
  margin:0 auto;
  padding:0 1.2rem 2rem;
  display:grid;
  grid-template-columns:1.5fr 1fr 1fr;
  gap:1.6rem;
  align-items:start;
}
.foot-brand{
  margin:0;
  font-size:clamp(2.1rem,7vw,3.5rem);
  line-height:1;
  font-weight:700;
  letter-spacing:.08em;
  color:#f1e2c0;
  opacity:.92;
}
.foot-addr{
  font-style:normal;
  display:grid;
  gap:.35rem;
  font-size:.95rem;
  color:#c8b795;
  padding-top:.4rem;
}
.foot-links{list-style:none;margin:0;padding:0;padding-top:.2rem}
.foot-links a{
  display:flex;
  align-items:center;
  min-height:40px;
  padding:.35rem 0;
  font-size:.95rem;
  color:#e0d0ac;
  text-decoration:none;
  border-bottom:1px dashed rgba(230,215,182,.16);
}
.foot-links a:hover,.foot-links a:focus-visible{color:#fff3d6}
.foot-bottom{
  border-top:1px solid rgba(230,215,182,.16);
  padding:1rem 1.2rem;
  text-align:center;
  font-size:.86rem;
  color:#b6a482;
}
.foot-bottom p{margin:0}

/* ---------- 回到顶部 ---------- */
.to-top{
  position:fixed;
  right:1rem;
  bottom:1rem;
  z-index:70;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 1.05rem;
  font-size:.92rem;
  color:#3a2c1a;
  text-decoration:none;
  background:var(--paper-2);
  border:1px solid var(--line);
  border-radius:999px;
  box-shadow:0 6px 18px rgba(38,33,23,.22);
  opacity:0;
  pointer-events:none;
  transform:translateY(8px);
  transition:opacity .22s ease,transform .22s ease;
}
.to-top.is-on{opacity:1;pointer-events:auto;transform:none}

/* ---------- 断点 ---------- */
@media (max-width:860px){
  .page-body{grid-template-columns:minmax(0,1fr);gap:1.4rem}
  .side-rail{
    position:static;
    border-left:0;
    border-top:2px solid var(--tan);
    padding:.85rem 0 0;
  }
  .side-nav ul{display:grid;grid-template-columns:1fr 1fr;gap:0 .9rem}
  .side-nav li + li{border-top:0}
  .side-nav a{border-bottom:1px dashed var(--line)}
  .foot-top{grid-template-columns:1fr;gap:1.2rem}
  .foot-brand{font-size:2.4rem}
  .hero{min-height:auto;padding-top:2.2rem}
  .hero h1{font-size:clamp(1.9rem,8.5vw,2.8rem)}
  .hero-media{margin-top:1.6rem}
  .hero-media, .hero-media:empty{height:220px}
  .hero-media:empty{border-radius:0}
  .hero-media img,.hero-media:empty{height:220px;border-radius:0}
  .slant-band{height:40px}
}
@media (max-width:520px){
  .search-box{flex:1 1 100%}
  .search-box input{flex:1 1 auto;width:auto;min-width:0}
  .menu-wrap{gap:.6rem}
  .prose > article{padding:1.1rem 1rem 1.2rem}
  .foot-bottom{font-size:.82rem}
}
@media (prefers-reduced-motion:reduce){
  html{scroll-behavior:auto}
  *{animation:none!important;transition:none!important}
}

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