@import url('https://fonts.googleapis.com/css2?family=Kanit:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Sarabun:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* ==================================================
   ธีมสีชมพู-แสด (sunset) — โรงเรียนบางแก้วประชาสรรค์
   ใช้ร่วมกันทุกหน้าข่าวประชาสัมพันธ์ (pr_tab1)
   -------------------------------------------------- */
:root {
  --pink: #ff2f7e;
  --orange: #ff7a30;
  --sunset: linear-gradient(135deg, var(--pink) 0%, #ff5f6d 45%, var(--orange) 100%);
  --sunset-soft: linear-gradient(135deg, #ffe1ee 0%, #fff1e6 100%);
  --ink: #3a1530;
  --ink-soft: #7c5468;
  --cream: #fff8f5;
  --shadow-pink: 0 12px 30px rgba(255, 47, 126, .22);
  --shadow-soft: 0 8px 22px rgba(120, 40, 80, .12);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--cream);
  font-family: "Sarabun", sans-serif;
  color: var(--ink);
}

div.container {
  max-width: 1180px;
  margin: 0 auto;
  background: transparent;
  height: auto;
  overflow: hidden;
  padding-bottom: 40px;
}

/* ==================================================
   HEADER
   -------------------------------------------------- */
header {
  align-items: center;
  justify-content: flex-end;
  background: var(--sunset);
  background-size: 200% 200%;
  animation: headerGradient 10s ease infinite;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 5%;
  position: sticky;
  top: 0;
  z-index: 500;
  box-shadow: 0 4px 18px rgba(180, 20, 90, .18);
  animation-fill-mode: forwards;
}

@keyframes headerGradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.logo {
  cursor: pointer;
  width: 64px;
  height: 64px;
  margin-right: auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .15);
  object-fit: cover;
  transition: transform .35s var(--ease);
}
.logo:hover {
  transform: rotate(-6deg) scale(1.06);
}

.nav_links {
  list-style: none;
  display: flex;
}
.nav_links li {
  display: inline-block;
  padding: 0 16px;
}
.nav_links li a {
  position: relative;
  padding: 6px 0;
}
.nav_links li a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: #ffffff;
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .3s var(--ease);
}
.nav_links li a:hover {
  color: #ffffff;
}
.nav_links li a:hover::after {
  transform: scaleX(1);
}

button {
  padding: 10px 26px;
  background: #ffffff;
  color: var(--pink);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), background .3s var(--ease), color .3s var(--ease);
}
button:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .22);
}

li, a, button {
  font-family: "Kanit", sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  color: #ffffff;
  text-decoration: none;
}

/* คืนสีปุ่ม "ติดต่อเรา" ให้เป็นสีชมพู (กฎด้านบนตั้ง color ของ li,a,button ไว้เป็นขาว) */
header button {
  color: var(--pink);
}
header button:hover {
  color: #ffffff;
}

/* ==================================================
   หัวข้อกิจกรรม
   -------------------------------------------------- */
h2 {
  text-align: center;
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 26px;
  line-height: 1.5;
  color: var(--ink);
  max-width: 900px;
  margin: 42px auto 8px;
  padding: 0 20px;
  opacity: 0;
  transform: translateY(16px);
  animation: fadeInUp .7s var(--ease) .1s forwards;
}
h2::after {
  content: "";
  display: block;
  width: 84px;
  height: 4px;
  margin: 18px auto 0;
  border-radius: 4px;
  background: var(--sunset);
}

@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ==================================================
   แกลเลอรีภาพ
   -------------------------------------------------- */
.image_box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px;
  max-width: 1100px;
  margin: 36px auto 0;
  padding: 0 24px;
}

.pic-link {
  display: block;
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(22px) scale(.97);
  transition: opacity .6s var(--ease), transform .6s var(--ease),
              box-shadow .35s ease;
  transition-delay: var(--d, 0s);
}
.pic-link.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.pic-link:hover {
  box-shadow: var(--shadow-pink);
}

.image_box .imgtab {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  border: none;
  margin: 0;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  transition: transform .5s var(--ease);
}
.pic-link:hover .imgtab {
  transform: scale(1.08);
}

.pic-link::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(255, 47, 126, .55), rgba(255, 47, 126, 0) 55%);
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.pic-link:hover::after {
  opacity: 1;
}

.pic-link .zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: var(--pink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.pic-link:hover .zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

/* ==================================================
   ไลท์บ็อกซ์ (คลิกเพื่อดูภาพขยาย)
   -------------------------------------------------- */
.pr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 5, 15, .88);
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  padding: 24px;
}
.pr-lightbox.open {
  opacity: 1;
  visibility: visible;
}
.pr-lightbox__img {
  max-width: min(92vw, 1100px);
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  transform: scale(.94);
  transition: transform .3s var(--ease);
}
.pr-lightbox.open .pr-lightbox__img {
  transform: scale(1);
}
.pr-lightbox__btn {
  position: absolute;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .25s ease, transform .25s ease;
}
.pr-lightbox__btn:hover {
  background: var(--sunset);
  transform: scale(1.08);
}
.pr-lightbox__close {
  top: 18px;
  right: 18px;
}
.pr-lightbox__prev {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}
.pr-lightbox__next {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}
.pr-lightbox__counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-family: "Sarabun", sans-serif;
  font-size: 14px;
  background: rgba(255, 255, 255, .12);
  padding: 6px 16px;
  border-radius: 50px;
}

/* ==================================================
   ปุ่มกลับขึ้นบนสุด
   -------------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--sunset);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
  z-index: 400;
}
.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  transform: translateY(-3px) scale(1.06);
}

/* ==================================================
   ฟุตเตอร์
   -------------------------------------------------- */
section footer {
  background: var(--sunset);
  display: flex;
  margin: 56px auto 0;
  max-width: 1100px;
  min-height: 100px;
  justify-content: center;
  align-items: center;
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-pink);
}
footer h5 {
  text-align: center;
  font-family: "Sarabun", sans-serif;
  font-weight: 500;
  font-size: 15px;
  color: #ffffff;
  margin: 0 auto;
  line-height: 1.7;
}

/* ==================================================
   RESPONSIVE
   -------------------------------------------------- */
@media (max-width: 767px) {
  header {
    justify-content: center;
    padding: 12px 5%;
  }
  .logo {
    margin-right: auto;
    margin-left: 0;
  }
  .nav_links li {
    padding: 0 10px;
  }
  li, a, button {
    font-size: 14px;
  }
  h2 {
    font-size: 21px;
    margin-top: 28px;
  }
  .image_box {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 0 16px;
  }
  .image_box .imgtab {
    height: 150px;
  }
  .pr-lightbox__prev,
  .pr-lightbox__next {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .back-to-top {
    right: 14px;
    bottom: 14px;
  }
}

/* ==================================================
   เคารพการตั้งค่าของผู้ใช้ที่ปิดแอนิเมชันในระบบ
   -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  header,
  .logo,
  h2,
  .pic-link,
  .image_box .imgtab,
  .pr-lightbox,
  .pr-lightbox__img,
  .back-to-top,
  button {
    animation: none !important;
    transition-duration: .01ms !important;
  }
  h2 {
    opacity: 1;
    transform: none;
  }
  .pic-link {
    opacity: 1;
    transform: none;
  }
}
