/* ─────────────────────────────────────────────────────────────
   CEW Header Widget
   Layout: [Logo] [Desktop Nav — flex: 1, centered] [Actions: desktop CTA + toggle]
   ───────────────────────────────────────────────────────────── */

.cew-menu-widget {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column; /* bar on top, mobile panel expands below */
}

/* ── Header bar ── */
.cew-menu-bar {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 1rem;
  box-sizing: border-box;
  /* Default spacing — user overrides via Style › Header bar */
  padding: 0.75rem 1.5rem;
}

/* ── Logo ── */
.cew-header-logo {
  flex-shrink: 0;
  line-height: 1;
}

.cew-header-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}

.cew-header-logo-img {
  display: block;
  max-width: 120px;
  height: auto;
}

.cew-header-logo-text {
  font-weight: 600;
  font-size: 1.15rem;
  white-space: nowrap;
}

/* ── Desktop navigation ── */
.cew-menu-desktop {
  display: none; /* shown/hidden by per-widget breakpoint <style> */
  flex: 1;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.cew-menu-link-wrap {
  position: relative;
  height: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.cew-menu-link {
  display: block;
  height: 24px;
  line-height: 24px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.5s ease;
  white-space: nowrap;
}

.cew-menu-link-wrap.is-shifted .cew-menu-link {
  transform: translateY(-100%);
}

.cew-menu-link-wrap.is-active .cew-menu-link {
  font-weight: 600;
}

.cew-menu-empty {
  font-size: 0.95rem;
  opacity: 0.75;
}

/* ── Actions (right side: desktop CTA + toggle) ── */
.cew-header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Desktop CTA wrapper — hidden on mobile via breakpoint <style> */
.cew-header-desktop-cta {
  display: none; /* shown by breakpoint media query */
  align-items: center;
}

/* ── Mobile toggle ── */
.cew-menu-toggle {
  display: none; /* shown by breakpoint media query */
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  color: inherit;
  position: relative;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.cew-menu-toggle svg {
  fill: currentColor;
}

.cew-menu-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

.cew-menu-icon-open,
.cew-menu-icon-close {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.cew-menu-icon-open svg,
.cew-menu-icon-close svg {
  display: block;
  width: 1em;
  height: 1em;
}

.cew-menu-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0);
}

.cew-menu-widget.menu-open .cew-menu-icon-open {
  opacity: 0;
  transform: rotate(90deg) scale(0);
}

.cew-menu-widget.menu-open .cew-menu-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* ─────────────────────────────────────────────────────────────
   Mobile panel — in-flow so it naturally expands the header.
   Because the header widget owns the full bar width, max-height
   animation works seamlessly here (no portaling needed).
   ───────────────────────────────────────────────────────────── */
.cew-menu-mobile-panel {
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition:
    max-height 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    opacity    0.3s  ease;
  /* Inherit the header's background by default so no seam is visible */
  background: inherit;
  box-sizing: border-box;
  width: 100%;
}

.cew-menu-widget.menu-open .cew-menu-mobile-panel {
  max-height: 85vh;
  opacity: 1;
  pointer-events: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.cew-menu-mobile-padding {
  box-sizing: border-box;
  width: 100%;
  padding: 1.75rem 1.5rem max(2rem, env(safe-area-inset-bottom, 0px)) 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cew-menu-mobile-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

/* ── Mobile links ── */
.cew-menu-mobile-link {
  display: block;
  text-decoration: none;
  color: inherit;
  font-size: clamp(1.875rem, 6vw, 2.25rem);
  line-height: 1.1;
  touch-action: manipulation;
  text-align: left;
  transform: translateX(1.25rem);
  opacity: 0;
  box-sizing: border-box;
  transition:
    transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    opacity   0.45s ease,
    background-color 0.2s ease,
    box-shadow       0.2s ease,
    border-color     0.2s ease;
  transition-delay: 0ms;
}

.cew-menu-mobile-link.is-active {
  font-weight: 600;
}

.cew-menu-widget.menu-open .cew-menu-mobile-link {
  transform: translateX(0);
  opacity: 1;
  transition-delay: var(--cew-stagger, 0ms);
}

/* ── Mobile CTA wrap ── */
.cew-menu-mobile-cta-wrap {
  margin-top: 16px;
  margin-bottom: 24px;
  transform: translateX(1.25rem);
  opacity: 0;
  transition:
    transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
    opacity   0.45s ease;
  transition-delay: 0ms;
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.cew-menu-widget.menu-open .cew-menu-mobile-cta-wrap {
  transform: translateX(0);
  opacity: 1;
  transition-delay: var(--cew-stagger, 0ms);
}

.cew-menu-mobile-cta-wrap .cew-menu-cta {
  display: flex;
  justify-content: flex-start;
}

.cew-menu-mobile-cta-wrap .cta-btn {
  -webkit-tap-highlight-color: transparent;
}

/*
 * When the menu is open, suppress the sticky header's box-shadow
 * so there's no visible seam between header and panel.
 * body.cew-menu-open is toggled by JS.
 */
body.cew-menu-open .elementor-sticky--active,
body.cew-menu-open .elementor-section.elementor-sticky--active,
body.cew-menu-open .e-con.elementor-sticky--active {
  box-shadow: none !important;
  border-bottom-color: transparent !important;
}

@media (prefers-reduced-motion: reduce) {
  .cew-menu-mobile-panel,
  .cew-menu-mobile-link,
  .cew-menu-mobile-cta-wrap,
  .cew-menu-icon-open,
  .cew-menu-icon-close {
    transition: none !important;
  }
}
