/* ═══════════════════════════════════════════════════════════════════════════
   Cosmos Menu — 3 layouts: horizontal, centered, split
   ═══════════════════════════════════════════════════════════════════════════ */

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

.cosmos-menu {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  font-family: 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;
}

/* ─── 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-size: 18px;
  font-weight: 700;
  color: #111;
  line-height: 1.2;
}

.cosmos-menu__subtitle {
  font-size: 12px;
  color: #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;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.cosmos-menu__links li a:hover {
  background: #f3f4f6;
  color: #111;
}

.cosmos-menu__links li a.cosmos-menu__link--active {
  background: #f3f4f6;
  color: #111;
  font-weight: 600;
}

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

.cosmos-menu__cta a,
.cosmos-menu__cta .cosmos-menu__cta-link {
  display: inline-block;
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--cos-accent, #111);
  border-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;
}

/* ─── 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: #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: #fff;
  border-top: 1px solid #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: 16px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  border-bottom: 1px solid #f3f4f6;
}

.cosmos-menu__mobile-links li a:hover,
.cosmos-menu__mobile-links li a.cosmos-menu__link--active {
  color: #111;
}

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

.cosmos-menu__mobile-cta a {
  display: block;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #111;
  border-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;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.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__cta a {
  background: rgba(255,255,255,0.18);
  color: #fff;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.cosmos-menu--overlay .cosmos-menu__cta a:hover {
  background: 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: rgba(255,255,255,0.15);
  color: #fff;
}

/* Hidden state when user has scrolled past hero */
.cosmos-menu--overlay.cosmos-menu--hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
}

/* 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: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 8px rgba(0,0,0,0.08);
  transform: translateY(-100%);
  margin-bottom: -64px;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  pointer-events: none;
}

.cosmos-menu--sticky-clone.cosmos-menu--visible {
  transform: translateY(0);
  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: 14px;
  }

  .cosmos-menu__subtitle {
    font-size: 10px;
  }

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

  .cosmos-menu__cta a,
  .cosmos-menu__cta .cosmos-menu__cta-link {
    padding: 6px 14px;
    font-size: 12px;
  }
}

/* ─── 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: 14px;
}
.cosmos-mobile .cosmos-menu__subtitle {
  font-size: 10px;
}
.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: 6px 14px;
  font-size: 12px;
}
