/* ==========================================================================
   โรงเรียนบ้านหนองปลา — stylesheet หลัก
   สีประจำโรงเรียน: ชมพู + ขาว
   แก้สีทั้งเว็บได้ที่ตัวแปรใน :root ข้างล่างนี้จุดเดียว ไม่ต้องไล่แก้ทีละบรรทัด
   ========================================================================== */

:root {
  /* --- สีประจำโรงเรียน (ชมพู-ขาว) --- */
  --brand:        #c2185b;   /* ชมพูเข้ม — สีหลัก ตัวอักษรขาวบนพื้นนี้อ่านชัด */
  --brand-dark:   #880e4f;
  --brand-light:  #fce4ec;   /* ชมพูอ่อน — พื้นหลังอ่อน ๆ */
  --accent:       #e91e63;   /* ชมพูสด — ไฮไลต์ */
  --accent-dark:  #ad1457;

  --text:         #1f2937;
  --text-muted:   #5b6472;
  --line:         #e9d7de;
  --bg:           #ffffff;
  --bg-soft:      #fdf6f8;   /* ขาวอมชมพูจาง ๆ */
  --bg-grey:      #f3f4f6;   /* เทา — โซนสำหรับครู ให้ดูแยกจากส่วนของคนทั่วไป */

  --radius:       14px;
  --shadow:       0 2px 4px rgba(16, 24, 40, .04), 0 8px 24px rgba(136, 14, 79, .07);
  --wrap:         1160px;
  --font:         "Noto Sans Thai", "Sarabun", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* ห้ามใส่ scroll-behavior:smooth ตรงนี้ตรง ๆ — มันทำให้ Chrome เลื่อนไป #anchor ตอนโหลดหน้าไม่ได้เลย
   (สังเกตได้บ่อยเพราะเมนูทั้งเว็บลิงก์ไปหน้าอื่น+anchor เกือบทุกจุด เช่น about.html#vision)
   เปิด smooth หลังหน้าโหลดเสร็จแทน ผ่าน .smooth-scroll ที่ main.js ใส่ให้ตอน window "load" */
html.smooth-scroll { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--brand); }

h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.45rem, 3vw, 1.95rem); }
h3 { font-size: 1.18rem; }

p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.center { text-align: center; }
.muted  { color: var(--text-muted); }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(194, 24, 91, .3); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.85); }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-ghost   { background: var(--brand-light); color: var(--brand-dark); }
.btn-ghost:hover { background: #f8bbd0; }

/* ---------- แถบบนสุด ---------- */
.topbar { background: var(--brand-dark); color: #f8d3e2; font-size: .87rem; }
.topbar .wrap {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding-top: 7px; padding-bottom: 7px;
}
.topbar a { color: #fff; text-decoration: none; }
.topbar-social { display: flex; gap: 18px; }
.topbar-social a:hover { text-decoration: underline; }

/* ---------- ไอคอน Facebook / YouTube — ใช้สีแบรนด์จริงให้เด่นบนพื้นเข้ม ---------- */
.social-link { display: inline-flex; align-items: center; gap: 7px; }
.social-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; flex: none;
}
.social-icon svg { width: 14px; height: 14px; }
.social-fb { background: #1877f2; }
.social-yt { background: #ff0000; }
.footer-social { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 0; }

/* ---------- หัวเว็บ + เมนู ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(8px);
  border-bottom: 3px solid var(--brand);
}
.site-header .wrap {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 10px; padding-bottom: 10px;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.logo img { width: 58px; height: 58px; object-fit: contain; }
.logo-text strong { display: block; font-size: 1.1rem; color: var(--brand-dark); }
.logo-text span   { display: block; font-size: .78rem; color: var(--text-muted); }

.nav ul { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav a, .sub-toggle {
  display: block;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 500;
  font-family: inherit;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover, .sub-toggle:hover { background: var(--brand-light); color: var(--brand-dark); }
.nav a[aria-current], .has-sub.active > .sub-toggle {
  background: var(--brand-light); color: var(--brand-dark); font-weight: 600;
}
.sub-toggle::after { content: " ▾"; font-size: .8em; }

/* เมนูย่อย (dropdown) */
.has-sub { position: relative; }
.submenu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 250px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 60;
}
.has-sub:hover > .submenu,
.has-sub.open > .submenu { display: block; }
.submenu ul { flex-direction: column; align-items: stretch; gap: 0; }
.submenu a { border-radius: 8px; font-size: .93rem; white-space: normal; }

.nav-toggle {
  display: none;
  width: 46px; height: 46px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 1.3rem; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--accent) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 66px 0 74px;
}
.hero h1 { color: #fff; }
.hero p  { font-size: 1.08rem; color: #fde5ee; max-width: 620px; }
.hero .btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 44px; align-items: center; }
/* กรอบขาวหลังตราโรงเรียน — ใช้มุมมน ไม่ใช่วงกลม เพราะวงกลมจะกินชื่อโรงเรียนที่โค้งอยู่ขอบล่างของตรา */
.hero-logo {
  width: 270px; margin: 0 auto; background: #fff; border-radius: 24px;
  padding: 24px; box-shadow: 0 18px 40px rgba(0,0,0,.25);
}
.badge {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  background: rgba(255,255,255,.18); font-size: .85rem; margin-bottom: 14px;
}

/* ---------- Hero แบบสไลด์รูป (หน้าแรก) ----------
   สแต็กรูปเต็มพื้นที่ไว้ข้างหลัง สลับ opacity ด้วย JS (assets/js/main.js)
   มีคำเตือน MOCKUP กำกับใน HTML — รูปตอนนี้มาจากเพจ Facebook ของโรงเรียน ยังไม่ใช่รูปที่ขอ
   ความยินยอมผู้ปกครองแล้ว ห้ามอัปขึ้นเว็บจริงจนกว่าจะได้รับอนุญาต (ดู CONTENT-CHECKLIST.md) */
.hero-carousel {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  align-items: center;
  padding: 0;
  background: var(--brand-dark); /* สีรองพื้นระหว่างรอรูปโหลด */
}
.hero-slides { position: absolute; inset: 0; }
.hero-slide {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.1s ease;
}
.hero-slide.is-active { opacity: 1; }
/* เอาสีชมพูทับรูปออกตามที่ขอ — เหลือแค่เฉดมืดบาง ๆ ด้านซ้ายให้ตัวหนังสือขาวอ่านออก
   รูปฝั่งขวาโล่งเกือบเต็ม ๆ ไม่มีสีทับ */
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(0,0,0,.62) 0%, rgba(0,0,0,.34) 32%, rgba(0,0,0,.05) 58%, rgba(0,0,0,0) 72%);
}
.hero-carousel .wrap { position: relative; z-index: 2; padding-top: 70px; padding-bottom: 92px; }
.hero-mockup-flag {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  background: #fff; color: var(--brand-dark);
  font-size: .74rem; font-weight: 700; letter-spacing: .3px;
  padding: 5px 12px; border-radius: 999px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.hero-dots {
  position: absolute; z-index: 3; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; gap: 9px;
}
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%; border: 2px solid #fff;
  background: rgba(255,255,255,.35); padding: 0; cursor: pointer;
}
.hero-dot.is-active { background: #fff; }
.hero-arrow {
  position: absolute; z-index: 3; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.22); color: #fff; font-size: 1.4rem; line-height: 1;
  display: grid; place-items: center;
  backdrop-filter: blur(2px);
}
.hero-arrow:hover { background: rgba(255,255,255,.4); }
.hero-arrow-prev { left: 16px; }
.hero-arrow-next { right: 16px; }

@media (max-width: 640px) {
  .hero-carousel { min-height: 460px; }
  .hero-arrow { width: 36px; height: 36px; font-size: 1.15rem; }
}

/* ---------- Section ---------- */
.section      { padding: 62px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { max-width: 700px; margin: 0 auto 40px; text-align: center; }
.section-head p { color: var(--text-muted); margin: 0; }
.section h2 + .lead { margin-top: -.4em; }

/* หัวข้อย่อยที่มี anchor — เว้นที่ให้ sticky header ไม่ทับตอนกดลิงก์ */
[id] { scroll-margin-top: 120px; }

/* ---------- การ์ด ---------- */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .4em; }
.card p  { color: var(--text-muted); margin: 0; font-size: .96rem; }
.card-link { text-decoration: none; color: inherit; display: block; transition: transform .15s ease; }
.card-link:hover { transform: translateY(-3px); }
.card-icon {
  width: 52px; height: 52px; display: grid; place-items: center;
  border-radius: 14px; background: var(--brand-light); color: var(--brand-dark);
  font-size: 1.4rem; font-weight: 700; margin-bottom: 16px;
}

/* ---------- กล่อง "รอข้อมูลจากโรงเรียน" ----------
   ใส่ไว้ตรงที่ยังไม่มีเนื้อหาจริง — ลบกล่องนี้ทิ้งเมื่อใส่ของจริงแล้ว */
.todo {
  border: 2px dashed #f4a6c2;
  border-radius: var(--radius);
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 22px 24px;
  margin: 0 0 18px;
}
.todo::before {
  content: "รอข้อมูลจากโรงเรียน";
  display: inline-block;
  background: var(--brand);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.todo p:last-child { margin-bottom: 0; }

/* ---------- ตัวเลขสถิติ ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; text-align: center; }
.stat strong { display: block; font-size: 2.2rem; color: var(--brand); line-height: 1.2; }
.stat span { color: var(--text-muted); font-size: .95rem; }

/* ---------- ข่าว ---------- */
.news-card {
  display: flex; flex-direction: column; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
a.news-card:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(136,14,79,.18); }
.news-card img { height: 190px; object-fit: cover; width: 100%; }
.news-body { padding: 20px 22px 24px; }
.news-date { font-size: .82rem; color: var(--accent-dark); font-weight: 600; }
.news-card h3 { font-size: 1.06rem; margin: 6px 0 8px; }
.news-card p  { font-size: .94rem; color: var(--text-muted); margin: 0; }
.news-card-mockup {
  display: inline-block; margin-top: 10px;
  font-size: .72rem; font-weight: 700; letter-spacing: .3px;
  color: var(--brand-dark); background: var(--brand-light);
  padding: 3px 10px; border-radius: 999px;
}

/* ---------- รายละเอียดกิจกรรมเต็ม (news.html) — ปลายทางที่การ์ดหน้าแรกคลิกแล้วมาถึง ---------- */
.news-detail-list { display: flex; flex-direction: column; gap: 18px; }
.news-detail {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 28px; box-shadow: var(--shadow);
}
.news-detail > .news-card-mockup { margin-top: 0; margin-bottom: 8px; }
.news-detail h2 { margin: 0 0 .5em; }
.news-detail-grid { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.news-detail-grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 12px; }
.news-detail .news-date { color: var(--accent-dark); font-weight: 600; font-size: .9rem; margin-bottom: .4em; }
@media (max-width: 720px) {
  .news-detail-grid { grid-template-columns: 1fr; }
}

/* ---------- ตาราง ---------- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; min-width: 520px; background: #fff; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--brand-light); color: var(--brand-dark); font-weight: 600; }
table.narrow { min-width: 0; }

/* ---------- แกลเลอรี ---------- */
.gallery-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.gallery-grid img { height: 200px; width: 100%; object-fit: cover; border-radius: 12px; }

/* ---------- โซนสำหรับครู (งานระบบ) ----------
   ตั้งใจให้เป็นสีเทา ไม่ใช่ชมพู — ครูหาเจอง่าย แต่ไม่แย่งสายตาผู้ปกครองที่เข้ามาดู */
.staff-zone { background: var(--bg-grey); border-top: 1px solid var(--line); padding: 40px 0; }
.staff-zone h2 { font-size: 1.2rem; margin-bottom: .2em; }
.staff-zone .muted { font-size: .92rem; }
.staff-links { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-top: 20px; }
.staff-links a {
  display: block; background: #fff; border: 1px solid #dfe3e8; border-radius: 10px;
  padding: 14px 16px; text-decoration: none; color: var(--text); font-size: .94rem; font-weight: 500;
}
.staff-links a:hover { border-color: var(--brand); color: var(--brand-dark); }
.staff-links small { display: block; color: var(--text-muted); font-weight: 400; font-size: .8rem; }

/* ---------- CTA ---------- */
.cta {
  background: linear-gradient(135deg, var(--accent) 0%, var(--brand-dark) 100%);
  color: #fff; border-radius: var(--radius); padding: 44px 32px; text-align: center;
}
.cta h2 { color: #fff; }
.cta p  { color: #fde5ee; max-width: 580px; margin: 0 auto 22px; }
.cta .btn-primary { background: #fff; color: var(--brand-dark); }
.cta .btn-primary:hover { background: #fff; }

/* ---------- ท้ายเว็บ ---------- */
.site-footer { background: #3b0a24; color: #e6c7d5; padding: 50px 0 24px; margin-top: 66px; font-size: .94rem; }
.footer-grid { display: grid; gap: 30px; grid-template-columns: 1.5fr 1fr 1.2fr; }
.site-footer h4 { color: #fff; font-size: 1rem; margin: 0 0 14px; }
.site-footer a  { color: #e6c7d5; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; }
.footer-bottom {
  margin-top: 32px; padding-top: 18px; border-top: 1px solid #58203a;
  text-align: center; font-size: .85rem; color: #b58fa1;
}

/* ---------- หัวหน้าเพจย่อย ---------- */
.page-head { background: var(--brand-light); padding: 42px 0; border-bottom: 1px solid var(--line); }
.page-head h1 { margin: 0; color: var(--brand-dark); }
.page-head p  { margin: 6px 0 0; color: var(--text-muted); }

/* สารบัญในหน้า (ลิงก์ไปหัวข้อย่อย) */
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; padding: 0; list-style: none; }
.toc a {
  display: block; padding: 7px 15px; border-radius: 999px;
  background: var(--brand-light); color: var(--brand-dark);
  text-decoration: none; font-size: .9rem; font-weight: 500;
}
.toc a:hover { background: var(--brand); color: #fff; }

/* บล็อกหัวข้อในหน้ารวม */
.block { margin-bottom: 46px; }
.block > h2 {
  border-left: 5px solid var(--brand);
  padding-left: 16px;
  margin-bottom: .7em;
}

/* ---------- มือถือ ---------- */
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-logo { width: 190px; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: 10px 16px 18px;
    max-height: 78vh; overflow-y: auto;
  }
  .nav.open { display: block; }
  .nav > ul { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav a, .sub-toggle { padding: 12px 14px; width: 100%; text-align: left; }
  /* บนมือถือ เมนูย่อยกางแบบดันเนื้อหาลง ไม่ลอยทับ และเปิดด้วยการกดเท่านั้น */
  .submenu {
    position: static; min-width: 0; box-shadow: none; border: none;
    border-left: 3px solid var(--brand-light); border-radius: 0;
    padding: 0 0 0 10px; margin: 2px 0 6px;
  }
  .has-sub:hover > .submenu { display: none; }
  .has-sub.open > .submenu { display: block; }
  body { font-size: 16px; }
  .section { padding: 44px 0; }
}
