/* เว็บไซต์โรงเรียนวัดหนองศาลา (ประชานุกูล) — สีประจำโรงเรียน ฟ้า-ขาว */
: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; }

/* ===== ดูรูปเต็มจอ ===== */
.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; }
}
