/* Site-wide header — ported from the React reference site
   (SiteNav.jsx + NavSearch.jsx), same tokens as assets/guides.css but
   scoped under #ms-shead so nothing here can leak into the rest of the
   site or the theme. Loads on every front-end page (see includes/header.php). */

#ms-shead {
  --blue: #19639A; --blue-700: #124b76; --blue-50: #eef5fb; --blue-100: #d8e7f4;
  --orange: #ED804B; --orange-hover: #E0703A; --orange-600: #B8531F;
  --ink: #111827; --text: #1F2937; --muted: #4B5563; --soft: #6B7280;
  --line: #E5E7EB; --gray-50: #F9FAFB; --gray-100: #F3F4F6; --page: #ffffff; --card: #ffffff;
  --dark-2: #1F2937;
  --r-sm: 8px; --r-lg: 18px;
  --sh: 0 1px 2px rgba(17,24,39,.05);
  --sh-lg: 0 26px 60px -24px rgba(17,24,39,.28);
  --h: 'Plus Jakarta Sans', system-ui, sans-serif;
  --shell: 1240px;
  font-family: var(--h);
}
#ms-shead * { box-sizing: border-box; }
#ms-shead a { text-decoration: none; }
#ms-shead .mshin { width: 100%; max-width: var(--shell); margin: 0 auto; padding-inline: 20px; }

/* utility bar */
.mshb { background: var(--dark-2); color: rgba(255,255,255,.74); font-size: 12.5px; }
.mshb__in { width: 100%; max-width: var(--shell); margin: 0 auto; padding-inline: 20px; display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 9px; }
.mshb__in b { color: #fff; font-weight: 600; }
.mshb__in a { color: inherit; }
.mshb__mail { color: var(--orange); font-weight: 500; }
.mshb__right { display: flex; gap: 18px; align-items: center; }

/* main nav */
.mshn { position: sticky; top: 0; z-index: 999; background: var(--page); border-bottom: 1px solid var(--line); }
.mshn__in { width: 100%; max-width: var(--shell); margin: 0 auto; padding-inline: 20px; display: flex; align-items: center; gap: 12px; padding-block: 12px; }

.mshn__brand { display: flex; align-items: center; gap: 10px; color: var(--ink); flex: none; }
.mshn__brand img { object-fit: contain; border-radius: 6px; }
.mshn__brand span { font-family: var(--h); font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--ink); }

.mshn__links { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.mshn__links > a, .mshn__dropbtn {
  padding: 9px 11px; border-radius: var(--r-sm);
  font-family: var(--h); font-size: 14.5px; font-weight: 500; color: var(--text); white-space: nowrap;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.mshn__links > a:hover, .mshn__dropbtn:hover { background: var(--gray-100); color: var(--text); }
.mshn__links > a[data-active="true"], .mshn__dropbtn[data-active="true"] { color: var(--blue); }
.mshn__caret { opacity: .72; transition: transform 180ms ease; }
.mshn__drop.is-open .mshn__caret { transform: rotate(180deg); }

.mshn__drop { position: relative; }
.mshn__mega {
  display: none; position: absolute; top: 100%; left: 0; padding-top: 10px; width: 560px; max-width: 82vw; z-index: 40;
  grid-template-columns: 1fr 1fr; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-lg); padding: 12px;
}
.mshn__drop.is-open .mshn__mega, .mshn__drop:hover .mshn__mega { display: grid; animation: msh-up 160ms ease both; }
.mshn__megaitem { display: block; min-width: 0; white-space: normal; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text); }
.mshn__megaitem:hover { background: var(--gray-100); }
.mshn__megat { display: block; font-size: 14px; font-weight: 600; font-family: var(--h); line-height: 1.35; color: var(--ink); }
.mshn__megap { display: block; font-size: 12px; color: var(--soft); margin-top: 2px; }
.mshn__megaall { grid-column: 1 / -1; margin-top: 6px; padding: 11px 12px; border-radius: var(--r-sm); background: var(--blue-50); color: var(--blue-700); font-size: 13.5px; font-weight: 600; font-family: var(--h); text-align: center; }

.mshn__icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid var(--line); background: var(--card); border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink); margin-left: 8px;
}
.mshn__icon:hover { border-color: var(--orange); color: var(--orange-600); }
.mshn__searchbtn { display: none; }

.mshn__auth { display: flex; gap: 8px; align-items: center; flex: none; margin-left: 8px; }
.mshn__login, .mshn__signup { font-family: var(--h); font-weight: 600; font-size: 14.5px; cursor: pointer; white-space: nowrap; border-radius: var(--r-sm); }
.mshn__login { border: 1px solid var(--line); background: var(--card); color: var(--ink); padding: 10px 16px; }
.mshn__login:hover { border-color: var(--blue); color: var(--blue); }
.mshn__signup { border: 0; background: var(--orange); color: var(--ink); padding: 11px 18px; font-weight: 700; box-shadow: var(--sh); transition: background 160ms ease, transform 160ms ease; }
.mshn__signup:hover { background: var(--orange-hover); color: var(--ink); transform: translateY(-1px); }

/* live search */
.mshsearch { position: relative; flex: 1; min-width: 0; max-width: 420px; }
.mshsearch__form {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); background: var(--gray-50);
  border-radius: 999px; padding: 9px 14px; transition: border-color 160ms ease;
}
.mshsearch.is-open .mshsearch__form { border-color: var(--blue); }
.mshsearch__form svg { flex: none; stroke: var(--soft); }
.mshsearch__form input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14.5px; color: var(--ink); font-family: var(--h); }
.mshsearch__clear { flex: none; border: 0; background: none; padding: 0; color: var(--soft); cursor: pointer; line-height: 1; display: flex; }
.mshsearch__panel {
  position: absolute; top: calc(100% + 9px); left: 0; right: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--sh-lg); overflow: hidden; max-height: 66vh; overflow-y: auto; z-index: 70;
  animation: msh-up 150ms ease both;
}
.mshp-kicker { margin: 0; padding: 11px 16px; background: var(--gray-50); border-bottom: 1px solid var(--line); font-family: var(--h); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--soft); }
.mshp-row { display: flex; gap: 12px; align-items: center; padding: 11px 16px; color: var(--text); border-bottom: 1px solid var(--gray-100); }
.mshp-row:hover { background: var(--gray-50); }
.mshp-row__img { flex: none; width: 38px; height: 38px; border-radius: 8px; overflow: hidden; background: var(--gray-100); }
.mshp-row__img img { width: 100%; height: 100%; object-fit: cover; }
.mshp-row__t { flex: 1; min-width: 0; }
.mshp-row__title { display: block; font-family: var(--h); font-weight: 600; font-size: 14.5px; color: var(--ink); }
.mshp-row__meta { display: block; font-size: 12.5px; color: var(--soft); }
.mshp-seeall { display: block; padding: 12px 16px; font-family: var(--h); font-weight: 600; font-size: 13.5px; color: var(--blue); }
.mshp-trend { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: none; padding: 11px 16px; border-bottom: 1px solid var(--gray-100); cursor: pointer; color: var(--ink); font-size: 14.5px; font-family: var(--h); }
.mshp-trend svg { flex: none; stroke: var(--orange-600); }
.mshp-empty { padding: 26px 16px; text-align: center; }
.mshp-empty__t { margin: 0 0 6px; font-family: var(--h); font-weight: 700; font-size: 15.5px; color: var(--ink); }
.mshp-empty__p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.mshp-empty a { font-family: var(--h); font-weight: 600; font-size: 13.5px; color: var(--blue); }

/* mobile burger drawer */
.mshn__burger { display: none; }
.mshn__mobile { display: none; }
.mshn__mobile[data-open] { display: block; border-top: 1px solid var(--line); background: var(--card); padding: 14px 20px 20px; animation: msh-up 180ms ease both; }
.mshn__mobile a { display: block; padding: 13px 12px; border-radius: var(--r-sm); font-family: var(--h); font-weight: 600; font-size: 16px; color: var(--text); border-bottom: 1px solid var(--gray-100); }
.mshn__mrow { display: flex; align-items: stretch; border-bottom: 1px solid var(--gray-100); }
.mshn__mrow a { flex: 1; border-bottom: 0; }
.mshn__mcaret { display: flex; align-items: center; justify-content: center; width: 44px; background: none; border: 0; color: var(--soft); cursor: pointer; }
.mshn__mcaret svg { transition: transform 180ms ease; }
.mshn__mcaret[aria-expanded="true"] svg { transform: rotate(180deg); }
.mshn__msub { display: none; grid-gap: 2px; padding: 4px 0 10px 14px; }
.mshn__msub[data-open] { display: grid; animation: msh-up 160ms ease both; }
.mshn__msub a { font-size: 14.5px; padding: 9px 10px; color: var(--muted); border-bottom: 0; }
.mshn__mauth { display: flex; gap: 10px; margin-top: 16px; }
.mshn__mauth a { flex: 1; text-align: center; border-bottom: 0; }

/* full-screen search modal (mobile) */
.mshmodal[data-open] {
  position: fixed; inset: 0; z-index: 1000; background: rgba(17,24,39,.55);
  animation: msh-in 140ms ease both; padding: 16px; overflow: auto;
}
.mshmodal:not([data-open]) { display: none; }
.mshmodal__box { max-width: 620px; margin: 8vh auto 0; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--sh-lg); overflow: hidden; animation: msh-up 180ms ease both; }
.mshmodal__form { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.mshmodal__form svg { flex: none; stroke: var(--soft); }
.mshmodal__form input { flex: 1; min-width: 0; border: 0; outline: none; font-size: 16.5px; background: none; color: var(--ink); font-family: var(--h); }
.mshmodal__esc { border: 1px solid var(--line); background: var(--card); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12px; color: var(--soft); cursor: pointer; }
.mshmodal__panel { max-height: 60vh; overflow-y: auto; }

@keyframes msh-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes msh-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 900px) {
  .mshb__right .mshb__wa { display: none; }
  .mshn__links, .mshn__auth { display: none; }
  .mshn__burger { display: grid; }
}
@media (max-width: 759px) {
  .mshsearch { display: none; }
  .mshn__searchbtn { display: grid; margin-left: auto; }
}
