/* Shared five-control header row for the public shell and Event portals. */
.tk-unified-header__controls {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(4px, 1vw, 10px);
  width: 100%;
  min-width: 0;
}

.tk-unified-header__controls > :is(.brand, .public-events-link, .qr-scanner-header-link),
.tk-unified-header__controls .ui-theme-toggle,
.tk-unified-header__controls .ui-country-choice {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border-radius: 5px;
}

.tk-unified-header__controls > .brand,
.tk-unified-header__controls > .public-events-link {
  overflow: visible;
}

.tk-unified-header__controls > .brand .brand-mark,
.tk-unified-header__controls .header-events-logo {
  display: block;
  box-sizing: border-box;
  flex: 0 0 40px;
  width: 40px;
  min-width: 0;
  height: 40px;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tk-unified-header__controls > .brand .brand-mark {
  aspect-ratio: 1;
}

.tk-unified-header__controls .tk-unified-header__events-fallback {
  display: flex;
  box-sizing: border-box;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid currentColor;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.05;
  text-align: center;
}

.tk-unified-header__controls .ui-appearance-controls {
  display: contents;
}

.tk-unified-header__controls .ui-theme-toggle,
.tk-unified-header__controls .ui-country-choice,
.tk-unified-header__controls .qr-scanner-header-link {
  color: inherit;
  background: transparent;
  border: 1px solid color-mix(in srgb, currentColor 35%, transparent);
  text-decoration: none;
  cursor: pointer;
}

.tk-unified-header__controls .ui-theme-icon {
  font-size: 19px;
  line-height: 1;
}

.tk-unified-header__controls .ui-theme-label,
.tk-unified-header__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tk-unified-header__controls .ui-country-choice > span {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.tk-unified-header__controls .ui-country-globe {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.tk-unified-header__controls :is(.brand, .public-events-link, .qr-scanner-header-link, .ui-theme-toggle, .ui-country-choice):focus-visible,
.tk-unified-header__secondary :is(a, button):focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  z-index: 1;
}

.tk-unified-header__controls :is(.qr-scanner-header-link, .ui-theme-toggle, .ui-country-choice):hover {
  background: color-mix(in srgb, currentColor 9%, transparent);
}

.tk-unified-header__controls :is(.public-events-link, .qr-scanner-header-link)[aria-current="page"] {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.tk-unified-header__secondary {
  box-sizing: border-box;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  width: 100%;
  min-width: 0;
  padding-top: 5px;
}

.tk-unified-header__secondary .ui-logout-form {
  margin: 0 0 0 auto;
}

.tk-unified-header__secondary .ui-logout {
  display: inline-flex;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
}

.tk-unified-header__secondary .header-logout-icon {
  width: 20px;
  height: 20px;
}

@media screen {
  .site-header:has(> .tk-unified-header__controls) {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    min-width: 0;
  }

  .site-header:has(> .tk-unified-header__controls) > .tk-unified-header__controls {
    order: 0;
  }

  .site-header:has(> .tk-unified-header__controls) > .tk-unified-header__secondary {
    order: 1;
  }

  .event-refined .event-site-header {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    min-width: 0;
  }

  .event-refined .event-site-header > .tk-unified-header__controls {
    order: 0;
  }

  .event-refined .event-header-context {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding-top: 8px;
  }

  .event-refined .event-site-identity {
    display: flex;
    align-items: baseline;
    gap: 9px;
    min-width: 0;
    justify-self: auto;
  }

  .event-refined .event-site-identity strong {
    max-width: min(60vw, 300px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .event-refined .event-header-context .event-menu-toggle {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
  }

  .event-refined .event-site-header > .event-public-nav {
    order: 2;
    min-width: 0;
  }
}

@media (max-width: 380px) {
  .tk-unified-header__controls {
    gap: 4px;
  }

  .event-refined .event-site-header {
    padding-right: 12px;
    padding-left: 12px;
  }

  .event-refined .event-header-context {
    gap: 6px;
  }

  .event-refined .event-site-identity {
    gap: 5px;
  }

  .event-refined .event-site-identity strong {
    max-width: 48vw;
  }
}
