/* เว็บไซต์โรงเรียนวัดหนองศาลา (ประชานุกูล) — สีประจำโรงเรียน ฟ้า-ขาว */
:root {
  --blue: #1677d2;
  --blue-dark: #0b4f9c;
  --blue-deep: #083a75;
  --blue-light: #e8f3fe;
  --blue-soft: #cfe6fc;
  --sky: #4fb3ff;
  --ink: #1d2a3a;
  --muted: #5d6b7c;
  --line: #dde7f2;
  --bg: #f4f8fc;
  --white: #ffffff;
  --gold: #f2b705;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(11, 79, 156, 0.08);
  --shadow-hover: 0 8px 24px rgba(11, 79, 156, 0.16);
  --max: 1200px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Sarabun', 'Leelawadee UI', Tahoma, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3, h4 { font-family: 'Prompt', 'Sarabun', sans-serif; font-weight: 500; line-height: 1.35; margin: 0 0 .5em; color: var(--blue-deep); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--blue-deep); color: #fff; padding: 8px 16px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }

/* ===== แถบบนสุด ===== */
.topbar { background: var(--blue-deep); color: #d9ebff; font-size: 14px; }
.topbar .wrap { display: flex; gap: 18px; justify-content: flex-end; align-items: center; min-height: 34px; flex-wrap: wrap; }
.topbar a { color: #fff; }

/* ===== หัวเว็บ ===== */
.site-head {
  background: linear-gradient(120deg, #ffffff 0%, #ffffff 45%, var(--blue-light) 100%);
  border-bottom: 4px solid var(--blue);
}
.site-head .wrap { display: flex; align-items: center; gap: 16px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 14px; color: inherit; text-decoration: none !important; min-width: 0; }
.brand img, .logo-ph { width: 76px; height: 76px; flex: none; object-fit: contain; }
.logo-ph {
  border-radius: 50%; border: 2px dashed var(--blue); background: var(--blue-light);
  display: grid; place-items: center; color: var(--blue); font-size: 13px; text-align: center; line-height: 1.2;
}
.brand-text { min-width: 0; }
.brand-name { font-family: 'Prompt', sans-serif; font-size: 25px; font-weight: 500; color: var(--blue-deep); line-height: 1.25; }
.brand-sub { color: var(--muted); font-size: 15px; }
.brand-en { color: var(--blue); font-size: 14px; letter-spacing: .3px; }

/* ===== เมนู ===== */
.nav { background: var(--blue); position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.nav .wrap { display: flex; align-items: stretch; }
.nav-toggle {
  display: none; background: none; border: 0; color: #fff; font: inherit; font-size: 17px;
  padding: 12px 4px; cursor: pointer; align-items: center; gap: 8px;
}
.nav-toggle .bars { font-size: 22px; line-height: 1; }
.menu { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.menu > li { position: relative; }
.menu > li > a, .menu > li > button {
  display: flex; align-items: center; gap: 4px; padding: 13px 15px; color: #fff; font: inherit; font-size: 16.5px;
  background: none; border: 0; cursor: pointer; text-decoration: none !important; white-space: nowrap;
}
.menu > li > a:hover, .menu > li > button:hover, .menu > li:focus-within > a, .menu > li:focus-within > button,
.menu > li.active > a, .menu > li.active > button { background: var(--blue-dark); }
.menu .caret { font-size: 11px; opacity: .85; }
.submenu {
  list-style: none; margin: 0; padding: 6px 0; position: absolute; left: 0; top: 100%; min-width: 240px;
  background: #fff; border-radius: 0 0 10px 10px; box-shadow: var(--shadow-hover); display: none; z-index: 60;
}
.menu > li:hover > .submenu, .menu > li:focus-within > .submenu { display: block; }
.submenu a { display: block; padding: 9px 18px; color: var(--ink); text-decoration: none !important; }
.submenu a:hover { background: var(--blue-light); color: var(--blue-dark); }

/* ===== โครงหน้า ===== */
.page { padding: 24px 0 40px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.layout.single { grid-template-columns: minmax(0, 1fr); }
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; border-bottom: 2px solid var(--blue-soft); }
.section-head h2 {
  font-size: 21px; margin: 0; padding: 6px 16px 6px 0; position: relative; border-bottom: 3px solid var(--blue); margin-bottom: -2px;
}
.section-head a { font-size: 15px; white-space: nowrap; }
.crumbs { font-size: 14.5px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.empty { color: var(--muted); padding: 18px; text-align: center; background: #fff; border-radius: var(--radius); }
.loading { color: var(--muted); padding: 30px; text-align: center; }

/* ===== สไลด์ ===== */
.slider { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--blue-deep); box-shadow: var(--shadow); touch-action: pan-y; }
.slides { display: flex; transition: transform .5s ease; }
.slide { flex: 0 0 100%; position: relative; aspect-ratio: 16 / 7; }
.slider.award .slide { aspect-ratio: 4 / 3; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.slider.award .slide img { object-fit: contain; background: #fff; }
.slide .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 20px 14px; color: #fff; font-size: 18px;
  background: linear-gradient(transparent, rgba(5, 30, 60, .78)); font-family: 'Prompt', sans-serif;
}
.slider .arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.85); color: var(--blue-deep); font-size: 20px; cursor: pointer; display: grid; place-items: center;
}
.slider .prev { left: 10px; } .slider .next { right: 10px; }
.dots { position: absolute; bottom: 8px; right: 12px; display: flex; gap: 6px; }
.dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; background: rgba(255,255,255,.55); cursor: pointer; }
.dots button.on { background: #fff; width: 22px; border-radius: 6px; }

/* ===== ต้อนรับ / ผู้บริหาร ===== */
.welcome { display: grid; grid-template-columns: 1fr; gap: 10px; }
.motto {
  background: linear-gradient(120deg, var(--blue), var(--sky)); color: #fff; border-radius: var(--radius);
  padding: 14px 20px; font-family: 'Prompt', sans-serif; font-size: 19px; text-align: center;
}
.execs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.exec { text-align: center; background: #fff; border-radius: var(--radius); padding: 16px 10px; box-shadow: var(--shadow); }
.exec .ph { width: 130px; height: 160px; margin: 0 auto 10px; border-radius: 10px; object-fit: cover; background: var(--blue-light); }
.exec .nm { font-weight: 600; color: var(--blue-deep); }
.exec .ps { font-size: 14.5px; color: var(--muted); }

/* ===== ปุ่มระบบงาน ===== */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.sys-btn {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow); color: var(--ink); text-decoration: none !important; border-left: 6px solid var(--c, var(--blue));
  transition: transform .15s, box-shadow .15s;
}
.sys-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.sys-ic {
  width: 52px; height: 52px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 28px;
  background: color-mix(in srgb, var(--c, var(--blue)) 14%, white);
}
.sys-ic img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; }
.sys-t { font-weight: 600; color: var(--blue-deep); line-height: 1.3; }
.sys-d { font-size: 14px; color: var(--muted); line-height: 1.4; }

/* ===== แบนเนอร์ ===== */
.banners { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.banners a, .banners div { display: block; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: #fff; }
.banners img { width: 100%; height: auto; }

/* ===== รายการข่าว ===== */
.news-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.news-item {
  display: flex; gap: 12px; background: #fff; border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
  color: inherit; text-decoration: none !important; transition: box-shadow .15s;
}
.news-item:hover { box-shadow: var(--shadow-hover); }
.news-item .th { width: 120px; height: 86px; flex: none; border-radius: 8px; object-fit: cover; background: var(--blue-light); }
.news-item .th.none { display: grid; place-items: center; font-size: 30px; }
.news-item .t { font-weight: 600; color: var(--ink); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-item:hover .t { color: var(--blue); }
.meta { font-size: 13.5px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
.pin { background: var(--gold); color: #3b2a00; border-radius: 6px; padding: 0 6px; font-size: 12.5px; font-weight: 600; }
.new { background: #e53935; color: #fff; border-radius: 6px; padding: 0 6px; font-size: 12.5px; }

.gallery-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.album { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: inherit; text-decoration: none !important; transition: transform .15s, box-shadow .15s; }
.album:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.album .th { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--blue-light); }
.album .body { padding: 10px 12px 12px; }
.album .t { font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.album .n { font-size: 13px; color: var(--muted); }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 40px; padding: 6px 12px; text-align: center; border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.pager span.on { background: var(--blue); color: #fff; }

.search { display: flex; gap: 8px; margin-bottom: 16px; }
.search input { flex: 1; min-width: 0; }
input, select, textarea, button { font: inherit; }
.input, .search input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 10px; border: 0;
  background: var(--blue); color: #fff; cursor: pointer; font-size: 16px; text-decoration: none !important;
}
.btn:hover { background: var(--blue-dark); }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--blue-soft); }

/* ===== อ่านข่าว ===== */
.article h1 { font-size: 27px; }
.article .body { white-space: pre-wrap; word-wrap: break-word; font-size: 18px; margin: 16px 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 16px 0; }
.photos button { padding: 0; border: 0; background: var(--blue-light); border-radius: 8px; overflow: hidden; cursor: zoom-in; aspect-ratio: 4 / 3; }
.photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.photos button:hover img { transform: scale(1.04); }
.photos.one { grid-template-columns: 1fr; }
.photos.one button { aspect-ratio: auto; }
.photos.one img { height: auto; object-fit: contain; }
.files { list-style: none; padding: 0; margin: 14px 0; }
.files a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--blue-light); border-radius: 10px; margin-bottom: 8px; }
.share { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); align-items: center; }
.share .btn { padding: 7px 14px; font-size: 15px; }
.share .fb { background: #1877f2; } .share .line { background: #06c755; }

/* เนื้อหาหน้าที่แอดมินเขียน */
.prose { font-size: 17.5px; }
.prose img { height: auto; border-radius: 8px; margin: 10px auto; }
.prose table { border-collapse: collapse; width: 100%; margin: 12px 0; display: block; overflow-x: auto; }
.prose td, .prose th { border: 1px solid var(--line); padding: 6px 10px; }
.prose blockquote { margin: 12px 0; padding: 8px 16px; border-left: 4px solid var(--blue); background: var(--blue-light); border-radius: 0 8px 8px 0; }

/* ===== บุคลากร ===== */
.people-group { margin-bottom: 28px; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.person { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; text-align: center; }
.person .ph { width: 120px; height: 150px; object-fit: cover; margin: 0 auto 8px; border-radius: 8px; background: var(--blue-light); }
.person .ph.none { display: grid; place-items: center; font-size: 48px; color: var(--blue); }
.person .nm { font-weight: 600; color: var(--blue-deep); line-height: 1.35; }
.person .ps { font-size: 14px; color: var(--muted); }
.people-group.lead .people { justify-content: center; grid-template-columns: repeat(auto-fit, minmax(170px, 220px)); }

/* ===== แถบข้าง ===== */
.aside .box { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.aside .box h3 { background: var(--blue); color: #fff; font-size: 17px; margin: 0; padding: 10px 16px; }
.aside .box ul { list-style: none; margin: 0; padding: 6px 0; }
.aside .box li a { display: block; padding: 7px 16px; color: var(--ink); border-bottom: 1px dashed var(--line); }
.aside .box li:last-child a { border-bottom: 0; }
.aside .box li a:hover { background: var(--blue-light); color: var(--blue-dark); text-decoration: none; }
.aside .box li a::before { content: '›'; color: var(--blue); margin-right: 8px; font-weight: 700; }
.stats { padding: 12px 16px; display: grid; gap: 4px; }
.stats div { display: flex; justify-content: space-between; }
.stats b { color: var(--blue-deep); font-variant-numeric: tabular-nums; }

/* ===== ติดต่อ ===== */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list .ic { width: 28px; text-align: center; font-size: 20px; }
.map { width: 100%; border: 0; border-radius: var(--radius); min-height: 340px; background: var(--blue-light); }

/* ===== ท้ายเว็บ ===== */
.foot { background: var(--blue-deep); color: #cfe3fb; padding: 30px 0 16px; margin-top: 10px; }
.foot a { color: #fff; }
.foot .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.foot h4 { color: #fff; font-size: 17px; }
.foot ul { list-style: none; padding: 0; margin: 0; }
.foot li { margin-bottom: 4px; }
.foot .copy { border-top: 1px solid rgba(255,255,255,.15); margin-top: 20px; padding-top: 12px; font-size: 14px; text-align: center; }
.foot .credit { margin-top: 4px; font-size: 12.5px; text-align: center; opacity: .75; }
.foot .credit a { color: inherit; text-decoration: none; }

/* ===== ดูรูปเต็มจอ ===== */
.lightbox { position: fixed; inset: 0; background: rgba(0, 10, 25, .93); z-index: 200; display: none; align-items: center; justify-content: center; touch-action: pan-y; }
.lightbox.on { display: flex; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: 6px; }
.lightbox button { position: absolute; background: rgba(255,255,255,.15); color: #fff; border: 0; width: 48px; height: 48px; border-radius: 50%; font-size: 24px; cursor: pointer; }
.lightbox .x { top: 14px; right: 14px; }
.lightbox .p { left: 14px; top: 50%; transform: translateY(-50%); }
.lightbox .n { right: 14px; top: 50%; transform: translateY(-50%); }
.lightbox .cnt { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 15px; }

.to-top {
  position: fixed; right: 16px; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--blue);
  color: #fff; font-size: 22px; box-shadow: var(--shadow-hover); cursor: pointer; display: none; z-index: 40;
}
.to-top.on { display: block; }

/* ===== มือถือ / แท็บเล็ต ===== */
@media (max-width: 980px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .gallery-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot .cols { grid-template-columns: 1fr 1fr; }
  .foot .cols > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .nav .wrap { flex-direction: column; }
  .menu { display: none; flex-direction: column; padding-bottom: 8px; }
  .nav.open .menu { display: flex; }
  .menu > li > a, .menu > li > button { width: 100%; justify-content: space-between; padding: 11px 6px; border-top: 1px solid rgba(255,255,255,.15); }
  .submenu { position: static; box-shadow: none; border-radius: 8px; background: rgba(255,255,255,.1); display: none; margin: 0 0 6px; }
  .menu > li:hover > .submenu, .menu > li:focus-within > .submenu { display: none; }
  .menu > li.open > .submenu { display: block; }
  .submenu a { color: #fff; padding: 9px 18px; }
  .submenu a:hover { background: rgba(255,255,255,.12); color: #fff; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .topbar .wrap { justify-content: center; gap: 12px; }
  .brand img, .logo-ph { width: 58px; height: 58px; }
  .brand-name { font-size: 19px; }
  .brand-sub { font-size: 13px; }
  .brand-en { display: none; }
  .page { padding-top: 14px; }
  .slide { aspect-ratio: 16 / 10; }
  .slide .cap { font-size: 15px; padding: 24px 12px 10px; }
  .slider .arrow { width: 34px; height: 34px; font-size: 16px; }
  .news-list { grid-template-columns: minmax(0, 1fr); }
  .news-item .th { width: 104px; height: 78px; }
  .gallery-list { gap: 10px; }
  .album .body { padding: 8px; }
  .album .t { font-size: 15px; }
  .card { padding: 16px; }
  .article h1 { font-size: 22px; }
  .article .body { font-size: 17px; }
  .photos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-grid { grid-template-columns: minmax(0, 1fr); }
  .execs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exec .ph { width: 110px; height: 136px; }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .person .ph { width: 100px; height: 125px; }
  .foot .cols { grid-template-columns: 1fr; }
}

/* =====================================================================
   ธีมรุ่น 2: แบนเนอร์เต็มจอ 3 คอลัมน์ ข่าววิ่ง หน้าเปิดเว็บ โหมดไว้อาลัย
   ===================================================================== */
/* สีหลักทั้งหมดอ่านจากตัวแปร เพื่อให้ธีมเทศกาลเปลี่ยนสีได้ในที่เดียว */
:root { --gold: #f5b700; --gold-soft: #ffe58a; --nav-deep: #0a4384; --page-bg: #edf4fb; --head-tint: #e3f1ff; }
body { background: var(--page-bg); }

/* หัวเว็บ */
.site-head {
  position: relative; overflow: hidden; border-bottom: 0;
  background:
    radial-gradient(circle at 92% -30%, color-mix(in srgb, var(--sky) 35%, transparent) 0, transparent 45%),
    radial-gradient(circle at 70% 140%, color-mix(in srgb, var(--blue) 18%, transparent) 0, transparent 40%),
    linear-gradient(115deg, #ffffff 0%, #ffffff 40%, var(--head-tint) 100%);
}
.site-head.has-bg { background: linear-gradient(90deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.85) 40%, rgba(255,255,255,.15) 75%), var(--head-bg) center / cover no-repeat; }
.site-head .wrap { padding-top: 18px; padding-bottom: 18px; justify-content: space-between; }
.brand img, .logo-ph { width: 88px; height: 88px; filter: drop-shadow(0 3px 6px rgba(11,79,156,.18)); }
.brand-name { font-size: 29px; font-weight: 600; letter-spacing: .2px; }
.brand-sub { font-size: 15.5px; color: #3f5872; }
.head-motto {
  font-family: 'Prompt', sans-serif; font-size: 20px; color: var(--blue-dark); text-align: right; max-width: 340px;
  padding-right: 70px; text-shadow: 0 1px 0 #fff;
}
.ribbon {
  position: absolute; top: 0; right: 0; width: 96px; height: 96px; z-index: 3; pointer-events: none;
  background: linear-gradient(225deg, #111 0 50%, transparent 50%);
}
.ribbon svg { position: absolute; top: 9px; right: 11px; width: 30px; height: 42px; fill: #fff; }

/* เมนู */
.nav { background: linear-gradient(90deg, var(--nav-deep) 0%, var(--blue) 50%, var(--nav-deep) 100%); border-bottom: 3px solid var(--gold); }
.menu > li > a, .menu > li > button { font-family: 'Prompt', sans-serif; font-size: 16px; position: relative; }
.menu > li > a::after, .menu > li > button::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px; background: var(--gold);
  transform: scaleX(0); transition: transform .2s;
}
.menu > li:hover > a::after, .menu > li:hover > button::after, .menu > li.active > a::after, .menu > li.active > button::after { transform: scaleX(1); }
.menu > li > a:hover, .menu > li > button:hover, .menu > li.active > a, .menu > li.active > button { background: rgba(255,255,255,.1); }
.submenu { border-top: 3px solid var(--gold); }

/* ข่าววิ่ง */
.marquee { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 6px rgba(11,79,156,.06); }
.marquee .wrap { display: flex; align-items: center; gap: 12px; min-height: 42px; }
.mq-label { flex: none; background: var(--blue-deep); color: #fff; border-radius: 20px; padding: 2px 14px; font-family: 'Prompt', sans-serif; font-size: 14.5px; }
.mq-track { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.mq-text { display: inline-flex; gap: 80px; white-space: nowrap; animation: mq 32s linear infinite; color: var(--blue-deep); font-size: 16px; }
.mq-text span { display: inline-block; }
.marquee:hover .mq-text { animation-play-state: paused; }
@keyframes mq { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .mq-text { animation: none; } .mq-text span { display: none; } }

/* แบนเนอร์เต็มจอ */
.hero-wide { background: var(--blue-deep); box-shadow: 0 6px 18px rgba(11,79,156,.18); }
.hero-wide .slider { border-radius: 0; box-shadow: none; }
.hero-wide .slide { aspect-ratio: 1920 / 600; }
.hero-wide .slide .cap { font-size: 22px; padding: 40px 6vw 22px; }
.hero-wide .dots { right: 50%; transform: translateX(50%); bottom: 12px; }

/* หน้าแรก 3 คอลัมน์ */
.home .page { padding-top: 22px; }
.home3 { display: grid; grid-template-columns: 250px minmax(0, 1fr) 280px; grid-template-areas: "left main right"; gap: 22px; align-items: start; }
.home3.no-left { grid-template-columns: minmax(0, 1fr) 290px; grid-template-areas: "main right"; }
.col-left { grid-area: left; } .col-main { grid-area: main; } .col-right { grid-area: right; }
.home3 .news-list { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1500px) { .home3 .news-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.home3 .gallery-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* กล่องแถบข้าง */
.aside .box { border-radius: 14px; border: 1px solid #dbe8f5; }
.aside .box h3 {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue) 55%, var(--sky)); text-align: center; font-size: 17px; padding: 11px 14px;
  letter-spacing: .3px; box-shadow: inset 0 -3px 0 var(--gold);
}
.box-more { display: block; text-align: center; padding: 8px; font-size: 14.5px; }
.exec-col { padding: 14px; display: grid; gap: 14px; }
.exec-col .exec { box-shadow: none; padding: 0; background: none; }
.exec-col .ph { width: 100%; height: auto; aspect-ratio: 3 / 4; border-radius: 10px; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(11,79,156,.18); margin-bottom: 8px; object-fit: cover; }
.exec-col .ph-none { display: grid; place-items: center; font-size: 60px; background: linear-gradient(160deg, #e8f3fe, #cfe6fc); }
.exec-col .nm { font-family: 'Prompt', sans-serif; font-weight: 500; }

/* ปุ่มระบบงานในคอลัมน์ขวา: ปุ่มแบนเนอร์สี */
.sys-col { padding: 12px; display: grid; gap: 10px; }
.sys-col .sys-btn {
  border-left: 0; color: #fff; padding: 12px; min-height: 64px;
  background: linear-gradient(135deg, var(--c, var(--blue)) 0%, color-mix(in srgb, var(--c, var(--blue)) 55%, #ffffff) 100%);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--c, var(--blue)) 35%, transparent);
}
.sys-col .sys-ic { width: 44px; height: 44px; font-size: 24px; background: rgba(255,255,255,.92); }
.sys-col .sys-t { color: #fff; font-family: 'Prompt', sans-serif; font-weight: 500; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sys-col .sys-d { color: rgba(255,255,255,.9); font-size: 13px; }

/* หัวข้อส่วน และการ์ด */
.section-head { border-bottom: 2px solid #d3e5f7; }
.section-head h2 { display: flex; align-items: center; gap: 10px; }
.section-head h2::before { content: ""; width: 10px; height: 22px; border-radius: 3px; background: linear-gradient(var(--gold), #ffcf33); flex: none; }
.welcome-card { border-top: 4px solid var(--blue); background: linear-gradient(180deg, #fff 0%, #f7fbff 100%); }
.banners { grid-template-columns: minmax(0, 1fr); }
.banners a, .banners div { transition: transform .2s, box-shadow .2s; }
.banners a:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* ปฏิทิน */
/* ===== ปฏิทินกิจกรรม ===== */
.cal { padding: 10px 12px 12px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.cal-title { text-align: center; font-family: 'Prompt', sans-serif; color: var(--blue-deep); font-size: 16px; line-height: 1.3; }
.cal-nav { width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: #e8f1fb; color: var(--blue-deep); font-size: 20px; line-height: 1; cursor: pointer; }
.cal-nav:hover { background: var(--blue); color: #fff; }
.cal-today, .cal-all { border: 1px solid #c9dcf2; background: #fff; color: var(--blue); border-radius: 999px; font: inherit; font-size: 12.5px; padding: 0 8px; cursor: pointer; vertical-align: middle; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; font-size: 14px; }
.cal-grid .wd { color: #fff; background: var(--blue); border-radius: 4px; font-weight: 500; font-size: 13px; padding: 2px 0; }
.cal-grid .cd { position: relative; padding: 4px 0 7px; border-radius: 6px; background: #f3f8fd; border: 0; font: inherit; color: inherit; min-width: 0; }
.cal-grid .cd.blank { background: none; }
.cal-grid .cd.we { color: #c62828; }
.cal-grid button.cd { cursor: pointer; background: #e3effc; font-weight: 600; }
.cal-grid button.cd:hover { outline: 2px solid var(--blue); }
.cal-grid .cd.today { background: var(--gold); color: #3b2a00; font-weight: 700; }
.cal-grid .cd.pick { outline: 2px solid var(--blue-deep); background: #fff; }
.cal-grid .dots { position: absolute; left: 0; right: 0; bottom: 2px; display: flex; justify-content: center; gap: 2px; }
.cal-grid .dots b { width: 5px; height: 5px; border-radius: 50%; }
.cal-list ul { list-style: none; margin: 10px 0 0; padding: 0; }
.cal-list li { display: flex; gap: 8px; align-items: baseline; padding: 5px 0 5px 8px; border-left: 3px solid var(--c); margin-bottom: 4px; font-size: 14.5px; line-height: 1.35; }
.cal-list .ev-d { flex: none; color: var(--muted); font-size: 13px; min-width: 46px; }
.cal-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 10px 0 4px; }
.cal-list .box-more { display: block; margin-top: 6px; }
/* หน้า /calendar แบบเต็ม */
.cal-lead { color: var(--muted); margin-top: -6px; }
.cal-full { padding: 16px; }
.cal-full .cal-title { font-size: 22px; }
.cal-full .cal-nav { width: 40px; height: 40px; font-size: 24px; }
.cal-full .cal-grid { gap: 4px; }
.cal-full .cal-grid .wd { font-size: 15px; padding: 6px 0; }
.cal-full .cal-grid .cd { min-height: 92px; padding: 4px; text-align: left; display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.cal-full .cal-grid .cd .n { font-size: 15px; }
.cal-full .cal-grid .chip { display: block; background: var(--c); color: #fff; border-radius: 4px; font-size: 12.5px; font-weight: 500; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-full .cal-grid .more { font-size: 12px; color: var(--muted); }
.cal-full .cal-list { margin-top: 18px; }
.cal-lh { font-size: 19px; color: var(--blue-deep); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ev { border-left: 5px solid var(--c); background: #f7fafe; border-radius: 0 10px 10px 0; padding: 10px 14px; margin-bottom: 10px; }
.ev-t { font-family: 'Prompt', sans-serif; font-size: 17px; color: var(--ink, #1d2b3a); }
.ev-m { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.ev-x { margin-top: 6px; white-space: pre-line; font-size: 15px; }
@media (max-width: 700px) {
  .cal-full { padding: 10px; }
  .cal-full .cal-grid .cd { min-height: 54px; padding: 3px 2px; align-items: center; }
  .cal-full .cal-grid .chip { width: 8px; height: 8px; padding: 0; border-radius: 50%; font-size: 0; display: inline-block; }
  .cal-full .cal-grid .more { font-size: 10px; }
}

/* ท้ายเว็บ */
.foot { background: linear-gradient(160deg, color-mix(in srgb, var(--blue-deep) 80%, black) 0%, var(--blue-dark) 100%); border-top: 4px solid var(--gold); }

/* หน้าเปิดเว็บ (ไว้อาลัย / ประกาศ) */
.intro {
  position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 30%, #1d3b5e 0%, #071a30 70%); overflow-y: auto; animation: intro-in .5s ease;
}
html.mourning .intro { background: radial-gradient(circle at 50% 30%, #2b2b2b 0%, #000 70%); }
.intro.out { opacity: 0; transition: opacity .4s; }
.intro-box { text-align: center; color: #fff; max-width: 900px; width: 100%; }
.intro-box img { max-width: 100%; max-height: 64vh; margin: 0 auto 18px; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.intro-box h1 { color: #fff; font-size: 30px; margin-bottom: 8px; }
.intro-box p { color: #e3e9f1; font-size: 18px; margin: 0 0 20px; }
.intro-go { font-size: 19px; padding: 12px 34px; border-radius: 30px; background: linear-gradient(135deg, var(--gold), #ffd54a); color: #2b1f00; font-family: 'Prompt', sans-serif; box-shadow: 0 6px 20px rgba(245,183,0,.35); }
.intro-go:hover { background: #fff; }
html.mourning .intro-go { background: #fff; color: #111; box-shadow: none; }
@keyframes intro-in { from { opacity: 0; } to { opacity: 1; } }

/* โหมดไว้อาลัย: สีซีดลง (ฟ้าอมเทา) ไม่ใช่ขาวดำทั้งเว็บ ให้ยังอ่านง่าย
   รูปลดความสดลงบางส่วน · มีริบบิ้นดำมุมขวาบน
   (ไม่ใช้ filter ทั้งหน้า เพราะทำให้มือถือบางรุ่นวาดหน้าไม่ครบ) */
html.mourning {
  --blue: #4f6478; --blue-dark: #3d4f61; --blue-deep: #2c3a48; --blue-light: #eef2f5; --blue-soft: #d3dbe2;
  --sky: #8fa3b5; --gold: #7d8a96; --gold-soft: #d9dee3; --line: #dde3e8;
}
html.mourning body { background: #f1f4f6; }
html.mourning img, html.mourning .slider, html.mourning .sys-btn, html.mourning .map { filter: saturate(.35); }
html.mourning .site-head { background: linear-gradient(115deg, #fff 0%, #fff 45%, #e7edf2 100%); }
html.mourning .nav { background: linear-gradient(90deg, #2c3a48, #4f6478 50%, #2c3a48); border-bottom-color: #222; }
html.mourning .menu > li > a::after, html.mourning .menu > li > button::after { background: #fff; }
html.mourning .aside .box h3 { background: linear-gradient(135deg, #2c3a48, #4f6478 60%, #6d8296); box-shadow: inset 0 -3px 0 #222; }
html.mourning .aside .box { border-color: #d8dfe5; }
html.mourning .section-head { border-bottom-color: #d6dde3; }
html.mourning .section-head h2::before { background: #3a3a3a; }
html.mourning .foot { background: linear-gradient(160deg, #222b34, #3d4f61); border-top-color: #222; }
html.mourning .cal-grid .cd.today { background: #3a3a3a; color: #fff; }
html.mourning .hero-wide { background: #2c3a48; }
html.mourning .new { background: #6b6b6b; }
html.mourning .pin { background: #d9dee3; color: #2c3a48; }

/* จอกลาง / มือถือ */
@media (max-width: 1180px) {
  .home3 { grid-template-columns: minmax(0, 1fr) 270px; grid-template-areas: "main right" "left right"; }
  .home3.no-left { grid-template-areas: "main right"; }
  .col-left .exec-col { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 860px) {
  .home3, .home3.no-left { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "left" "right"; }
  .head-motto { display: none; }
  .menu > li > a::after, .menu > li > button::after { display: none; }
  .hero-wide .slide { aspect-ratio: 1920 / 600; } /* มือถือ: แสดงรูปเต็ม ไม่ตัดขอบ (ตัวอักษรในรูปไม่หาย) */
  .hero-wide .slide .cap { font-size: 13px; padding: 14px 12px 8px; }
  .home3 .gallery-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-left .exec-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .brand img, .logo-ph { width: 60px; height: 60px; }
  .brand-name { font-size: 19px; }
  .ribbon { width: 64px; height: 64px; }
  .ribbon svg { top: 6px; right: 7px; width: 20px; height: 28px; }
  .site-head .wrap { padding-right: 40px; }
  .mq-label { font-size: 13px; padding: 2px 10px; }
  .mq-text { font-size: 15px; animation-duration: 24s; }
  .intro-box h1 { font-size: 23px; }
  .intro-box p { font-size: 16px; }
}

/* เอกสารแนบ: ตัวอย่าง PDF ในหน้าข่าว */
.files .doc { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; background: #fff; overflow: hidden; }
.files .doc summary { cursor: pointer; padding: 10px 14px; background: var(--blue-light); font-weight: 600; color: var(--blue-deep); list-style: none; }
.files .doc summary::before { content: '📄 '; }
.files .doc summary::-webkit-details-marker { display: none; }
.files .doc[open] summary { border-bottom: 1px solid var(--line); }
.files .doc iframe { display: block; width: 100%; height: 75vh; min-height: 420px; border: 0; background: #f4f4f4; }
.files .doc-open { padding: 8px 14px; font-size: 15px; }
.files .doc-open span { color: var(--muted); font-size: 13.5px; }
.files .doc-plain a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--blue-light); border-radius: 10px; margin-bottom: 8px; }
.prose iframe[src*="drive.google.com"] { aspect-ratio: auto !important; height: 75vh; min-height: 420px; }
@media (max-width: 640px) { .files .doc iframe, .prose iframe[src*="drive.google.com"] { height: 70vh; min-height: 360px; } }

/* ธีมสีตามเทศกาล: site.js ใส่ --t-main / --t-accent และคลาส themed ที่ html
   สีอื่นๆ คำนวณจาก 2 สีนี้ (เข้มขึ้น/อ่อนลง) */
html.themed {
  --blue: var(--t-main);
  --blue-dark: color-mix(in srgb, var(--t-main) 82%, black);
  --blue-deep: color-mix(in srgb, var(--t-main) 62%, black);
  --nav-deep: color-mix(in srgb, var(--t-main) 70%, black);
  --sky: color-mix(in srgb, var(--t-main) 55%, white);
  --blue-light: color-mix(in srgb, var(--t-main) 9%, white);
  --blue-soft: color-mix(in srgb, var(--t-main) 25%, white);
  --gold: var(--t-accent);
  --page-bg: color-mix(in srgb, var(--t-main) 6%, white);
  --head-tint: color-mix(in srgb, var(--t-main) 16%, white);
}
/* ของตกแต่งที่หัวเว็บ */
.fest-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.fest-deco span { position: absolute; font-size: 26px; opacity: .55; animation: fest-float 6s ease-in-out infinite; }
.site-head .wrap { position: relative; z-index: 1; }
@keyframes fest-float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.fest-greet {
  display: inline-block; margin-top: 6px; padding: 2px 14px; border-radius: 20px; font-family: 'Prompt', sans-serif; font-size: 15px;
  background: linear-gradient(135deg, var(--blue), var(--sky)); color: #fff; box-shadow: 0 2px 8px color-mix(in srgb, var(--blue) 35%, transparent);
}
@media (prefers-reduced-motion: reduce) { .fest-deco span { animation: none; } }
@media (max-width: 640px) { .fest-deco span { font-size: 18px; opacity: .4; } .fest-greet { font-size: 13px; } }

/* ===== อาคารสถานที่ ===== */
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.place { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.place .cover { display: block; position: relative; width: 100%; aspect-ratio: 4 / 3; border: 0; padding: 0; background: var(--blue-light); cursor: zoom-in; }
.place .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place .cover.none { display: grid; place-items: center; font-size: 64px; cursor: default; }
.place .cover .cnt { position: absolute; right: 10px; bottom: 10px; background: rgba(8, 58, 117, .82); color: #fff; font-size: 14px; padding: 3px 10px; border-radius: 99px; }
.place .thumbs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px 4px 0; }
.place .thumbs button { position: relative; border: 0; padding: 0; aspect-ratio: 1; background: var(--blue-light); cursor: zoom-in; border-radius: 6px; overflow: hidden; }
.place .thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.place .thumbs span { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(8, 58, 117, .6); color: #fff; font-weight: 600; }
.place .txt { padding: 14px 18px 18px; }
.place h2 { font-size: 20px; margin: 0 0 6px; }
.place p { margin: 0; color: var(--muted); white-space: pre-line; }
@media (max-width: 640px) { .places { grid-template-columns: 1fr; } }

/* ===== ข้อมูลนักเรียน ===== */
.stu-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stu-sum > div { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-top: 4px solid var(--blue); text-align: center; }
.stu-sum b { display: block; font-family: 'Prompt', sans-serif; font-weight: 500; font-size: 30px; color: var(--blue-deep); line-height: 1.2; }
.stu-sum span { color: var(--muted); font-size: 15px; }
.stu-sum .m { border-top-color: #1e88e5; } .stu-sum .m b { color: #1565c0; }
.stu-sum .f { border-top-color: #e91e63; } .stu-sum .f b { color: #c2185b; }
.stu-sum .r { border-top-color: var(--gold); }
.stu-card { padding: 0; overflow: hidden; }
.stu-wrap { overflow-x: auto; }
table.stu { border-collapse: collapse; width: 100%; min-width: 420px; font-variant-numeric: tabular-nums; }
table.stu th, table.stu td { padding: 8px 14px; border-bottom: 1px solid var(--line); text-align: right; }
table.stu th:nth-child(-n+2), table.stu td:nth-child(-n+2) { text-align: left; }
table.stu thead th { background: var(--blue-deep); color: #fff; font-family: 'Prompt', sans-serif; font-weight: 500; position: sticky; top: 0; }
table.stu tbody tr:hover td { background: var(--blue-light); }
table.stu tr.stage td { background: var(--blue-soft); color: var(--blue-deep); font-weight: 600; text-align: left; }
table.stu tr.sub td { background: #f6f9fc; font-weight: 600; color: var(--blue-dark); }
table.stu tr.sub2 td { background: #eef5fc; font-weight: 600; color: var(--blue-deep); }
table.stu tfoot td { background: var(--blue); color: #fff; font-weight: 600; font-size: 18px; border: 0; }
.stu-note { margin: 0; padding: 10px 16px; color: var(--muted); font-size: 14px; }
@media (max-width: 640px) {
  .stu-sum { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stu-sum b { font-size: 24px; }
  table.stu { min-width: 0; }
  table.stu th, table.stu td { padding: 7px 8px; font-size: 15px; }
  /* มือถือ: ซ่อนคอลัมน์ "ชั้น" (ชื่อห้อง ป.1/1 บอกชั้นอยู่แล้ว) */
  table.stu:not(.stu-edit) tr:not(.stage) > :first-child { display: none; }
}
