.header {
  background: linear-gradient(
    90deg,
    var(--gp-secondary-color, #ae1338) 0%,
    color-mix(in srgb, var(--gp-secondary-color, #ae1338) 70%, white) 100%
  );
  position: relative;
  height: 56px;
  z-index: 3001;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 8px;
  min-width: 0;
  overflow: hidden;
}

.header .logo {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  flex: 0 1 auto;
  width: auto;
  height: auto;
  max-width: min(132px, 42vw, 45%);
  max-height: 32px;
  object-fit: contain;
  object-position: left center;
  margin: 0;
}

/* Tours often define bare .logo / .login / .google-oauth-wrap-sm — keep header flex intact */
.header .header-right,
.header .oauth-login-buttons,
.header .oauth-login-buttons .google-oauth-wrap-sm,
.header .oauth-login-buttons .apple-oauth-wrap-sm,
.header .oauth-login-buttons .oauth-providers-sm-row,
.header .login-button {
  position: static;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

/* Login + OAuth "Sign in" prefix — identical typography */
.header .login-button,
.header .oauth-sm-signin-prefix {
  color: var(--tour-header-auth-accent, #fff);
  text-decoration: none;
  font-size: clamp(0.82rem, 2.6vw, 1em);
  font-weight: inherit;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  padding: 6px 4px;
  flex-shrink: 0;
}

.header .login-button {
  transition: opacity 0.2s ease;
}

.header .login-button:hover {
  color: var(--tour-header-auth-accent, #fff);
  text-decoration: underline;
  opacity: 0.9;
}

.header .oauth-login-buttons,
.header .google-login-button {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-height: 32px;
}

@media (min-width: 768px) {
  .header {
    height: 60px;
    padding: 0 12px;
  }
  .header .logo {
    max-width: min(140px, 38vw, 45%);
    max-height: 36px;
  }
  .header-right {
    gap: 10px;
  }
}

@media (min-width: 1280px) {
  .header {
    height: 64px;
    padding: 0 16px;
  }
  .header .logo {
    max-width: 140px;
    max-height: 40px;
  }
}

.header.compact {
  height: 48px;
}
.header.compact .logo {
  max-width: min(96px, 36vw, 40%);
  max-height: 28px;
}

/* Theme: solid black bar — logos that clash with brand gradient (KPM, or tour_header_black) */
.header.header-black,
.header.header-dark {
  background: #000 !important;
  background-image: none !important;
}

/* Theme: white bar */
.header.header-light {
  background: #fff;
  border-bottom: 1px solid color-mix(in srgb, var(--gp-secondary-color, #ae1338) 12%, white);
}
.header.header-light .login-button,
.header.header-light .oauth-sm-signin-prefix {
  color: var(--gp-secondary-color, #ae1338);
}
.header.header-light .login-button:hover {
  color: color-mix(in srgb, var(--gp-secondary-color, #ae1338) 75%, black);
}

/* Centered logo layout: Register (far left) · Logo (true center) · Login + OAuth (far right) */
.header.header-centered {
  justify-content: space-between;
  position: relative;
}
.header.header-centered .logo {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%) !important;
  width: auto;
  height: auto;
  max-width: min(180px, 55vw, 60%);
  max-height: 40px;
  margin: 0;
  flex: none;
  pointer-events: none;
  object-position: center center;
}
.header.header-centered .header-left-cluster {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  z-index: 1;
  margin-right: auto;
}
.header.header-centered .header-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  margin-left: auto;
  z-index: 1;
}
.header.header-centered .register-button {
  color: #fff;
  text-decoration: none;
  font-size: clamp(0.82rem, 2.6vw, 1em);
  white-space: nowrap;
  padding: 6px 4px;
}
.header.header-centered .register-button:hover {
  color: #fff;
  text-decoration: underline;
}

/* Transparent bar: logo left, Login + OAuth right; no gradient/chrome (default full layout) */
.header.header-transparent {
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  background: transparent !important;
  background-image: none !important;
  border: none;
  box-shadow: none;
  pointer-events: none;
  z-index: 10010;
  overflow: visible;
  justify-content: space-between;
  padding: 10px 12px;
  box-sizing: border-box;
  position: var(--tour-header-position, fixed);
}
@media (min-width: 768px) {
  .header.header-transparent {
    padding: 12px 16px;
  }
}
.header.header-transparent .logo,
.header.header-transparent .header-right,
.header.header-transparent .header-left-cluster {
  pointer-events: auto;
}
.header.header-transparent .login-button,
.header.header-transparent .oauth-sm-signin-prefix {
  color: var(--tour-header-auth-accent, #fff);
}
.header.header-transparent .login-button:hover {
  color: var(--tour-header-auth-accent, #fff);
  opacity: 0.85;
  text-decoration: underline;
}
.header.header-transparent.header-auth-light .login-button,
.header.header-transparent.header-auth-light .oauth-sm-signin-prefix {
  color: var(--gp-secondary-color, #ae1338);
}

/* Auth-only: login + OAuth top-right; no logo or bar chrome */
.header.header-auth-only {
  top: 0;
  right: 0;
  left: auto;
  width: auto;
  max-width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  background: transparent !important;
  background-image: none !important;
  border: none;
  box-shadow: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end !important;
  padding: 10px 12px;
  pointer-events: auto;
  /* Above tour overlays (e.g. am2step prelander z-index:9999) */
  z-index: 10010;
  overflow: visible;
  position: var(--tour-header-position, fixed);
}

.header.header-auth-only .header-right {
  pointer-events: auto;
  gap: 8px;
  margin-left: auto;
}

.header.header-auth-only .header-right,
.header.header-auth-only .oauth-login-buttons,
.header.header-auth-only .oauth-login-buttons .google-oauth-wrap-sm,
.header.header-auth-only .oauth-login-buttons .apple-oauth-wrap-sm,
.header.header-auth-only .oauth-login-buttons .oauth-providers-sm-row,
.header.header-auth-only .login-button {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
}

.header.header-auth-only .login-button,
.header.header-auth-only .oauth-sm-signin-prefix {
  color: var(--tour-header-auth-accent, #fff);
}

.header.header-auth-only .login-button:hover {
  color: var(--tour-header-auth-accent, #fff);
  opacity: 0.85;
  text-decoration: underline;
}

@media (min-width: 768px) {
  .header.header-auth-only {
    padding: 12px 16px;
  }
}

/* Light page behind auth-only links */
.header.header-auth-only.header-auth-light .login-button,
.header.header-auth-only.header-auth-light .oauth-sm-signin-prefix {
  color: var(--gp-secondary-color, #ae1338);
}
