/* ==========================================================================
   IFC Menu Widget
   Structure: nav.ifc-menu > (button.ifc-menu-burger, div.ifc-menu-panel)
   .ifc-menu-panel > (button.ifc-menu-close, ul.ifc-menu-list, div.ifc-menu-switch-wrap)

   Desktop: .ifc-menu-panel is a plain inline row (the "list"); burger and
   close button are hidden.
   Below the widget's configured breakpoint (applied inline per-instance,
   see below): the burger appears, .ifc-menu-panel becomes a fixed
   fullscreen overlay toggled by the `.is-open` class on the wrapper.
   ========================================================================== */

.ifc-menu {
  --ifc-menu-gap: 32px;
  --ifc-menu-mobile-gap: 36px;
  --ifc-menu-burger-size: 26px;
  --ifc-menu-burger-thickness: 2px;
  --ifc-menu-switch-scale: 1;
  --ifc-menu-switch-bottom: 28px;
  --ifc-menu-switch-right: 24px;
  display: flex;
  align-items: center;
}

/* --------------------------------------------------------------------
   Desktop: plain list
   -------------------------------------------------------------------- */
.ifc-menu-burger {
  display: none;
}

.ifc-menu-close {
  display: none;
}

.ifc-menu-panel {
  /* Falls back to the theme's own `--site-bg-color` token when present
     (e.g. a light-dark()-based dark-mode setup) so the overlay tracks
     the site's background with zero configuration; harmless on any
     theme that doesn't define it, since var() just skips to #ffffff. */
  --ifc-menu-overlay-bg: var(--site-bg-color, #ffffff);
  display: block;
}

/* Dark-mode overrides for this widget's OWN literal color controls (the
   `*_color_dark` fields in class-menu-widget.php) are added per-instance
   by Elementor as `html[data-theme="dark"] {{WRAPPER}} ...` rules -
   ordinary color overrides, nothing special needed here.

   Controls linked to an Elementor Global Color (the globe icon) don't
   need one of these at all: the site's own dark-mode.css already
   redefines `--e-global-color-text` / `-accent` / etc. per `data-theme`,
   so `color: var(--e-global-color-text)` flips automatically. The
   overlay background above follows the same idea via `--site-bg-color`. */

.ifc-menu-list {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ifc-menu-gap);
  list-style: none;
  margin: 0;
  padding: 0;
}

.ifc-menu-list a {
  display: inline-block;
  text-decoration: none;
  color: inherit;
  transition-property: color;
  transition-duration: 200ms;
  transition-timing-function: ease;
}

/* Theme switcher hidden on desktop unless the widget explicitly enables it */
.ifc-menu-switch-wrap {
  display: none;
}

.ifc-menu--show-switcher-desktop .ifc-menu-switch-wrap {
  display: inline-flex;
  align-items: center;
}

/* --------------------------------------------------------------------
   Burger icon (built from 3 lines, morphs into an X while open)
   -------------------------------------------------------------------- */
.ifc-menu-burger {
  position: relative;
  width: var(--ifc-menu-burger-size);
  height: var(--ifc-menu-burger-size);
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}

.ifc-menu-burger-line {
  display: block;
  width: 100%;
  height: var(--ifc-menu-burger-thickness);
  border-radius: 999px;
  background-color: currentColor;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.ifc-menu.is-open .ifc-menu-burger-line:nth-child(1) {
  transform: translateY(calc(var(--ifc-menu-burger-size) / 2 - var(--ifc-menu-burger-thickness) / 2)) rotate(45deg);
}

.ifc-menu.is-open .ifc-menu-burger-line:nth-child(2) {
  opacity: 0;
}

.ifc-menu.is-open .ifc-menu-burger-line:nth-child(3) {
  transform: translateY(calc(-1 * (var(--ifc-menu-burger-size) / 2 - var(--ifc-menu-burger-thickness) / 2))) rotate(-45deg);
}

/* --------------------------------------------------------------------
   Burger style: 3 dots (morphs into an X by growing each dot into a bar,
   same open-state transforms as the classic lines above)
   -------------------------------------------------------------------- */
.ifc-menu-burger--dots .ifc-menu-burger-line {
  width: var(--ifc-menu-burger-thickness);
  height: var(--ifc-menu-burger-thickness);
  border-radius: 50%;
  align-self: center;
  transition: width 0.25s ease, transform 0.25s ease, opacity 0.2s ease, border-radius 0.25s ease;
}

.ifc-menu.is-open .ifc-menu-burger--dots .ifc-menu-burger-line {
  width: 100%;
  border-radius: 999px;
}

/* --------------------------------------------------------------------
   Burger style: text label ("Menu" <-> "Close")
   -------------------------------------------------------------------- */
.ifc-menu-burger--text {
  width: auto;
  height: auto;
  white-space: nowrap;
  font: inherit;
}

.ifc-menu-burger--text .ifc-menu-burger-line {
  display: none;
}

.ifc-menu-burger-text {
  display: inline-block;
}

.ifc-menu-burger-text--close {
  display: none;
}

.ifc-menu.is-open .ifc-menu-burger-text--menu {
  display: none;
}

.ifc-menu.is-open .ifc-menu-burger-text--close {
  display: inline-block;
}

/* --------------------------------------------------------------------
   Theme switcher (pill/knob) — self-contained, namespaced classes so it
   doesn't depend on / collide with the theme's own dark-mode.css.
   -------------------------------------------------------------------- */
.ifc-menu-switch {
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  line-height: 0;
  transform: scale(var(--ifc-menu-switch-scale));
  transform-origin: center;
}

.ifc-menu-switch-track {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 64px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  background-color: #f2f5f7;
  transition: background-color 0.2s ease;
}

.ifc-menu-switch-knob {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  border-radius: 50%;
  background-color: #2872fa;
  transform: translateY(-50%);
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.ifc-menu-switch[aria-checked="true"] .ifc-menu-switch-knob {
  transform: translate(32px, -50%);
}

.ifc-menu-switch-icon {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: none;
  transform: translateY(-50%);
  transition: color 0.2s ease;
}

.ifc-menu-switch-icon--sun {
  left: 9px;
  color: #9aa5b1;
}

.ifc-menu-switch-icon--sun circle {
  fill: currentColor;
}

.ifc-menu-switch-icon--sun line {
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.ifc-menu-switch-icon--moon {
  right: 9px;
  color: #9aa5b1;
}

.ifc-menu-switch-icon--moon path {
  fill: currentColor;
}

.ifc-menu-switch[aria-checked="false"] .ifc-menu-switch-icon--sun {
  color: #ffffff;
}

.ifc-menu-switch[aria-checked="true"] .ifc-menu-switch-icon--moon {
  color: #ffffff;
}

/* --------------------------------------------------------------------
   Mobile overlay
   Breakpoint state (.ifc-menu--mobile) is still applied to <nav> by
   menu.js and only controls the burger icon's visibility there.

   The panel itself is PORTALED to the end of <body> by menu.js whenever
   the breakpoint engages, and gets its own `.ifc-menu-panel--mobile`
   class directly (rather than relying on being a descendant of
   `.ifc-menu--mobile`). This is what makes it a genuine fullscreen
   overlay: some themes/page builders wrap widgets in containers with
   `transform`, `filter`, or `contain` set for their own animations,
   which silently changes the containing block for `position: fixed`
   descendants — capping the overlay to that container's box instead of
   the actual viewport. Moving the panel out to a direct child of
   <body> sidesteps that entirely.
   -------------------------------------------------------------------- */
.ifc-menu--mobile .ifc-menu-burger {
  display: inline-flex;
}

.ifc-menu-panel--mobile {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* accounts for mobile browser address-bar show/hide, avoids bottom gaps */
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 72px 32px 40px;
  background-color: var(--ifc-menu-overlay-bg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.ifc-menu-panel--mobile.ifc-menu-panel--anim-slide {
  transform: translateY(-16px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0.3s;
}

.ifc-menu-panel--mobile.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.ifc-menu-panel--mobile.ifc-menu-panel--anim-slide.is-open {
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0s linear 0s;
}

/* Slide from Right - slide only, no fade (opacity stays at 1 throughout;
   visibility/pointer-events still handle hiding when closed). */
.ifc-menu-panel--mobile.ifc-menu-panel--anim-slide-right {
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
}

.ifc-menu-panel--mobile.ifc-menu-panel--anim-slide-right.is-open {
  transform: translateX(0);
  transition: transform 0.3s ease, visibility 0s linear 0s;
}

.ifc-menu-panel--mobile .ifc-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  color: inherit;
}

.ifc-menu-panel--mobile .ifc-menu-list {
  flex-direction: column;
  align-items: center;
  gap: var(--ifc-menu-mobile-gap);
  text-align: center;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
}

/* Bigger, more comfortable tap targets than the desktop list */
.ifc-menu-panel--mobile .ifc-menu-list a {
  display: block;
  padding: 10px 24px;
}

/* On mobile the switcher always follows the "show in mobile menu"
   setting, independent of the desktop-only setting above, and is
   anchored to the bottom-right corner of the screen. */
.ifc-menu-panel--mobile .ifc-menu-switch-wrap {
  display: flex;
}

.ifc-menu-panel--mobile .ifc-menu-switch-wrap--desktop-only {
  display: none;
}

.ifc-menu-panel--mobile .ifc-menu-switch-wrap:not(.ifc-menu-switch-wrap--desktop-only) {
  position: absolute;
  bottom: var(--ifc-menu-switch-bottom, 28px);
  right: var(--ifc-menu-switch-right, 24px);
}

@media (prefers-reduced-motion: reduce) {
  .ifc-menu-panel--mobile,
  .ifc-menu-burger-line,
  .ifc-menu-switch-knob {
    transition: none !important;
  }
}

/* Lock body scroll while a mobile overlay is open (class added to <body> by menu.js) */
body.ifc-menu-lock {
  overflow: hidden;
}
