/* Thasala School — เว็บไซต์สาธารณะ
   Layout: แถบกลุ่มผู้ใช้ → header + เมนู 6 หมวด → เนื้อหาเป็นแถบ ๆ → footer 3 คอลัมน์ (แนวทาง kku.ac.th)
   ค่าสีหลัก/รอง/พื้นหลังถูกแทนด้วยค่าจาก CONFIG ตอนโหลดหน้า */
:root {
  --purple: #400080;
  --purple-deep: #2b0057;
  --purple-tint: #efe8f7;
  --orange: #F28C28;
  --orange-ink: #a85500;
  --bg: #F7F5FA;
  --surface: #ffffff;
  --ink: #1e1530;
  --muted: #5d5470;
  --line: #e3dbee;
  --font: "IBM Plex Sans Thai", "Sarabun", "Noto Sans Thai", "Tahoma", sans-serif;
  --radius: 10px;
  --wrap: 1180px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.3; text-wrap: balance; margin: 0; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* ---------- แถบบนสุด ---------- */
.topbar { background: var(--purple-deep); color: #e9e0f5; font-size: 13.5px; }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; padding-block: 6px; }
.topbar .aud { display: flex; flex-wrap: wrap; gap: 4px 16px; flex: 1; min-width: 0; }
.topbar a { text-decoration: none; opacity: .9; }
.topbar a:hover { opacity: 1; text-decoration: underline; }
.topbar .tools { display: flex; gap: 10px; align-items: center; }
.btn-en { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 1px 10px; font-weight: 600; letter-spacing: .04em; }
.search { display: flex; }
.search input { width: 150px; border: 0; border-radius: 999px 0 0 999px; padding: 3px 12px; font: inherit; font-size: 13px; background: rgba(255,255,255,.12); color: #fff; }
.search input::placeholder { color: #cbbde0; }
.search button { border: 0; border-radius: 0 999px 999px 0; background: var(--orange); color: #fff; padding: 0 10px; cursor: pointer; font: inherit; font-size: 13px; }

/* ---------- header + เมนู ---------- */
.header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.header .wrap { display: flex; align-items: center; gap: 20px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand .logo { width: 52px; height: 52px; border-radius: 50%; object-fit: contain; }
.brand .mono { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--purple); color: #fff; font-weight: 700; font-size: 24px; box-shadow: inset 0 0 0 3px var(--orange); }
.brand .th { font-weight: 700; font-size: 20px; color: var(--purple); display: block; line-height: 1.2; }
.brand .en { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: block; }
.nav { margin-left: auto; }
.nav > ul { list-style: none; margin: 0; padding: 0; display: flex; }
.nav > ul > li { position: relative; }
.nav > ul > li > a { display: block; white-space: nowrap; padding: 26px 9px; text-decoration: none; font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; }
.nav > ul > li > a .n { color: var(--orange-ink); font-size: 12px; margin-right: 4px; font-variant-numeric: tabular-nums; }
.nav > ul > li:hover > a, .nav > ul > li:focus-within > a, .nav > ul > li > a.on { border-bottom-color: var(--orange); color: var(--purple); }
.mega { position: absolute; right: 0; top: 100%; width: 330px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--purple); border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 18px 40px rgba(43,0,87,.14); padding: 16px 18px; display: none; }
.nav > ul > li:nth-child(-n+3) .mega { left: 0; right: auto; }
.nav > ul > li:hover .mega, .nav > ul > li:focus-within .mega { display: block; }
.mega .aud { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.mega ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.mega a { display: block; padding: 6px 8px; border-radius: 6px; text-decoration: none; font-size: 15px; }
.mega a:hover { background: var(--purple-tint); color: var(--purple); }
.burger { display: none; margin-left: auto; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; color: var(--purple); }

@media (max-width: 1260px) {
  .burger { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); max-height: 75vh; overflow-y: auto; }
  .nav.open { display: block; }
  .nav > ul { flex-direction: column; padding: 8px 16px 16px; }
  .nav > ul > li > a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .mega { position: static; display: block; width: auto; border: 0; box-shadow: none; padding: 4px 0 10px 14px; }
  .mega .aud { display: none; }
  .search input { width: 110px; }
}

@media (max-width: 600px) { .topbar .aud { display: none; } .topbar .tools { flex: 1; justify-content: space-between; } .search input { width: 100%; } .search { flex: 1; } }

/* ---------- ส่วนประกอบทั่วไป ---------- */
main { min-height: 50vh; }
.band { padding-block: 44px; }
.band.alt { background: var(--surface); border-block: 1px solid var(--line); }
.band-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.band-head h2 { font-size: 26px; color: var(--purple); }
.band-head h2::after { content: ""; display: block; width: 44px; height: 4px; background: var(--orange); border-radius: 2px; margin-top: 8px; }
.more { color: var(--purple); font-weight: 600; text-decoration: none; font-size: 15px; }
.more:hover { text-decoration: underline; }
.empty { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 22px; color: var(--muted); text-align: center; background: var(--surface); }
.sample-note { background: #fff4e6; color: var(--orange-ink); border: 1px solid #f6d3ad; border-radius: var(--radius); padding: 8px 14px; font-size: 14px; margin-bottom: 16px; }
.loading { color: var(--muted); padding-block: 60px; text-align: center; }

/* ---------- hero ---------- */
.hero { background: var(--purple); color: #fff; position: relative; overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; align-items: center; padding-block: 48px; position: relative; }
.hero .eyebrow { color: var(--orange); font-weight: 600; letter-spacing: .08em; font-size: 14px; }
.hero h1 { font-size: clamp(30px, 4.4vw, 48px); margin: 6px 0 12px; }
.hero p { margin: 0 0 22px; color: #e5dbf3; max-width: 34em; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-block; text-decoration: none; font-weight: 600; padding: 10px 20px; border-radius: 999px; border: 2px solid transparent; }
.btn.primary { background: var(--orange); color: #fff; }
.btn.ghost { border-color: rgba(255,255,255,.55); color: #fff; }
.btn:hover { filter: brightness(1.07); }
.hero .slide { aspect-ratio: 16 / 9; width: 100%; max-width: 100%; border-radius: var(--radius); background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); overflow: hidden; display: grid; place-items: center; text-align: center; color: #d9cbee; font-size: 14px; }
.hero .slide img { width: 100%; height: 100%; object-fit: cover; }
.hero::before { content: ""; position: absolute; right: -120px; top: -120px; width: 380px; height: 380px; border-radius: 50%; border: 56px solid rgba(242,140,40,.16); }
@media (max-width: 760px) { .hero .wrap { grid-template-columns: 1fr; padding-block: 32px; } }

.jump { background: var(--surface); border-bottom: 1px solid var(--line); }
.jump .wrap { display: flex; gap: 6px 22px; flex-wrap: wrap; padding-block: 10px; font-size: 14px; }
.jump a { text-decoration: none; color: var(--muted); font-weight: 600; }
.jump a:hover { color: var(--purple); }

/* ---------- e-Service ---------- */
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.svc { display: flex; flex-direction: column; gap: 10px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; transition: border-color .15s, transform .15s; }
.svc:hover { border-color: var(--purple); transform: translateY(-2px); }
.svc .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--purple-tint); color: var(--purple); display: grid; place-items: center; }
.svc .ic svg { width: 22px; height: 22px; }
.svc b { font-size: 15px; line-height: 1.35; }

/* ---------- ข่าว ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.card .cover { aspect-ratio: 16 / 9; max-width: 100%; background: var(--purple-tint); display: grid; place-items: center; color: var(--purple); font-weight: 700; }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 14px 16px 18px; display: grid; gap: 6px; }
.card time, .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card h3 { font-size: 17px; }
.card:hover h3 { color: var(--purple); }
.tag { display: inline-block; font-size: 12px; font-weight: 600; color: var(--orange-ink); background: #fff1e2; border-radius: 999px; padding: 0 9px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; font-weight: 600; font-size: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--purple); color: #fff; border-color: var(--purple); }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px 16px; text-decoration: none; }
.list a:hover { background: var(--purple-tint); }
.list a > span:last-child { min-width: 0; }
@media (max-width: 520px) { .list a { grid-template-columns: 1fr; gap: 2px; } }

.events { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.ev { display: grid; grid-template-columns: 62px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ev .d { background: var(--purple); color: #fff; border-radius: 8px; text-align: center; padding: 6px 0; line-height: 1.15; }
.ev .d b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.ev .d span { font-size: 13px; color: #f9c58f; }
.ev h3 { font-size: 16px; }

/* ---------- หน้าหมวด ---------- */
.banner { background: var(--purple); color: #fff; }
.banner .wrap { padding-block: 36px 32px; }
.crumb { font-size: 14px; color: #d4c4ea; margin-bottom: 8px; }
.crumb a { text-decoration: none; }
.crumb a:hover { text-decoration: underline; }
.banner .num { color: var(--orange); font-weight: 700; font-variant-numeric: tabular-nums; }
.banner h1 { font-size: clamp(28px, 4vw, 40px); }
.banner p { margin: 8px 0 0; color: #e0d4f0; }
.subgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.sub { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; font-weight: 600; }
.sub::after { content: "→"; color: var(--orange-ink); }
.sub:hover { border-color: var(--purple); color: var(--purple); }

.page-layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; align-items: start; }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 96px; }
.side a { display: block; padding: 7px 10px; border-radius: 6px; text-decoration: none; font-size: 15px; }
.side a.on { background: var(--purple); color: #fff; }
.side a:not(.on):hover { background: var(--purple-tint); }
.content { min-width: 0; }
@media (max-width: 860px) { .page-layout { grid-template-columns: 1fr; } .side { position: static; } }

/* กล่องจาก Page Builder (ตาราง 12 คอลัมน์) */
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.blk { min-width: 0; background: var(--surface); border-radius: var(--radius); }
.blk.text { padding: 20px 22px; border: 1px solid var(--line); }
.blk.text :first-child { margin-top: 0; }
@media (max-width: 760px) { .grid12 { grid-template-columns: 1fr; } .blk { grid-column: auto !important; } }

.article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.article .cover { margin: -24px -24px 20px; aspect-ratio: 16/9; overflow: hidden; border-radius: var(--radius) var(--radius) 0 0; }
.article .cover img { width: 100%; height: 100%; object-fit: cover; }

/* ค้นหาเกียรติบัตร */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
.form input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.form button { font: inherit; font-weight: 600; background: var(--purple); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; cursor: pointer; }
.table-wrap { overflow-x: auto; margin-top: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--purple-tint); color: var(--purple); }
td { font-variant-numeric: tabular-nums; }

/* ---------- footer ---------- */
.footer { background: var(--purple-deep); color: #d9cdea; margin-top: 56px; font-size: 15px; }
.footer .cols { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 28px; padding-block: 40px 28px; }
.footer h4 { color: #fff; margin: 0 0 10px; font-size: 16px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.footer a { text-decoration: none; }
.footer a:hover { color: #fff; text-decoration: underline; }
.footer .addr { display: grid; gap: 4px; }
.footer .copy { border-top: 1px solid rgba(255,255,255,.12); padding-block: 14px; font-size: 13px; color: #b6a6cf; }
@media (max-width: 860px) { .footer .cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer .cols { grid-template-columns: 1fr; } }

/* ---------- สไลด์โชว์เต็มความกว้าง 16:9 ---------- */
.slider { position: relative; width: 100%; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: var(--purple-deep); }
.slider-track { display: flex; height: 100%; transition: transform .6s ease; }
.slide-item { flex: 0 0 100%; height: 100%; }
.slide-item a, .slide-item img { display: block; width: 100%; height: 100%; }
.slide-item img { object-fit: cover; }
.sl-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(43,0,87,.55); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding-bottom: 4px; }
.sl-btn:hover { background: var(--orange); }
.sl-btn.prev { left: 16px; }
.sl-btn.next { right: 16px; }
.sl-dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 8px; }
.sl-dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: rgba(255,255,255,.55); cursor: pointer; padding: 0; }
.sl-dots button[aria-current="true"] { background: var(--orange); width: 26px; border-radius: 5px; }
@media (max-width: 600px) { .sl-btn { width: 34px; height: 34px; font-size: 22px; } .sl-dots { bottom: 8px; } }

.footer .copy { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.admin-link { color: #f9c58f; font-weight: 600; }

/* ---------- กล่องจาก Page Builder ---------- */
.grid12 { grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: minmax(40px, auto); gap: 12px; }
.blk { --full: calc(var(--h, 2) * 40px + (var(--h, 2) - 1) * 12px); }
.blk.text { overflow-wrap: anywhere; }
.blk.text img { max-width: 100%; height: auto; border-radius: 8px; }
.blk.text h2 { color: var(--purple); font-size: 24px; margin: 0 0 10px; }
.blk.text h3 { color: var(--purple); font-size: 19px; margin: 14px 0 6px; }
.blk.image { margin: 0; display: flex; flex-direction: column; background: none; min-height: var(--full); }
.blk.image > a, .blk.image > img { flex: 1; display: block; min-height: 0; }
.blk.image img { width: 100%; height: 100%; border-radius: var(--radius); background: var(--purple-tint); }
.blk.image figcaption { font-size: 14px; color: var(--muted); padding-top: 6px; }
.blk.button { display: flex; align-items: center; background: none; }
.btn.outline { border-color: var(--purple); color: var(--purple); background: var(--surface); }
.blk.media { background: #000; overflow: hidden; min-height: var(--full); }
.blk.media iframe { width: 100%; height: 100%; min-height: var(--full); border: 0; display: block; }
.blk.divider { background: none; display: flex; align-items: center; }
.blk.divider hr { width: 100%; border: 0; border-top: 2px solid var(--line); }
.blk.feed { background: none; }
.blk-title { color: var(--purple); font-size: 20px; margin: 0 0 12px; }
@media (max-width: 760px) {
  .grid12 { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .blk { grid-row: auto !important; }
  .blk.image, .blk.media { min-height: 0; }
  .blk.image img { height: auto; aspect-ratio: 16 / 9; }
  .blk.media iframe { min-height: 0; aspect-ratio: 16 / 9; height: auto; }
}

/* ---------- เอกสาร บุคลากร FAQ ---------- */
.doc-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.doc-tools .tabs { margin: 0; }
.doc-q { font: inherit; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); min-width: 0; width: 240px; max-width: 100%; }
.docs { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.docs li + li { border-top: 1px solid var(--line); }
.docs a { display: flex; gap: 14px; align-items: center; padding: 12px 16px; text-decoration: none; }
.docs a:hover { background: var(--purple-tint); }
.doc-ic { width: 38px; height: 38px; flex-shrink: 0; border-radius: 9px; background: var(--purple-tint); color: var(--purple); display: grid; place-items: center; }
.doc-ic svg { width: 20px; height: 20px; }
.doc-main { flex: 1; min-width: 0; display: grid; }
.doc-open { color: var(--purple); font-weight: 600; font-size: 14px; white-space: nowrap; }
.grp { color: var(--purple); font-size: 21px; margin: 28px 0 12px; }
.grp:first-child, #pg-auto > .grp:first-of-type { margin-top: 0; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.person { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; text-align: center; display: grid; gap: 4px; align-content: start; }
.person .ph { aspect-ratio: 3 / 4; max-width: 100%; border-radius: 8px; overflow: hidden; background: var(--purple-tint); color: var(--purple); display: grid; place-items: center; margin-bottom: 6px; }
.person .ph img { width: 100%; height: 100%; object-fit: cover; }
.person .ph svg { width: 48px; height: 48px; }
.faq { display: grid; gap: 8px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 13px 0; list-style-position: inside; }
.faq details[open] summary { color: var(--purple); }
.faq .ans { padding-bottom: 14px; color: var(--ink); }
.contact { margin-top: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.contact .grp { margin-top: 0; }
.contact p { margin: 4px 0; }
.pfs { display: grid; gap: 2px; margin-top: 6px; font-size: 13.5px; text-align: left; border-top: 1px solid var(--line); padding-top: 8px; }
.pfs:empty { display: none; }
.pf { overflow-wrap: anywhere; }
.pf span { color: var(--muted); margin-right: 6px; }
.people.execs { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.roll { list-style: none; counter-reset: roll; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.roll li { counter-increment: roll; display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.roll li + li { border-top: 1px solid var(--line); }
.roll li::before { content: counter(roll); min-width: 2em; text-align: center; font-weight: 700; color: var(--orange-ink); font-variant-numeric: tabular-nums; }
.roll-ph { width: 48px; height: 64px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--purple-tint); color: var(--purple); display: grid; place-items: center; }
.roll-ph img { width: 100%; height: 100%; object-fit: cover; }
.roll-ph svg { width: 24px; height: 24px; }
.roll-main { flex: 1; min-width: 0; display: grid; }
.roll-term { color: var(--purple); font-weight: 600; font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) { .roll li { flex-wrap: wrap; } .roll-term { width: 100%; padding-left: calc(2em + 62px); } }

/* ---------- ตัวอักษรจากหน้าตั้งค่า (ไม่ตั้ง = ใช้ค่าเดิม) ---------- */
body { font-family: var(--font-body, var(--font)); color: var(--c-body, var(--ink)); }
h1, h2, .band-head h2, .grp, .blk.text h2, .blk-title, .brand .th { font-family: var(--font-heading, var(--font)); }
.band-head h2, .grp, .blk.text h2, .blk-title { color: var(--c-heading, var(--purple)); }
h3, h4, .card h3, .ev h3, .blk.text h3, .person b, .doc-main b, .roll-main b, .faq summary { font-family: var(--font-sub, var(--font)); }
.card h3, .ev h3, .person b, .doc-main b, .roll-main b { color: var(--c-sub, var(--ink)); }
.blk.text h3 { color: var(--c-sub, var(--purple)); }
.article, .blk.text, .faq .ans, .contact p { color: var(--c-body, var(--ink)); }

/* ---------- ป๊อปอัปหน้าแรก ---------- */
.popup { position: fixed; inset: 0; z-index: 100; background: rgba(30, 21, 48, .62); display: grid; place-items: center; padding: 16px; animation: pop-in .2s ease-out; }
.popup-card { position: relative; background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.popup-img { display: block; background: var(--purple-tint); }
.popup-img img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; margin-inline: auto; }
.popup-body { padding: 18px 22px 22px; display: grid; gap: 10px; justify-items: start; }
.popup-body h2 { color: var(--c-heading, var(--purple)); font-size: 22px; }
.popup-body p { margin: 0; }
.popup-x { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(30, 21, 48, .7); color: #fff; font-size: 24px; line-height: 1; cursor: pointer; z-index: 1; }
.popup-x:hover { background: var(--orange); }
@keyframes pop-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- สีไล่ระดับ (ตั้งค่าจากหลังบ้าน) ---------- */
html.grad-banner .banner, html.grad-banner .hero { background: var(--grad); }
html.grad-topbar .topbar { background: var(--grad); }
html.grad-footer .footer { background: var(--grad); }
html.grad-button .btn.primary, html.grad-button .form button, html.grad-button .tabs button[aria-selected="true"] { background: var(--grad); border-color: transparent; }

/* ---------- เอกสาร PDF แบบการ์ดมีรูปตัวอย่าง ---------- */
.pdfs { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 18px; }
@media (max-width: 900px) { .pdfs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .pdfs { gap: 12px; } .pdf-body { padding: 10px 12px 12px; } .pdf-body h3 { font-size: 14px; } .pdf-btns .btn { padding: 5px 10px; font-size: 13px; } .pdf-more { font-size: 13px; } }
.pdfc { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.pdfc:hover { box-shadow: 0 10px 28px rgba(43, 0, 87, .12); transform: translateY(-2px); }
.pdf-th { position: relative; display: block; aspect-ratio: 1 / 1.414; background: #EFEAF6; overflow: hidden; border-bottom: 1px solid var(--line); }
.pdf-th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; z-index: 1; background: #fff; }
.pdf-ph { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--purple); }
.pdf-ph svg { width: 54px; height: 54px; opacity: .6; }
.pdf-ph b { font-size: 13px; letter-spacing: .12em; opacity: .7; }
.pdf-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.pdf-body time { font-size: 13px; color: var(--muted); }
.pdf-body h3 { margin: 0; font-size: 16px; line-height: 1.45; }
.pdf-body h3 a { color: inherit; text-decoration: none; }
.pdf-body h3 a:hover { color: var(--purple); }
.pdf-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: auto; padding-top: 8px; }
.pdf-btns .btn { padding: 6px 14px; font-size: 14px; }
.pdf-more { font-size: 14px; color: var(--purple); font-weight: 600; text-decoration: none; }
.pdf-view { margin: 0 0 22px; }
.pdf-view iframe { width: 100%; height: min(80vh, 900px); border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pdf-view .pdf-btns { margin-top: 10px; }
.view-tg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.view-tg button { font: inherit; font-size: 14px; border: 0; background: none; padding: 6px 14px; cursor: pointer; color: var(--muted); }
.view-tg button[aria-pressed="true"] { background: var(--purple); color: #fff; }
.doc-tools .view-tg { margin-left: auto; }
