/* ===================================================================
   site.css — เว็บไซต์สาธารณะ โรงเรียนทุ่งกุลาประชานุสรณ์
   ธีมขาว-ทอง · รองรับโหมดมืด · ออกแบบ mobile-first
   =================================================================== */
:root{
  --gold:#B8912F; --gold-1:#D4AF57; --gold-2:#8B6D20; --gold-3:#F6EFDC; --gold-4:#FBF7EC;
  --bg:#FFFFFF; --bg-alt:#FAF7F0; --surface:#FFFFFF; --line:#E8E2D4;
  --text:#23241F; --text-soft:#6B6A63;
  --shadow:0 2px 12px rgba(80,64,20,.07); --shadow-lg:0 16px 44px rgba(80,64,20,.16);
  --nav-h:62px; --radius:16px;
  --ok:#198754; --info:#0D6EFD; --teal:#20A4A0; --warn:#E5A50A; --danger:#DC3545;
}
[data-bs-theme="dark"]{
  --gold:#D9B45B; --gold-1:#E7CB84; --gold-2:#B8912F; --gold-3:#2C2719; --gold-4:#1F1D16;
  --bg:#131418; --bg-alt:#191B20; --surface:#1C1E24; --line:#31343C;
  --text:#E9E6DE; --text-soft:#9A978E;
  --shadow:0 2px 12px rgba(0,0,0,.4); --shadow-lg:0 16px 44px rgba(0,0,0,.55);
}

*{ -webkit-tap-highlight-color:transparent; }
html{ scroll-behavior:smooth; scroll-padding-top:calc(var(--nav-h) + 10px); }
body{
  font-family:'Sarabun',system-ui,-apple-system,'Segoe UI',sans-serif;
  background:var(--bg); color:var(--text); font-size:15.5px; margin:0; overflow-x:hidden;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,h4,h5{ font-weight:700; letter-spacing:-.01em; }
a{ color:var(--gold-2); text-decoration:none; }
a:hover{ color:var(--gold); }
[data-bs-theme="dark"] a{ color:var(--gold-1); }
img{ max-width:100%; }
.text-gold{ color:var(--gold)!important; }
.text-soft{ color:var(--text-soft)!important; }
.bg-alt{ background:var(--bg-alt)!important; }
.container-x{ width:100%; max-width:1240px; margin:0 auto; padding:0 16px; }
@media (min-width:992px){ .container-x{ padding:0 24px; } }

/* ---------- ปุ่ม ---------- */
.btn-gold{ background:linear-gradient(135deg,var(--gold-1),var(--gold)); border:0; color:#fff; font-weight:600;
  box-shadow:0 3px 12px rgba(184,145,47,.34); }
.btn-gold:hover,.btn-gold:focus{ background:linear-gradient(135deg,var(--gold),var(--gold-2)); color:#fff; }
.btn-outline-gold{ border:1px solid var(--gold); color:var(--gold); background:transparent; font-weight:600; }
.btn-outline-gold:hover{ background:var(--gold); color:#fff; }
.btn-ghost{ border:1px solid var(--line); background:var(--surface); color:var(--text); }
.btn-ghost:hover{ background:var(--gold-3); color:var(--gold-2); border-color:var(--gold-1); }

/* ---------- แถบประกาศด่วน ---------- */
.notice-bar{ background:var(--gold-2); color:#fff; font-size:.86rem; padding:7px 0; text-align:center; }
.notice-bar a{ color:#fff; text-decoration:underline; }

/* ---------- เมนูด้านบน ---------- */
.site-nav{
  position:sticky; top:0; z-index:1040; background:var(--surface);
  border-bottom:1px solid var(--line); box-shadow:var(--shadow);
}
.site-nav .inner{ display:flex; align-items:center; gap:10px; height:var(--nav-h); }
.site-brand{ display:flex; align-items:center; gap:10px; color:inherit; min-width:0; flex:1; }
.site-brand img{ width:42px; height:42px; flex:none; }
.site-brand b{ display:block; font-size:.98rem; color:var(--gold-2); line-height:1.25;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.site-brand small{ display:block; font-size:.72rem; color:var(--text-soft); white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis; }
[data-bs-theme="dark"] .site-brand b{ color:var(--gold-1); }
.nav-main{ display:none; align-items:center; gap:2px; }
@media (min-width:1100px){ .nav-main{ display:flex; } .nav-burger{ display:none!important; } }
.nav-main > .nav-item{ position:relative; }
.nav-main .nav-top{
  display:flex; align-items:center; gap:5px; padding:9px 13px; border-radius:11px;
  font-size:.9rem; font-weight:600; color:var(--text); background:transparent; border:0; white-space:nowrap;
}
.nav-main .nav-top:hover,.nav-main .nav-item:hover .nav-top{ background:var(--gold-3); color:var(--gold-2); }
[data-bs-theme="dark"] .nav-main .nav-top:hover{ color:var(--gold-1); }
.nav-sub{
  position:absolute; top:100%; left:0; min-width:236px; background:var(--surface);
  border:1px solid var(--line); border-radius:13px; box-shadow:var(--shadow-lg); padding:7px;
  opacity:0; visibility:hidden; transform:translateY(6px); transition:.16s; z-index:5;
}
.nav-main .nav-item:hover .nav-sub{ opacity:1; visibility:visible; transform:none; }
.nav-sub a{ display:flex; align-items:center; gap:9px; padding:9px 12px; border-radius:9px;
  font-size:.88rem; color:var(--text); }
.nav-sub a:hover{ background:var(--gold-3); color:var(--gold-2); }
.nav-sub i{ color:var(--gold); width:18px; }
.nav-actions{ display:flex; align-items:center; gap:6px; flex:none; }
.icon-btn{ width:40px; height:40px; border-radius:12px; border:0; background:transparent; color:var(--text);
  display:inline-flex; align-items:center; justify-content:center; font-size:1.12rem; }
.icon-btn:hover{ background:var(--gold-3); color:var(--gold-2); }

/* เมนูมือถือ (offcanvas) */
.m-nav{ padding:8px; }
.m-nav .m-group{ border-bottom:1px solid var(--line); padding:4px 0; }
.m-nav .m-group:last-child{ border-bottom:0; }
.m-nav .m-top{ display:flex; align-items:center; gap:10px; width:100%; padding:12px 12px;
  background:transparent; border:0; font-weight:600; color:var(--text); font-size:.95rem; text-align:left; }
.m-nav .m-top i.bi-chevron-down{ margin-left:auto; transition:.2s; font-size:.8rem; color:var(--text-soft); }
.m-nav .m-top[aria-expanded="true"] i.bi-chevron-down{ transform:rotate(180deg); }
.m-nav .m-top > i:first-child{ color:var(--gold); width:20px; }
.m-nav .m-sub a{ display:flex; align-items:center; gap:9px; padding:10px 12px 10px 42px;
  color:var(--text); font-size:.9rem; border-radius:9px; }
.m-nav .m-sub a:hover{ background:var(--gold-3); color:var(--gold-2); }

/* ---------- แบนเนอร์สไลด์ ---------- */
.hero{ position:relative; background:var(--gold-4); }
.hero .slide{ position:relative; aspect-ratio:16/10; max-height:78vh; overflow:hidden; }
@media (min-width:768px){ .hero .slide{ aspect-ratio:21/8; } }
.hero .slide img{ width:100%; height:100%; object-fit:cover; display:block; }
.hero .cap{
  position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center;
  padding:22px 18px; background:linear-gradient(90deg, rgba(20,16,4,.62), rgba(20,16,4,.18) 62%, transparent);
}
@media (min-width:768px){ .hero .cap{ padding:0 8%; } }
.hero .cap h2{ color:#fff; font-size:1.34rem; line-height:1.4; text-shadow:0 2px 14px rgba(0,0,0,.45);
  max-width:680px; margin:0 0 8px; }
.hero .cap p{ color:rgba(255,255,255,.94); font-size:.92rem; max-width:620px; margin:0 0 14px;
  text-shadow:0 2px 12px rgba(0,0,0,.5); display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
@media (min-width:768px){ .hero .cap h2{ font-size:2.15rem; } .hero .cap p{ font-size:1.04rem; } }
@media (min-width:1200px){ .hero .cap h2{ font-size:2.6rem; } }
.hero .cap.center{ align-items:center; text-align:center; background:linear-gradient(0deg, rgba(20,16,4,.55), rgba(20,16,4,.2)); }
.hero .cap.right{ align-items:flex-end; text-align:right;
  background:linear-gradient(270deg, rgba(20,16,4,.62), rgba(20,16,4,.18) 62%, transparent); }
.carousel-indicators [data-bs-target]{ width:26px; height:4px; border-radius:4px; background:#fff; opacity:.5; }
.carousel-indicators .active{ opacity:1; background:var(--gold-1); width:38px; }
.carousel-control-prev,.carousel-control-next{ width:9%; opacity:.55; }
.carousel-control-prev:hover,.carousel-control-next:hover{ opacity:.95; }

/* ---------- ส่วนของหน้า ---------- */
.sec{ padding:46px 0; }
@media (min-width:992px){ .sec{ padding:70px 0; } }
.sec-head{ text-align:center; max-width:760px; margin:0 auto 30px; }
.sec-head .eyebrow{
  display:inline-flex; align-items:center; gap:7px; font-size:.76rem; font-weight:700; letter-spacing:.1em;
  text-transform:uppercase; color:var(--gold-2); background:var(--gold-3); border:1px solid var(--gold-1);
  padding:5px 15px; border-radius:20px; margin-bottom:12px;
}
[data-bs-theme="dark"] .sec-head .eyebrow{ color:var(--gold-1); }
.sec-head h2{ font-size:1.5rem; margin:0 0 8px; }
@media (min-width:768px){ .sec-head h2{ font-size:2rem; } }
.sec-head p{ color:var(--text-soft); margin:0; font-size:.96rem; }

.card-s{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; height:100%; transition:transform .18s, box-shadow .18s;
}
a.card-s:hover, .card-s.hoverable:hover{ transform:translateY(-3px); box-shadow:var(--shadow-lg); }
.card-s .body{ padding:18px; }

/* ---------- สถิติ ---------- */
.stats{ display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
@media (min-width:768px){ .stats{ grid-template-columns:repeat(4,1fr); gap:18px; } }
.stat-s{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:20px 16px; text-align:center; box-shadow:var(--shadow);
}
.stat-s i{ font-size:1.6rem; color:var(--gold); }
.stat-s .n{ font-size:1.85rem; font-weight:800; line-height:1.2; margin-top:6px; }
@media (min-width:768px){ .stat-s .n{ font-size:2.3rem; } }
.stat-s .l{ font-size:.82rem; color:var(--text-soft); }

/* ---------- ระดับคุณภาพ ---------- */
.lv-badge{ display:inline-block; padding:4px 14px; border-radius:20px; color:#fff; font-weight:700; font-size:.82rem; }
.std-card{ border-left:5px solid var(--gold); }
.issue-row{ display:flex; align-items:center; gap:10px; padding:9px 0; border-bottom:1px dashed var(--line); font-size:.88rem; }
.issue-row:last-child{ border-bottom:0; }
.issue-row .code{ font-weight:700; color:var(--gold-2); flex:none; min-width:34px; }
.bar-s{ height:7px; background:var(--line); border-radius:20px; overflow:hidden; flex:1; min-width:60px; }
.bar-s > i{ display:block; height:100%; border-radius:20px; background:linear-gradient(90deg,var(--gold-1),var(--gold)); }

/* ---------- SAR ---------- */
.sar-card{ display:flex; gap:16px; align-items:flex-start; }
.sar-year{
  flex:none; width:84px; height:96px; border-radius:14px; display:flex; flex-direction:column;
  align-items:center; justify-content:center; color:#fff; font-weight:800;
  background:linear-gradient(150deg,var(--gold-1),var(--gold-2)); box-shadow:var(--shadow);
}
.sar-year small{ font-size:.66rem; font-weight:600; opacity:.9; }
.sar-year b{ font-size:1.5rem; line-height:1.1; }

/* ---------- ข่าว ---------- */
.news-cover{
  aspect-ratio:16/9; background:linear-gradient(135deg,var(--gold-3),var(--gold-4));
  display:grid; place-items:center; color:var(--gold); font-size:2.4rem; overflow:hidden;
}
.news-cover img{ width:100%; height:100%; object-fit:cover; }
.news-date{ font-size:.78rem; color:var(--text-soft); }
.clamp2{ display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.clamp3{ display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

/* ---------- แท็บ ---------- */
.tabs-x{ display:flex; gap:7px; justify-content:center; flex-wrap:wrap; margin-bottom:22px; }
.tabs-x button{
  border:1px solid var(--line); background:var(--surface); color:var(--text-soft);
  padding:8px 18px; border-radius:22px; font-size:.87rem; font-weight:600;
}
.tabs-x button.active{ background:var(--gold); border-color:var(--gold); color:#fff; }

/* ---------- บุคลากร ---------- */
.person{ text-align:center; }
.person .ph{
  width:96px; height:96px; border-radius:50%; margin:0 auto 10px; display:grid; place-items:center;
  background:linear-gradient(140deg,var(--gold-1),var(--gold-2)); color:#fff; font-size:2rem; font-weight:700;
  border:4px solid var(--surface); box-shadow:var(--shadow); overflow:hidden;
}
.person .ph img{ width:100%; height:100%; object-fit:cover; }
.person .nm{ font-weight:600; font-size:.92rem; line-height:1.4; }
.person .po{ font-size:.79rem; color:var(--text-soft); }

/* ---------- ผลงาน ---------- */
.ach-item{ display:flex; gap:13px; align-items:flex-start; }
.ach-ic{
  width:46px; height:46px; border-radius:13px; flex:none; display:grid; place-items:center;
  background:var(--gold-3); color:var(--gold-2); font-size:1.25rem;
}
.lvl-chip{ font-size:.71rem; font-weight:700; padding:2px 9px; border-radius:20px;
  background:var(--gold-3); color:var(--gold-2); border:1px solid var(--gold-1); white-space:nowrap; }
[data-bs-theme="dark"] .lvl-chip{ color:var(--gold-1); }

/* ---------- เอกสาร ---------- */
.doc-row{
  display:flex; align-items:center; gap:13px; padding:13px 15px; border:1px solid var(--line);
  border-radius:13px; background:var(--surface); color:inherit; margin-bottom:9px;
}
.doc-row:hover{ border-color:var(--gold-1); background:var(--gold-4); color:inherit; }
.doc-ic{ font-size:1.5rem; color:var(--gold); flex:none; }

/* ---------- ปฏิทิน ---------- */
.ev-row{ display:flex; gap:13px; align-items:center; padding:11px 0; border-bottom:1px dashed var(--line); }
.ev-row:last-child{ border-bottom:0; }
.ev-date{
  flex:none; width:58px; text-align:center; border-radius:11px; padding:7px 0;
  background:var(--gold-3); color:var(--gold-2); font-weight:700; line-height:1.15;
}
.ev-date span{ display:block; font-size:1.3rem; }
.ev-date small{ font-size:.68rem; font-weight:600; }
[data-bs-theme="dark"] .ev-date{ color:var(--gold-1); }

/* ---------- ติดต่อ ---------- */
.contact-row{ display:flex; gap:12px; align-items:flex-start; margin-bottom:15px; }
.contact-ic{ width:40px; height:40px; border-radius:12px; flex:none; display:grid; place-items:center;
  background:var(--gold-3); color:var(--gold-2); font-size:1.05rem; }
.map-frame{ width:100%; aspect-ratio:16/10; border:0; border-radius:var(--radius); }
.form-control,.form-select{ background:var(--surface); border-color:var(--line); color:var(--text); border-radius:11px; }
.form-control:focus,.form-select:focus{ border-color:var(--gold-1); box-shadow:0 0 0 .2rem rgba(184,145,47,.2); }
.form-label{ font-size:.86rem; font-weight:600; margin-bottom:5px; }
.hp-field{ position:absolute!important; left:-9999px!important; opacity:0; height:0; }

/* ---------- ท้ายเว็บ ---------- */
.site-foot{ background:var(--gold-4); border-top:3px solid var(--gold); padding:42px 0 0; margin-top:10px; }
[data-bs-theme="dark"] .site-foot{ background:var(--bg-alt); }
.foot-grid{ display:grid; gap:26px; grid-template-columns:1fr; }
@media (min-width:768px){ .foot-grid{ grid-template-columns:1.6fr 1fr 1fr; } }
@media (min-width:1100px){ .foot-grid{ grid-template-columns:1.8fr 1fr 1fr 1fr; } }
.foot-grid h6{ font-size:.92rem; color:var(--gold-2); margin-bottom:12px; font-weight:700; }
[data-bs-theme="dark"] .foot-grid h6{ color:var(--gold-1); }
.foot-grid a{ display:block; padding:5px 0; font-size:.87rem; color:var(--text-soft); }
.foot-grid a:hover{ color:var(--gold); }
.foot-bottom{ border-top:1px solid var(--line); margin-top:30px; padding:16px 0; font-size:.82rem;
  color:var(--text-soft); text-align:center; }
.social a{ display:inline-grid; place-items:center; width:38px; height:38px; border-radius:11px;
  background:var(--surface); border:1px solid var(--line); color:var(--gold-2); margin-right:7px; }
.social a:hover{ background:var(--gold); color:#fff; border-color:var(--gold); }

/* ---------- อื่น ๆ ---------- */
.chart-wrap{ position:relative; width:100%; height:290px; }
@media (min-width:992px){ .chart-wrap{ height:330px; } }
.to-top{
  position:fixed; right:16px; bottom:18px; width:46px; height:46px; border-radius:14px; border:0;
  background:var(--gold); color:#fff; box-shadow:var(--shadow-lg); z-index:1035;
  display:none; place-items:center; font-size:1.2rem;
}
.to-top.show{ display:grid; }
.modal-content{ background:var(--surface); border:1px solid var(--line); border-radius:18px; }
.modal-header,.modal-footer{ border-color:var(--line); }
.skel{ background:linear-gradient(90deg,var(--bg-alt),var(--line),var(--bg-alt)); background-size:200% 100%;
  animation:sk 1.2s infinite; border-radius:10px; height:14px; }
@keyframes sk{ 0%{background-position:200% 0;} 100%{background-position:-200% 0;} }
.toast-area{ position:fixed; top:calc(var(--nav-h) + 12px); right:12px; left:12px; z-index:1090; display:grid; gap:8px; }
@media (min-width:576px){ .toast-area{ left:auto; width:360px; } }
.toast-s{ background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--gold);
  border-radius:12px; padding:12px 15px; box-shadow:var(--shadow-lg); font-size:.9rem; }
.toast-s.ok{ border-left-color:var(--ok); } .toast-s.err{ border-left-color:var(--danger); }
::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-thumb{ background:var(--line); border-radius:20px; }
::-webkit-scrollbar-thumb:hover{ background:var(--gold-1); }
@media print{ .site-nav,.site-foot,.to-top,.no-print{ display:none!important; } }
