/* --- Theme variables --- */
#c4r-nav{
  --w:1180px; --h:64px; --r:90px; --padX:22px;
  --shadow:0 10px 26px rgba(0,0,0,.12);
  --text:#32475a; --brand-green:#2f855a;
  font-family:"Open Sans",system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial,sans-serif;
}

/* Keep header on top and clickable */
#c4r-nav .nav-wrap{
  position:fixed; left:50%; top:18px; transform:translateX(-50%);
  width:min(var(--w),92vw); z-index:300001 !important; pointer-events:auto !important;
}
#c4r-nav .nav-inner{
  height:var(--h); padding:0 var(--padX);
  background:#fff; border-radius:var(--r); box-shadow:var(--shadow);
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:16px;
}

/* Logo (DON'T squish) */
#c4r-nav .nav-logo{ display:flex; align-items:center; min-width:120px; }
#c4r-nav .nav-logo img{
  height:auto;                         /* <- allow natural aspect */
  max-height:calc(var(--h) - 18px);    /* <- fit within bar */
  width:auto;                          /* <- no stretching */
  display:block;
}

/* Desktop menu */
#c4r-nav .nav-menu{ display:flex; justify-content:center; gap:22px; min-width:0; }
#c4r-nav .nav-menu a{
  position:relative; font-weight:600; font-size:15px; text-decoration:none; color:var(--text); padding:0 2px;
}
#c4r-nav .nav-menu a::after{
  content:""; position:absolute; left:0; right:0; bottom:-10px; height:2px; background:currentColor;
  opacity:0; transform:scaleX(0); transition:transform .18s ease, opacity .18s ease;
}
#c4r-nav .nav-menu a:hover::after{ opacity:1; transform:scaleX(1); }

/* Tools */
#c4r-nav .nav-tools{ display:flex; align-items:center; gap:12px; }

/* Flag pill */
#c4r-nav .flag-pill{
  display:inline-flex; align-items:center; gap:8px;
  height:36px; padding:0 10px 0 8px; border-radius:999px;
  border:1px solid #e7ebf0; background:#fff; color:#22313f; font-weight:700; font-size:13px; cursor:pointer;
}
#c4r-nav .fi-wrap{ display:inline-flex; width:22px; height:16px; border-radius:3px; overflow:hidden; }
#c4r-nav .fi{ width:100%; height:100%; object-fit:cover; display:block; }
#c4r-nav .flag-text{ white-space:nowrap; }
#c4r-nav .flag-arrow{
  width:0; height:0; border-left:4px solid transparent; border-right:4px solid transparent;
  border-top:5px solid #22313f; opacity:.8; transform:translateY(1px);
}

/* CTA */
#c4r-nav .cta{
  display:inline-flex; align-items:center; justify-content:center;
  height:36px; padding:0 12px; border-radius:999px;
  text-decoration:none; color:#fff; background:var(--brand-green);
  font-weight:700; font-size:13px; box-shadow:0 6px 14px rgba(47,133,90,.18);
}
#c4r-nav .cta:hover{ filter:brightness(1.05); }
#c4r-nav .person-ic{ margin-right:8px; font-size:20px; line-height:1; }

/* Burger */
#c4r-nav .nav-burger{
  display:none; width:40px; height:36px; border:none;
  background:#fff; cursor:pointer; flex-direction:column; justify-content:center;
}
#c4r-nav .nav-burger .bar{
  width:24px; height:2px; background:#22313f; margin:3px auto; border-radius:2px;
}

/* --- Tablet compact layout (<=1200px) --- */
@media (max-width:1200px){
  #c4r-nav .nav-menu{ display:none !important; }
  #c4r-nav .nav-burger{ display:flex !important; }
  #c4r-nav .nav-tools{ justify-self:end !important; margin-left:auto !important; gap:10px; }

  /* Keep pill label visible on tablet; hide small arrow */
  #c4r-nav .flag-pill{ border:1px solid #e7ebf0 !important; border-radius:999px !important; }
  #c4r-nav .flag-pill .flag-arrow{ display:none !important; }

  /* COMPACT CTA: icon-only circle */
  #c4r-nav .cta{
    width:36px; height:36px; padding:0; border-radius:50% !important;
  }
  #c4r-nav .cta .cta-text{ display:none !important; }
  #c4r-nav .person-ic{ margin-right:0; font-size:22px; }
}

/* --- Mobile layout (<=980px) --- */
@media (max-width:980px){
  #c4r-nav{ --w:94vw; --h:58px; --r:54px; --padX:14px; }
  #c4r-nav .nav-tools{ justify-self:end !important; margin-left:auto !important; gap:8px; }
  #c4r-nav .nav-wrap{ width:calc(100vw - 24px); }

  /* On phones, hide flag label for minimal UI */
  #c4r-nav .flag-pill .flag-text{ display:none !important; }

  html, body{ overflow-x:hidden; background:transparent; }
}

/* --- Offcanvas fallback --- */
.c4r-offcanvas{
  position:fixed; inset:0; z-index:300000; background:rgba(0,0,0,.45);
  display:flex; justify-content:flex-end;
}
.c4r-offcanvas[hidden]{ display:none !important; }
.c4r-offcanvas-menu{
  width:min(86vw,320px); background:#fff; height:100dvh; padding:16px;
  display:flex; flex-direction:column; gap:10px;
  border-top-left-radius:14px; border-bottom-left-radius:14px;
}
.c4r-offcanvas-menu a{
  padding:14px 10px; color:var(--text); text-decoration:none; font-weight:700;
}
.c4r-offcanvas-menu a:hover{ background:#f5f7fb; }

/* Ensure plugin flag switcher lightboxes are above nav */
#flag-lightbox, .flag-lightbox, .country-switcher-lightbox, .flag-modal, .flag-dropdown, .country-switcher-dropdown{
  position:fixed !important; z-index:400000 !important;
}

/* Kubio layering fixes */
.kubio-offscreen__overlay,
.kubio-offscreen__panel,
.kubio-offscreen,
[class*="kubio-offscreen"],
[class*="offscreen"]{
  position:fixed !important; z-index:400003 !important;
}
html:has(.kubio-offscreen__overlay),
html:has(.kubio-offscreen--open),
html:has(.is-offscreen-open) #c4r-nav .nav-wrap{ z-index:200000 !important; }
#c4r-fallback{ z-index:500000 !important; }
