/* KGP site header and search — shared by every public page.
   Transparent over the page hero at the top, a full-width charcoal bar once you scroll.
   Same language as the admin panel: charcoal #212226, KGP light blue #ADD8E6, DM Sans / Poppins. */

:root {
  --kgph-ink: #212226;
  --kgph-ink-2: #2c2e33;
  --kgph-ink-3: #3a3d43;
  --kgph-sky: #add8e6;
  --kgph-muted: #a6acb2;
  --kgph-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --kgph-height: 84px;
}

.kgp-header,
.kgp-header *,
.kgp-search,
.kgp-search * { box-sizing: border-box; }

/* Menu links jump to sections: land them below the fixed bar */
html { scroll-padding-top: 76px; }
/* Page heroes without the grey breadcrumb strip: let the image run to the bottom */
.breadcrumb-style1:not(:has(.breadcrumb-style1__bottom)) .breadcrumb-style1__bg { bottom: 0; }

.kgp-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  color: #fff;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  /* A soft fade keeps white text readable over bright hero images */
  background: linear-gradient(180deg, rgba(14, 15, 17, 0.55) 0%, rgba(14, 15, 17, 0) 100%);
  transition: background-color 220ms ease, box-shadow 220ms ease;
}
.kgp-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(33, 34, 38, 0.94);
  -webkit-backdrop-filter: saturate(1.3) blur(14px);
  backdrop-filter: saturate(1.3) blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transition: opacity 220ms ease;
}
.kgp-header.is-solid::before { opacity: 1; }

.kgp-header__inner {
  max-width: 1320px;
  margin: 0 auto;
  height: var(--kgph-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: height 220ms var(--kgph-ease);
}
.kgp-header.is-solid .kgp-header__inner { height: 68px; }

.kgp-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: #fff !important;
  text-decoration: none !important;
}
.kgp-header__brand img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
  transition: width 220ms var(--kgph-ease), height 220ms var(--kgph-ease);
}
.kgp-header.is-solid .kgp-header__brand img { width: 38px; height: 38px; }
.kgp-header__brand span {
  font-family: 'Poppins', 'DM Sans', sans-serif;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ── Navigation (link style mirrors the admin sidebar items) ── */
.kgp-nav { margin: 0 auto; }
.kgp-nav__list { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.kgp-nav__group { position: relative; }
.kgp-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.86) !important;
  font: 500 15px/1.2 'DM Sans', system-ui, sans-serif;
  text-decoration: none !important;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}
.kgp-nav__link i { font-size: 10px; opacity: 0.7; transition: transform 200ms var(--kgph-ease); }
@media (hover: hover) and (pointer: fine) {
  .kgp-nav__link:hover { background: rgba(255, 255, 255, 0.1); color: #fff !important; }
}
.kgp-nav__link[aria-expanded="true"] { background: rgba(255, 255, 255, 0.1); color: #fff !important; }
.kgp-nav__link[aria-expanded="true"] i { transform: rotate(180deg); }
.kgp-nav__link[aria-current="page"],
.kgp-nav__link.is-current { background: rgba(255, 255, 255, 0.14); color: #fff !important; }
.kgp-nav__link[aria-current="page"]::after,
.kgp-nav__link.is-current::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: 2px;
  background: var(--kgph-sky);
}
.kgp-header :focus-visible { outline: 2px solid var(--kgph-sky); outline-offset: 2px; }

/* Dropdown panels: charcoal like the admin sidebar, icon + label items */
.kgp-nav__panel {
  position: absolute;
  top: calc(100% + 10px);
  left: -8px;
  min-width: 300px;
  padding: 8px;
  border-radius: 16px;
  background: var(--kgph-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 22px 48px rgba(0, 0, 0, 0.35);
  transform-origin: top left;
  transition: opacity 160ms var(--kgph-ease), transform 160ms var(--kgph-ease);
}
.kgp-nav__panel[hidden] { display: none; }
@starting-style { .kgp-nav__panel { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.kgp-nav__panel::before { content: ''; position: absolute; left: 0; right: 0; top: -12px; height: 12px; } /* hover bridge */
.kgp-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #e8eaec !important;
  text-decoration: none !important;
  transition: background-color 150ms ease;
}
.kgp-nav__item i {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(173, 216, 230, 0.12);
  color: var(--kgph-sky);
  font-size: 14px;
}
.kgp-nav__item strong { display: block; color: #fff; font-size: 15px; font-weight: 600; line-height: 1.25; }
.kgp-nav__item small { display: block; color: var(--kgph-muted); font-size: 13px; line-height: 1.35; }
@media (hover: hover) and (pointer: fine) { .kgp-nav__item:hover { background: var(--kgph-ink-2); } }
.kgp-nav__item:focus-visible { background: var(--kgph-ink-2); }

/* ── Actions ── */
.kgp-header__actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.kgp-icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 150ms ease, transform 160ms var(--kgph-ease);
}
.kgp-icon-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .kgp-icon-btn:hover { background: rgba(255, 255, 255, 0.12); } }
.kgp-header__signin {
  padding: 9px 14px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.9) !important;
  font: 500 15px/1.2 'DM Sans', sans-serif;
  text-decoration: none !important;
  transition: background-color 150ms ease;
}
@media (hover: hover) and (pointer: fine) { .kgp-header__signin:hover { background: rgba(255, 255, 255, 0.1); color: #fff !important; } }
.kgp-header__join {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--kgph-sky);
  color: #10242c !important;
  font: 700 15px/1.2 'DM Sans', sans-serif;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background-color 150ms ease, transform 160ms var(--kgph-ease);
}
.kgp-header__join:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .kgp-header__join:hover { background: #c6e5ef; } }
.kgp-header__menu { display: none; }

/* ── Phone / tablet menu ── */
.kgp-mobile {
  position: fixed;
  inset: 0;
  z-index: -1;
  padding: calc(var(--kgph-height) + 8px) 20px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--kgph-ink);
  transition: opacity 200ms ease, transform 260ms cubic-bezier(0.32, 0.72, 0, 1);
}
.kgp-mobile[hidden] { display: none; }
@starting-style { .kgp-mobile { opacity: 0; transform: translateY(-12px); } }
.kgp-mobile a { color: #fff !important; text-decoration: none !important; }
.kgp-mobile__link, .kgp-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  padding: 0 4px;
  border-bottom: 1px solid var(--kgph-ink-3);
  font: 600 18px/1.2 'Poppins', 'DM Sans', sans-serif;
  color: #fff;
  cursor: pointer;
  list-style: none;
}
.kgp-mobile summary::-webkit-details-marker { display: none; }
.kgp-mobile summary i { font-size: 13px; color: var(--kgph-muted); transition: transform 200ms var(--kgph-ease); }
.kgp-mobile details[open] summary i { transform: rotate(180deg); }
.kgp-mobile details .kgp-nav__item { margin: 4px 0; }
.kgp-mobile details[open] { padding-bottom: 8px; border-bottom: 1px solid var(--kgph-ink-3); }
.kgp-mobile details[open] summary { border-bottom: 0; }
.kgp-mobile__link.is-current { color: var(--kgph-sky); }
.kgp-mobile__cta { display: grid; gap: 10px; margin-top: 24px; }
.kgp-mobile__cta a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; border-radius: 12px; font: 700 16px/1 'DM Sans', sans-serif; }
.kgp-mobile__cta .kgp-header__join { border-radius: 12px; justify-content: center; }
.kgp-mobile__cta .is-outline { border: 1px solid rgba(255, 255, 255, 0.35); }
body.kgp-menu-open { overflow: hidden; }

@media (max-width: 1180px) {
  .kgp-header__brand span { display: none; }
  .kgp-nav__link { padding: 9px 11px; }
}
@media (max-width: 991px) {
  :root { --kgph-height: 68px; }
  .kgp-header__inner { padding: 0 16px; gap: 8px; }
  .kgp-header.is-solid .kgp-header__inner { height: 64px; }
  .kgp-header__brand span { display: inline; font-size: 16px; }
  .kgp-nav, .kgp-header__signin, .kgp-header__actions > .kgp-header__join { display: none; }
  .kgp-header__actions { margin-left: auto; }
  .kgp-header__menu { display: inline-grid; }
  body.kgp-menu-open .kgp-header::before { opacity: 1; }
}
@media (max-width: 380px) { .kgp-header__brand span { display: none; } }

/* ── Search ── */
.kgp-search {
  width: min(680px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 80px));
  margin: 10vh auto auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: #212226;
  font-family: 'DM Sans', system-ui, sans-serif;
  box-shadow: 0 30px 80px rgba(10, 12, 14, 0.35);
  overflow: hidden;
  transition: opacity 180ms var(--kgph-ease), transform 180ms var(--kgph-ease), overlay 180ms allow-discrete, display 180ms allow-discrete;
}
.kgp-search[open] { display: flex; flex-direction: column; }
@starting-style { .kgp-search[open] { opacity: 0; transform: translateY(-8px) scale(0.98); } }
.kgp-search::backdrop { background: rgba(14, 15, 17, 0.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.kgp-search__bar { display: flex; align-items: center; gap: 12px; padding: 0 16px 0 20px; border-bottom: 1px solid #e3e7ea; transition: border-color 150ms ease; }
/* The whole bar is the field: mark focus on its edge instead of a ring inside it */
.kgp-search__bar:focus-within { border-bottom-color: #276f87; }
.kgp-search__bar > i { color: #80868c; font-size: 17px; }
.kgp-search__input {
  flex: 1;
  min-width: 0;
  height: 64px;
  border: 0;
  background: transparent;
  color: #212226;
  font: 500 18px/1.2 'DM Sans', sans-serif;
}
.kgp-search .kgp-search__input:focus,
.kgp-search .kgp-search__input:focus-visible { outline: none; box-shadow: none; }
.kgp-search__input::placeholder { color: #8a9096; }
.kgp-search__input::-webkit-search-cancel-button { display: none; }
.kgp-search__esc { flex-shrink: 0; padding: 4px 8px; border: 1px solid #cfd6db; border-radius: 6px; background: #f4f6f7; color: #5b6168; font: 600 12px/1 'DM Sans', sans-serif; cursor: pointer; }
.kgp-search__esc span:last-child { display: none; }
.kgp-search__body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 12px; }
.kgp-search__group { margin: 10px 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7177; }
.kgp-search__list { list-style: none; margin: 0; padding: 0; }
.kgp-search__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #212226 !important;
  text-decoration: none !important;
  cursor: pointer;
}
.kgp-search__item[aria-selected="true"] { background: #f1f4f6; }
.kgp-search__item[aria-selected="true"]::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #276f87; }
.kgp-search__icon { width: 38px; height: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: #e6f4f9; color: #276f87; }
.kgp-search__text { flex: 1; min-width: 0; }
.kgp-search__text strong { display: block; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kgp-search__text span { display: block; font-size: 13px; color: #5b6168; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kgp-search__text mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
.kgp-search__arrow { color: #b6bcc1; font-size: 12px; }
.kgp-search__state { padding: 36px 20px; text-align: center; color: #5b6168; }
.kgp-search__state i { display: block; margin-bottom: 10px; font-size: 22px; color: #276f87; }
.kgp-search__foot { display: flex; gap: 16px; padding: 10px 20px; border-top: 1px solid #e3e7ea; background: #f8fafb; font-size: 12.5px; color: #6b7177; }
.kgp-search__foot kbd { padding: 1px 6px; border: 1px solid #cfd6db; border-bottom-width: 2px; border-radius: 5px; background: #fff; font: 600 11.5px/1.4 'DM Sans', sans-serif; color: #3a3d43; }
@media (max-width: 640px) {
  .kgp-search { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .kgp-search__foot { display: none; }
  /* Touch screens have no Esc key: a plain Cancel instead */
  .kgp-search__esc { padding: 10px 4px; border: 0; background: none; color: #276f87; font-size: 16px; }
  .kgp-search__esc span:first-child { display: none; }
  .kgp-search__esc span:last-child { display: inline; }
}
@media (prefers-reduced-motion: reduce) {
  .kgp-header, .kgp-header::before, .kgp-header__inner, .kgp-nav__panel, .kgp-mobile, .kgp-search { transition: none !important; }
}
