/* ==========================================================================
   ประวัติโรงเรียนบางแก้วประชาสรรค์ — ธีมชมพู-แสด
   หัวข้อใช้ Kanit / เนื้อหาใช้ Sarabun
   สไตล์ชีตนี้ใช้เฉพาะหน้า history.html เท่านั้น ไม่กระทบหน้าอื่นที่ยังใช้ style.css เดิม
   ========================================================================== */
: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: 1000px;
  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-cta {
  background: var(--sunset) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: var(--shadow-pink);
}

.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: 300px;
    opacity: 1;
  }

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

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

/* ==========================================================================
   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: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #fff;
  box-shadow: var(--shadow-pink);
  margin-bottom: 16px;
}

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

.hero h1 {
  font-size: clamp(24px, 4.2vw, 34px);
  font-weight: 700;
  line-height: 1.4;
  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: 14px;
  font-size: 15.5px;
  line-height: 1.7;
  letter-spacing: .2px;
  opacity: .96;
  font-family: "Sarabun", sans-serif;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   SECTIONS / LAYOUT
   ========================================================================== */
section {
  padding: 44px 20px;
  max-width: 860px;
  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: 10px;
  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);
}

.section-lead {
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink-soft);
  text-indent: 40px;
  margin: 18px 0;
}

.gallery-lead {
  text-align: center;
  text-indent: 0;
  max-width: 620px;
  margin: 10px auto 28px;
}

/* ==========================================================================
   STORY CARD (จุดเริ่มต้น)
   ========================================================================== */
.story-section {
  padding-top: 48px;
}

.story-card {
  position: relative;
  background: #fff;
  padding: 32px 28px;
  border-radius: 22px;
  box-shadow: var(--shadow-pink);
  border: 1px solid var(--pale);
}

.story-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: 16px;
}

.story-card p {
  font-size: 16px;
  line-height: 1.9;
  color: var(--ink-soft);
  text-indent: 40px;
  margin: 0;
}

/* ==========================================================================
   DONOR LIST
   ========================================================================== */
.donor-list {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
  display: grid;
  gap: 12px;
}

.donor-list li {
  background: #fff;
  border: 1px solid var(--pale);
  border-left: 4px solid var(--orange);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
  box-shadow: var(--shadow-soft);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}

.donor-list li:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-pink);
}

.donor-name {
  display: block;
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 15.5px;
  color: var(--pink);
  margin-bottom: 2px;
}

/* ==========================================================================
   TIMELINE
   ========================================================================== */
.timeline {
  position: relative;
  margin-top: 30px;
  padding-left: 26px;
  border-left: 3px solid var(--pale);
}

.timeline-item {
  position: relative;
  margin-bottom: 30px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -32.5px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sunset);
  box-shadow: 0 0 0 4px #fff, 0 0 0 5px var(--pale);
}

.timeline-dot {
  display: inline-block;
  font-family: "Kanit", sans-serif;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .3px;
  color: #fff;
  background: var(--sunset);
  padding: 5px 16px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.timeline-item p {
  font-size: 15.5px;
  line-height: 1.85;
  color: var(--ink-soft);
  margin: 0;
  background: #fff;
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   GALLERY
   ========================================================================== */
.gallery-section {
  max-width: 1040px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 18px;
  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 h5 {
  margin: 0;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.8;
  opacity: .95;
  font-family: "Sarabun", sans-serif;
}

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