/* ============================================================
   public.css — ส่วนกลางของหน้าสาธารณะทุกหน้า
   เขียวสาธิต + ทองเกียรติบัตร
   ============================================================ */
:root {
  --primary: #0F5C30;
  --primary-mid: #14713C;
  --primary-light: #1F9D5A;
  --primary-tint: #F0FDF4;
  --primary-tint2: #DCFCE7;
  --accent: #E0B559;
  --accent-hover: #F4D998;
  --bg-main: #F8FAFC;
  --surface: #FFFFFF;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --border: #E2E8F0;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,.05);
  --shadow-md: 0 4px 10px -2px rgba(15,30,60,.08);
  --shadow-lg: 0 20px 40px -12px rgba(15,92,48,.18);
  --shadow-xl: 0 28px 60px -18px rgba(15,92,48,.28);
  --radius: 14px;
  --radius-lg: 24px;
  --header-h: 72px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  font-family: 'Sarabun', Tahoma, sans-serif; background: var(--bg-main); color: var(--text-main);
  line-height: 1.65; overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
body.nav-lock { overflow: hidden; }
h1, h2, h3, h4, .btn, .brand-text .title { font-family: 'Prompt', 'Sarabun', sans-serif; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
button, input, select { font-family: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.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; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 600; background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 5vw, 28px); }

/* ---------- ปุ่ม ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 12px 26px; border-radius: 999px; font-weight: 600; font-size: 15px;
  border: none; cursor: pointer; transition: background .2s ease, transform .2s ease, box-shadow .2s ease; text-align: center; }
.btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(15,92,48,.22); }
.btn-primary:hover { background: var(--primary-mid); transform: translateY(-2px); }
.btn-accent { background: var(--accent); color: #17331F; box-shadow: 0 8px 22px rgba(224,181,89,.35); }
.btn-accent:hover { background: var(--accent-hover); transform: translateY(-2px); }
.btn-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1.5px solid rgba(255,255,255,.55); backdrop-filter: blur(6px); }
.btn-ghost:hover { background: rgba(255,255,255,.24); transform: translateY(-2px); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--primary-light); background: var(--primary-tint); transform: translateY(-2px); }
.btn-sm { min-height: 38px; padding: 8px 16px; font-size: 13.5px; }
.btn-nav { min-height: 42px; padding: 10px 22px; font-size: 14.5px; margin-left: 6px; }

.more-link { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 15px;
  color: var(--primary); padding: 10px 4px; transition: color .18s ease; }
.more-link svg { width: 17px; height: 17px; transition: transform .18s ease; }
.more-link:hover { color: var(--primary-light); }
.more-link:hover svg { transform: translateX(4px); }

/* ============================================================
   Header
   ============================================================ */
.site-header { position: fixed; inset: 0 0 auto 0; z-index: 200; background: rgba(255,255,255,.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226,232,240,.8); transition: box-shadow .2s ease; }
.site-header.scrolled { box-shadow: var(--shadow-sm); }
.nav-container { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 12px; }
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text .title { font-weight: 700; font-size: 17px; color: var(--primary); line-height: 1.2; }
.brand-text .subtitle { font-size: 11.5px; color: var(--text-muted); }
.nav-links { display: none; align-items: center; gap: 4px; margin-left: auto; }
.nav-links > a:not(.btn), .nav-dropdown-toggle {
  font-size: 14.5px; font-weight: 500; color: var(--text-main); padding: 9px 12px; border-radius: 10px;
  transition: color .15s ease, background .15s ease; }
.nav-links > a:not(.btn):hover { color: var(--primary); background: var(--primary-tint); }
.nav-links > a.active, .nav-dropdown-toggle.active { color: var(--primary); font-weight: 600; background: var(--primary-tint); }
.nav-dropdown { position: relative; }
.nav-dropdown-toggle { display: flex; align-items: center; gap: 5px; background: none; border: none; font-family: inherit; }
.nav-dropdown-toggle svg { transition: transform .15s ease; }
.nav-dropdown-toggle:hover, .nav-dropdown.open .nav-dropdown-toggle { color: var(--primary); background: var(--primary-tint); }
.nav-dropdown.open .nav-dropdown-toggle svg { transform: rotate(180deg); }
.nav-dropdown-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 8px; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s; z-index: 250; }
.nav-dropdown.open .nav-dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown-menu a { display: block; font-size: 14px; font-weight: 500; padding: 10px 12px; border-radius: 9px; }
.nav-dropdown-menu a:hover { background: var(--primary-tint); color: var(--primary); }
.nav-dropdown-menu a.active { color: var(--primary); font-weight: 700; background: var(--primary-tint); }

.nav-mobile-right { display: flex; align-items: center; gap: 6px; }
.mobile-toggle { display: flex; background: none; border: none; padding: 8px; color: var(--text-main); border-radius: 10px; }
.live-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; color: #B91C1C;
  background: #FEF2F2; border: 1px solid #FECACA; border-radius: 999px; padding: 6px 12px; font-family: 'Prompt', sans-serif; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #DC2626; flex-shrink: 0; position: relative; }
.live-dot::after { content: ''; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid #DC2626; opacity: 0;
  animation: livePulse 1.6s ease-out infinite; }
@keyframes livePulse { 0% { transform: scale(.5); opacity: .8; } 100% { transform: scale(1.5); opacity: 0; } }

.mobile-menu { position: fixed; top: var(--header-h); left: 0; right: 0; max-height: calc(100vh - var(--header-h));
  max-height: calc(100dvh - var(--header-h));
  overflow-y: auto; background: #fff; padding: 14px 20px 26px; border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md); display: none; flex-direction: column; gap: 2px; z-index: 199; }
.mobile-menu.open { display: flex; }
.mobile-menu a:not(.btn) { font-size: 15.5px; font-weight: 500; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.mobile-menu a.active { color: var(--primary); font-weight: 700; }
.mobile-menu .group-label { font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 16px 4px 4px; }
.mobile-menu .sub { padding-left: 16px !important; font-size: 15px !important; color: #475569; }
.mobile-menu .sub.active { color: var(--primary); }
.mobile-menu .btn { margin-top: 12px; width: 100%; }
@media (min-width: 1080px) {
  .nav-links { display: flex; }
  .nav-mobile-right { display: none; }
  .mobile-menu { display: none !important; }
}
@media (max-width: 380px) {
  .brand-text .title { font-size: 15.5px; }
  .brand img { width: 36px; height: 36px; }
}

/* ============================================================
   หัวหน้าหน้าย่อย
   ============================================================ */
.page-hero { padding: calc(var(--header-h) + 40px) 0 26px; text-align: center;
  background: linear-gradient(180deg, #EAF5EE 0%, var(--bg-main) 100%); }
.page-hero.tone-gold { background: linear-gradient(180deg, #FBF3E3 0%, var(--bg-main) 100%); }
.page-hero.tone-red { background: linear-gradient(180deg, #FDF0EE 0%, var(--bg-main) 100%); }
.page-hero h1 { font-size: clamp(23px, 4.4vw, 32px); font-weight: 700; color: var(--primary); line-height: 1.3;
  display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.page-hero h1 svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }
.page-hero p { font-size: clamp(14px, 1.8vw, 15.5px); color: var(--text-muted); max-width: 620px; margin: 0 auto; }

.page-wrap { max-width: 860px; margin: 0 auto; padding: 22px 16px 40px; min-height: 260px; }

/* ---------- ช่องค้นหา + ชิปกรอง ---------- */
.search-wrap { max-width: 680px; margin: 18px auto 0; padding: 0 16px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; box-shadow: var(--shadow-md); padding: 12px 18px; }
.search-box:focus-within { border-color: var(--primary-light); box-shadow: 0 0 0 4px var(--primary-tint2); }
.search-box svg { flex-shrink: 0; color: var(--text-muted); width: 20px; height: 20px; }
.search-box input { flex: 1; min-width: 0; border: none; outline: none; font-size: 16px; background: transparent; color: var(--text-main); }
.search-clear { border: none; background: #EEF2F6; color: var(--text-muted); width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.search-clear svg { width: 14px; height: 14px; }
.search-hint { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-top: 8px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; overflow: visible; justify-content: center; }
@media (min-width: 760px) { .chip-row { flex-wrap: wrap; overflow: visible; } }
.chip { flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text-main);
  border-radius: 999px; padding: 7px 15px; font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .c { opacity: .72; font-weight: 500; }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ---------- ป้ายสถานะ ---------- */
.st-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; white-space: nowrap; line-height: 1.5; flex-shrink: 0; }
.st-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.st-pending   { background: #F1F5F9; color: #64748B; }
.st-checkin   { background: #FEF3C7; color: #92400E; }
.st-ongoing   { background: #FEE2E2; color: #B91C1C; }
.st-ongoing i { animation: stBlink 1.4s ease-in-out infinite; }
.st-waiting   { background: #E0F2FE; color: #075985; }
.st-announced { background: #DCFCE7; color: #15803D; }
.st-medal     { background: #FEF9C3; color: #A16207; }
.st-done      { background: #E0E7FF; color: #3730A3; }
.st-cert      { background: #FAE8FF; color: #86198F; }
.st-protest   { background: #FFEDD5; color: #9A3412; }
.st-cancel    { background: #F1F5F9; color: #94A3B8; }
@keyframes stBlink { 50% { opacity: .25; } }

/* ---------- เหรียญ ---------- */
.medal { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 12.5px; flex-shrink: 0; color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.14); }
.medal-gold   { background: linear-gradient(145deg, #F4D27A, #C9962B); color: #4A3405; }
.medal-silver { background: linear-gradient(145deg, #E7EBEF, #A8B2BD); color: #2D3742; }
.medal-bronze { background: linear-gradient(145deg, #E8B48A, #B06A3B); color: #3D1F0A; }
.medal-none   { background: #E2E8F0; color: #475569; }

/* ---------- รายการเมนูแบบแถว: ไอคอน + ชื่อ + คำอธิบาย + ลูกศร ---------- */
.row-list { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 14px; padding: 15px 16px; transition: background .15s ease; }
.row-item + .row-item { border-top: 1px solid var(--border); }
a.row-item:hover { background: #FAFCFB; }
a.row-item:active { background: var(--primary-tint); }
.row-icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--primary-tint); color: var(--primary); }
.row-icon svg { width: 22px; height: 22px; }
.row-icon.gold { background: #FBF3E3; color: #9A6B12; }
.row-icon.red { background: #FEF2F2; color: #B91C1C; }
.row-body { flex: 1; min-width: 0; }
.row-title { font-family: 'Prompt', sans-serif; font-weight: 600; font-size: 16px; color: var(--text-main); line-height: 1.35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { font-size: 13.5px; color: var(--text-muted); line-height: 1.5; margin-top: 1px; }
.row-chev { width: 18px; height: 18px; color: #94A3B8; flex-shrink: 0; }
.row-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #FEF2F2; color: #B91C1C; font-family: 'Sarabun', sans-serif; }
.section-label { font-family: 'Prompt', sans-serif; font-size: 14px; font-weight: 600; color: #475569; margin: 22px 4px 8px; }

/* ---------- เวลาอัปเดต / ที่มา ---------- */
.meta-line { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.meta-line svg { width: 14px; height: 14px; flex-shrink: 0; }
.meta-line.ok svg { color: var(--primary-light); }

/* ---------- empty / notice ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--text-muted); grid-column: 1 / -1; }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; color: #94A3B8; }
.empty-state p { font-size: 14.5px; }
.notice { display: flex; gap: 12px; align-items: flex-start; border-radius: var(--radius); padding: 13px 16px;
  font-size: 14px; line-height: 1.6; border: 1px solid; }
.notice svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.notice-info { background: #F0F9FF; border-color: #BAE6FD; color: #075985; }
.notice-warn { background: #FFF8EC; border-color: #F2DCB3; color: #6B4E13; }
.notice-ok   { background: var(--primary-tint); border-color: #BBF7D0; color: var(--primary); }
.notice b { font-weight: 700; }

/* ---------- toast ---------- */
.pub-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(14px);
  background: #1E293B; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; line-height: 1.55;
  max-width: min(92vw, 420px); text-align: center; box-shadow: 0 14px 34px rgba(15,30,60,.28);
  opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease; z-index: 450; }
.pub-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 600px) { .pub-toast { bottom: 84px; } }

/* ============================================================
   Footer
   ============================================================ */
.site-footer { background: #0B1F14; color: #C6D2CB; padding: clamp(42px, 6vw, 62px) 0 26px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 30px; margin-bottom: 30px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 1.5fr 1fr 1fr; } }
.footer-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.footer-brand img { width: 34px; height: 34px; border-radius: 50%; }
.footer-brand span { font-family: 'Prompt', sans-serif; font-weight: 700; font-size: 17px; color: #fff; }
.footer-lead { font-size: 13.5px; color: #93A49A; line-height: 1.7; max-width: 340px; }
.footer-col h4 { font-size: 14.5px; margin-bottom: 13px; color: #fff; font-weight: 600; }
.footer-col a { display: block; font-size: 13.5px; color: #93A49A; padding: 5px 0; }
.footer-col a:hover { color: var(--accent); }
.footer-contact p { font-size: 13.5px; color: #93A49A; margin-bottom: 8px; }
.footer-contact p a { display: inline; color: #fff; font-weight: 600; padding: 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding-top: 20px; font-size: 12.5px; color: #6B7C72;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; }

/* ---------- ปุ่มเลื่อนขึ้น/ลง ---------- */
.scroll-nav { position: fixed; right: 20px; bottom: 24px; z-index: 150; display: flex; flex-direction: column; gap: 10px; }
.scroll-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border);
  color: var(--primary); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-md); opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .2s ease, transform .2s ease, background .15s ease, visibility .2s; }
.scroll-btn.show { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-btn:hover { background: var(--primary-tint); border-color: var(--primary-light); }
.scroll-btn svg { width: 20px; height: 20px; }
@media (max-width: 600px) { .scroll-nav { right: 14px; bottom: 16px; } .scroll-btn { width: 40px; height: 40px; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print { .site-header, .scroll-nav, .mobile-menu, .site-footer { display: none !important; } .page-hero { padding-top: 10px; } }
