/* ROUND S5C.4 - EXACT PUBLIC HEADER PARITY */

/* The language menu is closed until the shared switcher explicitly opens it.
 * Upgrade pages do not carry the home page's inline language CSS, so this
 * rule belongs to the shared parity asset and prevents the menu from being
 * painted as a vertical stack during first paint. */
nav.public-unified-header > #lang-switcher {
  position: relative;
  z-index: 230;
  flex: 0 0 auto;
}

nav.public-unified-header #lang-switcher .lang-switcher {
  position: relative;
}

nav.public-unified-header #lang-switcher .lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  z-index: 240;
  min-width: 13rem;
  margin: 0;
  padding: .45rem;
  border: 1px solid rgba(139, 92, 246, .32);
  border-radius: 14px;
  background: rgba(10, 10, 24, .98);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .42);
}

nav.public-unified-header #lang-switcher .lang-switcher.open .lang-menu,
nav.public-unified-header #lang-switcher .lang-btn[aria-expanded="true"] + .lang-menu {
  display: grid;
  gap: .2rem;
}

nav.public-unified-header #lang-switcher .lang-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 38px;
  border: 1px solid rgba(139, 92, 246, .28);
  border-radius: 999px;
  padding: .45rem .75rem;
  color: #f8f7ff;
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
  font: inherit;
}

nav.public-unified-header #lang-switcher .lang-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 38px;
  border-radius: 9px;
  padding: .45rem .6rem;
  color: #f8f7ff;
  text-decoration: none;
  white-space: nowrap;
}

nav.public-unified-header #lang-switcher .lang-item:hover,
nav.public-unified-header #lang-switcher .lang-item:focus-visible {
  background: rgba(139, 92, 246, .2);
  outline: none;
}

/* The wordmark is the same shared component on every public page. */
.public-unified-header .cometai-brand-wordmark,
.solutions-home-header.public-unified-header .solutions-official-brand.cometai-brand-wordmark {
  width: 122px !important;
  height: 34px !important;
  flex: 0 0 122px !important;
  margin: 0 !important;
  padding: 0 !important;
  transform: none !important;
}

.public-unified-header .cometai-brand-wordmark__art,
.solutions-home-header.public-unified-header .cometai-brand-wordmark__art {
  left: -5px !important;
  top: 3px !important;
  width: 142px !important;
  height: 38px !important;
  transform: none !important;
}

/* Solutions follows the exact full-width alignment used by the home. */
.solutions-home-header.public-unified-header .solutions-header-inner {
  width: 100% !important;
  max-width: none !important;
  min-height: 68px;
  margin: 0 !important;
  padding: 0 5% !important;
}

.solutions-home-header.public-unified-header .solutions-header-channels {
  margin-right: .55rem;
}

/* Home mobile menu button. */
.public-header-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  gap: 4px;
  border: 1px solid rgba(139, 92, 246, .28);
  border-radius: 12px;
  padding: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .035);
  cursor: pointer;
}

.public-header-menu-toggle span {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform .18s ease, opacity .18s ease;
}

nav.public-unified-header.is-menu-open .public-header-menu-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

nav.public-unified-header.is-menu-open .public-header-menu-toggle span:nth-child(2) {
  opacity: 0;
}

nav.public-unified-header.is-menu-open .public-header-menu-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.public-header-mobile-start {
  display: none;
}

@media (max-width: 1100px) {
  /* Home receives the same responsive menu behavior as Solutions. */
  nav.public-unified-header .public-header-menu-toggle {
    display: grid;
  }

  nav.public-unified-header .nav-links {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 210;
    display: none !important;
    max-height: calc(100vh - 76px);
    overflow-y: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .8rem max(3vw, 1rem) 1rem;
    border-bottom: 1px solid rgba(139, 92, 246, .2);
    background: rgba(7, 7, 15, .995);
    box-shadow: 0 22px 50px rgba(0, 0, 0, .38);
  }

  nav.public-unified-header.is-menu-open .nav-links {
    display: grid !important;
  }

  nav.public-unified-header .nav-links > li {
    min-width: 0;
  }

  nav.public-unified-header .nav-links > li > a {
    display: flex;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, .14);
    border-radius: 12px;
    padding: .55rem .75rem;
    background: rgba(255, 255, 255, .025);
    font-size: .88rem;
    text-align: center;
  }

  nav.public-unified-header .public-header-mobile-start {
    display: block;
    grid-column: 1 / -1;
  }

  nav.public-unified-header .public-header-mobile-start .nav-cta {
    border: 0;
    border-radius: 999px;
    color: #fff !important;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  }

  .solutions-home-header.public-unified-header .solutions-header-menu-toggle {
    display: grid !important;
  }

  .solutions-home-header.public-unified-header .solutions-main-nav.nav-links {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 210 !important;
    display: none !important;
    max-height: calc(100vh - 112px);
    overflow-y: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .35rem;
    padding: .8rem max(3vw, 1rem) 1rem;
    border-bottom: 1px solid rgba(139, 92, 246, .2);
    background: rgba(7, 7, 15, .995);
    box-shadow: 0 22px 50px rgba(0, 0, 0, .38);
  }

  .solutions-home-header.public-unified-header.is-menu-open .solutions-main-nav.nav-links {
    display: grid !important;
  }

  .solutions-home-header.public-unified-header .solutions-main-nav.nav-links > a {
    justify-content: center;
    min-height: 46px;
    border: 1px solid rgba(139, 92, 246, .14);
    border-radius: 12px;
    background: rgba(255, 255, 255, .025);
    font-size: .88rem;
  }
}

/* FINAL CASCADE: keep the approved Home composition as the shared public header. */
@media (max-width: 1100px) {
  nav.public-unified-header {
    min-height: 68px !important;
    height: 68px !important;
    grid-template-columns: 122px minmax(104px, 1fr) auto auto !important;
    grid-template-rows: 68px !important;
    padding: 0 3% !important;
    gap: 0 .35rem !important;
  }

  nav.public-unified-header > .nav-logo {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
  }

  nav.public-unified-header > #public-channel-status-top {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    margin: 0 !important;
    justify-self: center !important;
    align-self: center !important;
  }

  nav.public-unified-header > #lang-switcher {
    grid-column: 3 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .public-header-menu-toggle {
    grid-column: 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .nav-cta {
    display: none !important;
  }
}

@media (max-width: 520px) {
  nav.public-unified-header {
    gap: 0 .18rem !important;
    padding-right: 2% !important;
    padding-left: 2% !important;
  }

  nav.public-unified-header #public-channel-status-top {
    gap: .16rem !important;
  }

  nav.public-unified-header #public-channel-status-top .public-channel-status__item {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    border-radius: 7px !important;
  }

  nav.public-unified-header #public-channel-status-top .public-channel-status__glyph {
    width: 12px !important;
    height: 12px !important;
  }

  nav.public-unified-header .cometai-brand-wordmark,
  nav.public-unified-header .cometai-brand-wordmark__art {
    transform: none !important;
  }

  nav.public-unified-header .public-header-menu-toggle {
    width: 38px !important;
    height: 38px !important;
  }
}

/* The smallest phones use a compact second row only when the one-row
 * composition cannot physically fit. The language selector remains visible. */
@media (max-width: 389px) {
  nav.public-unified-header {
    height: 104px !important;
    min-height: 104px !important;
    grid-template-columns: minmax(122px, auto) minmax(0, 1fr) auto !important;
    grid-template-rows: 68px 36px !important;
    padding: 0 4% !important;
  }

  nav.public-unified-header > #public-channel-status-top {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
  }

  nav.public-unified-header > #lang-switcher {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }

  nav.public-unified-header > .public-header-menu-toggle {
    grid-column: 3 !important;
    grid-row: 1 !important;
  }
}

/* ROUND S5C.7 - FINAL SHARED NAV BASE AND MOBILE OVERFLOW GUARD */
nav.public-unified-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  display: flex;
  width: 100%;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 1.35rem;
  margin: 0;
  padding: 0 5%;
  background: rgba(7, 7, 15, .7);
  border-bottom: 1px solid rgba(139, 92, 246, .18);
  backdrop-filter: blur(20px);
}

nav.public-unified-header .nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

nav.public-unified-header .nav-links a {
  color: #8b8aa8;
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

nav.public-unified-header .nav-links a:hover,
nav.public-unified-header .nav-links a[aria-current='page'] {
  color: #f1f0ff;
}

nav.public-unified-header > .nav-cta,
nav.public-unified-header .public-header-mobile-start .nav-cta {
  border-radius: 999px;
  padding: .55rem 1.4rem;
  color: #fff !important;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  box-shadow: 0 0 20px rgba(139, 92, 246, .4);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

nav.public-unified-header > .nav-cta:hover,
nav.public-unified-header .public-header-mobile-start .nav-cta:hover {
  color: #fff !important;
  box-shadow: 0 0 30px rgba(139, 92, 246, .6);
  transform: translateY(-2px);
}

html,
body {
  max-width: 100%;
}

/* Keep intentional horizontal scrollers (comparison tables and showcase tabs)
 * inside their own boxes while preventing their scrollable contents from
 * becoming page-level overflow. */
html {
  overflow-x: clip;
}

.channel-home-comparison,
.conversation-showcase {
  overflow-x: clip;
  contain: paint;
}

nav.public-unified-header > *,
nav.public-unified-header .nav-links,
nav.public-unified-header #public-channel-status-top,
nav.public-unified-header #lang-switcher {
  min-width: 0;
}

@media (max-width: 1100px) {
  nav.public-unified-header {
    min-height: 112px !important;
    height: 112px !important;
    display: grid !important;
    grid-template-columns: minmax(122px, auto) minmax(0, 1fr) auto !important;
    grid-template-rows: 68px 36px !important;
    align-items: center !important;
    gap: 0 .5rem !important;
    padding: 0 5% !important;
  }

  nav.public-unified-header > .nav-logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  nav.public-unified-header > #lang-switcher {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin: 0 !important;
  }

  nav.public-unified-header > .public-header-menu-toggle {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  nav.public-unified-header > #public-channel-status-top {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: auto !important;
    margin: 0 !important;
  }

  nav.public-unified-header > .nav-cta {
    display: none !important;
  }

  nav.public-unified-header .nav-links {
    top: 100% !important;
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  nav.public-unified-header {
    padding-right: 4% !important;
    padding-left: 4% !important;
  }

  nav.public-unified-header #public-channel-status-top {
    gap: .35rem !important;
  }
}


@media (max-width: 1100px) {
  /* One shared mobile composition: logo + language + menu, icons below. */
  nav.public-unified-header {
    height: auto !important;
    min-height: 112px !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 52px 36px;
    align-items: center;
    gap: .3rem .5rem;
    padding: .35rem 5% .45rem !important;
  }

  nav.public-unified-header > .nav-logo {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  nav.public-unified-header > #lang-switcher {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin: 0 !important;
  }

  nav.public-unified-header > .public-header-menu-toggle {
    grid-column: 3;
    grid-row: 1;
  }

  nav.public-unified-header > .nav-cta {
    display: none !important;
  }

  nav.public-unified-header > #public-channel-status-top {
    grid-column: 1 / -1;
    grid-row: 2;
    width: auto;
    margin: 0 !important;
    justify-self: center;
  }

  nav.public-unified-header .nav-links {
    top: 100%;
    grid-template-columns: 1fr;
  }

  /* Solutions uses the same rows without changing its semantic structure. */
  .solutions-home-header.public-unified-header {
    min-height: 112px !important;
  }

  .solutions-home-header.public-unified-header .solutions-header-inner {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 52px 36px;
    min-height: 112px !important;
    align-items: center;
    gap: .3rem .5rem;
    padding: .35rem 5% .45rem !important;
  }

  .solutions-home-header.public-unified-header .solutions-official-brand {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .solutions-home-header.public-unified-header .solutions-home-header-tools {
    display: contents !important;
  }

  .solutions-home-header.public-unified-header .solutions-header-language-switcher {
    display: block !important;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .solutions-home-header.public-unified-header .solutions-header-menu-toggle {
    display: grid !important;
    grid-column: 3;
    grid-row: 1;
  }

  .solutions-home-header.public-unified-header .solutions-header-cta {
    display: none !important;
  }

  .solutions-home-header.public-unified-header .solutions-header-channels {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    margin: 0 !important;
  }

  .solutions-home-header.public-unified-header .solutions-main-nav.nav-links {
    top: 100% !important;
  }

  .solutions-home-header.public-unified-header .solutions-mobile-language {
    display: none !important;
  }

  .solutions-home-header.public-unified-header .solutions-mobile-header-actions {
    grid-template-columns: 1fr !important;
  }

  /* Preserve the exact shared mobile wordmark behavior. */
  .public-unified-header .cometai-brand-wordmark,
  .solutions-home-header.public-unified-header .solutions-official-brand.cometai-brand-wordmark {
    width: 112px !important;
    height: 31px !important;
    flex-basis: 112px !important;
  }

  .public-unified-header .cometai-brand-wordmark__art,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__art {
    left: -5px !important;
    top: 3px !important;
    width: 130px !important;
    height: 35px !important;
  }

  .hero {
    padding-top: 146px !important;
  }
}

@media (max-width: 420px) {
  nav.public-unified-header,
  .solutions-home-header.public-unified-header .solutions-header-inner {
    padding-right: 4% !important;
    padding-left: 4% !important;
  }

  .public-header-menu-toggle,
  .solutions-header-menu-toggle {
    width: 39px !important;
    height: 39px !important;
  }

  nav.public-unified-header #public-channel-status-top,
  .solutions-home-header.public-unified-header .solutions-header-channels {
    gap: .25rem !important;
  }
}

/* ROUND S5C.5 - EXACT WORDMARK GEOMETRY AND SINGLE-ROW RESPONSIVE HEADER */
.public-unified-header .cometai-brand-wordmark__art,
.solutions-home-header.public-unified-header .cometai-brand-wordmark__art {
  max-width: none !important;
  min-width: 142px !important;
}

@media (min-width: 1101px) {
  .solutions-home-header.public-unified-header .solutions-header-inner {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .solutions-home-header.public-unified-header .solutions-home-header-tools {
    display: contents !important;
  }

  .solutions-home-header.public-unified-header .solutions-header-channels,
  .solutions-home-header.public-unified-header .solutions-header-language-switcher {
    margin: 0 !important;
  }
}

@media (max-width: 1100px) {
  nav.public-unified-header,
  .solutions-home-header.public-unified-header,
  .solutions-home-header.public-unified-header .solutions-header-inner {
    min-height: 68px !important;
    height: 68px !important;
  }

  nav.public-unified-header,
  .solutions-home-header.public-unified-header .solutions-header-inner {
    display: grid !important;
    grid-template-columns: 112px minmax(104px, 1fr) auto auto !important;
    grid-template-rows: 68px !important;
    align-items: center !important;
    gap: 0 .35rem !important;
    padding: 0 3% !important;
  }

  nav.public-unified-header > .nav-logo,
  .solutions-home-header.public-unified-header .solutions-official-brand {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
  }

  nav.public-unified-header > #public-channel-status-top,
  .solutions-home-header.public-unified-header .solutions-header-channels {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    margin: 0 !important;
    justify-self: center !important;
    align-self: center !important;
  }

  nav.public-unified-header > #lang-switcher,
  .solutions-home-header.public-unified-header .solutions-header-language-switcher {
    grid-column: 3 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .public-header-menu-toggle,
  .solutions-home-header.public-unified-header .solutions-header-menu-toggle {
    grid-column: 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .nav-cta,
  .solutions-home-header.public-unified-header .solutions-header-cta {
    display: none !important;
  }

  .solutions-home-header.public-unified-header .solutions-home-header-tools {
    display: contents !important;
  }

  nav.public-unified-header .nav-links,
  .solutions-home-header.public-unified-header .solutions-main-nav.nav-links {
    top: 100% !important;
  }

  nav.public-unified-header .public-header-mobile-start,
  .solutions-home-header.public-unified-header .solutions-mobile-header-actions {
    display: block !important;
    grid-column: 1 / -1 !important;
  }

  .solutions-home-header.public-unified-header .solutions-mobile-header-actions {
    grid-template-columns: 1fr !important;
  }

  .solutions-home-header.public-unified-header .solutions-mobile-language {
    display: none !important;
  }

  .public-unified-header .cometai-brand-wordmark,
  .solutions-home-header.public-unified-header .solutions-official-brand.cometai-brand-wordmark {
    width: 112px !important;
    height: 31px !important;
    flex-basis: 112px !important;
  }

  .public-unified-header .cometai-brand-wordmark__art,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__art {
    left: -5px !important;
    top: 3px !important;
    width: 130px !important;
    min-width: 130px !important;
    height: 35px !important;
    max-width: none !important;
  }

  .hero {
    padding-top: 100px !important;
  }
}

@media (max-width: 520px) {
  nav.public-unified-header,
  .solutions-home-header.public-unified-header .solutions-header-inner {
    gap: 0 .18rem !important;
    padding-right: 2% !important;
    padding-left: 2% !important;
  }

  nav.public-unified-header #public-channel-status-top,
  .solutions-home-header.public-unified-header .solutions-header-channels {
    gap: .16rem !important;
  }

  nav.public-unified-header #public-channel-status-top .public-channel-status__item,
  .solutions-home-header.public-unified-header .solutions-header-channels .public-channel-status__item {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    border-radius: 7px !important;
  }

  nav.public-unified-header #public-channel-status-top .public-channel-status__glyph,
  .solutions-home-header.public-unified-header .solutions-header-channels .public-channel-status__glyph {
    width: 12px !important;
    height: 12px !important;
  }

  .solutions-home-header.public-unified-header .solutions-header-language {
    min-width: 54px !important;
    min-height: 38px !important;
    padding: .35rem .5rem !important;
  }

  .public-header-menu-toggle,
  .solutions-header-menu-toggle {
    width: 38px !important;
    height: 38px !important;
  }
}

/* ROUND S5C.6 - IDENTICAL DESKTOP AND MOBILE WORDMARK */
/* The approved desktop wordmark is the single source of truth at every viewport. */
@media (max-width: 1100px) {
  .public-unified-header .cometai-brand-wordmark,
  .solutions-home-header.public-unified-header .solutions-official-brand.cometai-brand-wordmark {
    width: 122px !important;
    min-width: 122px !important;
    height: 34px !important;
    flex-basis: 122px !important;
  }

  .public-unified-header .cometai-brand-wordmark__text,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__text {
    font-size: 22px !important;
  }

  .public-unified-header .cometai-brand-wordmark__art,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__art {
    left: -5px !important;
    top: 3px !important;
    width: 142px !important;
    min-width: 142px !important;
    height: 38px !important;
    max-width: none !important;
    transform: none !important;
  }

  .public-unified-header .cometai-brand-wordmark__particles,
  .public-unified-header .cometai-brand-wordmark__wave,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__particles,
  .solutions-home-header.public-unified-header .cometai-brand-wordmark__wave {
    display: inline !important;
  }

  nav.public-unified-header,
  .solutions-home-header.public-unified-header .solutions-header-inner {
    min-height: 68px !important;
    height: 68px !important;
    grid-template-columns: 112px minmax(104px, 1fr) auto auto !important;
    grid-template-rows: 68px !important;
    padding: 0 3% !important;
    gap: 0 .35rem !important;
  }

  nav.public-unified-header > .nav-logo {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: start !important;
  }

  nav.public-unified-header > #public-channel-status-top {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    margin: 0 !important;
    justify-self: center !important;
    align-self: center !important;
  }

  nav.public-unified-header > #lang-switcher {
    grid-column: 3 !important;
    grid-row: 1 !important;
    margin: 0 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .public-header-menu-toggle {
    grid-column: 4 !important;
    grid-row: 1 !important;
    justify-self: end !important;
    align-self: center !important;
  }

  nav.public-unified-header > .nav-cta {
    display: none !important;
  }
}
