/* Shared site header — keep in sync with index.html main nav row */
:root {
  --header-main-h: 76px;
  --header-brand-h: 72px;
  --header-content-nav-h: 36px;
  /* Safe default until site-header.js measures (brand row + main nav) */
  --site-header-h: calc(var(--header-brand-h) + var(--header-main-h) + 16px);
  --site-content-max: 1500px;
  --site-content-gutter: 32px;
  --link: #8ec8ff;
  --btn-primary-fg: #0a0a0c;
}

@media (max-width: 900px) {
  :root {
    --site-content-gutter: 20px;
  }
}

/* Early signed-in hint (site-auth-boot.js) — hide guest chrome before nav JS runs */
html[data-sv-auth='signed-in'] #main-nav-guest-nav,
html[data-sv-auth='signed-in'] .main-nav-actions > .btn-nav-cta,
html[data-sv-auth='signed-in'] .main-nav-actions > .btn-primary.btn-nav-cta,
html[data-sv-auth='signed-in'] .main-nav-actions > a.btn-nav-cta,
html.sv-auth-signed-in #main-nav-guest-nav,
html.sv-auth-signed-in .main-nav-actions > .btn-nav-cta,
html.sv-auth-signed-in .main-nav-actions > .btn-primary.btn-nav-cta,
html.sv-auth-signed-in .main-nav-actions > a.btn-nav-cta {
  display: none !important;
}

html[data-sv-auth='signed-in'] .site-header:has(.site-header-brand) .main-nav-row > .main-nav-marketing,
html[data-sv-auth='signed-in'] .site-header:has(.site-header-brand) .main-nav-row > .main-nav-pill[data-i18n-aria='nav.mainMenuAria'],
html.sv-auth-signed-in .site-header:has(.site-header-brand) .main-nav-row > .main-nav-marketing,
html.sv-auth-signed-in .site-header:has(.site-header-brand) .main-nav-row > .main-nav-pill[data-i18n-aria='nav.mainMenuAria'] {
  display: none !important;
}

html[data-sv-auth='signed-in'] .site-header.is-signed-in .content-nav-row:not([hidden]),
html.sv-auth-signed-in .site-header.is-signed-in .content-nav-row:not([hidden]) {
  display: flex !important;
}

/* Base links — no browser default purple/blue on dark backgrounds */
a {
  color: var(--link, #8ec8ff);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:visited {
  color: var(--link, #8ec8ff);
}

a:hover {
  color: var(--text, #f5f5f7);
}

/* White primary CTAs — beat global a / a:visited link colors on anchor buttons */
a:is(.btn-primary, .btn-nav-cta),
a:is(.btn-primary, .btn-nav-cta):link,
a:is(.btn-primary, .btn-nav-cta):visited,
a:is(.btn-primary, .btn-nav-cta):hover,
a:is(.btn-primary, .btn-nav-cta):active,
a:is(.btn-primary, .btn-nav-cta):focus-visible {
  color: var(--btn-primary-fg, #0a0a0c);
}

a:is(
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-ghost,
  .btn-sm,
  .btn-nav-cta,
  .btn-danger,
  .main-nav-logo,
  .main-nav-projects-link,
  .project-switcher-overview-link,
  .project-switcher-new-btn,
  .pres-branding-link,
  .inline-link,
  .auth-logo-link,
  .auth-inline-link,
  .proto-pill-link,
  .product-related-card,
  .product-card-cta,
  .product-breadcrumb-link
):hover {
  text-decoration: none;
}

a:not(
  .btn,
  .btn-primary,
  .btn-secondary,
  .btn-ghost,
  .btn-sm,
  .btn-nav-cta,
  .btn-danger,
  .main-nav-logo,
  .main-nav-projects-link,
  .project-switcher-overview-link,
  .project-switcher-new-btn,
  .pres-branding-link,
  .inline-link,
  .auth-logo-link,
  .auth-inline-link,
  .proto-pill-link,
  .chat-header-design-link,
  .preview-back-link
):hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: var(--glass-blur, blur(40px) saturate(1.15));
  -webkit-backdrop-filter: var(--glass-blur, blur(40px) saturate(1.15));
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
}

/* Signed-in: compact content pages bar above the functional nav row */
.content-nav-row {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px 16px;
  min-height: var(--header-content-nav-h);
  padding: 5px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.45);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.content-nav-row[hidden] {
  display: none !important;
}
.content-nav-row::-webkit-scrollbar {
  display: none;
}
.site-header.is-signed-in .content-nav-row:not([hidden]),
.site-header:has(.site-header-brand) .content-nav-row:not([hidden]),
body[data-content-surface="pages"] .content-nav-row:not([hidden]) {
  display: flex;
}

/* Brand-header funnel + content pages: plain text nav row; account/login stay in main row */
body[data-content-surface="pages"] .main-nav-actions .main-nav-tools,
.site-header:has(.site-header-brand) .main-nav-actions .main-nav-tools {
  display: none !important;
}

body[data-content-surface="pages"] .main-nav-row,
.site-header:has(.site-header-brand) .main-nav-row {
  justify-content: center;
}

.site-header:has(.site-header-brand) .main-nav-logo {
  display: none !important;
}

.main-nav-project-zone {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.main-nav-row > .main-nav-actions {
  margin-left: 0;
}

.site-header-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 28px 2px;
  border-bottom: none;
}

/* Design focus (studio / briefing / producible): hide project status chrome; logo stays for home. */
body.is-producible-focus .content-nav-row,
body.is-producible-focus .main-nav-row,
body.is-design-focus .content-nav-row,
body.is-design-focus .main-nav-row {
  display: none !important;
}

body.is-producible-focus .site-header,
body.is-design-focus .site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body.is-producible-focus .site-header-brand,
body.is-design-focus .site-header-brand {
  justify-content: center;
  padding: 8px 28px 12px;
}

body.is-producible-focus .site-header-brand-logo,
body.is-design-focus .site-header-brand-logo {
  height: var(--header-brand-h);
  max-width: min(92vw, 480px);
}

body.is-producible-focus .site-header-brand-link,
body.is-design-focus .site-header-brand-link {
  opacity: 0.92;
  transition: opacity 0.15s ease;
}

body.is-producible-focus .site-header-brand-link:hover,
body.is-producible-focus .site-header-brand-link:focus-visible,
body.is-design-focus .site-header-brand-link:hover,
body.is-design-focus .site-header-brand-link:focus-visible {
  opacity: 1;
}

.site-header-brand-link {
  line-height: 0;
  text-decoration: none;
}

.site-header-brand-logo {
  height: var(--header-brand-h);
  width: auto;
  max-width: min(92vw, 480px);
  display: block;
  object-fit: contain;
}

.site-header:has(.site-header-brand) .main-nav-row > .main-nav-marketing,
.site-header:has(.site-header-brand) .main-nav-row > .main-nav-pill[data-i18n-aria="nav.mainMenuAria"] {
  display: none !important;
}

.content-nav-row .main-nav-marketing,
.content-nav-row .main-nav-tools {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  flex: 0 0 auto;
}

.content-nav-row .main-nav-pill {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  padding: 2px;
  gap: 2px;
  background: transparent;
  border: none;
  width: auto;
  max-width: none;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
}
.content-nav-row .main-nav-pill a,
.content-nav-row .main-nav-pill button {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.content-nav-row .main-nav-tools {
  gap: 2px;
  margin: 0;
  padding: 0 0 0 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.main-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  min-height: var(--header-main-h);
  padding: 4px 28px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}

.site-header.is-signed-in .main-nav-row {
  gap: 14px;
}
.site-header.is-signed-in .main-nav-project-zone > .project-switcher-wrap,
.site-header.is-signed-in .main-nav-row > .project-switcher-wrap {
  flex: 0 1 auto;
  max-width: min(520px, 52vw);
  margin-right: 0;
}

.site-header.is-signed-in .main-nav-project-zone > .project-switcher-wrap.document-header--toolbar,
.site-header.is-signed-in .main-nav-row > .project-switcher-wrap.document-header--toolbar {
  flex: 1 1 auto;
  max-width: min(640px, 58vw);
}
.site-header.is-signed-in .main-nav-actions .main-nav-tools {
  display: none !important;
}

.main-nav-logo {
  flex-shrink: 0;
  line-height: 0;
  text-decoration: none;
}

/* Signed-in only — hidden until auth adds .is-visible */
.main-nav-projects-link {
  display: none;
  flex-shrink: 0;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--pill, 980px);
  color: rgba(87, 227, 255, 0.95);
  border: 1px solid rgba(87, 227, 255, 0.28);
  background: rgba(87, 227, 255, 0.08);
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.main-nav-projects-link.is-visible {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.main-nav-projects-link.is-visible:hover,
.main-nav-projects-link.is-visible.active {
  color: #e8fbff;
  background: rgba(87, 227, 255, 0.14);
  border-color: rgba(87, 227, 255, 0.45);
}

.main-nav-logo img {
  height: 42px;
  width: auto;
  display: block;
}

.main-nav-pill {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 5px;
  border-radius: 980px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.main-nav-pill::-webkit-scrollbar {
  display: none;
}

/* Guest auth pill — readable on black header */
#main-nav-guest-nav {
  background: var(--page-chrome-bg, rgba(87, 227, 255, 0.08));
  border: 1px solid var(--page-chrome, #57e3ff);
  box-shadow: 0 0 0 1px var(--page-chrome-dim, rgba(87, 227, 255, 0.35));
}
#main-nav-guest-nav a {
  color: var(--text, #f5f5f7);
  font-weight: 600;
}
#main-nav-guest-nav a:hover {
  color: #fff;
  background: rgba(87, 227, 255, 0.16);
}

.main-nav-marketing {
  flex-shrink: 1;
}

/* Legacy horizontal lang switcher styles (no longer used — replaced by .lang-picker dropdown) */
.lang-switcher,
.lang-switcher-btn {
  /* kept for back-compat in case any external snippet still references them */
}

/* Language picker (dropdown) — themed to match site header + account menu */
.lang-picker {
  position: relative;
  flex-shrink: 0;
  z-index: 1050;
}
.lang-picker.is-open {
  z-index: 1150;
}

/* Trigger pill — compact but consistent with other nav controls */
.lang-picker-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--pill, 980px);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text, #f5f5f7);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.lang-picker-trigger:hover,
.lang-picker.is-open .lang-picker-trigger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text, #fff);
}

.lang-picker-icon {
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
}

.lang-picker-chevron {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 1px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.lang-picker.is-open .lang-picker-chevron {
  transform: rotate(180deg);
  opacity: 0.75;
}

/* Dropdown panel — matches .nav-account-dropdown visual language */
.lang-picker-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 208px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(18, 20, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 1200;

  /* Themed dropdown list — always vertical, never inherit row flex from nav */
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Ensure the hidden attribute (or class) actually hides it, even if other rules compete */
.lang-picker-menu[hidden],
.lang-picker-menu.is-hidden {
  display: none !important;
}

/* List items — clean rows like account menu items */
.lang-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text, #f5f5f7);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}

.lang-picker-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lang-picker-item.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
}

.lang-picker-item .lang-name {
  flex: 1 1 auto;
  font-weight: 500;
}

.lang-picker-item .lang-code {
  font-size: 10px;
  letter-spacing: 0.08em;
  opacity: 0.55;
  margin-left: 12px;
  font-weight: 600;
}

.lang-picker-item.is-active .lang-code {
  opacity: 0.7;
}

/* Subtle selected affordance */
.lang-picker-item.is-active::after {
  content: '\2713';
  margin-left: 6px;
  font-size: 11px;
  opacity: 0.85;
  font-weight: 700;
}

.main-nav-pill a,
.main-nav-pill button {
  padding: 9px 18px;
  border-radius: var(--pill, 980px);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted, #86868b);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.main-nav-pill button {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.main-nav-pill a:hover,
.main-nav-pill button:hover {
  color: var(--text, #f5f5f7);
  background: rgba(255, 255, 255, 0.06);
}

.main-nav-pill a.active,
.main-nav-pill button.active {
  color: var(--text, #f5f5f7);
  background: rgba(255, 255, 255, 0.06);
}

.main-nav-pill.hidden,
.main-nav-link.hidden,
a.hidden,
button.hidden {
  display: none !important;
}

/* Signed-in account menu */
.nav-account-menu {
  position: relative;
  flex-shrink: 0;
  z-index: 1100;
}

.nav-account-menu.is-open {
  z-index: 1101;
}

.nav-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: var(--pill, 980px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text, #f5f5f7);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-account-trigger:hover,
.nav-account-menu.is-open .nav-account-trigger {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.nav-account-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #57e3ff 0%, #8a6cff 100%);
  color: #0a0c10;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-account-name {
  white-space: nowrap;
  max-width: 32ch;
}

.nav-account-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted, #86868b);
  margin-left: 2px;
}

.nav-account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(18, 20, 26, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  z-index: 1102;
}

.nav-account-dropdown.hidden {
  display: none;
}

.nav-account-dropdown-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.nav-account-dropdown-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #f5f5f7);
}

.nav-account-dropdown-email {
  display: block;
  font-size: 12px;
  color: var(--muted, #86868b);
  margin-top: 2px;
  word-break: break-all;
}

.nav-account-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text, #f5f5f7);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nav-account-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-account-logout {
  color: #ff9f9f;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 0 10px 10px;
  padding-top: 12px;
}

.nav-account-logout:hover {
  background: rgba(255, 138, 138, 0.12);
}


.main-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  flex-shrink: 0;
  min-width: 0;
  overflow: visible;
}

.main-nav-pill.main-nav-tools a {
  font-size: 12px;
  padding: 8px 14px;
}

.main-nav-actions .btn-primary,
.main-nav-actions .btn-nav-cta {
  border: none;
  padding: 10px 22px;
  border-radius: var(--pill, 980px);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--accent, #ffffff);
  color: var(--btn-primary-fg, #0a0a0c);
}

.main-nav-actions .btn-primary:hover,
.main-nav-actions .btn-nav-cta:hover {
  opacity: 0.92;
}

@media (max-width: 900px) {
  :root {
    --header-main-h: 56px;
    --header-brand-h: 56px;
    --header-content-nav-h: 28px;
  }

  .site-header-brand {
    padding: 6px 16px 2px;
  }

  .content-nav-row {
    justify-content: flex-start;
    padding: 3px 12px;
    gap: 6px 10px;
    min-height: var(--header-content-nav-h);
  }

  .content-nav-row .main-nav-pill a,
  .content-nav-row .main-nav-pill button {
    padding: 4px 8px;
    font-size: 11px;
  }

  .main-nav-row {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
    min-height: auto;
  }

  /* Guest: marketing nav wraps to its own row */
  .site-header:not(.is-signed-in) .main-nav-projects-link.is-visible {
    order: 2;
    flex: 1 1 auto;
    text-align: center;
  }

  .site-header:not(.is-signed-in) .main-nav-row > .main-nav-marketing,
  .site-header:not(.is-signed-in) .main-nav-row > .main-nav-pill[data-i18n-aria="nav.mainMenuAria"] {
    flex: 1 1 100%;
    justify-content: center;
    order: 3;
  }

  .site-header:not(.is-signed-in) .main-nav-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    margin-left: 0;
  }

  /* Signed-in: compact two-band main row (logo + actions, then switcher) */
  .site-header.is-signed-in .main-nav-projects-link.is-visible {
    display: none !important;
  }

  .site-header.is-signed-in .main-nav-row > .main-nav-marketing,
  .site-header.is-signed-in .main-nav-row > .main-nav-pill[data-i18n-aria="nav.mainMenuAria"],
  .site-header.is-signed-in .main-nav-row > .main-nav-tools {
    display: none !important;
  }

  .site-header.is-signed-in .main-nav-logo img {
    height: 34px;
  }

  .site-header.is-signed-in .main-nav-actions {
    order: 2;
    width: auto;
    flex: 0 1 auto;
    justify-content: center;
    flex-wrap: nowrap;
    margin-left: 0;
    gap: 6px;
  }

  .site-header.is-signed-in .main-nav-actions .btn-nav-cta,
  .site-header.is-signed-in .main-nav-actions .btn-primary {
    padding: 8px 14px;
    font-size: 12px;
  }

  .site-header.is-signed-in .main-nav-project-zone,
  .site-header.is-signed-in .main-nav-row > .project-switcher-wrap:not(.is-hidden) {
    order: 10;
    flex: 1 1 100%;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    justify-content: center;
  }

  .site-header.is-signed-in .main-nav-project-zone > .project-switcher-wrap {
    flex: 1 1 auto;
    max-width: none;
  }

  .site-header.is-signed-in .nav-account-trigger {
    padding: 4px 10px 4px 4px;
    font-size: 13px;
  }

  .site-header.is-signed-in .nav-account-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .site-header.is-signed-in .nav-account-name {
    display: none;
  }

  .site-header.is-signed-in .lang-picker-trigger {
    padding: 4px 8px 4px 6px;
    font-size: 11px;
  }
}

@media (max-width: 640px) {
  .site-header.is-signed-in .content-nav-row {
    display: none !important;
  }

  body[data-content-surface="pages"] .content-nav-row:not([hidden]) {
    display: flex !important;
  }

  .site-header.is-signed-in .main-nav-actions .btn-nav-cta,
  .site-header.is-signed-in .main-nav-actions .btn-primary {
    display: none;
  }
}

/* Gallery-style topbar: logo | flat links | lang + account */
html:has(.site-header--topbar) {
  --header-brand-h: 70px;
  --header-main-h: 56px;
  --site-header-h: 108px;
}

html:has(.site-header--topbar:not(.is-signed-in)),
html[data-sv-auth='guest']:has(.site-header--topbar) {
  --site-header-h: 108px;
}

html:has(.site-header--topbar.is-signed-in) {
  --site-header-h: 180px;
}

.site-header--topbar {
  background: #000;
  border-bottom: none;
}

.site-header--topbar .site-header-top,
.site-header--topbar .main-nav-row {
  width: 100%;
  max-width: var(--site-content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--site-content-gutter);
  padding-right: var(--site-content-gutter);
  box-sizing: border-box;
}

.site-header--topbar .site-header-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px 28px;
  min-height: 84px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.site-header--topbar .site-header-brand {
  justify-content: flex-start;
  align-self: center;
  padding: 0;
  border: none;
  max-width: 322px;
  min-width: 0;
  margin-top: 0;
}

.site-header--topbar .site-header-brand-logo {
  height: auto;
  max-height: var(--header-brand-h);
  max-width: 100%;
}

.site-header--topbar .main-nav-marketing {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-wrap: nowrap;
  gap: 6px 22px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.site-header--topbar .main-nav-marketing::-webkit-scrollbar {
  display: none;
}

.site-header--topbar .main-nav-marketing a,
.site-header--topbar .main-nav-marketing button {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

.site-header--topbar .main-nav-marketing button {
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.site-header--topbar .main-nav-marketing a:visited {
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
}

.site-header--topbar .main-nav-marketing a:hover,
.site-header--topbar .main-nav-marketing a:focus-visible,
.site-header--topbar .main-nav-marketing a.is-active {
  color: #fff;
  text-decoration: none;
  border-bottom-color: #fff;
}

.site-header--topbar .main-nav-actions {
  justify-self: end;
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

/* Guest: one row — logo | centered menu | lang + Log in + Create CTA. Signup stays hidden. */
.site-header--topbar:not(.is-signed-in) .site-header-top,
html[data-sv-auth='guest'] .site-header--topbar .site-header-top {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand nav actions";
  row-gap: 0;
  padding-bottom: 10px;
}

.site-header--topbar:not(.is-signed-in) .site-header-brand,
html[data-sv-auth='guest'] .site-header--topbar .site-header-brand {
  grid-area: brand;
}

.site-header--topbar:not(.is-signed-in) .main-nav-marketing,
html[data-sv-auth='guest'] .site-header--topbar .main-nav-marketing {
  grid-area: nav;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  min-width: 0;
  gap: 6px 16px;
}

.site-header--topbar:not(.is-signed-in) .main-nav-actions,
html[data-sv-auth='guest'] .site-header--topbar .main-nav-actions {
  grid-area: actions;
  justify-self: end;
  width: auto;
  margin-top: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  gap: 10px 14px;
}

html[data-sv-auth='guest'] .site-header--topbar .lang-picker,
.site-header--topbar:not(.is-signed-in) .lang-picker {
  order: 1;
}

html[data-sv-auth='guest'] .site-header--topbar #main-nav-guest-nav,
.site-header--topbar:not(.is-signed-in) #main-nav-guest-nav {
  order: 2;
}

html[data-sv-auth='guest'] .site-header--topbar .btn-nav-cta,
.site-header--topbar:not(.is-signed-in) .btn-nav-cta {
  display: inline-flex;
  order: 3;
  flex-shrink: 0;
}

html[data-sv-auth='guest'] .site-header--topbar .main-nav-tools,
.site-header--topbar:not(.is-signed-in) .main-nav-tools {
  order: 4;
}

.site-header--topbar:not(.is-signed-in) #main-nav-signup-link,
html[data-sv-auth='guest'] .site-header--topbar #main-nav-signup-link {
  display: none !important;
}

.site-header--topbar:not(.is-signed-in) #main-nav-guest-nav,
html[data-sv-auth='guest'] .site-header--topbar #main-nav-guest-nav {
  margin-right: 0;
  flex: 0 0 auto;
  width: max-content;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  gap: 0;
}

html[data-sv-auth='guest'] .site-header--topbar #main-nav-login-link,
.site-header--topbar:not(.is-signed-in) #main-nav-login-link {
  color: rgba(255, 255, 255, 0.88);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 8px 0;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
}

html[data-sv-auth='guest'] .site-header--topbar #main-nav-login-link:hover,
.site-header--topbar:not(.is-signed-in) #main-nav-login-link:hover {
  color: #fff;
  background: transparent;
}

.site-header--topbar:not(.is-signed-in) .main-nav-tools:not(:has(a:not([hidden]))),
html[data-sv-auth='guest'] .site-header--topbar .main-nav-tools:not(:has(a:not([hidden]))) {
  display: none;
}

.site-header--topbar .lang-picker-trigger {
  background: transparent;
  border: none;
  padding: 4px 8px;
}

.site-header--topbar .nav-account-menu {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.site-header--topbar .nav-account-trigger {
  background: transparent;
  border: none;
  padding: 2px 0 2px 2px;
}

.site-header--topbar .nav-account-avatar {
  background: #7c5cbf;
  color: #fff;
}

.site-header--topbar .main-nav-row {
  display: none;
}

body:has(#detail.active) .site-header--topbar .main-nav-row,
body:has(#briefing.active) .site-header--topbar .main-nav-row,
.site-header--topbar.site-header--has-app-nav .main-nav-row {
  display: flex;
}

body.is-design-focus .site-header--topbar .site-header-brand,
body.is-producible-focus .site-header--topbar .site-header-brand {
  justify-content: flex-start;
  padding: 0;
}

body.is-design-focus .site-header--topbar .site-header-brand-logo,
body.is-producible-focus .site-header--topbar .site-header-brand-logo {
  height: auto;
  max-height: var(--header-brand-h);
  max-width: 100%;
}

body.is-design-focus .header-project-bar,
body.is-producible-focus .header-project-bar {
  display: none !important;
}

.header-project-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: var(--site-content-max);
  margin: 8px auto 12px;
  padding: 16px var(--site-content-gutter);
  border-radius: 16px;
  background: #1c1c1e;
  min-width: 0;
  box-sizing: border-box;
}

.header-project-bar[hidden] {
  display: none !important;
}

html[data-sv-auth="guest"] .header-project-bar,
.site-header:not(.is-signed-in) .header-project-bar {
  display: none !important;
}

.header-project-bar-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.header-project-folder {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f7' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.header-project-bar .main-nav-project-zone {
  min-width: 0;
}

.header-project-bar .main-nav-projects-link {
  display: none !important;
}

.header-project-empty {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.header-project-empty:hover,
.header-project-empty:visited {
  color: #fff;
  text-decoration: none;
}

.header-project-bar:not(:has(.project-switcher-wrap:not(.is-hidden))) .header-project-empty {
  display: flex;
}

.header-project-empty-kicker,
.header-project-bar .project-switcher-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.55);
}

.header-project-empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
}

.header-project-bar .project-switcher-inner {
  gap: 2px;
}

.header-project-bar .project-switcher-trigger {
  min-height: 0;
  padding: 0 18px 0 0;
  border: none;
  background-color: transparent;
  font-size: 15px;
  font-weight: 600;
}

.header-project-bar .project-switcher-new-btn,
.header-project-bar .project-switcher-count {
  display: none !important;
}

.header-project-all {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.header-project-all:hover,
.header-project-all:visited {
  color: #fff;
  text-decoration: none;
}

.header-project-bar-help {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 0 0 auto;
}

.header-project-help-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin: 0;
  text-align: right;
}

.header-project-help-copy [data-i18n='nav.needHelp'] {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.header-project-help-copy [data-i18n='nav.needHelpLead'] {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
}

.header-project-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 980px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.header-project-contact::before {
  content: '';
  width: 16px;
  height: 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
}

.header-project-contact:hover,
.header-project-contact:visited {
  color: #fff;
  text-decoration: none;
  border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 980px) {
  .site-header--topbar .site-header-brand {
    max-width: 263px;
  }

  .site-header--topbar .main-nav-marketing {
    gap: 6px 14px;
  }

  .site-header--topbar.is-signed-in .site-header-top {
    grid-template-columns: auto 1fr auto;
  }

  .header-project-bar {
    padding: 14px 16px;
    flex-wrap: wrap;
  }

  .header-project-help-copy {
    display: none;
  }
}

@media (max-width: 760px) {
  html:has(.site-header--topbar) {
    --header-brand-h: 56px;
    --site-header-h: 148px;
  }

  html:has(.site-header--topbar:not(.is-signed-in)),
  html[data-sv-auth='guest']:has(.site-header--topbar) {
    --site-header-h: 148px;
  }

  .site-header--topbar .site-header-brand {
    max-width: 240px;
  }

  .site-header--topbar.is-signed-in .site-header-top {
    grid-template-columns: 1fr auto;
  }

  .site-header--topbar:not(.is-signed-in) .site-header-top,
  html[data-sv-auth='guest'] .site-header--topbar .site-header-top {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand nav actions";
  }

  .site-header--topbar.is-signed-in .main-nav-marketing {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
  }

  .site-header--topbar .nav-account-name {
    display: none;
  }
}
