/**
 * WCP nav — cream-adapted port of the 10018 (wcp2026) interactive menu language.
 *
 * Loaded from a late wp_head priority-1000 hook so this <link> lands AFTER
 * Bricks' inline design-system CSS (bricks-frontend-inline-inline-css). Equal-
 * specificity rules therefore win by source order; the few Bricks rules that
 * use !important are matched with !important + equal/higher specificity here.
 *
 * Non-destructive: only adds the 10018 interactive bits that 10023 lacked —
 * chevron rotation, frosted-glass dropdown, scrolled-state opacity, and the
 * mobile hamburger + grouped slide-down panel. 10023's Bricks menu structure
 * and cream palette are left intact.
 *
 * Palette (defined in Bricks inline CSS): --wcp-bg #FAF6EF, --wcp-clay-500
 * #BE6149, --wcp-clay-600, --wcp-clay-700, --wcp-sage-deep #435247,
 * --wcp-sage-700, --wcp-text #2F3A33, --wcp-muted, --wcp-warm-100.
 */

/* ===== Chevron rotation on hover/focus (desktop) ===== */
.wcp-nav-chevron {
  transition: transform 0.2s ease !important;
  will-change: transform;
}
.wcp-nav-item:hover .wcp-nav-chevron,
.wcp-nav-item:focus-within .wcp-nav-chevron {
  transform: rotate(180deg);
}

/* Keep dropdowns/panels visible even though the Bricks page globally hides overflow. */
.brxe-section.wcp-sticky {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  z-index: 1000 !important;
  overflow: visible !important;
  background: rgba(250, 246, 239, 0.74) !important;
  -webkit-backdrop-filter: blur(18px) saturate(135%) !important;
  backdrop-filter: blur(18px) saturate(135%) !important;
  border-bottom: 1px solid rgba(190, 97, 73, 0.10) !important;
  box-shadow: 0 2px 20px rgba(67, 82, 71, 0.08) !important;
  transition: background-color .25s ease, box-shadow .25s ease, border-color .25s ease !important;
}
body.admin-bar .brxe-section.wcp-sticky {
  top: var(--wp-admin--admin-bar--height, 32px) !important;
}
.brxe-section.wcp-sticky + .brxe-section {
  margin-top: 138px !important;
}
.wcp-nav-item {
  position: relative;
}
.wcp-nav-item:has(.wcp-dropdown)::after {
  content: '';
  position: absolute;
  left: -16px;
  right: -16px;
  top: 100%;
  height: 14px;
  z-index: 59;
}

/* ===== Frosted-glass dropdown (subtle cream opacity + blur, like 10018) ===== */
.wcp-dropdown {
  top: calc(100% + 4px) !important;
  background: rgba(250, 246, 239, 0.88) !important;
  -webkit-backdrop-filter: blur(22px) saturate(140%) !important;
  backdrop-filter: blur(22px) saturate(140%) !important;
  border-color: rgba(190, 97, 73, 0.14) !important;
  box-shadow: 0 18px 44px rgba(67, 82, 71, 0.14), 0 2px 8px rgba(33, 28, 24, 0.05) !important;
  min-width: 280px !important;
  width: max-content !important;
  max-width: min(320px, calc(100vw - 32px)) !important;
  z-index: 1002 !important;
}
.wcp-dropdown a:hover {
  background: rgba(243, 232, 216, 0.72) !important;
}
.wcp-dropdown a {
  white-space: nowrap !important;
}

/* ===== Sticky header scrolled state (intensify the frosted glass) ===== */
.brxe-section.wcp-sticky.scrolled,
body.wcp-nav-open .brxe-section.wcp-sticky {
  background-color: rgba(250, 246, 239, 0.58) !important;
  -webkit-backdrop-filter: blur(24px) saturate(145%) !important;
  backdrop-filter: blur(24px) saturate(145%) !important;
  box-shadow: 0 12px 36px rgba(67, 82, 71, 0.12) !important;
  border-bottom: 1px solid rgba(190, 97, 73, 0.14) !important;
}

/* ===== Hamburger toggle (cream) — hidden by default, shown on mobile ===== */
.wcp-mobile-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(190, 97, 73, 0.25);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  order: 9;
}
.wcp-mobile-toggle__icon,
.wcp-mobile-toggle__icon::before,
.wcp-mobile-toggle__icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background-color: var(--wcp-clay-600, #B66A4B);
  border-radius: 2px;
  transition: all 0.3s ease;
}
.wcp-mobile-toggle__icon { position: relative; }
.wcp-mobile-toggle__icon::before,
.wcp-mobile-toggle__icon::after { content: ''; position: absolute; left: 0; }
.wcp-mobile-toggle__icon::before { top: -7px; }
.wcp-mobile-toggle__icon::after { top: 7px; }
.wcp-mobile-toggle[aria-expanded="true"] .wcp-mobile-toggle__icon { background-color: transparent; }
.wcp-mobile-toggle[aria-expanded="true"] .wcp-mobile-toggle__icon::before { top: 0; transform: rotate(45deg); }
.wcp-mobile-toggle[aria-expanded="true"] .wcp-mobile-toggle__icon::after { top: 0; transform: rotate(-45deg); }

/* ===== Mobile slide-down panel (cream frosted glass, grouped like 10018) ===== */
.wcp-mobile-nav {
  display: none;
  flex-direction: column;
  padding: 20px 24px 24px;
  background-color: rgba(250, 246, 239, 0.97);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(190, 97, 73, 0.10);
  box-shadow: 0 12px 40px rgba(67, 82, 71, 0.10);
  z-index: 90;
}
.wcp-mobile-nav.is-open { display: flex; }

.wcp-mobile-nav__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.wcp-mobile-nav__list li {
  border-bottom: 1px solid rgba(67, 82, 71, 0.06);
}
.wcp-mobile-nav__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 0;
  font-family: "TT Norms", system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--wcp-sage-deep, #435247);
  text-decoration: none;
  transition: color 0.2s;
}
.wcp-mobile-nav__list a:hover { color: var(--wcp-clay-600, #B66A4B); }

.wcp-mobile-nav__list--flat a {
  justify-content: center;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.wcp-mobile-nav__group { margin-top: 8px; }
.wcp-mobile-nav__group-title {
  display: block;
  font-family: "TT Norms", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wcp-clay-600, #B66A4B);
  padding: 14px 0 6px;
  border-top: 1px solid rgba(190, 97, 73, 0.14);
  text-decoration: none;
  transition: color 0.2s;
}
.wcp-mobile-nav__group-title:hover { color: var(--wcp-clay-700, #8f4a34); }
.wcp-mobile-nav__group .wcp-mobile-nav__list a { padding-left: 8px; font-size: 14px; }

.wcp-mobile-nav__cta {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wcp-mobile-nav__cta .wcp-btn-block {
  width: 100%;
  justify-content: center;
}

/* ===== Desktop: never show the hamburger / panel ===== */
@media (min-width: 941px) {
  .wcp-mobile-toggle { display: none !important; }
  .wcp-mobile-nav,
  .wcp-mobile-nav.is-open { display: none !important; }
}

/* ===== Mobile / tablet (<=940px): hamburger + grouped panel ===== */
@media (max-width: 940px) {
  /* Replace the wrapping inline nav row + desktop CTA button with the hamburger + panel.
     body.wcp-nav-enhanced is set by wcp-nav.js, so this only takes effect once JS runs
     (no-JS visitors keep the original wrapping-row experience). */
  body.wcp-nav-enhanced .wcp-header-bar .wcp-nav-mobile { display: none !important; }
  body.wcp-nav-enhanced .wcp-header-cta-btn { display: none !important; }
  body.wcp-nav-enhanced .wcp-mobile-toggle {
    display: flex !important;
    justify-self: end !important;
    grid-column: 3 !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.38) !important;
    border-color: rgba(190, 97, 73, 0.24) !important;
    box-shadow: 0 2px 10px rgba(67, 82, 71, 0.08) !important;
  }

  /* Keep the header bar a single row: logo + phone + hamburger */
  body.wcp-nav-enhanced .wcp-header-bar {
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(112px, auto) minmax(0, 1fr) 44px !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 12px !important;
    padding: 10px 20px !important;
  }
  body.wcp-nav-enhanced .wcp-header-bar .brxe-image,
  body.wcp-nav-enhanced .wcp-header-bar #brxe-pcheee {
    width: 126px !important;
    max-width: 126px !important;
    min-width: 0 !important;
  }
  body.wcp-nav-enhanced .wcp-header-bar img {
    width: 126px !important;
    height: auto !important;
  }
  body.wcp-nav-enhanced .wcp-mobile-nav {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1001 !important;
    max-height: calc(100vh - 82px) !important;
    overflow-y: auto !important;
    padding: 18px 24px 24px !important;
    background: rgba(250, 246, 239, 0.995) !important;
    -webkit-backdrop-filter: blur(26px) saturate(145%) !important;
    backdrop-filter: blur(26px) saturate(145%) !important;
    border-bottom: 1px solid rgba(190, 97, 73, 0.14) !important;
    box-shadow: 0 20px 48px rgba(67, 82, 71, 0.16) !important;
    border-radius: 0 0 20px 20px !important;
  }
  body.wcp-nav-enhanced .wcp-mobile-nav.is-open {
    display: flex !important;
  }
}

@media (max-width: 782px) {
  body.admin-bar .brxe-section.wcp-sticky {
    top: 46px !important;
  }
}

@media (max-width: 520px) {
  body.wcp-nav-enhanced .wcp-header-bar {
    grid-template-columns: minmax(118px, auto) 1fr 44px !important;
    padding-inline: 24px !important;
  }
  body.wcp-nav-enhanced .wcp-header-bar .wcp-header-phone,
  body.wcp-nav-enhanced .wcp-header-bar .wcp-phone-chip {
    display: none !important;
  }
}
