/* ═══════════════════════════════════════════════════════════════════════════
   Cosmos Menu — layouts: horizontal, horizontal-overlay, horizontal-overlay-collapsed, centered, split
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Base Reset ─────────────────────────────────────────────────────────── */

/* Colors inherit the website palette (--cos-*) from [data-publish-root];
   a per-menu palette override sets the same vars inline on the nav.
   Typography: fonts + letter spacing inherit from the website typography via
   --menu-*-font / --menu-*-ls vars set inline on the nav by MenuRenderer.
   Sizes stay menu-owned (--menu-*-size, set from MenuConfig overrides). */
.cosmos-menu {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--cos-bg, #fff);
  border-bottom: 1px solid var(--cos-border, #e5e7eb);
  font-family: var(--menu-body-font, Inter, system-ui, -apple-system, sans-serif);
}

.cosmos-menu__inner {
  display: flex;
  align-items: center;
  max-width: var(--website-max-width, 1280px);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  box-sizing: border-box;
}

/* The hero overlay menu (and the sticky clone that replaces it on scroll —
   both bars, or the brand jumps at the swap) spans the full viewport. */
.cosmos-menu--overlay .cosmos-menu__inner,
.cosmos-menu--sticky-clone .cosmos-menu__inner {
  max-width: none;
}

/* Horizontal and split bars follow the website width: as wide as the site
   (its max width when one is set, otherwise the full viewport) instead of
   a fixed 1280px band that leaves the brand and CTA floating inside a
   full-bleed page on wide screens. */
[data-menu-layout="horizontal"] .cosmos-menu__inner,
[data-menu-layout="split"] .cosmos-menu__inner {
  max-width: var(--website-max-width, none);
}

/* ─── Brand ──────────────────────────────────────────────────────────────── */

.cosmos-menu__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.cosmos-menu__icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 6px;
}

.cosmos-menu__brand-text {
  display: flex;
  flex-direction: column;
}

.cosmos-menu__title {
  font-family: var(--menu-title-font, inherit);
  letter-spacing: var(--menu-title-ls, normal);
  font-size: var(--menu-title-size, 18px);
  font-weight: var(--menu-title-weight, 700);
  font-style: var(--menu-title-style, normal);
  color: var(--cos-text, #111);
  line-height: 1.2;
}

.cosmos-menu__subtitle {
  font-family: var(--menu-subtitle-font, inherit);
  letter-spacing: var(--menu-subtitle-ls, normal);
  font-size: var(--menu-subtitle-size, 12px);
  color: var(--cos-text-secondary, #6b7280);
  line-height: 1.2;
}

/* ─── Links ──────────────────────────────────────────────────────────────── */

.cosmos-menu__links {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
}

.cosmos-menu__links li a {
  display: block;
  padding: 8px 14px;
  /* Never break a label onto two lines. With nowrap the list can't shrink
     below its content, so cosmos-menu.js measures the true width the links
     need and collapses the bar to the hamburger instead. */
  white-space: nowrap;
  font-size: var(--menu-links-size, 14px);
  letter-spacing: var(--menu-body-ls, normal);
  /* Link text style (menu.linksStyle): case / weight / italic, set as vars by
     MenuRenderer. Dropdown sub-links are `li a` under this list too. */
  text-transform: var(--menu-links-transform, none);
  font-weight: var(--menu-links-weight, 500);
  font-style: var(--menu-links-style, normal);
  color: var(--cos-text-secondary, #374151);
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.cosmos-menu__links li a:hover {
  background: var(--cos-surface, #f3f4f6);
  color: var(--cos-text, #111);
}

.cosmos-menu__links li a.cosmos-menu__link--active {
  background: var(--cos-surface, #f3f4f6);
  color: var(--cos-text, #111);
  font-weight: var(--menu-links-weight-active, 600);
}

/* ─── Nested menus: desktop dropdown (#60) ───────────────────────────────── */
/* A parent is its own link plus a chevron button. The sub-list opens on
   :hover / :focus-within (pure CSS — the static publish needs no JS for it)
   and stays open while the chevron is aria-expanded (toggled by
   cosmos-menu.js, which also closes on Escape / outside click). */

.cosmos-menu__item--has-children {
  position: relative;
}

.cosmos-menu__parent {
  display: flex;
  align-items: center;
}

.cosmos-menu__links li a.cosmos-menu__parent-link {
  padding-right: 6px;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.cosmos-menu__caret {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 0 6px 6px 0;
  background: transparent;
  color: var(--cos-text-secondary, #374151);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.cosmos-menu__caret svg {
  transition: transform 0.15s;
}

.cosmos-menu__caret:hover,
.cosmos-menu__parent:hover .cosmos-menu__caret,
.cosmos-menu__caret[aria-expanded="true"] {
  background: var(--cos-surface, #f3f4f6);
  color: var(--cos-text, #111);
}

.cosmos-menu__caret[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.cosmos-menu__sublinks {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1001;
  min-width: 180px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--cos-bg, #fff);
  border: 1px solid var(--cos-border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Keep the dropdown reachable: no gap between the parent row and the panel. */
.cosmos-menu__sublinks::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

/* .cosmos-menu__item--closed: set by cosmos-menu.js after Escape so the panel
   stays shut while focus / pointer are still on the item. */
.cosmos-menu__item--has-children:not(.cosmos-menu__item--closed):hover > .cosmos-menu__sublinks,
.cosmos-menu__item--has-children:not(.cosmos-menu__item--closed):focus-within > .cosmos-menu__sublinks,
.cosmos-menu__item--has-children.cosmos-menu__item--open > .cosmos-menu__sublinks {
  display: block;
}

.cosmos-menu__sublinks li a {
  white-space: nowrap;
  padding: 8px 12px;
}

/* Centered layout: dropdowns hang from the middle of their parent. */
[data-menu-layout="centered"] .cosmos-menu__sublinks {
  left: 50%;
  transform: translateX(-50%);
}

/* Right-aligned link groups (split): the last dropdown must not run off-screen. */
[data-menu-layout="split"] .cosmos-menu__item--has-children:last-child > .cosmos-menu__sublinks {
  left: auto;
  right: 0;
}

/* ─── Link indicator (menu.linkIndicator → data-menu-indicator) ──────────── */
/* How the current page's link and the hovered link are marked. The default
   (no attribute) is the pill above. The three alternatives below drop the
   background on the TOP-LEVEL links only — dropdown sub-links keep the pill,
   an underline reads wrong inside a panel — and share one underline colour.
   Selectors carry the .cosmos-menu prefix so they outrank the overlay bar's
   own hover/active background (.cosmos-menu--overlay .cosmos-menu__links li a). */

.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > a,
.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > .cosmos-menu__parent > a {
  position: relative;
}

.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > a:hover,
.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > a.cosmos-menu__link--active,
.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > .cosmos-menu__parent > a:hover,
.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > .cosmos-menu__parent > a.cosmos-menu__link--active {
  background: transparent;
}

/* Underline (static + no-JS fallback of the sliding one): a 2px bar under the
   label, inset by the link's own side padding so it spans the text only. */
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > a::after,
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > .cosmos-menu__parent > a::after,
.cosmos-menu[data-menu-indicator="slide"] .cosmos-menu__links:not(.cosmos-menu__links--slider) > li > a::after,
.cosmos-menu[data-menu-indicator="slide"] .cosmos-menu__links:not(.cosmos-menu__links--slider) > li > .cosmos-menu__parent > a::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  border-radius: 1px;
  background: var(--menu-indicator-color, var(--cos-accent, currentColor));
  opacity: 0;
  transition: opacity 0.18s;
}
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > a:hover::after,
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > .cosmos-menu__parent > a:hover::after {
  opacity: 0.45;
}
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > a.cosmos-menu__link--active::after,
.cosmos-menu[data-menu-indicator="underline"] .cosmos-menu__links > li > .cosmos-menu__parent > a.cosmos-menu__link--active::after,
.cosmos-menu[data-menu-indicator="slide"] .cosmos-menu__links:not(.cosmos-menu__links--slider) > li > a.cosmos-menu__link--active::after,
.cosmos-menu[data-menu-indicator="slide"] .cosmos-menu__links:not(.cosmos-menu__links--slider) > li > .cosmos-menu__parent > a.cosmos-menu__link--active::after {
  opacity: 1;
}
/* The parent link's right padding is trimmed for the caret; end the bar there too. */
.cosmos-menu[data-menu-indicator] .cosmos-menu__links > li > .cosmos-menu__parent > a::after {
  right: 6px;
}

/* Sliding underline: cosmos-menu.js appends ONE .cosmos-menu__slider to the
   list, positions it under the current page, and glides it to whichever
   top-level link is hovered (back home on mouseleave). */
.cosmos-menu[data-menu-indicator="slide"] .cosmos-menu__links {
  position: relative;
}
.cosmos-menu__slider {
  position: absolute;
  left: 0;
  bottom: 4px;
  height: 2px;
  width: 0;
  border-radius: 1px;
  background: var(--menu-indicator-color, var(--cos-accent, currentColor));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s;
  will-change: transform, width;
}
.cosmos-menu__slider--on {
  opacity: 1;
}

/* Colour only: no shape; the hover / active colour change already in place
   (text-secondary → text) is the whole indicator. */

/* The overlay bar sits on the hero photo: an accent underline may vanish
   there, so it uses white like its text. */
.cosmos-menu--overlay[data-menu-indicator] {
  --menu-indicator-color: #fff;
}

/* ─── CTA ────────────────────────────────────────────────────────────────── */

/* The CTA follows the site's button style: MenuRenderer (menuCtaStyle) sets
   the --menu-cta-* vars from the site-wide preset — or the one menu.ctaStyle
   pins — and from its colour overrides. Everything here is the fallback for a
   site without a preset, and stays the layout scaffold for the responsive
   rules below (which scale the padding vars, not fixed numbers). */
.cosmos-menu__cta a,
.cosmos-menu__cta .cosmos-menu__cta-link {
  display: inline-flex;
  align-items: center;
  gap: var(--menu-cta-arrow-gap, 8px);
  padding: var(--menu-cta-pad-v, 8px) var(--menu-cta-pad-h, 20px);
  font-family: var(--menu-cta-font, inherit);
  font-size: var(--menu-cta-size, 14px);
  letter-spacing: var(--menu-cta-ls, var(--menu-body-ls, normal));
  font-weight: var(--menu-cta-weight, 600);
  text-transform: var(--menu-cta-transform, none);
  color: var(--menu-cta-color, var(--cos-on-accent, #fff));
  background: var(--menu-cta-bg, var(--cos-accent, #111));
  border: var(--menu-cta-border, none);
  border-radius: var(--menu-cta-radius, 6px);
  text-decoration: none;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.cosmos-menu__cta a:hover,
.cosmos-menu__cta .cosmos-menu__cta-link:hover {
  opacity: 0.85;
}

/* Link-style presets (underline / underline-hover): the bar is painted under
   the label alone as a background gradient, sliding in on hover for the hover
   variant — the same drawing as cosmos-skins.css [data-btn-underline]. */
[data-menu-cta-underline] .cosmos-menu__cta a > span:first-child,
[data-menu-cta-underline] .cosmos-menu__cta .cosmos-menu__cta-link > span:first-child,
[data-menu-cta-underline] .cosmos-menu__mobile-cta a > span:first-child {
  padding-bottom: 0.15em;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1.5px;
  transition: background-size 0.25s ease, opacity 0.2s ease;
}
[data-menu-cta-underline="hover"] .cosmos-menu__cta a > span:first-child,
[data-menu-cta-underline="hover"] .cosmos-menu__cta .cosmos-menu__cta-link > span:first-child {
  background-size: 0% 1.5px;
}
[data-menu-cta-underline="hover"] .cosmos-menu__cta a:hover > span:first-child,
[data-menu-cta-underline="hover"] .cosmos-menu__cta .cosmos-menu__cta-link:hover > span:first-child {
  background-size: 100% 1.5px;
}
[data-menu-cta-underline] .cosmos-menu__cta a:hover,
[data-menu-cta-underline] .cosmos-menu__cta .cosmos-menu__cta-link:hover {
  opacity: 1;
}
[data-menu-cta-underline="always"] .cosmos-menu__cta a:hover > span:first-child,
[data-menu-cta-underline="always"] .cosmos-menu__cta .cosmos-menu__cta-link:hover > span:first-child {
  opacity: 0.75;
}

/* ─── Hamburger (hidden on desktop) ──────────────────────────────────────── */

.cosmos-menu__hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  margin-left: auto;
}

.cosmos-menu__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--cos-text, #374151);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

.cosmos-menu__hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.cosmos-menu__hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.cosmos-menu__hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ─── Mobile Panel (hidden by default) ───────────────────────────────────── */

.cosmos-menu__mobile {
  display: none;
  flex-direction: column;
  padding: 16px 24px 24px;
  background: var(--cos-bg, #fff);
  border-top: 1px solid var(--cos-border, #e5e7eb);
}

.cosmos-menu__mobile[hidden] {
  display: none !important;
}

.cosmos-menu__mobile:not([hidden]) {
  display: flex;
}

.cosmos-menu__mobile-links {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cosmos-menu__mobile-links li a {
  display: block;
  padding: 12px 0;
  font-size: calc(var(--menu-links-size, 14px) * 1.14);
  letter-spacing: var(--menu-body-ls, normal);
  text-transform: var(--menu-links-transform, none);
  font-weight: var(--menu-links-weight, 500);
  font-style: var(--menu-links-style, normal);
  color: var(--cos-text-secondary, #374151);
  text-decoration: none;
  border-bottom: 1px solid var(--cos-border, #f3f4f6);
}

.cosmos-menu__mobile-links li a:hover,
.cosmos-menu__mobile-links li a.cosmos-menu__link--active {
  color: var(--cos-text, #111);
}
.cosmos-menu__mobile-links li a.cosmos-menu__link--active {
  font-weight: var(--menu-links-weight-active, 500);
}

/* ─── Nested menus: mobile accordion (#60) ───────────────────────────────── */
/* Parent row = link + chevron; the chevron toggles the indented sub-list
   (cosmos-menu.js flips `hidden`, like the hamburger panel). */

.cosmos-menu__mobile-parent {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--cos-border, #f3f4f6);
}

.cosmos-menu__mobile-links li a.cosmos-menu__mobile-parent-link {
  flex: 1;
  border-bottom: none;
}

.cosmos-menu__mobile-caret {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--cos-text-secondary, #374151);
  cursor: pointer;
}

.cosmos-menu__mobile-caret svg {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.cosmos-menu__mobile-caret[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.cosmos-menu__mobile-sublinks {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--cos-border, #f3f4f6);
}

.cosmos-menu__mobile-sublinks[hidden] {
  display: none;
}

.cosmos-menu__mobile-sublinks li a {
  font-size: var(--menu-links-size, 14px);
  padding: 10px 0;
}

.cosmos-menu__mobile-cta {
  margin-top: 16px;
}

.cosmos-menu__mobile-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--menu-cta-arrow-gap, 8px);
  padding: calc(var(--menu-cta-pad-v, 8px) * 1.5) var(--menu-cta-pad-h, 20px);
  font-family: var(--menu-cta-font, inherit);
  font-size: calc(var(--menu-cta-size, 14px) * 1.14);
  letter-spacing: var(--menu-cta-ls, var(--menu-body-ls, normal));
  font-weight: var(--menu-cta-weight, 600);
  text-transform: var(--menu-cta-transform, none);
  color: var(--menu-cta-color, var(--cos-on-accent, #fff));
  background: var(--menu-cta-bg, var(--cos-accent, #111));
  border: var(--menu-cta-border, none);
  border-radius: var(--menu-cta-radius, 8px);
  text-decoration: none;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout: horizontal (default)
   Brand left, links center, CTA right
   ═══════════════════════════════════════════════════════════════════════════ */

[data-menu-layout="horizontal"] .cosmos-menu__inner {
  justify-content: space-between;
}

[data-menu-layout="horizontal"] .cosmos-menu__links {
  margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout: centered
   Brand centered on top row, links centered below
   ═══════════════════════════════════════════════════════════════════════════ */

[data-menu-layout="centered"] .cosmos-menu__inner {
  flex-wrap: wrap;
  justify-content: center;
  height: auto;
  padding-top: 16px;
  padding-bottom: 12px;
  gap: 4px;
}

[data-menu-layout="centered"] .cosmos-menu__brand {
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

[data-menu-layout="centered"] .cosmos-menu__brand-text {
  align-items: center;
}

[data-menu-layout="centered"] .cosmos-menu__links {
  justify-content: center;
}

[data-menu-layout="centered"] .cosmos-menu__cta {
  margin-left: 8px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout: split
   Brand left, links + CTA right inline
   ═══════════════════════════════════════════════════════════════════════════ */

[data-menu-layout="split"] .cosmos-menu__inner {
  justify-content: space-between;
}

[data-menu-layout="split"] .cosmos-menu__links {
  margin-left: auto;
  margin-right: 16px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout: horizontal-overlay
   Transparent dark gradient over hero; becomes sticky on scroll
   ═══════════════════════════════════════════════════════════════════════════ */

/* --- Overlay bar (on top of hero) --- */
.cosmos-menu--overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 70%, transparent 100%);
  border-bottom: none;
  /* Fade only: when the customer scrolls back up to the hero the bar
     reappears in place rather than dropping in from the top edge — after a
     short pause, so the sticky clone has left before it starts. */
  transition: opacity 0.45s ease 0.25s;
}

.cosmos-menu--overlay .cosmos-menu__title {
  color: #fff;
}

.cosmos-menu--overlay .cosmos-menu__subtitle {
  color: rgba(255,255,255,0.7);
}

.cosmos-menu--overlay .cosmos-menu__links li a {
  color: rgba(255,255,255,0.85);
}

.cosmos-menu--overlay .cosmos-menu__links li a:hover,
.cosmos-menu--overlay .cosmos-menu__links li a.cosmos-menu__link--active {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.cosmos-menu--overlay .cosmos-menu__caret {
  color: rgba(255,255,255,0.85);
}

.cosmos-menu--overlay .cosmos-menu__caret:hover,
.cosmos-menu--overlay .cosmos-menu__parent:hover .cosmos-menu__caret,
.cosmos-menu--overlay .cosmos-menu__caret[aria-expanded="true"] {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

.cosmos-menu--overlay .cosmos-menu__sublinks {
  background: rgba(0,0,0,0.85);
  border-color: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cosmos-menu--overlay .cosmos-menu__mobile-caret {
  color: rgba(255,255,255,0.85);
}

.cosmos-menu--overlay .cosmos-menu__mobile-parent,
.cosmos-menu--overlay .cosmos-menu__mobile-sublinks {
  border-color: rgba(255,255,255,0.08);
}

/* Glass fill over the hero — unless the CTA has its own colours / is link-style
   (then --menu-cta-bg / --menu-cta-color are set and win). */
.cosmos-menu--overlay .cosmos-menu__cta a,
.cosmos-menu--overlay .cosmos-menu__cta .cosmos-menu__cta-link {
  background: var(--menu-cta-bg, rgba(255,255,255,0.18));
  color: var(--menu-cta-color, #fff);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.cosmos-menu--overlay .cosmos-menu__cta a:hover,
.cosmos-menu--overlay .cosmos-menu__cta .cosmos-menu__cta-link:hover {
  background: var(--menu-cta-bg, rgba(255,255,255,0.28));
}

.cosmos-menu--overlay .cosmos-menu__hamburger span {
  background: #fff;
}

.cosmos-menu--overlay .cosmos-menu__mobile {
  background: rgba(0,0,0,0.85);
  border-top: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cosmos-menu--overlay .cosmos-menu__mobile-links li a {
  color: rgba(255,255,255,0.85);
  border-bottom-color: rgba(255,255,255,0.08);
}

.cosmos-menu--overlay .cosmos-menu__mobile-links li a:hover {
  color: #fff;
}

.cosmos-menu--overlay .cosmos-menu__mobile-cta a {
  background: var(--menu-cta-bg, rgba(255,255,255,0.15));
  color: var(--menu-cta-color, #fff);
}

/* Hidden state when user has scrolled past hero (the sticky clone takes over).
   Hiding is immediate — the delay is only on the way back in. */
.cosmos-menu--overlay.cosmos-menu--hidden {
  opacity: 0;
  pointer-events: none;
  transition-delay: 0s;
}

/* Horizontal layout positioning for the overlay bar */
[data-menu-layout="horizontal-overlay"] .cosmos-menu__inner {
  justify-content: space-between;
}

[data-menu-layout="horizontal-overlay"] .cosmos-menu__links {
  margin: 0 auto;
}

/* --- Sticky clone (slides in from top on scroll) --- */
.cosmos-menu--sticky-clone {
  position: sticky;
  top: 0;
  z-index: 999;
  background: var(--cos-bg, #fff);
  border-bottom: 1px solid var(--cos-border, #e5e7eb);
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  transform: translateY(-100%);
  margin-bottom: -64px;
  /* visibility flips only after the slide-out finishes — without it the
     translated-up bar peeks above the canvas in the editors (nothing clips
     a sticky element there). */
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), visibility 0s linear 0.35s;
  pointer-events: none;
}

.cosmos-menu--sticky-clone.cosmos-menu--visible {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), visibility 0s;
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive — Mobile (<768px)
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  .cosmos-menu__links {
    display: none;
  }

  /* Show hamburger only when page links exist */
  .cosmos-menu__hamburger {
    display: none;
  }
  .cosmos-menu:has(.cosmos-menu__mobile-links li) .cosmos-menu__hamburger {
    display: flex;
  }

  /* When hamburger is visible, hide CTA in the bar (it moves to the mobile panel) */
  .cosmos-menu:has(.cosmos-menu__mobile-links li) .cosmos-menu__cta {
    display: none;
  }

  /* All layouts collapse to split style on mobile */
  .cosmos-menu__inner {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    padding-top: 0;
    padding-bottom: 0;
    gap: 0;
  }

  .cosmos-menu__brand {
    flex-direction: row !important;
    width: auto !important;
    align-items: center !important;
    gap: 8px !important;
  }

  .cosmos-menu__brand-text {
    align-items: flex-start !important;
  }

  .cosmos-menu__title {
    font-size: calc(var(--menu-title-size, 18px) * 0.78);
  }

  .cosmos-menu__subtitle {
    font-size: calc(var(--menu-subtitle-size, 12px) * 0.83);
  }

  .cosmos-menu__icon {
    width: 28px;
    height: 28px;
  }

  .cosmos-menu__cta a,
  .cosmos-menu__cta .cosmos-menu__cta-link {
    padding: calc(var(--menu-cta-pad-v, 8px) * 0.75) calc(var(--menu-cta-pad-h, 20px) * 0.7);
    font-size: calc(var(--menu-cta-size, 14px) * 0.86);
  }
}

/* ─── Editor device simulation ─────────────────────────────────────────── */

.cosmos-mobile .cosmos-menu__links {
  display: none;
}
.cosmos-mobile .cosmos-menu__hamburger {
  display: none;
}
.cosmos-mobile .cosmos-menu:has(.cosmos-menu__mobile-links li) .cosmos-menu__hamburger {
  display: flex;
}
.cosmos-mobile .cosmos-menu:has(.cosmos-menu__mobile-links li) .cosmos-menu__cta {
  display: none;
}
.cosmos-mobile .cosmos-menu__inner {
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
}
.cosmos-mobile .cosmos-menu__brand {
  flex-direction: row !important;
  width: auto !important;
  align-items: center !important;
  gap: 8px !important;
}
.cosmos-mobile .cosmos-menu__brand-text {
  align-items: flex-start !important;
}
.cosmos-mobile .cosmos-menu__title {
  font-size: calc(var(--menu-title-size, 18px) * 0.78);
}
.cosmos-mobile .cosmos-menu__subtitle {
  font-size: calc(var(--menu-subtitle-size, 12px) * 0.83);
}
.cosmos-mobile .cosmos-menu__icon {
  width: 28px;
  height: 28px;
}
.cosmos-mobile .cosmos-menu__cta a,
.cosmos-mobile .cosmos-menu__cta .cosmos-menu__cta-link {
  padding: calc(var(--menu-cta-pad-v, 8px) * 0.75) calc(var(--menu-cta-pad-h, 20px) * 0.7);
  font-size: calc(var(--menu-cta-size, 14px) * 0.86);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Auto-collapse — cosmos-menu.js adds .cosmos-menu--collapsed when the bar's
   content (brand + page links + CTA) is wider than the screen, at ANY width.
   Presentation mirrors the mobile hamburger bar so it's a familiar fallback.

   Before giving up on the horizontal links the script tries .cosmos-menu--tight
   once: the same labels with less air between them. A nine-page site with
   two-word labels typically fits the 1280px content column this way and only
   the hamburger at genuinely narrow widths.
   ═══════════════════════════════════════════════════════════════════════════ */

.cosmos-menu--tight .cosmos-menu__links {
  gap: 2px;
}
.cosmos-menu--tight .cosmos-menu__links li a {
  padding-left: 8px;
  padding-right: 8px;
}
.cosmos-menu--tight[data-menu-layout="split"] .cosmos-menu__links {
  margin-right: 8px;
}
/* Underline indicators follow the tighter side padding. */
.cosmos-menu--tight[data-menu-indicator] .cosmos-menu__links > li > a::after {
  left: 8px;
  right: 8px;
}
.cosmos-menu--tight[data-menu-indicator] .cosmos-menu__links > li > .cosmos-menu__parent > a::after {
  left: 8px;
}

.cosmos-menu--collapsed .cosmos-menu__links {
  display: none;
}
.cosmos-menu--collapsed .cosmos-menu__hamburger {
  display: none;
}
.cosmos-menu--collapsed:has(.cosmos-menu__mobile-links li) .cosmos-menu__hamburger {
  display: flex;
}
.cosmos-menu--collapsed:has(.cosmos-menu__mobile-links li) .cosmos-menu__cta {
  display: none;
}
.cosmos-menu--collapsed .cosmos-menu__inner {
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding-top: 0;
  padding-bottom: 0;
  gap: 0;
}
.cosmos-menu--collapsed .cosmos-menu__brand {
  flex-direction: row !important;
  width: auto !important;
  align-items: center !important;
  gap: 8px !important;
}
.cosmos-menu--collapsed .cosmos-menu__brand-text {
  align-items: flex-start !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Layout: horizontal-overlay-collapsed ("Overlay Collapsed")
   Brand left, CTA right, then a menu button. No inline page links at any
   width — the navigation lives in a side panel. The bar is the overlay bar
   (+ sticky clone) with .cosmos-menu--drawer; the panel is the ordinary
   .cosmos-menu__mobile element the hamburger toggles, restyled as a fixed
   side sheet. Kept at the end of the file so it wins over the responsive
   rules above at equal specificity.
   ═══════════════════════════════════════════════════════════════════════════ */

.cosmos-menu--drawer .cosmos-menu__inner {
  justify-content: flex-start;
  gap: 16px;
}
.cosmos-menu--drawer .cosmos-menu__brand {
  margin-right: auto;
}

/* The menu button is the only way to the page links — always on. */
.cosmos-menu--drawer:has(.cosmos-menu__mobile-links li) .cosmos-menu__hamburger,
.cosmos-mobile .cosmos-menu--drawer:has(.cosmos-menu__mobile-links li) .cosmos-menu__hamburger {
  display: flex;
  margin-left: 0;
}
/* The CTA stays in the bar at every width (the panel repeats it). */
.cosmos-menu--drawer:has(.cosmos-menu__mobile-links li) .cosmos-menu__cta,
.cosmos-mobile .cosmos-menu--drawer:has(.cosmos-menu__mobile-links li) .cosmos-menu__cta {
  display: block;
}

/* --- Side panel --- */
@keyframes cosmos-drawer-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.cosmos-menu--drawer .cosmos-menu__mobile {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  height: 100dvh;
  width: min(340px, 86vw);
  z-index: 1100;
  padding: 76px 28px 32px;
  border-top: none;
  border-left: 1px solid var(--cos-border, #e5e7eb);
  /* Second shadow = the backdrop: a spread larger than any viewport dims the
     page behind the sheet without an extra element. */
  box-shadow: -12px 0 40px rgba(0,0,0,0.18), 0 0 0 200vmax rgba(0,0,0,0.45);
  overflow-y: auto;
  animation: cosmos-drawer-in 0.28s cubic-bezier(0.4,0,0.2,1);
}
.cosmos-menu--overlay.cosmos-menu--drawer .cosmos-menu__mobile {
  border-left: 1px solid rgba(255,255,255,0.1);
  background: rgba(12,12,14,0.92);
}
.cosmos-menu--drawer .cosmos-menu__mobile-links li a {
  font-size: calc(var(--menu-links-size, 14px) * 1.35);
  padding: 14px 0;
}
.cosmos-menu--drawer .cosmos-menu__mobile-cta {
  margin-top: 24px;
}

.cosmos-menu__drawer-close {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--cos-text, #374151);
  cursor: pointer;
}
.cosmos-menu__drawer-close:hover {
  background: rgba(127,127,127,0.12);
}
.cosmos-menu--overlay .cosmos-menu__drawer-close {
  color: #fff;
}
@media (prefers-reduced-motion: reduce) {
  .cosmos-menu--drawer .cosmos-menu__mobile { animation: none; }
}
