/* Component: header */

.wpar-topbar {
  position: sticky;
  top: var(--wpar-top, 0px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  height: 56px;
  padding: 0 max(12px, calc((100vw - 1128px) / 2 + 12px));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

/* Brand: the Flatstone wordmark (inline SVG, see templates/components/brand.php). */
.wpar-brand {
  flex: none;
  display: flex;
  align-items: center;
  padding: 10px 0; /* larger click/tap target; the artwork itself stays --logo-h tall */
  color: var(--ink); /* only used by the text fallback when the SVG file is missing */
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wpar-brand__logo {
  --logo-h: 24px;
  display: block;
  flex: none;
  height: var(--logo-h);
  width: calc(var(--logo-h) * 5.4287); /* artwork aspect ratio: viewBox 1189.71 x 219.16 */
  position: relative;
  top: -1px; /* optical centring: lowercase letters sit low inside their box */
}

/* Fill comes from CSS so it follows the theme: brand blue in light mode, the lighter accent in dark mode. */
.wpar-brand__logo path { fill: var(--accent); }

.wpar-brand__name { white-space: nowrap; }

.wpar-search {
  position: relative;
  flex: 1;
  max-width: 340px;
  min-width: 0;
}

.wpar-search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.wpar-search input[type="search"] {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
}

.wpar-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.wpar-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 2px;
}

.wpar-nav__item {
  position: relative;
  min-width: 62px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  list-style: none;
  cursor: pointer;
}

.wpar-nav__item:hover {
  background: var(--field);
  color: var(--ink);
}

.wpar-nav__item[aria-current="page"] {
  color: var(--ink);
}

.wpar-nav__item[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -8px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.wpar-menu {
  position: relative;
}

.wpar-menu summary::-webkit-details-marker {
  display: none;
}

.wpar-menu[open]>summary {
  background: var(--field);
  color: var(--ink);
}

.wpar-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 60;
  width: 240px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(3, 7, 91, .16);
}

.wpar-menu__who {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.wpar-menu__link {
  display: block;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 550;
  text-decoration: none;
}

.wpar-menu__link:hover {
  background: var(--field);
}

@media (max-width: 640px) {
  .wpar-topbar {
    gap: 8px;
    padding: 0 8px;
  }
  .wpar-brand__logo { --logo-h: 20px; }
  .wpar-nav__item {
    min-width: 44px;
    padding: 8px;
  }
  .wpar-nav__item>span {
    display: none;
  }
  .wpar-nav__item[aria-current="page"]::after {
    left: 8px;
    right: 8px;
  }
  .wpar-menu__panel {
    position: fixed;
    right: 8px;
    top: 72px;
  }
}

/* The wordmark is wider than the old icon, so on phones the header (logo + 5-6 nav icons) has no room left for the
   search field. Hide it below 560 px rather than let it collapse and overlap the icons. */
@media (max-width: 560px) {
  .wpar-search { display: none; }
}

.wpar-notifications {
  position: relative;
}

.wpar-notifications summary::-webkit-details-marker {
  display: none;
}

.wpar-notifications__badge {
  position: absolute;
  top: 1px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #d93025;
  color: #fff;
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--surface);
}

.wpar-notifications__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 70;
  width: min(390px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 82px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(3, 7, 91, .18);
}

.wpar-notifications__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.wpar-notifications__mark {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}

.wpar-notifications__list {
  overflow: auto;
}

.wpar-notifications__all {
  flex: none;
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  text-align: center;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.wpar-notifications__all:hover {
  background: var(--field);
}

.wpar-notifications__empty {
  margin: 0;
  padding: 32px 18px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}

@media (max-width: 640px) {
  .wpar-notifications__panel {
    position: fixed;
    top: 64px;
    right: 8px;
    width: min(390px, calc(100vw - 16px));
    max-height: calc(100vh - 76px);
  }
}
