

/* -------------------------------------------------------
   Hide Polylang/WPML language switchers (we use portal flags)
   ------------------------------------------------------- */
li.lang-item,
.pll-parent-menu-item,
.pll-switcher-shortcode,
.kadence-language-switcher,
.wpml-ls,
.wpml-ls-statics-shortcode_actions,
.wpml-ls-legacy-dropdown,
.wpml-ls-legacy-list-horizontal {
  display: none !important;
}

/* -------------------------------------------------------
   Screen-reader only utility (must NEVER leak into layout)
   ------------------------------------------------------- */
.fg-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ======================================
   Portal flags switcher (CA/DE)
   ====================================== */

/* Base (works inline, e.g. inside Kadence header HTML element) */
.fg-langflags {
  position: relative;
  z-index: 9999;
}

/* Fixed variant (fallback if you don't place it inside header builder) */
.fg-langflags--fixed {
  position: fixed;
  top: calc(var(--wp-admin--admin-bar--height, 0px) + 14px);
  right: max(12px, calc((100vw - var(--fg-content-max, 1440px)) / 2 + 12px));
}

/* Optional helper if we need to hide duplicates */
.fg-langflags.is-hidden {
  display: none !important;
}

.fg-langflags__wrap {
  position: relative;
}

/* Hover bridge so dropdown doesn't vanish when moving the mouse */
.fg-langflags__wrap::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  width: 48px;
  height: 10px;
}

.fg-langflags__btn,
.fg-langflags__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 32px;
  border-radius: 10px;
  background: rgba(18, 21, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  padding: 0;
  margin: 0;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.fg-langflags__btn {
  appearance: none;
  -webkit-appearance: none;
}

.fg-langflags__btn:focus-visible,
.fg-langflags__item:focus-visible {
  outline: 2px solid rgba(187, 134, 252, 0.9);
  outline-offset: 3px;
}

.fg-langflags__flag {
  width: 34px;
  height: 24px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: block;
}

/* Flag images (we keep both filenames in theme: ca.svg/de.svg and fg-flag-*.svg) */
.fg-langflags__flag--ca { background-image: url('/wp-content/themes/kadence-child/assets/img/flags/ca.svg'); }
.fg-langflags__flag--de { background-image: url('/wp-content/themes/kadence-child/assets/img/flags/de.svg'); }
/* Global portal (/) uses a blue globe icon instead of a country flag */
.fg-langflags__flag--global { background-image: url('data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2211%22%20fill%3D%22%232d7dff%22/%3E%3Cpath%20fill%3D%22%23ffffff%22%20d%3D%22M12%204a8%208%200%201%200%200%2016a8%208%200%200%200%200-16zm5.7%207h-2.2c-.2-2-.8-3.8-1.6-5.1A6%206%200%200%201%2017.7%2011zM12%206c.7%200%201.7%201.5%202.4%205H9.6c.7-3.5%201.7-5%202.4-5zM6.3%2013h2.2c.2%202%20.8%203.8%201.6%205.1A6%206%200%200%201%206.3%2013zm0-2A6%206%200%200%201%2010.1%205.9C9.3%207.2%208.7%209%208.5%2011H6.3zM12%2018c-.7%200-1.7-1.5-2.4-5h4.8c-.7%203.5-1.7%205-2.4%205zm1.9-.1c.8-1.3%201.4-3.1%201.6-5.1h2.2a6%206%200%200%201-3.8%205.2z%22/%3E%3C/svg%3E'); }
.fg-langflags--global .fg-langflags__flag{width:26px;height:26px;border-radius:999px;}


/* Dropdown */
.fg-langflags__dd {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;

  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

/* Увеличили "мостик", чтобы курсор спокойно доходил до списка */
.fg-langflags__wrap::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  width: 90px;
  height: 16px;
}

.fg-langflags__wrap:hover .fg-langflags__dd,
.fg-langflags.is-open .fg-langflags__dd {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* КНОПКА (текущий флаг) — оставляем компактной */
.fg-langflags__btn {
  width: 44px;
  height: 32px;
}

/* ПУНКТЫ ВЫПАДАШКИ — делаем нормальной ширины, чтобы был И флаг И текст */
.fg-langflags__item {
  width: auto;
  min-width: 170px;
  height: 36px;

  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  padding: 0 12px;

  border-radius: 10px;
  background: rgba(18, 21, 31, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);

  text-decoration: none;
}

/* Флаг фиксируем по размеру, чтобы он не "схлопывался" */
.fg-langflags__flag {
  flex: 0 0 34px;
  width: 34px;
  height: 24px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: block;
}

/* Текст в пунктах */
.fg-langflags__label {
  font-size: 13px;
  line-height: 1;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
}

/* Tablet / mobile: чуть компактнее */
@media (max-width: 768px) {
  .fg-langflags__btn { width: 40px; height: 30px; }
  .fg-langflags__item { min-width: 160px; height: 34px; }
  .fg-langflags__flag { width: 30px; height: 22px; flex-basis: 30px; }
  .fg-langflags__wrap::after { width: 86px; height: 16px; }
}


/* Global portal icon (globe) for root / */
.fg-langflags__flag--global{
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M2 12h20'/%3E%3Cpath d='M12 2c3.5 3 3.5 17 0 20'/%3E%3Cpath d='M12 2c-3.5 3-3.5 17 0 20'/%3E%3C/svg%3E");
  background-size:18px 18px;
  background-repeat:no-repeat;
  background-position:center;
}



/* =========================================================
   FLAGS: stable positioning across resolutions
   - Desktop: use INLINE switcher inside header (Kadence Header Builder)
   - Mobile: use FIXED switcher (mounted into mobile header when possible)
   This prevents the flag button from overlapping desktop header text.
   ========================================================= */

/* Desktop: hide the floating (fixed) button to avoid overlap with header text */
@media (min-width: 992px) {
  .fg-langflags--fixed {
    display: none !important;
  }
}

/* Mobile: hide inline (if it exists) to avoid duplicates; keep fixed */
@media (max-width: 991.98px) {
  .fg-langflags--inline {
    display: none !important;
  }
}

/* If the fixed switcher is mounted inside the mobile header/menu, it must stop being fixed */
.fg-mh-lang .fg-langflags--fixed,
.fg-mobile-langmount .fg-langflags--fixed {
  position: static !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  transform: none !important;
  margin: 0 !important;
}

/* Give the wrapper a small “hover bridge” so the dropdown does not close when moving the mouse */
@media (hover: hover) and (pointer: fine) {
  .fg-langflags {
    padding-bottom: 12px; /* makes the wrapper taller so pointer doesn't "leave" between btn and dropdown */
  }
  .fg-langflags__wrap::after {
    height: 20px; /* bridge zone */
  }
}


/* =========================================================
   FG langflags placement
   Desktop: inside primary menu (li.fg-langflags-menu)
   Mobile: floating switcher (.fg-langflags--fixed)
   ========================================================= */

@media (min-width: 1025px){
  .fg-langflags--fixed{ display:none !important; }
  .fg-langflags-menu{ display:flex !important; align-items:center; }
}

@media (max-width: 1024px){
  .fg-langflags-menu{ display:none !important; }
  .fg-langflags--fixed{ display:flex !important; }
}

/* Make it look like a header icon (not a big menu link) */
.fg-langflags-menu{
  padding: 0 !important;
  margin-left: 12px;
}

.fg-langflags-menu .fg-langflags{
  margin: 0;
}

.fg-langflags-menu .fg-langflags__btn{
  width: 34px;
  height: 24px;
  padding: 0;
}

.fg-langflags-menu .fg-langflags__dd{
  right: 0;
  left: auto;
}
