/* =========================================================
   โรงเรียนบางบาล — สไตล์หลัก
   สีประจำโรงเรียน ฟ้า–ชมพู: เปลี่ยนสีทั้งเว็บได้ที่ :root ด้านล่าง
   ========================================================= */
:root {
  --navy: #0b2545;
  --navy-2: #12355f;
  --sky: #12b5ea;
  --sky-700: #0369a1;   /* ตัวอักษรสีฟ้าบนพื้นขาว */
  --sky-50: #eef9fe;
  --sky-100: #d6f1fc;
  --pink: #ec4c8c;
  --pink-700: #be185d;  /* ตัวอักษรสีชมพูบนพื้นขาว */
  --pink-50: #fdf0f6;
  --pink-100: #fbd9e8;
  --ink: #0f1f33;
  --text: #334155;
  --muted: #5b6b80;
  --line: #e5ecf4;
  --bg: #f7f9fc;
  --white: #fff;
  --grad: linear-gradient(135deg, #12b5ea 0%, #7d8cf2 50%, #ec4c8c 100%);
  --grad-strong: linear-gradient(135deg, #0377b8 0%, #6d4fd0 55%, #c8166f 100%);
  --r-sm: 12px;
  --r: 20px;
  --r-lg: 28px;
  --sh-sm: 0 1px 2px rgba(15,31,51,.05), 0 2px 6px rgba(15,31,51,.06);
  --sh: 0 12px 32px -14px rgba(15,31,51,.22);
  --sh-lg: 0 30px 60px -24px rgba(15,31,51,.30);
  --max: 1200px;
  --head-h: 76px;
}

/* ขนาดตัวอักษร (ปุ่ม ก ก ก) */
html { font-size: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--head-h) + 16px); }
html[data-fs="2"] { font-size: 112.5%; }
html[data-fs="3"] { font-size: 125%; }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'IBM Plex Sans Thai Looped', 'Sarabun', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: 'Anuphan', 'IBM Plex Sans Thai Looped', sans-serif; color: var(--ink); line-height: 1.3; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: var(--sky-700); }
img { max-width: 100%; display: block; }
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
@media (max-width: 560px) { .container { padding: 0 16px; } }
.i { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.2em; }
:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 8px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--pink-700); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 300; }
.skip-link:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grad-text { background: var(--grad-strong); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 26px; border-radius: 999px; border: 0; cursor: pointer;
  font-family: 'Anuphan', sans-serif; font-weight: 600; font-size: 1rem; text-decoration: none; white-space: nowrap;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn .i { width: 1.15em; height: 1.15em; }
.btn-primary { background: var(--grad-strong); color: #fff; box-shadow: 0 10px 24px -10px rgba(200,22,111,.55); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(200,22,111,.6); }
.btn-ghost { background: var(--white); color: var(--ink); box-shadow: var(--sh-sm); border: 1px solid var(--line); }
.btn-ghost:hover { transform: translateY(-2px); color: var(--sky-700); }
.btn-white { background: #fff; color: var(--navy); }
.btn-white:hover { transform: translateY(-2px); }
.btn-sm { min-height: 42px; padding: 8px 18px; font-size: .95rem; }

/* ---------- Top bar ---------- */
.topbar { background: var(--navy); color: #c8d6e8; font-size: .85rem; }
.topbar .container { display: flex; align-items: center; gap: 6px 22px; min-height: 38px; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar a:hover { color: var(--sky-100); }
.topbar .contact { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-right: auto; }
.fs-control { display: flex; align-items: center; gap: 4px; }
.fs-control .label { display: inline-flex; align-items: center; gap: 4px; margin-right: 2px; }
.fs-control button {
  min-width: 30px; height: 26px; border-radius: 7px; cursor: pointer; line-height: 1;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.22); font-family: 'Anuphan', sans-serif;
}
.fs-control button[aria-pressed="true"] { background: var(--pink); border-color: var(--pink); }
.fs-control button:nth-of-type(1) { font-size: 12px; }
.fs-control button:nth-of-type(2) { font-size: 15px; }
.fs-control button:nth-of-type(3) { font-size: 18px; }
@media (max-width: 560px) {
  .topbar .container { flex-wrap: nowrap; justify-content: space-between; }
  .topbar .email, .topbar .lbl, .fs-control .label span { display: none; }
  .hide-sm { display: none; }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid rgba(229,236,244,.8); transition: box-shadow .25s;
}
.site-header.scrolled { box-shadow: 0 8px 30px -16px rgba(15,31,51,.35); }
.site-header .container { display: flex; align-items: center; gap: 20px; height: var(--head-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; min-width: 0; }
.brand img { width: 50px; height: 50px; flex: none; }
.brand .t1 { display: block; font-family: 'Anuphan', sans-serif; font-weight: 700; font-size: 1.25rem; color: var(--ink); line-height: 1.15; }
.brand .t2 { display: block; font-family: 'Anuphan', sans-serif; font-size: .72rem; letter-spacing: .2em; color: var(--pink-700); font-weight: 600; }
.nav { display: flex; align-items: center; gap: 2px; }
.nav a.link { position: relative; color: var(--text); text-decoration: none; padding: 8px 12px; font-family: 'Anuphan', sans-serif; font-weight: 500; font-size: .98rem; border-radius: 10px; white-space: nowrap; }
.nav a.link:hover { color: var(--sky-700); background: var(--sky-50); }
.nav a.link.active { color: var(--pink-700); }
.nav a.link.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; border-radius: 3px; background: var(--grad); }
.nav .btn { margin-left: 8px; }
.nav-toggle { display: none; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; }
.nav-toggle .i { width: 24px; height: 24px; }

@media (max-width: 1100px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 4px;
    background: #fff; padding: 12px 16px 20px; border-bottom: 1px solid var(--line); box-shadow: 0 24px 40px -20px rgba(15,31,51,.3);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a.link { padding: 12px 14px; font-size: 1.05rem; }
  .nav a.link.active { background: var(--pink-50); }
  .nav a.link.active::after { display: none; }
  .nav .btn { margin: 8px 0 0; }
}
@media (max-width: 420px) { .brand .t1 { font-size: 1.1rem; } .brand img { width: 44px; height: 44px; } }

/* ---------- พื้นหลังไล่สี (mesh) ---------- */
.mesh { position: relative; overflow: hidden; isolation: isolate; background: #fbfdff; }
.mesh::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background:
    radial-gradient(40% 55% at 8% 20%, rgba(18,181,234,.22), transparent 70%),
    radial-gradient(35% 50% at 95% 10%, rgba(236,76,140,.20), transparent 70%),
    radial-gradient(45% 50% at 70% 100%, rgba(125,140,242,.16), transparent 70%);
}
.mesh::after {
  content: ''; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: radial-gradient(rgba(15,31,51,.12) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}

/* ---------- Hero หน้าแรก ---------- */
.hero { padding: 72px 0 88px; }
.hero .container { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px;
  background: rgba(255,255,255,.8); border: 1px solid var(--line); box-shadow: var(--sh-sm);
  font-family: 'Anuphan', sans-serif; font-weight: 500; font-size: .9rem; color: var(--ink); margin-bottom: 20px;
}
.eyebrow .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.eyebrow .dot .i { width: 15px; height: 15px; }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: 1.12; margin-bottom: 18px; font-weight: 700; letter-spacing: -.02em; }
.hero h1 .grad-text { display: inline-block; padding-bottom: .08em; }
.hero .lead { font-size: 1.2rem; color: var(--text); max-width: 34em; margin-bottom: 30px; }
.hero .lead b { color: var(--ink); font-weight: 600; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }
.stats { display: flex; flex-wrap: wrap; gap: 14px; }
.stat { background: rgba(255,255,255,.85); border: 1px solid var(--line); border-radius: 18px; padding: 12px 18px; min-width: 130px; box-shadow: var(--sh-sm); }
.stat b { display: block; font-family: 'Anuphan', sans-serif; font-size: 1.6rem; line-height: 1.2; color: var(--ink); }
.stat span { font-size: .88rem; color: var(--muted); }

.hero-visual { position: relative; aspect-ratio: 1; max-width: 460px; width: 100%; justify-self: center; }
.hero-visual .ring { position: absolute; inset: 0; border-radius: 50%; background: var(--grad); padding: 3px; box-shadow: var(--sh-lg); }
.hero-visual .ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fff 55%, #f3f7fc 100%); }
.hero-visual .orbit { position: absolute; inset: -22px; border-radius: 50%; border: 2px dashed rgba(18,181,234,.35); animation: spin 60s linear infinite; }
.hero-visual .orbit::before, .hero-visual .orbit::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; }
.hero-visual .orbit::before { top: 12%; left: 8%; background: var(--sky); box-shadow: 0 0 0 6px rgba(18,181,234,.18); }
.hero-visual .orbit::after { bottom: 10%; right: 9%; background: var(--pink); box-shadow: 0 0 0 6px rgba(236,76,140,.18); }
.hero-visual .logo { position: absolute; inset: 15%; width: 70%; height: 70%; object-fit: contain; filter: drop-shadow(0 18px 30px rgba(15,31,51,.25)); }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 10px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.9); border-radius: 18px; box-shadow: var(--sh); animation: bob 6s ease-in-out infinite;
  font-family: 'Anuphan', sans-serif; line-height: 1.3;
}
.float-card .ic { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.float-card small { display: block; color: var(--muted); font-size: .78rem; }
.float-card b { color: var(--ink); font-size: .98rem; font-weight: 600; }
.float-card.a { top: 6%; left: -8%; }
.float-card.a .ic { background: linear-gradient(135deg, #12b5ea, #0377b8); }
.float-card.b { bottom: 4%; right: -6%; animation-delay: -3s; }
.float-card.b .ic { background: linear-gradient(135deg, #ec4c8c, #c8166f); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (max-width: 960px) {
  .hero { padding: 48px 0 64px; text-align: center; }
  .hero .container { grid-template-columns: 1fr; gap: 56px; }
  .hero .actions, .stats { justify-content: center; }
  .hero .lead { margin-left: auto; margin-right: auto; }
  .hero-visual { max-width: 320px; order: -1; }
  .float-card.a { left: -14%; }
  .float-card.b { right: -14%; }
}
@media (max-width: 560px) {
  .stat { min-width: 0; flex: 1 1 28%; padding: 10px 12px; }
  .stat b { font-size: 1.3rem; }
  .hero-visual { max-width: 250px; }
  .float-card { padding: 7px 12px 7px 7px; }
  .float-card .ic { width: 34px; height: 34px; border-radius: 11px; }
  .float-card b { font-size: .86rem; }
  .float-card.a { left: -16%; top: 0; }
  .float-card.b { right: -16%; bottom: 0; }
}

/* ---------- Section ---------- */
.section { padding: 88px 0; }
.section.alt { background: #fff; }
.section.tight { padding: 56px 0; }
@media (max-width: 760px) { .section { padding: 64px 0; } }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 36px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-family: 'Anuphan', sans-serif; font-weight: 600; font-size: .9rem; letter-spacing: .08em; color: var(--pink-700); margin-bottom: 8px; }
.kicker::before { content: ''; width: 24px; height: 3px; border-radius: 3px; background: var(--grad); }
.sec-head h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); margin: 0; }
.sec-head p { margin: 8px 0 0; color: var(--muted); max-width: 40em; }
.sec-head.center { flex-direction: column; align-items: center; text-align: center; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-family: 'Anuphan', sans-serif; font-weight: 600; color: var(--sky-700); text-decoration: none; }
.link-arrow:hover { gap: 10px; color: var(--pink-700); }
.link-arrow, .link-arrow .i { transition: gap .2s, color .2s; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.card-pad { padding: 32px; }
@media (max-width: 560px) { .card-pad { padding: 22px; } }
.muted { color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sec-head > div > .kicker, .kicker + h2 { margin-top: 0; }

/* ---------- สีตามกลุ่มผู้ใช้ (นักเรียน / ผู้ปกครอง / ครู) ---------- */
.c-sky { --c: #0369a1; --c-bg: #eef9fe; --c-line: #cdeefb; --c-grad: linear-gradient(135deg, #12b5ea, #0369a1); }
.c-pink { --c: #be185d; --c-bg: #fdf0f6; --c-line: #f9d3e4; --c-grad: linear-gradient(135deg, #ec4c8c, #be185d); }
.c-violet { --c: #5b3fc4; --c-bg: #f3f0fe; --c-line: #e0d8fb; --c-grad: linear-gradient(135deg, #8b6cf0, #5b3fc4); }

/* ---------- หน้าแรก: การ์ดระบบตามผู้ใช้ ---------- */
.roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.role-card { position: relative; overflow: hidden; display: flex; flex-direction: column; padding: 28px 24px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.role-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px; background: var(--c-grad); }
.rc-head, .role-intro { display: flex; align-items: center; gap: 14px; }
.rc-ic { width: 56px; height: 56px; border-radius: 18px; background: var(--c-grad); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 12px 22px -12px var(--c); }
.rc-ic .i { width: 28px; height: 28px; }
.rc-head small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.2; }
.rc-head h3 { margin: 0; font-size: 1.45rem; color: var(--c); }
.rc-desc { color: var(--muted); font-size: .95rem; margin: 12px 0 16px; }
.rc-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; flex: 1; align-content: start; }
.rc-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--c-bg); color: var(--ink); text-decoration: none; font-family: 'Anuphan', sans-serif; font-weight: 500; transition: background .2s, transform .2s; }
.rc-list a:hover { background: var(--c-line); transform: translateX(3px); }
.rc-list .ic { width: 36px; height: 36px; border-radius: 11px; background: #fff; color: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.rc-list .ic .i { width: 20px; height: 20px; }
.rc-list a > span:nth-child(2) { flex: 1; }
.rc-list .go { width: 16px; height: 16px; color: var(--c); opacity: .6; }
.rc-more { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px; border-radius: 14px; border: 1.5px solid var(--c-line); color: var(--c); font-family: 'Anuphan', sans-serif; font-weight: 600; text-decoration: none; transition: background .2s, color .2s; }
.rc-more:hover { background: var(--c); border-color: var(--c); color: #fff; }
.rc-desc { min-height: 3.4em; }
@media (max-width: 960px) { .roles { grid-template-columns: 1fr; } .rc-desc { min-height: 0; } }

/* แถบช่วยเหลือ */
.help-bar { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 10px; margin-top: 24px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); }
.hb-title, .hb-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; }
.hb-title > .i { width: 30px; height: 30px; color: var(--pink-700); }
.hb-title b, .hb-link b { display: block; font-family: 'Anuphan', sans-serif; color: var(--ink); line-height: 1.3; }
.hb-title small, .hb-link small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.4; }
.hb-link { text-decoration: none; background: var(--bg); transition: background .2s; }
.hb-link > .i { width: 26px; height: 26px; color: var(--sky-700); }
.hb-link:hover { background: var(--sky-50); }
@media (max-width: 760px) { .help-bar { grid-template-columns: 1fr; } }

/* ---------- หน้า "ระบบงาน" ---------- */
.search { position: relative; max-width: 560px; }
.search > [data-icon] { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; pointer-events: none; }
.search input {
  width: 100%; height: 56px; padding: 0 20px 0 52px; border-radius: 999px; border: 1px solid var(--line); background: #fff;
  font: inherit; color: var(--ink); box-shadow: var(--sh-sm);
}
.search input:focus { outline: 3px solid var(--sky-100); border-color: var(--sky); }
.role-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0 36px; }
.role-tab { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; border: 2px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; text-align: left; font: inherit; transition: border-color .2s, background .2s, box-shadow .2s; }
.role-tab .rt-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--c-bg); color: var(--c); display: flex; align-items: center; justify-content: center; flex: none; }
.role-tab b { display: block; font-family: 'Anuphan', sans-serif; font-size: 1.1rem; line-height: 1.3; }
.role-tab small { color: var(--muted); font-size: .85rem; }
.role-tab:hover { border-color: var(--c-line); }
.role-tab[aria-selected="true"] { border-color: var(--c); background: var(--c-bg); box-shadow: 0 12px 24px -16px var(--c); }
.role-tab[aria-selected="true"] .rt-ic { background: var(--c-grad); color: #fff; }
.role-tab[aria-selected="true"] b { color: var(--c); }
@media (max-width: 640px) {
  .role-tabs { gap: 8px; }
  .role-tab { flex-direction: column; text-align: center; gap: 6px; padding: 12px 6px; }
  .role-tab b { font-size: .92rem; }
  .role-tab small { display: none; }
}
.role-intro { margin-bottom: 26px; }
.role-intro h2 { margin: 0; font-size: 1.6rem; color: var(--c); }
.role-intro p { margin: 0; color: var(--muted); }
.cat { margin-bottom: 34px; }
.cat h3 { display: flex; align-items: center; gap: 10px; font-size: 1.12rem; margin-bottom: 14px; }
.cat h3::before { content: ''; width: 6px; height: 22px; border-radius: 4px; background: var(--c-grad, var(--grad)); }
.cat .count { font-size: .78rem; font-weight: 600; background: var(--c-bg, var(--sky-50)); color: var(--c, var(--sky-700)); border-radius: 999px; padding: 1px 10px; }

/* ปุ่มระบบ */
.sys-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sys {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 16px 44px 16px 16px; min-height: 84px;
  background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--r);
  text-decoration: none; color: var(--ink); box-shadow: var(--sh-sm); transition: transform .2s, box-shadow .2s;
}
.sys .ic { width: 48px; height: 48px; border-radius: 14px; background: var(--c-bg); color: var(--c); display: flex; align-items: center; justify-content: center; flex: none; transition: background .2s, color .2s; }
.sys .ic .i { width: 26px; height: 26px; }
.sys .txt b { display: block; font-family: 'Anuphan', sans-serif; font-weight: 600; line-height: 1.35; }
.sys .txt small { display: block; color: var(--muted); font-size: .86rem; line-height: 1.4; margin-top: 2px; }
.role-tag { display: inline-block; font-style: normal; font-size: .74rem; font-weight: 600; color: var(--c); background: var(--c-bg); border-radius: 999px; padding: 0 8px; margin-top: 4px; }
.sys .go { position: absolute; top: 50%; right: 16px; width: 18px; height: 18px; margin-top: -9px; color: #b6c3d3; transition: color .2s; }
.sys:hover { transform: translateY(-2px); box-shadow: var(--sh); }
.sys:hover .ic { background: var(--c-grad); color: #fff; }
.sys:hover .go { color: var(--c); }
@media (max-width: 1000px) { .sys-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .sys-grid { grid-template-columns: 1fr; gap: 10px; } .sys { min-height: 72px; } }
.no-result { text-align: center; padding: 32px; color: var(--muted); background: #fff; border: 1.5px dashed #cfdbe8; border-radius: var(--r); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--text); cursor: pointer;
  font-family: 'Anuphan', sans-serif; font-weight: 500; font-size: .95rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.chip-btn:hover { border-color: var(--sky); color: var(--sky-700); }

/* ---------- Facebook (หน้าแรก: การ์ดเพจ / หน้าข่าว: ฟีด) ---------- */
.fb-card { width: 380px; max-width: 100%; justify-self: center; padding: 12px; }
.fb-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; background: var(--sky-50); border-bottom: 1px solid var(--line); font-size: .92rem; }
.fb-note > [data-icon] { display: flex; color: var(--sky-700); margin-top: 3px; }
.fb-note > [data-icon] .i { width: 22px; height: 22px; }
.fb-note a { font-weight: 600; }

/* ---------- ผู้บริหาร / เกี่ยวกับ ---------- */
.welcome { display: grid; grid-template-columns: .85fr 1.15fr; gap: 64px; align-items: center; }
.portrait { position: relative; max-width: 400px; justify-self: center; width: 100%; }
.portrait::before { content: ''; position: absolute; inset: 8% -6% -6% 8%; border-radius: var(--r-lg); background: var(--grad); opacity: .9; transform: rotate(4deg); }
.portrait img { position: relative; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-lg); box-shadow: var(--sh-lg); background: var(--sky-50); }
.portrait .tag {
  position: absolute; left: -18px; bottom: 26px; background: #fff; border-radius: 18px; padding: 12px 18px; box-shadow: var(--sh);
  font-family: 'Anuphan', sans-serif; line-height: 1.35; max-width: 82%;
}
.portrait .tag b { display: block; color: var(--ink); font-size: 1.05rem; }
.portrait .tag span { color: var(--pink-700); font-size: .88rem; }
.welcome blockquote { margin: 0 0 20px; font-family: 'Anuphan', sans-serif; font-size: clamp(1.5rem, 2.8vw, 2.1rem); line-height: 1.4; color: var(--ink); font-weight: 600; }
.welcome blockquote .i { display: block; width: 44px; height: 44px; color: var(--pink); margin-bottom: 8px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 28px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); font-size: .95rem; }
.pill .i { color: var(--sky-700); }
.pill:nth-child(2) .i { color: var(--pink-700); }
.pill b { font-family: 'Anuphan', sans-serif; color: var(--ink); font-weight: 600; }
@media (max-width: 900px) {
  .welcome { grid-template-columns: 1fr; gap: 48px; }
  .portrait { max-width: 300px; }
  .portrait .tag { left: 50%; transform: translateX(-50%); bottom: -24px; text-align: center; white-space: nowrap; max-width: none; }
}

/* ---------- ปุ่มรูปภาพ (carousel) ---------- */
.carousel { position: relative; }
.track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 4 * 20px) / 5); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 6px 4px 18px; scrollbar-width: thin;
}
.track::-webkit-scrollbar { height: 6px; }
.track::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
.tile { scroll-snap-align: start; text-decoration: none; color: var(--ink); display: block; }
.tile .img { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-sm); transition: transform .25s, box-shadow .25s; background: var(--sky-50); }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; transition: transform .4s; }
.tile span { display: block; margin-top: 12px; font-family: 'Anuphan', sans-serif; font-weight: 500; font-size: .95rem; line-height: 1.4; }
.tile:hover .img { transform: translateY(-4px); box-shadow: var(--sh); }
.tile:hover img { transform: scale(1.05); }
.car-btns { display: flex; gap: 8px; }
.car-btn { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--sh-sm); }
.car-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (max-width: 1000px) { .track { grid-auto-columns: calc((100% - 2 * 20px) / 3); } }
@media (max-width: 560px) { .track { grid-auto-columns: 62%; gap: 14px; } }

/* ---------- Facebook ---------- */
.fb-split { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.fb-split .points { list-style: none; padding: 0; margin: 24px 0 30px; display: grid; gap: 14px; }
.fb-split .points li { display: flex; gap: 12px; align-items: flex-start; }
.fb-split .points .i { width: 26px; height: 26px; padding: 4px; border-radius: 8px; background: var(--sky-50); color: var(--sky-700); flex: none; margin-top: 2px; }
.fb-split .points li:nth-child(2) .i { background: var(--pink-50); color: var(--pink-700); }
.phone { width: 360px; border-radius: 44px; padding: 12px; background: var(--navy); box-shadow: var(--sh-lg), inset 0 0 0 2px rgba(255,255,255,.08); position: relative; }
.phone::before { content: ''; position: absolute; top: 20px; left: 50%; width: 90px; height: 6px; margin-left: -45px; border-radius: 6px; background: rgba(255,255,255,.18); z-index: 1; }
.phone .screen { border-radius: 34px; overflow: hidden; background: #fff; padding-top: 22px; }
.fb-frame iframe { display: block; width: 100%; border: 0; background: var(--bg); }
@media (max-width: 900px) { .fb-split { grid-template-columns: 1fr; gap: 40px; } .phone { justify-self: center; } }
@media (max-width: 420px) { .phone { width: 100%; border-radius: 36px; padding: 10px; } .phone .screen { border-radius: 28px; } }
.fb-page-card { max-width: 560px; margin: 0 auto; overflow: hidden; }
.fb-page-card .bar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.fb-page-card .bar img { width: 44px; height: 44px; }
.fb-page-card .bar b { display: block; font-family: 'Anuphan', sans-serif; color: var(--ink); line-height: 1.3; }
.fb-page-card .bar small { color: var(--muted); }
.fb-page-card .bar .btn { margin-left: auto; }
.fb-page-card .fb-frame { padding: 12px; display: flex; justify-content: center; }
.fb-page-card .fb-frame iframe { max-width: 500px; border-radius: 12px; }

/* ---------- หน่วยงาน ---------- */
.agencies { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.agency { display: block; border-radius: 16px; overflow: hidden; box-shadow: var(--sh-sm); transition: transform .2s, box-shadow .2s; }
.agency img { width: 100%; aspect-ratio: 6 / 1; object-fit: cover; }
.agency:hover { transform: translateY(-3px); box-shadow: var(--sh); }
@media (max-width: 860px) { .agencies { grid-template-columns: 1fr; } }

/* ---------- หัวหน้าเพจย่อย ---------- */
.page-hero { padding: 56px 0 60px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--sky-700); }
.crumb .i { width: 14px; height: 14px; }
.page-hero .row { display: flex; align-items: center; gap: 18px; }
.page-hero .badge { width: 64px; height: 64px; border-radius: 20px; background: var(--grad-strong); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 14px 28px -14px rgba(109,79,208,.8); }
.page-hero .badge .i { width: 32px; height: 32px; }
.page-hero h1 { font-size: clamp(2rem, 4.6vw, 3rem); margin: 0; font-weight: 700; }
.page-hero p { margin: 6px 0 0; color: var(--muted); font-size: 1.08rem; }
@media (max-width: 560px) { .page-hero { padding: 40px 0 44px; } .page-hero .badge { width: 52px; height: 52px; border-radius: 16px; } }

/* ---------- ข้อมูลทั่วไป ---------- */
.about-top { display: grid; grid-template-columns: 340px 1fr; gap: 28px; align-items: stretch; }
.logo-card { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; background: var(--grad-strong); color: #fff; border-radius: var(--r-lg); box-shadow: var(--sh); }
.logo-card img { width: 72%; max-width: 230px; background: #fff; border-radius: 50%; padding: 8px; box-shadow: 0 20px 40px -18px rgba(0,0,0,.5); margin-bottom: 18px; }
.logo-card b { font-family: 'Anuphan', sans-serif; font-size: 1.15rem; }
.logo-card span { opacity: .92; font-size: .95rem; }
.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin: 0; }
.info-list div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.info-list dt { font-family: 'Anuphan', sans-serif; font-weight: 600; color: var(--pink-700); font-size: .9rem; }
.info-list dd { margin: 2px 0 0; color: var(--ink); }
@media (max-width: 900px) { .about-top { grid-template-columns: 1fr; } .info-list { grid-template-columns: 1fr; } }
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.id-card { padding: 26px; border-radius: var(--r); background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-sm); transition: transform .2s, box-shadow .2s; }
.id-card:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.id-card .ic { width: 48px; height: 48px; border-radius: 15px; display: flex; align-items: center; justify-content: center; background: var(--sky-50); color: var(--sky-700); margin-bottom: 16px; }
.id-card:nth-child(even) .ic { background: var(--pink-50); color: var(--pink-700); }
.id-card .ic .i { width: 26px; height: 26px; }
.id-card .label { display: block; font-family: 'Anuphan', sans-serif; font-size: .88rem; font-weight: 600; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.id-card .value { font-family: 'Anuphan', sans-serif; font-size: 1.22rem; font-weight: 600; color: var(--ink); line-height: 1.45; }
.id-card.wide { grid-column: span 2; }
.id-card.wide .value { font-family: 'IBM Plex Sans Thai Looped', sans-serif; font-size: 1.05rem; font-weight: 400; color: var(--text); line-height: 1.8; }
.id-card.feature { background: var(--navy); border-color: var(--navy); }
.id-card.feature .label { color: #9fb3cc; }
.id-card.feature .value { color: #fff; font-size: 1.45rem; }
.id-card.feature .ic { background: rgba(255,255,255,.1); color: #fff; }
.swatches { display: flex; gap: 8px; margin-top: 12px; }
.swatches span { width: 46px; height: 46px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
@media (max-width: 900px) { .bento { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .bento { grid-template-columns: 1fr; } .id-card.wide { grid-column: auto; } }

/* ---------- ประวัติ ---------- */
.history-intro { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center; }
.big-year { font-family: 'Anuphan', sans-serif; font-weight: 700; font-size: clamp(3.5rem, 9vw, 6.5rem); line-height: 1; }
.big-year small { display: block; font-size: 1rem; font-weight: 500; color: var(--muted); margin-top: 8px; }
.history-intro p { margin: 0 0 .8em; }
@media (max-width: 760px) { .history-intro { grid-template-columns: 1fr; gap: 16px; } }
.timeline { position: relative; list-style: none; margin: 0; padding: 0; }
.timeline::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px; background: linear-gradient(180deg, var(--sky), var(--pink)); border-radius: 3px; opacity: .45; }
.timeline li { position: relative; width: 50%; padding: 0 44px 34px 0; }
.timeline li:nth-child(even) { margin-left: 50%; padding: 0 0 34px 44px; }
.timeline li::before { content: ''; position: absolute; top: 22px; right: -9px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--sky); }
.timeline li:nth-child(even)::before { left: -9px; right: auto; border-color: var(--pink); }
.timeline .tl-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; box-shadow: var(--sh-sm); }
.timeline .yr { display: inline-block; font-family: 'Anuphan', sans-serif; font-weight: 600; font-size: .9rem; color: #fff; background: var(--sky-700); padding: 2px 12px; border-radius: 999px; margin-bottom: 8px; }
.timeline li:nth-child(even) .yr { background: var(--pink-700); }
.timeline ul { margin: 6px 0; padding-left: 20px; }
@media (max-width: 760px) {
  .timeline::before { left: 9px; }
  .timeline li, .timeline li:nth-child(even) { width: auto; margin-left: 0; padding: 0 0 22px 38px; }
  .timeline li::before, .timeline li:nth-child(even)::before { left: 0; right: auto; }
}

/* ---------- เพลง ---------- */
.song-card { max-width: 920px; margin: 0 auto; overflow: hidden; border-radius: var(--r-lg); }
.song-card .top { display: flex; align-items: center; gap: 20px; padding: 28px 30px; background: var(--grad-strong); color: #fff; }
.song-card .top .disc { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; flex: none; border: 2px solid rgba(255,255,255,.35); }
.song-card .top .disc .i { width: 34px; height: 34px; }
.song-card .top h2 { color: #fff; margin: 0; font-size: clamp(1.35rem, 3vw, 1.8rem); }
.song-card .top p { margin: 2px 0 0; opacity: .92; }
.song-card .body { padding: 24px; }
.video { position: relative; padding-top: 56.25%; border-radius: 18px; overflow: hidden; background: var(--navy); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.song-card .meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-top: 18px; }

/* ---------- บุคลากร ---------- */
.group-nav { position: sticky; top: calc(var(--head-h) + 8px); z-index: 20; margin-bottom: 36px; }
.group-nav .chips { flex-wrap: nowrap; overflow-x: auto; padding: 8px; background: rgba(255,255,255,.88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--sh-sm); scrollbar-width: none; }
.group-nav .chips::-webkit-scrollbar { display: none; }
.group-nav .chip-btn { flex: none; height: 38px; font-size: .9rem; border: 0; background: transparent; }
.group-nav .chip-btn:hover { background: var(--sky-50); }
.staff-group { margin-bottom: 52px; }
.staff-group .gh { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.staff-group .gh .ic { width: 48px; height: 48px; border-radius: 15px; background: var(--grad-strong); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.staff-group .gh h2 { font-size: 1.35rem; margin: 0; }
.staff-group .gh small { display: block; color: var(--muted); font-size: .88rem; }
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.staff-grid.lead { grid-template-columns: repeat(auto-fit, minmax(240px, 300px)); justify-content: center; }
.person { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 12px 18px; text-align: center; box-shadow: var(--sh-sm); transition: transform .2s, box-shadow .2s; }
.person:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.person .photo { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 14px; margin-bottom: 14px; background: linear-gradient(160deg, var(--sky-50), var(--pink-50)); display: flex; align-items: center; justify-content: center; color: #b9c9db; }
.person .photo .i { width: 56px; height: 56px; }
.person .name { font-family: 'Anuphan', sans-serif; font-weight: 600; color: var(--ink); line-height: 1.4; }
.person .pos { color: var(--pink-700); font-size: .9rem; line-height: 1.45; margin-top: 4px; }
.empty { display: flex; align-items: center; gap: 12px; padding: 20px 22px; color: var(--muted); background: #fff; border: 1.5px dashed #cfdbe8; border-radius: var(--r); }
@media (max-width: 560px) { .staff-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } .person .name { font-size: .95rem; } }

/* ---------- ติดต่อ ---------- */
.contact-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.c-card { display: flex; flex-direction: column; gap: 10px; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); text-decoration: none; color: var(--text); transition: transform .2s, box-shadow .2s; min-width: 0; }
a.c-card:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.c-card .ic { width: 50px; height: 50px; border-radius: 15px; display: flex; align-items: center; justify-content: center; background: var(--sky-50); color: var(--sky-700); }
.c-card:nth-child(even) .ic { background: var(--pink-50); color: var(--pink-700); }
.c-card b { font-family: 'Anuphan', sans-serif; color: var(--ink); font-size: 1.05rem; }
.c-card span { overflow-wrap: anywhere; }
.map-card { display: grid; grid-template-columns: 1fr 1.6fr; overflow: hidden; }
.map-card .addr { padding: 32px; }
.map-card .addr h2 { font-size: 1.4rem; }
.map-card .map { min-height: 420px; background: var(--sky-50); }
.map-card .map iframe { width: 100%; height: 100%; min-height: 420px; border: 0; display: block; }
@media (max-width: 1000px) { .contact-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .map-card { grid-template-columns: 1fr; } .map-card .map, .map-card .map iframe { min-height: 340px; } }
@media (max-width: 480px) { .contact-cards { grid-template-columns: 1fr; } }

/* ---------- CTA ก่อน footer ---------- */
.cta-box {
  position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 48px; color: #fff;
  background: var(--grad-strong); display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.cta-box::after { content: ''; position: absolute; right: -80px; top: -120px; width: 320px; height: 320px; border-radius: 50%; border: 50px solid rgba(255,255,255,.08); }
.cta-box h2 { color: #fff; font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 6px; }
.cta-box p { margin: 0; opacity: .92; }
.cta-box .actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.cta-box .btn-outline-w { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.6); }
.cta-box .btn-outline-w:hover { background: rgba(255,255,255,.12); transform: translateY(-2px); }
@media (max-width: 560px) { .cta-box { padding: 32px 24px; } }

/* ---------- Footer ---------- */
.site-footer { position: relative; overflow: hidden; background: var(--navy); color: #b9c8db; padding: 72px 0 24px; margin-top: 0; font-size: .97rem; }
.site-footer::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--grad); }
.site-footer::after { content: ''; position: absolute; left: -160px; bottom: -220px; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(18,181,234,.18), transparent 70%); pointer-events: none; }
.site-footer a { color: #e6eef8; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 36px; }
.f-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.f-brand img { width: 56px; height: 56px; background: #fff; border-radius: 50%; padding: 3px; }
.f-brand b { display: block; font-family: 'Anuphan', sans-serif; color: #fff; font-size: 1.2rem; line-height: 1.2; }
.f-brand small { letter-spacing: .18em; color: var(--pink-100); font-size: .72rem; }
.site-footer h3 { color: #fff; font-size: 1rem; letter-spacing: .04em; margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.f-contact li { display: flex; gap: 10px; align-items: flex-start; }
.f-contact .i { color: var(--sky); margin-top: 4px; }
.socials { display: flex; gap: 10px; margin-top: 18px; }
.socials a { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.08); display: inline-flex; align-items: center; justify-content: center; }
.socials a:hover { background: var(--pink); text-decoration: none; }
.footer-bottom { position: relative; z-index: 1; border-top: 1px solid rgba(255,255,255,.1); margin-top: 48px; padding-top: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; font-size: .86rem; }
@media (max-width: 1000px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; gap: 28px; } .site-footer { padding-top: 56px; } }

.to-top { position: fixed; right: 18px; bottom: 18px; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--navy); color: #fff; box-shadow: var(--sh); cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .25s, transform .25s; z-index: 90; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }

/* ---------- เอฟเฟกต์ค่อยๆ ปรากฏ ---------- */
[data-reveal] { transition: opacity .6s ease, transform .6s ease; }
[data-reveal].pending { opacity: 0; transform: translateY(18px); }
@media print { [data-reveal].pending { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  [data-reveal].pending { opacity: 1; transform: none; }
}
