/* ==========================================================================
   Site header: the single header for every public page (templates/partials/site_header.html).
   Uses only .site-header* classes so rules in app.css / theme.css / home.css cannot leak in.
   Layout: three grid columns (brand | nav | actions); the outer columns are equal, so the
   navigation is always exactly centred. Below --sh-collapse the nav moves into a menu panel.
   ========================================================================== */
.site-header {
  --sh-height: 84px;
  --sh-max: 1180px;
  --sh-gutter: 32px;
  --sh-green: #008452;
  --sh-text: #2b3d35;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffffeb;
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid #e6f0ea;
}

.site-header__inner {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: var(--sh-max);
  height: var(--sh-height);
  margin: 0 auto;
  padding: 0 var(--sh-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 24px;
}

/* Brand */
.site-header__brand {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  color: #0b1412;
  text-decoration: none !important;
}
.site-header__mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(140deg, #009963, #006f47);
  box-shadow: 0 3px 8px #00845214;
}
.site-header__mark svg { width: 24px; height: 24px; }
.site-header__name {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.7px;
  line-height: 1.15;
  white-space: nowrap;
}
.site-header__name small {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: #728178;
}

/* Navigation */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.site-header__nav > a,
.site-header__menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 14px;
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--sh-text);
  text-decoration: none !important;
  transition: color .15s;
}
.site-header__nav > a:hover,
.site-header__menu-btn:hover { color: var(--sh-green); }
/* Same weight as other links: a bolder active link is wider and would shift the nav between pages. */
.site-header__nav > a.active,
.site-header__menu-btn.active { color: var(--sh-green); }
.site-header__nav > a.active::after,
.site-header__menu-btn.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--sh-green);
}

/* Actions (user menu / log in + get started) */
.site-header__actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}
.site-header__actions .btn { height: 42px; font-size: 14.5px; white-space: nowrap; }
.site-header__actions .user-trigger { padding: 6px 12px 6px 6px; border: 1px solid #e3ece7; border-radius: 999px; }
.site-header__actions .user-trigger .avatar { --size: 32px; }
.site-header__actions .user-trigger .small {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14.5px;
}
.site-header__toggle {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid #e3ece7;
  border-radius: 10px;
  background: #fff;
  color: #1d3340;
  cursor: pointer;
}
.site-header__toggle svg { width: 22px; height: 22px; }

/* Collapsed layout: the 6 signed-in links need ~1180px next to the brand and actions,
   so below that the navigation becomes a menu panel. */
@media (max-width: 1199px) {
  .site-header__inner { grid-template-columns: minmax(0, 1fr) auto; }
  .site-header__toggle { display: grid; }
  .site-header__nav {
    display: none;
    position: absolute;
    top: var(--sh-height);
    left: var(--sh-gutter);
    right: var(--sh-gutter);
    height: auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 10px;
    background: #fff;
    border: 1px solid #dcebe2;
    border-top: 0;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 20px 40px #0f2a1f1f;
  }
  .site-header.nav-open .site-header__nav { display: flex; }
  .site-header__nav > a { height: auto; padding: 14px; border-radius: 9px; font-size: 16px; }
  .site-header__nav > a.active { background: #edf8f1; }
  .site-header__nav > a.active::after { display: none; }
}

@media (max-width: 760px) {
  .site-header { --sh-height: 72px; --sh-gutter: 20px; }
  .site-header__mark { width: 36px; height: 36px; }
  .site-header__mark svg { width: 21px; height: 21px; }
  .site-header__name { font-size: 20px; }
  .site-header__name small { font-size: 11px; }
  .site-header__actions { gap: 8px; }
  .site-header__actions .btn { height: 40px; padding-inline: 14px; font-size: 14px; }
  .site-header__actions .user-trigger { padding: 5px; }
  .site-header__actions .user-trigger .hide-mobile { display: none; }
}

@media (max-width: 560px) {
  .site-header__signup { display: none; }
  .site-header__name small { display: none; }
}

/* Pin every icon size inside the header so page-level rules (e.g. "main svg") can never resize it. */
.site-header svg { flex: none; }
.site-header .site-header__actions .btn svg { width: 18px; height: 18px; }
.site-header .site-header__actions .user-trigger svg { width: 16px; height: 16px; }
.site-header .site-header__toggle svg { width: 22px; height: 22px; }
.site-header .site-header__mark svg { width: 24px; height: 24px; }
@media (max-width: 760px) {
  .site-header .site-header__mark svg { width: 21px; height: 21px; }
}

/* ---------- "Tests" menu: button + certificate list (templates/partials/tests_menu.html) ---------- */
.site-header__dropdown { position: relative; display: flex; height: 100%; }
.site-header__menu-btn {
  gap: 6px;
  margin: 0;
  border: 0;
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.site-header .site-header__chevron { width: 15px; height: 15px; transition: transform .18s; }
.site-header__dropdown.is-open .site-header__chevron { transform: rotate(180deg); }
.site-header__menu-btn:focus-visible { outline: 2px solid var(--sh-green); outline-offset: -6px; border-radius: 8px; }

.site-header__menu {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 60;
  width: 380px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dcebe2;
  border-radius: 14px;
  box-shadow: 0 24px 48px #0f2a1f24;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
/* Invisible bridge so the pointer can travel from the button into the panel without closing it. */
.site-header__menu::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 14px; }
.site-header__dropdown.is-open > .site-header__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity .16s ease, transform .16s ease, visibility 0s;
}
.site-header__menu-label {
  margin: 4px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #7a8a93;
}
.site-header__menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: #0d1b24;
  text-decoration: none !important;
  transition: background .12s;
}
.site-header__menu-item:hover,
.site-header__menu-item:focus-visible { background: #f1fbf6; outline: none; }
.site-header__menu-item.is-current { background: #edf8f1; }
.site-header__menu-icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #e6f5ee;
  color: var(--sh-green);
}
.site-header__menu-item.is-current .site-header__menu-icon,
.site-header__menu-item:hover .site-header__menu-icon,
.site-header__menu-item:focus-visible .site-header__menu-icon { background: linear-gradient(145deg, #009963, #006a43); color: #fff; }
.site-header .site-header__menu-icon svg { width: 20px; height: 20px; }
.site-header__menu-text { min-width: 0; flex: 1; }
.site-header__menu-text strong { display: block; font-size: 15px; letter-spacing: -.2px; }
.site-header__menu-text small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.35; color: #5f6f79; }
.site-header .site-header__menu-arrow { width: 16px; height: 16px; color: #9aaab2; }
.site-header__menu-item:hover .site-header__menu-arrow { color: var(--sh-green); }
.site-header__menu-empty { margin: 6px 10px 10px; font-size: 14px; color: #5f6f79; }

/* Collapsed header: the certificate list becomes an accordion inside the menu panel. */
@media (max-width: 1199px) {
  .site-header__dropdown { display: block; height: auto; }
  .site-header__menu-btn {
    width: 100%;
    height: auto;
    justify-content: space-between;
    padding: 14px;
    border-radius: 9px;
    font-size: 16px;
  }
  .site-header__menu-btn.active { background: #edf8f1; }
  .site-header__menu-btn.active::after { display: none; }
  .site-header__menu {
    position: static;
    display: none;
    width: auto;
    padding: 2px 0 6px 10px;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
  }
  .site-header__menu::before { display: none; }
  .site-header__dropdown.is-open > .site-header__menu { display: block; transform: none; }
  .site-header__menu-label { display: none; }
}
