/* ==========================================================================
   header.css — Header หลัก (includes/header.php)
   แถบเมนูสีขาวทรงแคปซูล ลอยทับขอบบนของแบนเนอร์ (fixed)
   ========================================================================== */

.site-header {
  position: fixed;
  top: 22px;
  left: 0;
  right: 0;
  z-index: 100;
  padding-inline: calc(var(--gutter) + 12px);
  pointer-events: none;
  transition: top .3s var(--ease);
}
.site-header.is-scrolled { top: 12px; }

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
  max-width: 1120px;
  min-height: 64px;
  margin-inline: auto;
  padding: 0.45rem 0.55rem 0.45rem 1rem;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 8px 30px -12px rgb(20 20 20 / 0.28);
  pointer-events: auto;
  transition: box-shadow .3s var(--ease);
}
.site-header.is-scrolled .site-header__inner { box-shadow: 0 12px 36px -10px rgb(20 20 20 / 0.35); }

/* โลโก้ */
.brand { display: flex; align-items: center; gap: 0.65rem; justify-self: start; text-decoration: none; }
.brand__logo { width: 46px; height: 46px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-size: 0.9375rem; font-weight: 700; color: var(--black); }
.brand__sub { font-size: 0.75rem; color: var(--gray-500); }

/* เมนู */
.site-nav__list { display: flex; align-items: center; gap: 0.25rem; }
.site-nav__link {
  position: relative;
  display: block;
  padding: 0.55rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s;
}
.site-nav__link:hover { color: var(--black); }
.site-nav__link[aria-current="page"] { color: var(--black); font-weight: 700; }
.site-nav__link[aria-current="page"]::after { content: ""; position: absolute; left: 50%; bottom: 0.1rem; width: 5px; height: 5px; margin-left: -2.5px; background: var(--brand); border-radius: 50%; }

/* สลับภาษา + ปุ่ม */
.site-header__actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }

.lang-switch { display: inline-flex; align-items: center; height: 38px; padding: 0 0.35rem; }
.lang-switch a { padding: 0.1rem 0.45rem; font-size: 0.8125rem; font-weight: 700; color: var(--gray-500); text-decoration: none; }
.lang-switch a + a { border-left: 1px solid var(--gray-300); }
.lang-switch a:hover, .lang-switch a[aria-current] { color: var(--black); }

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--white);
  background: var(--black);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.nav-toggle .icon { width: 1.3rem; height: 1.3rem; }
.nav-toggle__close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle__close { display: block; }

@media (max-width: 1199px) {
  .brand__text { display: none; }
  /* คอลัมน์ข้างไม่ต้องกว้างเท่ากัน → เมนูมีที่พอบนแล็ปท็อป/แท็บเล็ตแนวนอน */
  .site-header__inner { grid-template-columns: auto 1fr auto; }
  .site-nav { justify-self: center; }
}

/* มือถือ / แท็บเล็ต: เมนูพับใต้แถบ */
@media (max-width: 991px) {
  :root { --header-h: 60px; }
  .site-header { top: 14px; padding-inline: calc(var(--gutter) + 4px); }
  .site-header__inner { grid-template-columns: 1fr auto; min-height: 58px; position: relative; }
  .brand__logo { width: 42px; height: 42px; }
  .lang-switch { height: 44px; }
  .lang-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 100%; }
  .nav-toggle { display: inline-flex; }

  .site-nav {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    justify-self: stretch;
    padding: 0.75rem;
    background: var(--white);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 110px);
    max-height: calc(100dvh - 110px);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
  }
  .site-nav.is-open { visibility: visible; opacity: 1; transform: none; }
  .site-nav__list { flex-direction: column; align-items: stretch; gap: 0.1rem; }
  .site-nav__link { padding: 0.8rem 1rem; font-size: 1.0625rem; border-radius: 12px; }
  .site-nav__link[aria-current="page"] { background: var(--tint); }
  .site-nav__link[aria-current="page"]::after { display: none; }
}
@media (max-width: 375px) {
  .site-header { top: 10px; padding-inline: calc(var(--gutter) + 2px); }
  .site-header__inner { gap: 0.5rem; padding-left: 0.6rem; }
  .lang-switch { padding: 0; }
}
