/* VU CMS — ส่วนประกอบหน้าบ้านที่ทุก theme ใช้ร่วม
   theme ปรับหน้าตาด้วยตัวแปร (--primary, --border, --banner-h ...) หรือ selector ของตัวเอง */
:root {
    --primary: #6b1f7c; --accent: #f2a900; --text: #1f2430; --muted: #6b7280;
    --border: #e5e2ea; --surface: #f6f5f8; --radius: 10px;
    --banner-h: clamp(220px, 32vw, min(560px, 60vh));
}
*, *::before, *::after { box-sizing: border-box; }
img { max-width: 100%; height: auto; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: #fff; padding: .5rem 1rem; z-index: 100; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cms-menu { list-style: none; margin: 0; padding: 0; }

/* แบนเนอร์: แสดงทั้งภาพ + พื้นหลังเบลอ */
.cms-banner { position: relative; overflow: hidden; background: #111; }
.cms-banner__track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.cms-banner__track::-webkit-scrollbar { display: none; }
.cms-banner__slide { flex: 0 0 100%; margin: 0; scroll-snap-align: start; position: relative; overflow: hidden; background: #1f1726; }
.cms-banner__slide::before { content: ""; position: absolute; inset: -40px; background: var(--bn-bg) center / cover no-repeat; filter: blur(28px) brightness(.8) saturate(1.1); }
.cms-banner__slide picture, .cms-banner__link { position: relative; z-index: 1; display: block; }
.cms-banner__slide img { display: block; width: 100%; height: var(--banner-h); object-fit: contain; }
.cms-banner__caption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: .55rem 1.25rem; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.cms-banner__nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.85); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.cms-banner__nav--prev { left: 1rem; } .cms-banner__nav--next { right: 1rem; }

/* โมดูล */
.cms-block { margin-bottom: 1.25rem; }
.cms-block__title { margin: 0 0 .75rem; font-size: 1.1rem; }
.cms-post-list, .cms-category-list { list-style: none; margin: 0; padding: 0; }
.cms-post-list li { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.cms-post-list time { display: block; font-size: .85rem; color: var(--muted); }
.cms-category-list li { padding: .3rem 0; }
.cms-category-list ul { list-style: none; padding-left: 1rem; margin: .25rem 0 0; }
.cms-embed { position: relative; aspect-ratio: 16 / 9; }
.cms-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cms-contact { font-style: normal; }
.cms-contact p { margin: 0 0 .4rem; }
.cms-social { list-style: none; margin: .75rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.cms-social a { display: inline-block; padding: .25rem .75rem; border: 1px solid currentColor; border-radius: 99px; font-size: .9rem; text-decoration: none; }

/* เนื้อหา */
.cms-content table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.cms-content td, .cms-content th { border: 1px solid var(--border); padding: .5rem; }
.notice { background: #fff4d6; border: 1px solid #eed39c; padding: .5rem 1rem; border-radius: 6px; }
.empty { color: var(--muted); }
.attachments { margin-top: 2rem; padding: 1rem 1.25rem; background: var(--surface); border-radius: var(--radius); }

/* ค้นหา */
.cms-search { display: flex; gap: .5rem; }
.cms-search input { flex: 1; min-width: 0; font: inherit; padding: .55rem .8rem; border: 1px solid var(--border); border-radius: 8px; }
.cms-search button { font: inherit; padding: .55rem 1.1rem; border: 0; border-radius: 8px; background: var(--primary); color: var(--primary-on, #fff); cursor: pointer; }
.cms-search--large { max-width: 640px; margin-top: .75rem; }
.search-summary { color: var(--muted); margin: 1rem 0 1.5rem; }
.search-group { margin-bottom: 2rem; }
.search-item { padding: .9rem 0; border-bottom: 1px solid var(--border); }
.search-item h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.search-item h3 a { color: var(--primary-ink, var(--primary)); text-decoration: none; }
.search-item h3 a:hover { text-decoration: underline; }
.search-item p { margin: .2rem 0; }
.search-item__meta { font-size: .85rem; color: var(--muted); }
mark { background: #fff1c2; color: inherit; padding: 0 .1em; border-radius: 2px; }

/* แบ่งหน้า */
.pagination { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.pagination li > a, .pagination li > span { display: block; min-width: 2.4rem; text-align: center; padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--text); }
.pagination li.active > span { background: var(--primary); border-color: var(--primary); color: var(--primary-on, #fff); }
.pagination li.disabled > span { color: var(--muted); }

/* ปุ่ม hamburger ☰ -> ✕ (แสดงบนมือถือโดย theme) */
.nav-toggle { display: none; align-items: center; justify-content: center; gap: .55rem; min-width: 44px; min-height: 44px; padding: .5rem; background: transparent; border: 0; color: inherit; font: inherit; cursor: pointer; }
.nav-toggle__bars { position: relative; display: inline-block; width: 22px; height: 16px; flex: none; }
.nav-toggle__bars span { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: top .2s ease, transform .2s ease, opacity .15s ease; }
.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 7px; }
.nav-toggle__bars span:nth-child(3) { top: 14px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(1) { top: 7px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars span:nth-child(3) { top: 7px; transform: rotate(-45deg); }
/* ปุ่มกาง/พับเมนูย่อยบนมือถือ */
.submenu-toggle { display: none; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; background: transparent; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; }
.submenu-toggle span { display: inline-block; transition: transform .2s ease; }
.is-open > .submenu-toggle span { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    .nav-toggle__bars span, .submenu-toggle span { transition: none; }
}
