/* ==========================================================================
   ฝ่ายบริหารงานบุคคลและงบประมาณ โรงเรียนบางแก้วประชาสรรค์ — ธีมชมพู-แสด
   หัวข้อใช้ Kanit / เนื้อหาใช้ Sarabun
   ========================================================================== */
:root {
  --pink: #ff2f7e;
  --orange: #ff7a30;
  --sunset: linear-gradient(135deg, #ff2f7e 0%, #ff5f6d 45%, #ff7a30 100%);
  --ink: #401225;
  --ink-soft: #6b3a51;
  --pale: #fff4ef;
  --paler: #fffaf8;
  --shadow-pink: 0 18px 40px -20px rgba(216, 17, 89, 0.34);
  --shadow-soft: 0 10px 26px -14px rgba(64, 18, 37, 0.18);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Sarabun", Arial, sans-serif;
  background: var(--paler);
  color: var(--ink);
}

h1, h2, h3 {
  font-family: "Kanit", sans-serif;
  margin: 0;
}

img {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--pink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 0 0 10px 0;
  z-index: 10000;
}

.skip-link:focus {
  left: 0;
}

/* ==========================================================================
   NAVBAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 500;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 0 var(--pale);
  transition: box-shadow .3s ease;
}

.navbar.is-scrolled {
  box-shadow: var(--shadow-soft);
}

.navbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--pink);
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: .2px;
}

.navbar-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--pale);
  background: #fff;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 10px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  margin: 0 auto;
  background: var(--pink);
  transition: transform .3s var(--ease), opacity .3s ease;
}

.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links li a {
  position: relative;
  display: inline-block;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
  border-radius: 999px;
  transition: color .25s ease, background .25s ease;
}

.nav-links li a:hover,
.nav-links li a:focus-visible {
  color: var(--pink);
  background: var(--pale);
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--pale);
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  margin-left: 4px;
}

.nav-search-box {
  border: none;
  background: transparent;
  outline: none;
  font-family: "Sarabun", sans-serif;
  font-size: 13.5px;
  color: var(--ink);
  width: 110px;
}

.nav-search-box::placeholder {
  color: var(--ink-soft);
  opacity: .7;
}

.nav-search-btn {
  border: none;
  background: var(--sunset);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: transform .25s var(--ease);
}

.nav-search-btn:hover {
  transform: scale(1.08);
}

/* ปุ่มเข้าสู่ระบบ Sornflow ในเมนู — ให้เด่นกว่าเมนูอื่นเพราะเป็นลิงก์ไปยังระบบภายนอก */
.nav-cta {
  background: var(--sunset) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-pink);
  margin-left: 4px;
}

.nav-cta:hover,
.nav-cta:focus-visible {
  color: #fff !important;
  background: var(--sunset) !important;
  transform: translateY(-1px) scale(1.03);
}

@media (max-width: 800px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: #fff;
    padding: 10px 16px 18px;
    box-shadow: var(--shadow-soft);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .35s var(--ease), opacity .3s ease, padding .35s var(--ease);
  }

  .nav-links.is-open {
    max-height: 460px;
    opacity: 1;
  }

  .nav-links li a {
    display: block;
    text-align: center;
  }

  .nav-cta {
    margin: 6px 0 0;
  }

  .nav-search {
    margin: 6px 0 0;
    justify-content: space-between;
  }

  .nav-search-box {
    width: auto;
    flex: 1;
  }
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--sunset);
  color: #fff;
  text-align: center;
  padding: 56px 20px 68px;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  pointer-events: none;
}

.hero-blob--1 { width: 260px; height: 260px; top: -110px; left: -70px; }
.hero-blob--2 { width: 200px; height: 200px; bottom: -90px; right: -40px; }

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
}

.hero .logo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: var(--shadow-pink);
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  line-height: 1.45;
  letter-spacing: .2px;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.hero h1 span {
  font-weight: 500;
  font-size: 0.82em;
  opacity: .95;
}

.hero p {
  margin-top: 10px;
  font-size: 15px;
  letter-spacing: .3px;
  opacity: .95;
  font-family: "Sarabun", sans-serif;
}

/* ปุ่ม CTA เข้าสู่ระบบ Sornflow ใน hero */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  background: #fff;
  color: var(--pink);
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  padding: 12px 26px;
  border-radius: 999px;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.28);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}

.hero-cta:hover,
.hero-cta:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -12px rgba(0, 0, 0, 0.34);
}

.hero-cta span {
  transition: transform .25s var(--ease);
}

.hero-cta:hover span {
  transform: translateX(3px);
}

/* ==========================================================================
   SECTION / LAYOUT
   ========================================================================== */
section {
  padding: 44px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-title {
  text-align: center;
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  letter-spacing: .3px;
  color: var(--ink);
  margin-bottom: 8px;
  position: relative;
  padding-bottom: 14px;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 4px;
  border-radius: 999px;
  background: var(--sunset);
}

/* ==========================================================================
   ORGANIZATION PROFILE
   ========================================================================== */
.org {
  position: relative;
  background: #fff;
  padding: 34px 28px;
  border-radius: 22px;
  text-align: center;
  box-shadow: var(--shadow-pink);
  border: 1px solid var(--pale);
}

.org-badge {
  display: inline-block;
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .4px;
  color: #fff;
  background: var(--sunset);
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.org p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto;
}

/* ==========================================================================
   CAROUSEL — ตกแต่งเป็นพิเศษ (grand frame treatment)
   ========================================================================== */
.carousel-frame {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
  padding: 12px;
  border-radius: 30px;
  background: var(--sunset);
  box-shadow: var(--shadow-pink), 0 0 0 1px rgba(255, 255, 255, .35) inset;
}

.carousel-frame-blob {
  position: absolute;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
  opacity: .55;
}

.carousel-frame-blob--1 {
  width: 150px;
  height: 150px;
  top: -46px;
  left: -36px;
  background: radial-gradient(circle, rgba(255, 47, 126, .5), rgba(255, 47, 126, 0) 70%);
}

.carousel-frame-blob--2 {
  width: 180px;
  height: 180px;
  bottom: -60px;
  right: -46px;
  background: radial-gradient(circle, rgba(255, 122, 48, .5), rgba(255, 122, 48, 0) 70%);
}

.carousel {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
}

.carousel-counter {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 3;
  background: rgba(64, 18, 37, 0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-family: "Kanit", sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .3px;
  padding: 5px 12px;
  border-radius: 999px;
}

.slides {
  display: flex;
  transition: transform .6s var(--ease);
}

.slides img {
  width: 100%;
  flex: 0 0 100%;
  object-fit: contain;
  background: #fff;
  aspect-ratio: 16 / 8;
  transform: scale(1);
  transition: transform 6s ease-out;
}

.slides img.is-active {
  transform: scale(1.05);
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--pink);
  border: none;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-soft);
  transition: background .25s ease, transform .25s var(--ease), color .25s ease;
  z-index: 3;
}

.carousel-btn:hover {
  background: var(--sunset);
  color: #fff;
  transform: translateY(-50%) scale(1.08);
}

.prev { left: 16px; }
.next { right: 16px; }

.carousel-progress {
  position: relative;
  height: 4px;
  width: 100%;
  background: var(--pale);
}

.carousel-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--sunset);
  border-radius: 0 4px 4px 0;
}

@keyframes progressFill {
  from { width: 0%; }
  to { width: 100%; }
}

.carousel-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 3;
}

.carousel-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(255, 47, 126, .3), var(--shadow-soft);
  cursor: pointer;
  padding: 0;
  transition: background .25s ease, width .25s var(--ease);
}

.carousel-dot.is-active {
  background: var(--sunset);
  width: 22px;
  border-radius: 999px;
}

/* ==========================================================================
   PERSON PROFILE
   ========================================================================== */
.people {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: center;
}

.card {
  background: #fff;
  width: 220px;
  padding: 22px 16px 20px;
  border-radius: 18px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-pink);
}

.card img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--pale);
  outline: 3px solid var(--pink);
  outline-offset: 3px;
  margin-bottom: 14px;
}

.card h3 {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .1px;
  color: var(--ink);
  line-height: 1.4;
}

.card p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--pink);
  font-weight: 500;
  font-family: "Sarabun", sans-serif;
}

/* รองผู้อำนวยการ — เน้นให้เด่นกว่าตำแหน่งอื่นเพื่อความเป็นระเบียบของลำดับชั้น */
.card--lead {
  width: 240px;
  background: var(--sunset);
  box-shadow: var(--shadow-pink);
}

.card--lead h3,
.card--lead p {
  color: #fff;
}

.card--lead img {
  border-color: #fff;
  outline-color: #fff;
}

.card--lead:hover {
  transform: translateY(-8px);
}

/* ==========================================================================
   GALLERY
   ========================================================================== */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}

.gallery img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease), outline-color .3s ease;
  outline: 3px solid transparent;
  outline-offset: 2px;
}

.gallery img:hover {
  transform: scale(1.035);
  box-shadow: var(--shadow-pink);
  outline-color: var(--orange);
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(64, 18, 37, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s var(--ease), visibility .3s var(--ease);
  z-index: 2000;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 90%;
  max-height: 86%;
  border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.5);
  transform: scale(0.94);
  opacity: 0;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}

.lightbox.is-open img {
  transform: scale(1);
  opacity: 1;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease, transform .25s var(--ease);
}

.lightbox-close:hover {
  background: var(--sunset);
  transform: scale(1.08);
}

body.lightbox-lock {
  overflow: hidden;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
  background: var(--sunset);
  color: #fff;
  text-align: center;
  padding: 36px 20px 30px;
  margin-top: 20px;
  border-radius: 32px 32px 0 0;
}

.footer-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #fff;
  padding: 4px;
  margin-bottom: 12px;
}

footer p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  opacity: .95;
  font-family: "Sarabun", sans-serif;
}

.footer-cta {
  display: inline-block;
  margin-top: 16px;
  color: #fff;
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  padding: 8px 20px;
  border-radius: 999px;
  transition: background .25s ease, transform .25s var(--ease);
}

.footer-cta:hover,
.footer-cta:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .slides { transition: none; }
  .slides img { transition: none; }
  .slides img.is-active { transform: none; }
  .carousel-progress { display: none; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
