/* ==========================================================
   header.css — Sticky header, logo, navigation
   Always loaded on every page.
   ========================================================== */

/* ── Sticky header wrapper ────────────────────────────────── */
/*
 * The FSE template-part <header> is the correct sticky target.
 * It wraps the full header content and spans the viewport width.
 */
header.wp-block-template-part {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 244, 240, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e4e0da;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

/* Admin bar offset */
.admin-bar header.wp-block-template-part {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar header.wp-block-template-part {
    top: 46px;
  }
}

/* Inner header bar — layout only, background comes from the wrapper */
/*
 * max-width + margin:auto centres the logo/nav content at 1280px
 * while header.wp-block-template-part keeps the full-width frosted background.
 */
.site-header {
  max-width: 1280px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0.875rem 2rem !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: none !important;
  box-shadow: none !important;
}

/* ── Header logo ──────────────────────────────────────────── */
/* display:block removes the inline baseline gap that offsets the img vertically */
.site-logo-img {
  display: block;
  height: auto;
}

/* ── Custom navigation — desktop ─────────────────────────── */
.custom-site-nav {
  display: flex;
  align-items: center;
}

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-desktop a {
  color: #716c67;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  font-family: "Noto Sans TC", "PingFang TC", sans-serif;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-desktop a:hover {
  color: #2d2a27;
}

/* ── Hamburger button ─────────────────────────────────────── */
.nav-toggle {
  display: none; /* hidden on desktop */
  background: none;
  border: none;
  cursor: pointer;
  color: #2d2a27;
  padding: 0;
  line-height: 0;
  align-items: center;
  justify-content: center;
}

/* ── Mobile dropdown ──────────────────────────────────────── */
/*
 * position: absolute pulls the dropdown out of document flow so it
 * overlays the hero instead of pushing it down.
 * top: 100% pins it flush to the bottom of the sticky header bar.
 * The containing block is header.wp-block-template-part (position:sticky).
 */
.nav-mobile-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  background: rgba(246, 244, 240, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid #e4e0da;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 99;
}

.nav-mobile-dropdown.is-open {
  display: flex;
}

.nav-mobile-dropdown a {
  display: block;
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  font-family: "Noto Serif TC", Georgia, serif;
  color: #2d2a27;
  text-decoration: none;
  border-bottom: 1px solid #e4e0da;
  transition: color 0.2s;
}

.nav-mobile-dropdown a:last-child {
  border-bottom: none;
}

.nav-mobile-dropdown a:hover {
  color: #c49a3c;
}

/* ── Responsive ───────────────────────────────────────────── */
/* < 1024px: switch to hamburger */
@media (max-width: 1023px) {
  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }
}

@media (max-width: 1024px) {
  .site-header {
    padding: 0.75rem 1.5rem !important;
  }
}

@media (max-width: 768px) {
  .site-header {
    padding: 0.75rem 1.25rem !important;
  }

  .nav-mobile-dropdown a {
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 0.75rem 1rem !important;
  }

  .nav-mobile-dropdown a {
    padding: 1rem;
  }
}
