/* งาน 122: วิกิ (/wiki/) — ใช้ร่วมกับ site.css (สี ฟอนต์ ปุ่ม กรอบไม้ กระดาษ) · มือถือก่อน */

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.paper .muted { color: #6b4a33; }

/* ---- แถบบน ---- */
.wbrand { display: flex; align-items: center; gap: 8px; color: var(--cream); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1.2; min-height: 44px; }
.wbrand img { width: 72px; image-rendering: pixelated; flex: none; }
.wbrand:hover { color: var(--gold); }
@media (max-width: 420px) { .wbrand span { font-size: 14px; } .wtop .nav-wide { display: none; } }

/* ---- ค้นหา (โผล่เมื่อสคริปต์ทำงาน) ---- */
.wsearch { position: relative; max-width: 1080px; margin: 0 auto; padding: 12px 16px 0; }
.wsearch[hidden] { display: none; }
.wsearch input {
  width: 100%; min-height: 46px; padding: 8px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--cream); border: 3px solid var(--rim); border-radius: 8px;
}
.wsearch input::placeholder { color: #8a6a50; }
.wsearch input:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.wresults {
  position: absolute; left: 16px; right: 16px; z-index: 6; margin: 4px 0 0; padding: 4px; list-style: none;
  background: var(--wood); border: 3px solid var(--rim); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); max-height: 60vh; overflow-y: auto;
}
.wresults a { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 10px 12px; color: var(--text); text-decoration: none; border-radius: 4px; }
.wresults a:hover, .wresults a:focus { background: var(--card); color: var(--gold); }
.wresults a span { color: var(--muted); font-size: 14px; }
.wresults .none { padding: 10px 12px; color: var(--muted); }

/* ---- เนื้อหา ---- */
.wmain { max-width: 1080px; margin: 0 auto; padding: 8px 16px 24px; }
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; padding: 0; list-style: none; font-size: 14px; }
.crumbs li + li::before { content: "›"; margin-right: 4px; color: var(--muted); }
.crumbs a { display: inline-block; padding: 6px 2px; }
.crumbs [aria-current] { padding: 6px 2px; color: var(--muted); }
.wtitle { display: flex; align-items: center; gap: 10px; margin: 6px 0 8px; font-size: 28px; color: var(--gold); }
.wlead { margin: 0 0 16px; font-size: 17px; color: var(--cream); max-width: 46em; }

.ico { width: 32px; height: 32px; image-rendering: pixelated; vertical-align: middle; flex: none; }
.ico-big { width: 48px; height: 48px; }
.ico-title { width: 48px; height: 48px; }
.it { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; }
a.it { text-decoration: none; }
a.it span { text-decoration: underline; text-underline-offset: 3px; }
.items { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; }

.toc { margin: 0 0 20px; max-width: 520px; }
.toc h2 { margin: 0 0 4px; font-size: 17px; color: var(--gold); }
.toc ol { margin: 0; padding-left: 1.4em; columns: 2; column-gap: 24px; }
.toc li { break-inside: avoid; }
.toc a { display: inline-block; padding: 4px 0; }

.wsec { margin: 28px 0 8px; scroll-margin-top: 64px; }
.wsec h2 { margin: 0 0 10px; padding-bottom: 6px; font-size: 22px; color: var(--cream); border-bottom: 2px solid var(--rim); }
.wsec h3 { margin: 16px 0 6px; font-size: 18px; color: var(--gold); }
.wsec p { max-width: 52em; }
.anchor { display: block; position: relative; top: -72px; visibility: hidden; }
.note { font-size: 14.5px; color: var(--muted); max-width: 52em; }

/* การ์ดหมวดหน้าแรก */
.wcards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
.wcard a {
  display: grid; grid-template-columns: 48px 1fr; gap: 2px 12px; align-items: center; height: 100%; padding: 10px 12px; text-decoration: none; color: var(--text);
  border: 12px solid var(--rim); border-image: url("img/panel.png") 32 fill / 16px / 0 stretch; background: var(--wood); background-clip: padding-box;
}
.wcard .ico { grid-row: span 2; }
.wcard strong { color: var(--gold); font-size: 18px; line-height: 1.3; }
.wcard span { font-size: 14.5px; color: var(--text); }
.wcard a:hover strong, .wcard a:focus strong { color: var(--cream); text-decoration: underline; }
.wcard-money a { box-shadow: 0 0 0 2px var(--gold); }

/* ตาราง: เลื่อนแนวนอนในกรอบของตัวเองบนจอแคบ */
.tbl { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0 12px; border: 2px solid #0f1813; border-radius: 6px; background: var(--ground-2); }
.tbl:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid #2e4234; white-space: nowrap; }
.tbl table.c2, .tbl table.c3 { min-width: 0; }
.tbl td.long { white-space: normal; min-width: 15em; }
.tbl tbody th { white-space: normal; min-width: 9em; }
.tbl thead th { position: sticky; top: 0; background: var(--card); color: var(--gold); font-weight: 600; white-space: nowrap; }
.tbl tbody th { font-weight: 600; color: var(--cream); }
.tbl tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
.tbl tbody tr:hover { background: rgba(255, 214, 107, 0.06); }

/* ข้อเท็จจริงแบบสองคอลัมน์ */
.facts { display: grid; gap: 0; margin: 8px 0 16px; border: 2px solid #0f1813; border-radius: 6px; background: var(--ground-2); max-width: 760px; }
.facts > div { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #2e4234; }
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--gold); font-weight: 600; }
.facts dd { margin: 0; }
@media (max-width: 480px) { .facts > div { grid-template-columns: 1fr; gap: 0; } }

.lesson { margin: 16px 0; max-width: 760px; padding: 8px 16px; }
.lesson h3 { margin: 4px 0 6px; color: var(--ink); font-size: 18px; }
.lesson p { margin: 0 0 8px; }
article.lesson { scroll-margin-top: 72px; }
.hint { margin: 8px 0 16px; max-width: 640px; padding: 8px 16px; font-size: 17px; }
.hint p { margin: 0; }
.hint footer { font-size: 14px; color: #6b4a33; }
.hb { display: grid; gap: 8px; max-width: 760px; }
.hb summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.hb p { margin: 0 0 8px; }

.vhead { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.vhead .facts { flex: 1 1 280px; margin-top: 0; }
.portrait { image-rendering: pixelated; border: 3px solid var(--rim); border-radius: 6px; background: var(--paper); flex: none; }

.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.people a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; text-align: center; text-decoration: none; color: var(--text); background: var(--wood); border: 2px solid var(--rim); border-radius: 8px; height: 100%; }
.people a:hover strong, .people a:focus strong { text-decoration: underline; }
.people strong { color: var(--gold); font-size: 17px; }
.people span { font-size: 14px; line-height: 1.4; }

.swatches { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; padding: 0; }
.swatches li { display: flex; align-items: center; gap: 6px; }
.lessons { columns: 2; column-gap: 24px; }
.lessons li { break-inside: avoid; padding: 2px 0; }

.pager { margin: 32px 0 0; padding-top: 12px; border-top: 2px solid var(--rim); }
.pager ul { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 15px; }
.pager a { display: inline-block; padding: 6px 0; }

@media (min-width: 700px) {
  .wcards { grid-template-columns: repeat(2, 1fr); }
  .wtitle { font-size: 32px; }
  .wgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
}
@media (min-width: 1000px) {
  .wcards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 520px) {
  .lessons { columns: 1; }
  /* สารบัญบนมือถือ: ปุ่มเล็กเรียงต่อกัน ไม่กินจอ */
  .toc { padding: 6px 8px; }
  .toc ol { columns: auto; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
  .toc a { padding: 4px 10px; border: 1px solid var(--rim); border-radius: 999px; text-decoration: none; font-size: 14.5px; min-height: 36px; display: inline-flex; align-items: center; }
}
