/* ==========================================================================
   กระดานดำสัมพันธ์ ครั้งที่ 21 — สไตล์หลัก
   ========================================================================== */

:root {
  --accent:        #9d4215;
  --accent-dark:   #7d3210;
  --accent-soft:   #f4efec;
  --blue:          #004aad;
  --blue-dark:     #003a88;
  --yellow:        #fccc14;
  --green:         #0c7a45;

  --ink:           #181818;
  --ink-2:         #3a3a3a;
  --muted:         #5a5a5a;
  --muted-2:       #6a6a6a;
  --muted-3:       #8a8a8a;
  --muted-4:       #9a9a9a;

  --bg:            #ffffff;
  --bg-warm:       #faf7f5;
  --bg-admin:      #f6f4f2;
  --line:          rgba(24, 24, 24, 0.10);
  --line-soft:     rgba(24, 24, 24, 0.07);

  --shadow-sm:     0 2px 14px rgba(24, 24, 24, 0.04);
  --shadow-md:     0 4px 16px rgba(24, 24, 24, 0.07);
  --shadow-lg:     0 22px 50px rgba(24, 24, 24, 0.16);

  --radius:        24px;
  --radius-sm:     16px;
  --pill:          9999px;

  --font:          'Noto Sans Thai', 'Inter', system-ui, sans-serif;
  --font-en:       'Inter', system-ui, sans-serif;

  --pad-x:         clamp(20px, 4vw, 32px);
  --wrap:          1180px;
}

/* --------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }

/* ต้องมาก่อนทุกกฎที่ตั้ง display เอง (เช่น .card{display:flex})
   ไม่งั้น attribute hidden จะไม่มีผล แล้วส่วนที่ควรซ่อนจะโผล่ออกมา */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
}

body {
  font-family: var(--font);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.admin { background: var(--bg-admin); }

img { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

input, select, textarea, button { font-family: inherit; }
input::placeholder, textarea::placeholder { color: #a8a8a8; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 12px 0;
}
.skip-link:focus { left: 0; color: #fff; }

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

.eyebrow {
  font-family: var(--font-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --------------------------------------------------------------- nav */

.nav {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: calc(100% - 24px);
  max-width: 1240px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px clamp(10px, 2vw, 16px) 10px clamp(12px, 2vw, 20px);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(24, 24, 24, 0.08);
  box-shadow: 0 6px 24px rgba(24, 24, 24, 0.07);
}

.nav__brand { display: flex; align-items: center; gap: 12px; }
.nav__brand img { width: 44px; height: 44px; object-fit: contain; display: block; }
.nav__brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.nav__brand-th { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: 0.2px; }
.nav__brand-en {
  font-family: var(--font-en);
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent);
}

.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 0 10px;
  border: none;
  background: transparent;
  cursor: pointer;
}
.nav__burger span {
  display: block;
  height: 2px; width: 100%;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 220ms ease, opacity 180ms ease;
}
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__menu {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.nav__link {
  padding: 9px clamp(10px, 1.4vw, 18px);
  border-radius: var(--pill);
  font-size: clamp(13px, 1.3vw, 14px);
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease;
}
.nav__link:hover,
.nav__link.is-active { background: var(--accent-soft); color: var(--accent); }

.nav__cta {
  margin-left: 4px;
  padding: 11px clamp(16px, 2vw, 26px);
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: background 160ms ease;
}
.nav__cta:hover { background: var(--accent-dark); color: #fff; }

@media (max-width: 859px) {
  .nav__burger { display: flex; }
  .nav__menu {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding-top: 8px;
  }
  .nav__menu.is-open { display: flex; }
  .nav__link, .nav__cta { text-align: center; margin-left: 0; }
}

/* --------------------------------------------------------------- footer */

.footer {
  background: var(--ink);
  color: #969696;
}
.footer__grid {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(44px, 6vw, 64px) var(--pad-x) 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(28px, 4vw, 48px);
}
.footer__col { display: flex; flex-direction: column; gap: 12px; }
.footer__col:first-child { gap: 16px; }
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__brand img { width: 48px; height: 48px; object-fit: contain; }
.footer__brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.footer__brand-th { font-size: 16px; font-weight: 600; color: #fff; }
.footer__brand-en {
  font-family: var(--font-en);
  font-size: 10px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: #d4713f;
}
.footer__tagline { margin: 0; max-width: 340px; font-size: 14px; line-height: 1.8; color: #8a8a8a; }
.footer__heading {
  font-family: var(--font-en);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: #fff;
}
.footer__col a { font-size: 14px; color: #969696; }
.footer__col a:hover { color: #fff; }
.footer__social { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.footer__social a {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--pill);
  border: 1px solid #303030;
  color: #969696;
}
.footer__social a:hover { color: #fff; border-color: #606060; }
.footer__bar { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad-x) 40px; }
.footer__copy {
  border-top: 1px solid #303030;
  padding-top: 24px;
  font-family: var(--font-en);
  font-size: 12px;
  color: #666;
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 34px;
  border: none;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease;
}
.btn:hover { background: var(--accent-dark); color: #fff; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn--lg { padding: 16px 40px; font-size: 16px; }
.btn--blue { background: var(--blue); padding: 12px 22px; font-size: 14px; font-weight: 600; }
.btn--blue:hover { background: var(--blue-dark); }
.btn--ghost {
  padding: 13px 24px;
  border: 1px solid rgba(24, 24, 24, 0.16);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); background: #fff; }

/* --------------------------------------------------------------- hero */

.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  /* พื้นขาวนวลไล่ไปทางเทาอมฟ้าอ่อน ๆ ให้ต่อเนื่องกับพื้นหลังในตัววิดีโอ */
  background: linear-gradient(105deg, #ffffff 0%, #fdfdfe 46%, #eef1f6 100%);
  padding: 150px 0 110px;
}
/*
 * วิดีโอในหน้าแรก — ดันโลโก้ไปอยู่โซนขวา ไม่ให้ทับกับตัวหนังสือ
 *
 * โลโก้ทองอยู่กลางเฟรมวิดีโอพอดี (กว้าง 32%-68% ของเฟรม) ส่วนตัวหนังสือ
 * ชิดซ้ายกินถึงราว 51% ของจอ ถ้าปล่อยวิดีโอเต็มจอแบบเดิม สองอย่างจะทับกัน
 * อ่านยากทั้งคู่
 *
 * วิธีแก้: ย่อกรอบวิดีโอแล้วดันไปชิดขวา จุดกึ่งกลาง (= ตำแหน่งโลโก้)
 * จึงเลื่อนไปอยู่ราว 74% ของจอ พ้นจากตัวหนังสือ
 *
 * ขอบซ้ายของวิดีโอไล่จางด้วย mask ไม่ให้เห็นเป็นเส้นตัดตรง ๆ
 * กลืนเข้ากับพื้นเข้มฝั่งซ้ายที่เป็นที่อยู่ของตัวหนังสือ
 */
.hero__video {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: auto;
  right: -10%;
  width: 72%;

  /*
   * ขนาดโลโก้บนจอถูกกำหนดด้วย "ความสูง" ของกรอบวิดีโอ (เพราะ object-fit: cover
   * ย่อ-ขยายตามด้านที่ขาด ซึ่งกรอบนี้เตี้ยกว่าสัดส่วนวิดีโอเสมอ)
   *
   * ถ้าตั้งความสูงเป็น 100% ตายตัว พอจอแคบลงแต่ความสูงเท่าเดิม โลโก้จะกิน
   * สัดส่วนหน้าจอมากขึ้นเรื่อย ๆ จนล้นขอบและไปทับตัวหนังสือ
   * ผูกกับ vw แทน โลโก้จึงกว้างราว 40% ของจอเท่ากันทุกขนาด
   */
  height: min(100%, 62vw);
  object-fit: cover;

  /*
   * ไล่จางรอบ ๆ โลโก้ให้กลืนไปกับพื้นเข้ม ไม่ให้เห็นกรอบวิดีโอเป็นสี่เหลี่ยม
   *
   * ค่าเปอร์เซ็นต์ในนี้อิงกับ "กรอบวิดีโอ" ไม่ใช่ทั้งหน้าจอ และโลโก้อยู่
   * กึ่งกลางกรอบพอดี จุดศูนย์กลางจึงเป็น 50% 50%
   * รัศมี 52%/54% ทำให้จางหมดพอดีตรงขอบกรอบ ส่วน 56% แรกทึบไว้ให้เต็มตัวโลโก้
   */
  -webkit-mask-image: radial-gradient(52% 54% at 50% 50%, #000 56%, transparent 100%);
          mask-image: radial-gradient(52% 54% at 50% 50%, #000 56%, transparent 100%);
}
.hero__scrim {
  position: absolute;
  inset: 0;
  background:
    /* ไล่เป็นสีขาวด้านล่าง ให้ต่อเนื่องกับส่วนถัดไปของหน้า */
    linear-gradient(180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0) 62%,
      rgba(255, 255, 255, 0.80) 88%,
      #ffffff 100%),
    /* ผ้าคลุมขาวจาง ๆ ฝั่งซ้าย กันไม่ให้แสงจากโลโก้ลามมารบกวนตัวหนังสือ */
    linear-gradient(90deg,
      rgba(255, 255, 255, 0.94) 0%,
      rgba(255, 255, 255, 0.80) 32%,
      rgba(255, 255, 255, 0.16) 60%,
      rgba(255, 255, 255, 0) 76%);
}
.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
/*
 * ไม่มีกรอบและไม่มีพื้น เป็นตัวหนังสือเปล่า ๆ
 * ตัด padding ซ้ายออกด้วย ตัวอักษรจะได้เริ่มตรงแนวเดียวกับหัวเรื่องข้างล่าง
 */
.hero__badge {
  display: inline-block;
  margin-bottom: 16px;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-en);
  font-size: clamp(11px, 1.1vw, 15px);
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #834200;
  white-space: nowrap;
}
.hero__title { margin: 0; max-width: 833px; font-weight: 600; line-height: 1.28; letter-spacing: -0.5px; }
/*
 * เดิมสองบรรทัดนี้เป็นแดงอิฐกับสีขาว พร้อมเงาดำหนา ๆ เพราะฉากหลังเป็น
 * วิดีโอเต็มจอที่สีสว่าง-มืดสลับกันตลอด ต้องมีเงาช่วยให้อ่านออก
 *
 * พอเปลี่ยนพื้นหลังเป็นสีขาว บรรทัดที่ 2 ที่เป็นสีขาวจะหายไปเลย
 * จึงเปลี่ยนเป็นสีเข้ม และตัดเงาออกเพราะบนพื้นขาวเงาจะดูเลอะ
 */
.hero__line-1 {
  display: block;
  color: #a73b24;
  font-size: clamp(34px, 6.4vw, 84px);
  text-shadow: none;
}
.hero__line-2 {
  display: block;
  color: var(--ink);
  font-size: clamp(30px, 5.2vw, 68px);
  text-shadow: none;
}
.hero__actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/*
 * จอแคบ — จอไม่กว้างพอจะวางโลโก้ข้างตัวหนังสือ จึงเปลี่ยนเป็นวางบน-ล่าง
 * โลโก้อยู่ครึ่งบน ตัวหนังสืออยู่ครึ่งล่าง
 *
 * ย่อกรอบวิดีโอให้สูงแค่ครึ่งเดียว โลโก้จะได้เล็กลงและไม่โดนตัดข้าง
 * (ถ้าปล่อยเต็มจอ object-fit: cover จะซูมจนเห็นแค่กลางโลโก้)
 * ขอบล่างไล่จางด้วย mask ไม่ให้เห็นเป็นเส้นตัดกับพื้นเข้มด้านล่าง
 */
@media (max-width: 859px) {
  .hero {
    align-items: flex-end;
    padding: 120px 0 92px;
  }
  .hero__video {
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    height: 56%;
    transform: none;   /* ล้างการจัดกึ่งกลางแนวตั้งของเลย์เอาต์จอกว้าง */
    -webkit-mask-image: linear-gradient(180deg, #000 58%, transparent 100%);
            mask-image: linear-gradient(180deg, #000 58%, transparent 100%);
  }
  /* จอแคบใช้ชั้นเดียวไล่จากบนลงล่างพอ ไม่ต้องมีผ้าคลุมฝั่งซ้าย */
  .hero__scrim {
    background: linear-gradient(180deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 0) 38%,
      rgba(255, 255, 255, 0.72) 52%,
      rgba(255, 255, 255, 0.96) 62%,
      #ffffff 74%,
      #ffffff 100%);
  }
}
.hero__notice {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.hero__pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 30px;
  border-radius: var(--pill);
  background: var(--ink);
  box-shadow: 0 4px 22px rgba(24, 24, 24, 0.28);
}
.hero__dot { width: 9px; height: 9px; border-radius: var(--pill); background: var(--yellow); flex: 0 0 auto; }
.hero__pill-text { font-size: clamp(15px, 2vw, 19px); font-weight: 700; color: #fff; letter-spacing: -0.2px; }

/* ป้ายที่กดได้ (ลิงก์ไปเพจ Facebook) */
.hero__pill--link {
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.hero__pill--link:hover,
.hero__pill--link:focus-visible {
  background: #2a2a2a;
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(24, 24, 24, 0.36);
}
.hero__pill--link:hover .hero__pill-text { color: #fff; }
.hero__pill-arrow {
  font-family: var(--font-en);
  font-size: 15px;
  color: var(--yellow);
  flex: 0 0 auto;
  transition: transform 180ms ease;
}
.hero__pill--link:hover .hero__pill-arrow { transform: translate(2px, -2px); }

/* --------------------------------------------------------------- about */

.about {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(72px, 9vw, 112px) var(--pad-x) clamp(64px, 8vw, 96px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: clamp(28px, 6vw, 80px);
  align-items: start;
  /* เผื่อที่ให้แถบเมนูลอย ไม่ให้บังหัวข้อตอนกดเมนูกระโดดมาที่ส่วนนี้ */
  scroll-margin-top: 100px;
}
/* ไม่ใช้ position:sticky
   เพราะบนมือถือคอลัมน์เรียงลงมาเป็นแถวเดียว หัวข้อจะค้างอยู่กับที่
   แล้วเนื้อหาไหลผ่านข้างใต้จนอ่านทับกัน */
.about__aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.about__title {
  margin: 0;
  font-size: clamp(28px, 4.4vw, 44px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.4px;
}
.rule { display: flex; gap: 4px; }
.rule span { height: 3px; }
.rule span:nth-child(1) { width: 32px; background: var(--accent); }
.rule span:nth-child(2) { width: 14px; background: var(--yellow); }
.rule span:nth-child(3) { width: 10px; background: var(--blue); }

.about__body { display: flex; flex-direction: column; gap: 28px; }
.about__lead { margin: 0; font-size: clamp(17px, 2vw, 20px); font-weight: 500; line-height: 1.75; }
.about__text { margin: 0; font-size: 17px; line-height: 1.85; color: var(--muted); }

/* --------------------------------------------------------------- history */

.history {
  background: var(--bg-warm);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.history__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(60px, 8vw, 96px) var(--pad-x);
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 6vw, 64px);
}
.history__head { display: flex; flex-direction: column; gap: 24px; max-width: 720px; }
.history__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.3px;
}
.history__text { margin: 0; font-size: 17px; line-height: 1.85; color: var(--muted); }
.history__text strong { font-weight: 600; color: var(--ink); }

.timeline {
  max-width: 1000px;
  width: min(812px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: 0 2px 16px rgba(24, 24, 24, 0.05);
}
.timeline__label { font-size: 14px; font-weight: 600; text-align: center; }
.timeline__scroll {
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 4px 0 8px;
  cursor: grab;
  user-select: none;
}
.timeline__scroll::-webkit-scrollbar { display: none; }
.timeline__scroll.is-dragging { cursor: grabbing; }
.timeline__track {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
  padding-top: 94px;
  position: relative;
}
.timeline__rail {
  position: absolute;
  left: 0; right: 0; top: 94px;
  height: 2px;
  background: rgba(157, 66, 21, 0.28);
  pointer-events: none;
}
.timeline__item {
  flex: 0 0 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: transform 220ms cubic-bezier(.2, .7, .3, 1);
}
.timeline__item:hover { transform: translateY(-8px); }
.timeline__logo {
  position: absolute;
  top: -76px;
  width: 64px; height: 64px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.timeline__spacer { width: 100%; height: 2px; background: transparent; }
.timeline__dot {
  width: 11px; height: 11px;
  margin-top: -16px;
  border-radius: var(--pill);
  background: var(--accent);
  border: 2px solid #fff;
  box-sizing: content-box;
}
.timeline__item.is-current .timeline__dot { background: var(--yellow); }
.timeline__no { font-size: 12px; color: var(--muted-3); }
.timeline__org { font-size: 12px; line-height: 1.55; color: var(--muted); text-align: center; padding: 0 8px; }

/* --------------------------------------------------------------- page head */

.pagehead {
  padding: clamp(150px, 18vw, 200px) var(--pad-x) clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--line-soft);
  background: #f4f4f4;
}
.pagehead__title {
  margin: 0;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-align: center;
}
.pagehead__sub {
  margin: 12px auto 0;
  max-width: 640px;
  font-size: clamp(15px, 1.8vw, 18px);
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}

/* --------------------------------------------------------------- people cards */

.photo {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
  background: #eef1f6;
}
/* ขนาดและตำแหน่งมาจาก style ที่ bb_photo() ใส่ให้ทีละรูป
   (width/height เป็น % ของกรอบ, left/top คือจุดกึ่งกลางของรูป)
   translate(-50%,-50%) ทำให้ left/top หมายถึงจุดกึ่งกลาง ไม่ใช่มุมซ้ายบน */
.photo img {
  position: absolute;
  max-width: none;          /* กัน img{max-width:100%} ที่ตั้งไว้ส่วนกลางมาบีบรูป */
  transform: translate(-50%, -50%);
  display: block;
}
.photo--empty { aspect-ratio: 1 / 1; width: 100%; background: #eef1f6; }

.person {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}
.person__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 16px 18px;
}
.person__name { font-size: 16px; font-weight: 600; color: var(--ink); }
.person__role { font-size: 13px; font-weight: 500; color: var(--accent); }
.person__org  { font-size: 13px; color: var(--muted-3); }

/* --------------------------------------------------------------- management */

.section {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--pad-x) clamp(52px, 7vw, 80px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.section--top { padding-top: clamp(150px, 20vw, 190px); }
.section__title { margin: 0; font-size: 28px; font-weight: 600; }

.people-rows { display: flex; flex-direction: column; gap: 48px; }
.people-rows--tight { gap: 28px; }
.people-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 48px;
}
.people-row--tight { gap: 20px; }
.people-row .person { width: clamp(180px, 42vw, 232px); }
.people-row--tight .person { width: clamp(160px, 30vw, 232px); }

.person--org .person__body {
  min-height: 56px;
  gap: 4px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.person--org .person__name { font-size: 15px; font-weight: 700; line-height: 1.45; color: #1d2b45; }
.person--org .person__role { font-size: 13px; font-weight: 500; line-height: 1.5; color: #5a6478; }
.person--org .person__org  { font-size: 13px; font-weight: 500; line-height: 1.5; color: #8a93a5; }

.people-row .person__body { text-align: center; }

/* --------------------------------------------------------------- departments */

.dept-search {
  position: fixed;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  width: calc(100% - 48px);
  max-width: 560px;
}
.dept-search__box { position: relative; z-index: 20; width: 100%; }
.dept-search__input {
  width: 100%;
  height: 50px;
  padding: 0 20px;
  border-radius: var(--pill);
  border: 1px solid rgba(24, 24, 24, 0.16);
  background: #fff;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  box-shadow: 0 6px 24px rgba(24, 24, 24, 0.12);
}
.dept-search__input:focus { border-color: var(--accent); }
.dept-search__drop {
  display: none;
  position: absolute;
  top: 58px; left: 0; right: 0;
  max-height: 340px;
  overflow-y: auto;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(24, 24, 24, 0.12);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  text-align: left;
}
.dept-search__drop.is-open { display: flex; }
.dept-search__drop a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}
.dept-search__drop a:hover,
.dept-search__drop a.is-cursor { background: var(--accent-soft); color: var(--accent); }
.dept-search__drop a[hidden] { display: none; }
.dept-search__empty { padding: 14px; font-size: 14px; color: var(--muted-3); }

.depts {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(48px, 7vw, 80px) var(--pad-x) clamp(64px, 8vw, 96px);
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 5vw, 60px);
}
.dept { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: 160px; }
.dept__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.dept__name { margin: 0; font-size: clamp(24px, 3.2vw, 34px); font-weight: 600; color: var(--blue); }
.dept__desc { margin: 0; max-width: 820px; font-size: 18px; line-height: 1.8; color: var(--muted); }
.dept__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}
.dept__people { display: flex; flex-wrap: wrap; gap: 16px; }
.dept__people .person { flex: 1 1 44%; min-width: 0; max-width: 232px; }
.dept__people .person__name { font-size: 19px; font-weight: 700; line-height: 1.45; color: #1d2b45; }
.dept__people .person__role { font-size: 16px; line-height: 1.5; color: #5a6478; }
.dept__duties { display: flex; flex-direction: column; gap: 10px; }
.dept__duties-title { font-size: 16px; font-weight: 600; }
.duty { display: flex; gap: 10px; align-items: flex-start; }
.duty::before {
  content: '';
  flex: 0 0 auto;
  width: 7px; height: 7px;
  margin-top: 10px;
  border-radius: var(--pill);
  background: var(--accent);
}
.duty span { font-size: 17px; line-height: 1.75; color: #4a4a4a; }

.dept.is-flash { animation: deptFlash 1.4s ease; }
@keyframes deptFlash {
  0%, 100% { background: transparent; box-shadow: 0 0 0 0 transparent; }
  15%      { background: rgba(157, 66, 21, 0.08); box-shadow: 0 0 0 2px rgba(157, 66, 21, 0.35); }
}

/* --------------------------------------------------------------- q&a */

.faqs {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) var(--pad-x) clamp(64px, 8vw, 96px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr));
  gap: clamp(16px, 2.4vw, 24px);
}
.faq {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(22px, 3vw, 30px);
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}
.faq__row { display: flex; align-items: flex-start; gap: 14px; }
.faq__row--q { padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.faq__mark {
  flex: 0 0 auto;
  width: 36px; height: 36px;
  border-radius: var(--pill);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-size: 15px;
  font-weight: 700;
}
.faq__mark--q { background: var(--accent); color: #fff; }
.faq__mark--a { background: rgba(0, 74, 173, 0.10); color: var(--blue); }
.faq__q {
  margin: 0;
  padding-top: 2px;
  font-size: clamp(17px, 2vw, 19px);
  font-weight: 600;
  line-height: 1.6;
  color: var(--ink);
}
.faq__body { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.faq__a { margin: 0; font-size: 16px; line-height: 1.8; color: var(--muted); }
.faq__link { align-self: flex-start; font-size: 14px; font-weight: 600; }

/* --------------------------------------------------------------- calendar */

.agenda {
  --agenda-dot: 44px;                       /* ขนาดวงกลมตัวเลข */
  --agenda-gap: clamp(18px, 3vw, 26px);     /* ระยะห่างระหว่างการ์ด */
  --agenda-pad: clamp(18px, 3vw, 24px);     /* ขอบในด้านบนของการ์ด */
  --agenda-date: clamp(20px, 2.8vw, 26px);  /* ขนาดตัวอักษรวันที่ */
  /* ดันวงกลมลงให้กึ่งกลางตรงกับบรรทัดวันที่พอดีทุกขนาดจอ
     = ขอบใน + ครึ่งหนึ่งของความสูงบรรทัดวันที่ + เส้นขอบการ์ด 1px − ครึ่งหนึ่งของวงกลม */
  --agenda-offset: calc(var(--agenda-pad) + var(--agenda-date) * 1.35 / 2 + 1px - var(--agenda-dot) / 2);
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) var(--pad-x) clamp(64px, 8vw, 96px);
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--agenda-gap);
}
.agenda__item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2.6vw, 24px);
}
/* เส้น timeline: ลากจากใต้วงกลมของขั้นนี้ ลงไปจนถึงวงกลมของขั้นถัดไป */
.agenda__item:not(:last-child)::before {
  content: '';
  position: absolute;
  top: calc(var(--agenda-offset) + var(--agenda-dot));
  bottom: calc(-1 * (var(--agenda-gap) + var(--agenda-offset)));
  left: calc(var(--agenda-dot) / 2 - 1px);
  width: 2px;
  background: rgba(157, 66, 21, 0.18);
}
.agenda__item--done:not(:last-child)::before { background: var(--accent); }

.agenda__marker {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  width: var(--agenda-dot);
  height: var(--agenda-dot);
  margin-top: var(--agenda-offset);
  border-radius: var(--pill);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 2px solid var(--accent);
  font-family: var(--font-en);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.agenda__item--done .agenda__marker,
.agenda__item--now .agenda__marker { background: var(--accent); color: #fff; }
.agenda__item--now .agenda__marker { box-shadow: 0 0 0 6px rgba(157, 66, 21, 0.16); }

.agenda__card {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: var(--agenda-pad) clamp(20px, 3vw, 28px);
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
}
.agenda__item--now .agenda__card { border-color: rgba(157, 66, 21, 0.4); box-shadow: 0 10px 30px rgba(157, 66, 21, 0.12); }
.agenda__item--done .agenda__card { opacity: 0.72; }
.agenda__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.agenda__date { margin: 0; font-size: var(--agenda-date); font-weight: 700; line-height: 1.35; color: var(--accent); }
.agenda__badge {
  padding: 4px 12px;
  border-radius: var(--pill);
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.agenda__badge--done { background: rgba(24, 24, 24, 0.07); color: var(--muted-2); }
.agenda__title { margin: 0; font-size: clamp(16px, 2.2vw, 19px); font-weight: 600; line-height: 1.6; color: var(--ink); }

@media (max-width: 520px) {
  .agenda { --agenda-dot: 36px; }
  .agenda__marker { font-size: 14px; }
}

/* --------------------------------------------------------------- forms */

.form-page {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(110px, 14vw, 150px) var(--pad-x) clamp(64px, 8vw, 96px);
}
.form-page__title {
  margin: 0 0 28px;
  font-size: clamp(20px, 20vw, 30px);
  padding: 0px 50px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.6px;
}
.form { display: flex; flex-direction: column; gap: 28px; }

.card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 40px);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-bottom: 1px solid rgba(24, 24, 24, 0.12);
  padding-bottom: 16px;
}
.card__title { margin: 0; font-size: clamp(21px, 3vw, 26px); font-weight: 600; }

.grid-1 { display: grid; grid-template-columns: 1fr; gap: 20px; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 20px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink); }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(24, 24, 24, 0.18);
  border-radius: 12px;
  font-size: 15px;
  color: var(--ink);
  outline: none;
  background: #fff;
}
.field input, .field select { height: 48px; }
.field input { padding: 0 16px; }
.field select { padding: 0 12px; }
.field textarea { padding: 14px 16px; line-height: 1.7; resize: vertical; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); }
.field input:invalid:not(:placeholder-shown) { border-color: var(--accent); }
.field[hidden] { display: none; }

.note {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid rgba(0, 74, 173, 0.22);
  border-radius: 18px;
  background: rgba(0, 74, 173, 0.04);
}
.note[hidden] { display: none; }
.note__title { font-size: 14px; font-weight: 700; color: var(--blue); }
.note__text { font-size: 14px; line-height: 1.75; color: #4a4a4a; }
.note .btn { align-self: flex-start; }

.confirm {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  cursor: pointer;
}
.confirm input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.confirm__text { display: flex; flex-direction: column; gap: 4px; }
.confirm__title { font-size: 15px; font-weight: 600; }
.confirm__desc { font-size: 14px; line-height: 1.7; color: var(--muted-2); }

.form__actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form__status { font-size: 14px; color: var(--accent); }

/* --------------------------------------------------------------- alerts */

.alert {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 22px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.75;
}
.alert--error {
  border: 1px solid rgba(157, 66, 21, 0.28);
  background: rgba(157, 66, 21, 0.06);
  color: var(--accent);
}
.alert--ok {
  border: 1px solid rgba(12, 122, 69, 0.28);
  background: rgba(12, 122, 69, 0.07);
  color: var(--green);
}
.alert ul { margin: 0; padding-left: 20px; }
.alert__title { font-weight: 700; }

/* --------------------------------------------------------------- status */

.status-head {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(110px, 14vw, 150px) var(--pad-x) 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.status-head h1 {
  margin: 0;
  font-size: clamp(30px, 5.4vw, 50px);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-align: center;
}
.status-head p {
  margin: 0 auto;
  max-width: 600px;
  font-size: 17px;
  line-height: 1.8;
  color: var(--muted);
  text-align: center;
}
.status-search { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.status-search input {
  flex: 1 1 300px;
  min-width: 0;
  height: 56px;
  padding: 0 20px;
  border: 1px solid rgba(24, 24, 24, 0.18);
  border-radius: var(--pill);
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
.status-search input:focus { border-color: var(--accent); }
.status-search button { height: 56px; padding: 0 34px; }

/* ช่องเบอร์โทรที่ใช้ยืนยันตัวตน แคบกว่าช่องรหัสนักศึกษาเล็กน้อย */
.status-search #sphone { flex: 1 1 200px; }

/* คำอธิบายว่าทำไมต้องกรอกเบอร์โทรด้วย */
.status-note {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted-2);
}

.status-body {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px var(--pad-x) clamp(64px, 8vw, 96px);
}
.status-idle {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--bg-warm);
  padding: clamp(28px, 5vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.status-idle__title { font-size: 19px; font-weight: 600; }
.status-idle__text { font-size: 16px; line-height: 1.75; color: var(--muted-2); }

.result { border: 1px solid rgba(24, 24, 24, 0.12); border-radius: var(--radius); overflow: hidden; }
.result__head {
  background: var(--ink);
  padding: clamp(24px, 4vw, 34px);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}
.result__id { display: flex; flex-direction: column; gap: 6px; }
.result__eyebrow {
  font-family: var(--font-en);
  font-size: 11px; font-weight: 600;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--yellow);
}
.result__name { font-size: clamp(21px, 3vw, 28px); font-weight: 600; color: #fff; }
.result__sid { font-size: 15px; color: var(--muted-4); }
.result__badge {
  padding: 9px 18px;
  border-radius: var(--pill);
  font-size: 14px;
  font-weight: 600;
  background: rgba(252, 204, 20, 0.18);
  color: var(--yellow);
}
.result__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1px;
  background: var(--line);
}
.fact { background: #fff; padding: 24px; display: flex; flex-direction: column; gap: 6px; }
.fact__label { font-size: 14px; color: var(--muted-3); }
.fact__value { font-size: 18px; font-weight: 600; }

.result__block {
  padding: clamp(24px, 4vw, 34px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--line);
}
.result__block-title { font-size: 17px; font-weight: 600; }
.choice {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid rgba(24, 24, 24, 0.08);
}
.choice__rank {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: var(--pill);
  font-size: 13px;
  font-weight: 700;
}
.choice__rank--1 { background: rgba(157, 66, 21, 0.12); color: var(--accent); }
.choice__rank--2 { background: rgba(0, 74, 173, 0.12); color: var(--blue); }
.choice__rank--3 { background: rgba(24, 24, 24, 0.08); color: var(--muted); }
.choice__name { font-size: 17px; font-weight: 600; }

.result__vehicles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
}
.vehicle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-warm);
}
.vehicle__label { font-size: 14px; color: var(--muted-3); }
.vehicle__value { font-size: 17px; font-weight: 600; }

.result__drive { background: rgba(0, 74, 173, 0.04); gap: 12px; }
.result__drive .result__block-title { color: var(--blue); font-weight: 700; }
.result__drive p { margin: 0; font-size: 16px; line-height: 1.75; color: #4a4a4a; }
.result__drive .btn { align-self: flex-start; font-size: 15px; }

/* --------------------------------------------------------------- closed */

.closed {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(140px, 18vw, 190px) var(--pad-x) clamp(64px, 8vw, 96px);
}
.closed__card {
  max-width: 600px;
  width: 100%;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(28px, 5vw, 44px);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.closed__icon {
  width: 64px; height: 64px;
  border-radius: var(--pill);
  background: rgba(157, 66, 21, 0.08);
  border: 1px solid rgba(157, 66, 21, 0.24);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.closed__title { margin: 0; font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; color: var(--accent); }
.closed__text { margin: 0; font-size: 16px; line-height: 1.8; color: var(--muted); }

/* --------------------------------------------------------------- news */

/* ข่าวสารล่าสุดในหน้าแรก — อยู่ใต้ส่วน history ที่มีเส้นขอบล่างอยู่แล้ว จึงไม่ใส่เส้นบนซ้ำ */
.home-news { padding-bottom: clamp(52px, 7vw, 88px); scroll-margin-top: 100px; }
.home-news__inner {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(60px, 8vw, 96px) var(--pad-x) clamp(20px, 3vw, 28px);
}
.home-news__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}
.home-news__heading { display: flex; flex-direction: column; gap: 14px; }
.home-news__title {
  margin: 0;
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.3px;
}

/* การ์ดข่าวไหลวนไม่รู้จบ
   ในแถวมีการ์ด 2 ชุดเหมือนกัน เลื่อนไป -50% พอดีหนึ่งชุดแล้วเริ่มใหม่ ภาพตอนเริ่มกับตอนจบจึงตรงกัน
   ระยะห่างใช้ margin-right แทน gap ไม่งั้นชุดที่สองจะเหลื่อมไปครึ่งช่อง รอยต่อจะกระตุก */
.news-marquee {
  overflow: hidden;
  padding: 6px 0 22px;   /* เผื่อเงาการ์ดไม่ให้โดนตัด */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 4%, #000 96%, transparent);
}
.news-marquee__track {
  display: flex;
  width: max-content;
  animation: newsMarquee calc(var(--marquee-cards, 8) * 8s) linear infinite;
}
.news-marquee .news-card { flex: 0 0 clamp(260px, 26vw, 340px); margin-right: clamp(16px, 2vw, 24px); }
.news-marquee:hover .news-marquee__track,
.news-marquee:focus-within .news-marquee__track { animation-play-state: paused; }
@keyframes newsMarquee { to { transform: translateX(-50%); } }

/* ผู้ใช้ที่ตั้งเครื่องให้ลดการเคลื่อนไหว: ไม่ไหลเอง แสดงชุดเดียวแล้วปัดเลื่อนดูเอา */
@media (prefers-reduced-motion: reduce) {
  .news-marquee { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
  .news-marquee__track { animation: none; padding: 0 var(--pad-x); }
  .news-marquee .news-card[aria-hidden="true"] { display: none; }
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(18px, 2.4vw, 26px);
}
/* ไม่ขยับการ์ดตอน hover เพราะ .reveal.is-visible คุม transform อยู่ ใช้เงากับซูมรูปแทน */
.news-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
.news-card:hover { color: var(--ink); box-shadow: 0 12px 32px rgba(24, 24, 24, 0.12); }
.news-card__media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--accent-soft); }
.news-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 400ms ease;
}
.news-card:hover .news-card__media img { transform: scale(1.04); }
/* ไม่มีรูปปก → พื้นสีอ่อนพร้อมโลโก้โครงการ */
.news-card__media--empty { background: var(--accent-soft) url('../img/logo.png') center / 64px no-repeat; }
.news-card__body { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 22px; }
.news-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 13px;
  color: var(--muted-3);
}
.news-card__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
  transition: color 160ms ease;
}
.news-card:hover .news-card__title { color: var(--accent); }
.news-card__excerpt { margin: 0; font-size: 15px; line-height: 1.75; color: var(--muted); overflow-wrap: anywhere; }
.news-card__more { margin-top: auto; padding-top: 4px; font-size: 14px; font-weight: 600; color: var(--accent); }

.news-pin {
  padding: 3px 10px;
  border-radius: var(--pill);
  background: rgba(252, 204, 20, 0.22);
  color: #7a5c00;
  font-size: 12px;
  font-weight: 700;
}

/* หน้ารวมข่าวสาร */
.news-page {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 72px) var(--pad-x) clamp(64px, 8vw, 96px);
  display: flex;
  flex-direction: column;
  gap: clamp(28px, 4vw, 40px);
}
.news-empty { margin: 0; padding: 48px 20px; font-size: 16px; text-align: center; color: var(--muted-3); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; }
.pager__info { font-size: 14px; color: var(--muted-2); }

/* หน้าอ่านโพสต์ */
.post {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(130px, 16vw, 170px) var(--pad-x) clamp(64px, 8vw, 96px);
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3vw, 30px);
}
.post__head { display: flex; flex-direction: column; gap: 14px; }
.post__back { align-self: flex-start; font-size: 14px; font-weight: 600; }
.post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  font-size: 14px;
  color: var(--muted-3);
}
.post__title {
  margin: 0;
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.3px;
  overflow-wrap: anywhere;
}
.post__cover { margin: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--accent-soft); }
.post__cover img { width: 100%; display: block; }
.post__body { font-size: 17px; line-height: 1.9; color: var(--ink-2); overflow-wrap: anywhere; }
.post__body a { text-decoration: underline; text-underline-offset: 3px; }
.post__foot { padding-top: 20px; border-top: 1px solid var(--line-soft); }

/* --------------------------------------------------------------- reveal */

/* ซ่อนไว้รอ fade เฉพาะเมื่อ JavaScript ทำงานเท่านั้น (คลาส .js ใส่โดยสคริปต์ใน header)
   ถ้า JS พัง/ถูกปิด เนื้อหาจะแสดงตามปกติ ไม่หายไปทั้งส่วน */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 750ms cubic-bezier(0.22, 1, 0.36, 1),
              transform 750ms cubic-bezier(0.22, 1, 0.36, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

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

