/* Keep the brand, selected public event and navigation in distinct regions. */
.site-header .topbar {
  gap: clamp(16px, 2vw, 48px);
}

.site-header .header-identity {
  --header-mark-size: 50px;
  position: relative;
  display: grid;
  align-content: center;
  gap: 5px;
  flex: 0 0 clamp(260px, 22vw, 360px);
  min-width: 0;
  padding-block: 9px;
  padding-inline-start: calc(var(--header-mark-size) + 12px);
}

.site-header .brand {
  min-width: 0;
  width: fit-content;
}

.site-header .brand-mark {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: var(--header-mark-size);
  height: var(--header-mark-size);
  transform: translateY(-50%);
}

.site-header .brand-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.site-header .brand-copy small {
  margin-top: 0;
}

.site-header .season-switcher {
  position: relative;
  min-width: 0;
  max-width: none;
  margin: 0;
}

.site-header .season-switcher summary {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 30px;
  max-width: none;
  padding: 5px 9px;
  border: 1px solid var(--line-strong, #2a4253);
  border-radius: 6px;
  background: var(--backdrop-tint);
  color: var(--text-2);
  font-size: clamp(12px, .66vw, 18px);
  font-weight: 700;
  line-height: 1.3;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .14s ease, color .14s ease;
}

.site-header .season-switcher summary::-webkit-details-marker { display: none; }
.site-header .season-switcher-label,
.site-header .season-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-header .season-switcher-label { flex: 1 1 auto; }
.site-header .season-switcher .caret { flex: 0 0 auto; font-size: 10px; opacity: .7; }
.site-header .season-switcher[open] summary { border-color: var(--lime-line); color: var(--lime); }

.site-header .season-switcher ul {
  box-sizing: border-box;
  position: absolute;
  inset-block-start: calc(100% + 6px);
  inset-inline-start: 0;
  width: max(100%, 280px);
  max-width: min(420px, calc(100vw - 96px));
  max-height: min(420px, calc(100dvh - 100px));
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--line-strong, #2a4253);
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  list-style: none;
  z-index: 70;
}

.site-header .season-switcher li { margin: 0; }
.site-header .season-switcher a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: clamp(13px, .66vw, 18px);
  text-decoration: none;
  white-space: nowrap;
}
.site-header .season-switcher a:hover { background: var(--lime-wash); color: var(--text-1); }
.site-header .season-switcher a[aria-current="true"] {
  background: color-mix(in srgb, var(--lime) 9%, transparent);
  color: var(--lime);
  font-weight: 850;
}
.site-header .season-switcher-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.site-header .season-freeze-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}
.site-header .season-switcher summary:focus-visible,
.site-header .season-switcher a:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.site-header .main-nav { flex: 0 0 auto; }
.site-header .header-actions { min-width: 0; }
.site-header .account-cluster { min-width: 0; }
.site-header .account-display-name { min-width: 0; flex: 1 1 auto; }
.site-header .account-avatar,
.site-header .account-cluster form { flex: 0 0 auto; }

@media (min-width: 1181px) and (max-width: 1700px) {
  .site-header .topbar { padding-inline: 16px; gap: 16px; }
  .site-header .header-identity { flex-basis: clamp(260px, 22vw, 320px); }
  .site-header .main-nav { gap: 0; }
  .site-header .main-nav > a,
  .site-header .database-nav > a { padding-inline: 9px; font-size: 15px; }
  .site-header .database-nav > a { padding-right: 2px; }
  .site-header .database-nav > button { width: 22px; padding-inline: 2px 6px; }
  .site-header .header-actions { gap: 8px; }
  .site-header .account-cluster { gap: 7px; font-size: 13px; }
}

@media (max-width: 1180px) {
  .site-header .header-identity { flex-basis: clamp(260px, 38vw, 380px); }
  .site-header .header-actions { margin-left: 0; }
}

@media (max-width: 700px) {
  .site-header .topbar { min-height: 76px; gap: 8px; }
  .site-header .header-identity { flex: 1 1 auto; padding-block: 8px; }
  .site-header .brand-copy { gap: 7px; }
  .site-header .brand-copy strong { font-size: 17px; }
  .site-header .brand-copy small { font-size: 11px; }
  .site-header .season-switcher summary { min-height: 28px; }
  .site-header .season-switcher ul {
    /* Override the historical right-aligned small-screen dropdown. */
    left: 0 !important;
    right: auto;
    min-width: 0 !important;
    max-width: calc(100vw - 86px);
  }
  .site-header .header-actions { flex: 0 0 62px; min-width: 62px; flex-direction: column; gap: 4px; padding-block: 4px; }
}

@media (max-width: 480px) {
  .site-header .header-identity { --header-mark-size: 40px; padding-inline-start: 48px; }
  .site-header .brand-copy strong { font-size: 15px; line-height: 1.15; }
  .site-header .brand-copy small { font-size: 10px; line-height: 1.15; }
  .site-header .season-switcher summary { max-width: none; }
  .site-header .season-switcher ul { max-width: calc(100vw - 66px); }
}

@media (min-width: 2400px) {
  .site-header .header-identity { --header-mark-size: 64px; flex-basis: 420px; gap: 7px; }
  .site-header .season-switcher summary { min-height: 36px; }
  .site-header .season-freeze-badge { min-height: 22px; font-size: 13px; }
}

/* Once initialized, visual and accessible dropdown state must agree. */
.site-header .database-nav[data-menu-ready]:not(.is-open) .database-nav-menu { display: none; }
.site-header .database-nav[data-menu-ready].is-open .database-nav-menu { display: grid; }
.site-header .database-nav > button:focus-visible { outline: 2px solid var(--lime); outline-offset: -2px; border-radius: 4px; }

.site-header .database-nav-menu > a:not(:hover):not(.active) { color: var(--text-1); }

/* Both browser-local tools share one neutral navigation group. */
.site-header .local-lab-nav > .local-lab-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  padding: 0 18px;
  color: var(--muted);
  font-size: 18px;
  font-weight: inherit;
  white-space: nowrap;
  transition: color .16s ease;
}
.site-header .local-lab-toggle .caret { font-size: 11px; opacity: .75; }
.site-header .local-lab-toggle::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 3px;
  background: var(--lime);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s var(--ease-out);
}
.site-header .local-lab-nav:hover > .local-lab-toggle,
.site-header .local-lab-nav:focus-within > .local-lab-toggle,
.site-header .local-lab-nav.active > .local-lab-toggle { color: var(--text-1); }
.site-header .local-lab-nav:hover > .local-lab-toggle::after,
.site-header .local-lab-nav:focus-within > .local-lab-toggle::after,
.site-header .local-lab-nav.active > .local-lab-toggle::after { transform: scaleX(1); }
.site-header .mobile-lab-nav { display: grid; gap: 4px; }
@media (min-width: 1181px) and (max-width: 1700px) {
  .site-header .main-nav { flex: 1 1 auto; min-width: 0; flex-wrap: wrap; align-content: center; }
  .site-header .main-nav > a,
  .site-header .main-nav > .database-nav { min-height: 38px; }
  .site-header .local-lab-nav > .local-lab-toggle { padding-inline: 9px; font-size: 15px; }
  .site-header .local-lab-toggle::after { left: 8px; right: 8px; }
}
@media (min-width: 2200px) and (max-width: 2399px) {
  .site-header .local-lab-nav > .local-lab-toggle { font-size: 19px; }
}
@media (min-width: 2400px) {
  .site-header .local-lab-nav > .local-lab-toggle { font-size: 21px; }
}
