/* ==========================================================================
   cx-explorer - Cross-Country Analytics "Compare" tool.
   One component: level cards (cx-tabbar) + indicator rail (cx-rail) +
   chart panel (cx-panel). Colour, font-size and spacing are custom
   properties on .cx-explorer; defaults fall back to the shared tokens in
   base/color/color.css, base/fonts/fonts.css where the value matches.
   The country profile drawer/tooltip (cx-drawer/cx-tip) and the floating
   "About these indicators" info panel (cx-info-*) are both included -
   see their own sections below. The page-level "Data sources" accordion
   is a separate standalone component (../data-sources) with its own CSS
   file, not styled here even though explorer.html.twig includes it.
   ========================================================================== */

.cx-explorer {
  position: relative;
  z-index: 3;
  --cxe-ink: var(--clr-gray-dark, #4D4D4D);
  --cxe-ink-strong: #14243A;
  --cxe-ink-muted: #767676;
  --cxe-line: var(--clr-gray-light, #DBDBDB);
  --cxe-bg-soft: #F3F5F7;
  --cxe-bg-grid: #E6EDF5;
  --cxe-white: #FFFFFF;
  --cxe-teal: var(--clr-teal-500, #1FA29C);
  --cxe-navy: var(--clr-blue, #21568C);
  --cxe-navy-overlay: rgba(6, 26, 56, 0.42);
  --cxe-accent: var(--clr-yellow-orange, #F8B323);

  /* chart-only colours - literal, not UI tokens (set by the data, not the theme) */
  --cxe-color-improved: #14a99b;
  --cxe-color-worsened: #e8606a;
  --cxe-color-neutral: #8a97a8;
  --cxe-color-median: #f5b82e;

  /* font sizes */
  --cxe-fs-kicker: var(--fs-11, 11px);
  --cxe-fs-tab-title: var(--fs-18, 18px);
  --cxe-fs-tab-desc: 13.5px;
  --cxe-fs-tab-count: var(--fs-22, 22px);
  --cxe-fs-rail-title: var(--fs-18, 18px);
  --cxe-fs-rail-sub: var(--fs-13, 13px);
  --cxe-fs-search: var(--fs-14, 14px);
  --cxe-fs-acc-h: var(--fs-14, 14px);
  --cxe-fs-radio: var(--fs-13, 13px);
  --cxe-fs-title: var(--fs-20, 20px);
  --cxe-fs-unit: var(--fs-13, 13px);
  --cxe-fs-seg-l: var(--fs-14, 14px);
  --cxe-fs-seg-btn: var(--fs-13, 13px);
  --cxe-fs-stat-value: var(--fs-28, 28px);
  --cxe-fs-stat-label: var(--fs-13, 13px);
  --cxe-fs-ctl-label: 11px;
  --cxe-fs-ddl: var(--fs-14, 14px);
  --cxe-fs-ddl-opt: var(--fs-13, 13px);
  --cxe-fs-legend: var(--fs-13, 13px);
  --cxe-fs-foot: var(--fs-13, 13px);
  --cxe-fs-profile-link: var(--fs-14, 14px);

  /* spacing / radii */
  --cxe-radius-tab: 20px;
  --cxe-radius-rail: 20px 0 20px 0;
  --cxe-radius-panel: 0 24px 0 24px;
  --cxe-radius-stat: 0 16px 0 16px;
  --cxe-gap-main: 24px;
  --cxe-rail-pad: 22px;
  --cxe-panel-pad: 24px;
  --cxe-sticky-top: calc(var(--top-fixed-height, var(--header-height, 70px)) + 20px);
  --cxe-tabbar-overlap: -104px;

  font-family: var(--primary-ff, 'Poppins', sans-serif);
}

/* --------------------------------------------------------------------------
   Level cards (cx-tabbar / cx-tablist)
   -------------------------------------------------------------------------- */
.cx-tabbar {
  display: block;
  position: relative;
  margin-top: var(--cxe-tabbar-overlap);
}

.cx-tablist {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--cxe-gap-main);
}

.cx-tab {
  /* height:auto override for the live site's own global button height
     lives in ../../css/common.css along with this file's other site
     overrides (hover/focus leaks etc.) - see that file's own comment */
  position: relative;
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--cxe-ink);
  background: var(--cxe-white);
  border: 0;
  border-radius: 0 var(--cxe-radius-tab) 0 var(--cxe-radius-tab);
  padding: 18px 20px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  box-shadow: 0 6px 14px rgba(13, 30, 55, 0.14);
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.cx-tab:nth-child(even) {
  border-radius: var(--cxe-radius-tab) 0 var(--cxe-radius-tab) 0;
}

.cx-tab .k {
  font-size: var(--cxe-fs-kicker);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding-right: 36px;
}

.cx-tab .t {
  font-size: var(--cxe-fs-tab-title);
  line-height: 1.3;
  font-weight: 700;
  padding-right: 36px;
}

.cx-tab .d {
  font-size: var(--cxe-fs-tab-desc);
  line-height: 1.45;
  padding-right: 36px;
}

/* level.description is rendered |raw - CKEditor output wraps it in its
   own <p>, which would otherwise carry body-text-field's own font-size
   instead of this card's smaller one. */
.cx-tab .d p {
  font-size: inherit;
}

.cx-tab .n {
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: var(--cxe-fs-tab-count);
  line-height: 1;
  font-weight: 700;
  color: var(--cxe-ink);
}

.cx-tab .arrow {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--cxe-accent);
  color: var(--cxe-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.cx-tab:hover .arrow {
  color: var(--cxe-white);
}

.cx-tab:hover,
.cx-tab.is-on {
  background: var(--cxe-navy);
  color: var(--cxe-white);
  box-shadow: 0 6px 14px rgba(13, 30, 55, 0.14), inset 0 0 0 999px var(--cxe-navy-overlay);
}

.cx-tab:hover .n,
.cx-tab.is-on .n {
  color: var(--cxe-accent);
}

.cx-tab:focus-visible {
  outline: 3px solid var(--cxe-accent);
  outline-offset: 2px;
}

@media (max-width: 1000px) {
  .cx-tablist {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .cx-tablist {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Main grid (rail + panel)
   -------------------------------------------------------------------------- */
.cx-main {
  position: relative;
  display: grid;
  grid-template-columns: calc((100% - 72px) / 4) minmax(0, 1fr);
  gap: var(--cxe-gap-main);
  margin-top: var(--cxe-gap-main);
  align-items: start;
}

@media (max-width: 1024px) {
  .cx-main {
    grid-template-columns: 1fr;
  }
}

/* Filter toggle button (explorer.html.twig/explorer.stories.html) - same
   mechanism as kpi.html.twig's own .logical-model-filter-btn (icon swap
   on .filter-show, see base styling wherever that shared asset lives) -
   hidden above 1024px, this component's own rail stays in its normal
   sticky-sidebar position there (no drawer needed). */
.logical-model-filter-btn {
  display: none;
}

@media (max-width: 1024px) {
  .logical-model-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    /* Component-owned copy (img/, alongside this css/ folder) instead of
       reaching across to components/logic-model-responses/img/ - same
       asset, just not a cross-component relative path. */
    background: url("/themes/custom/gff/templates/components/cross-country-analytics/explorer/css/../img/filter_icon_hover.svg") no-repeat center center;
    background-size: contain;
    font-size: 0;
    border: none;
  }

  .cx-explorer.filter-show .logical-model-filter-btn {
    background: url("/themes/custom/gff/templates/components/cross-country-analytics/explorer/css/../img/filter_icon_with_close_hover.svg") no-repeat center center;
    background-size: contain;
  }

  /* Direct child only - NOT the embedded KPI level's own filter button
     (kpi.html.twig's, several levels deeper inside .cross-country-kpi),
     which already gets its own breathing room from that wrapper's own
     margin-top. This one (explorer's own, right after .cx-tabbar) had
     none of its own - sat flush under the tab cards (reported,
     screenshot: two stacked filter icons, only the inner one properly
     spaced). */
  .cx-explorer > .logical-model-filter-btn {
    margin-top: var(--cxe-gap-main);
    /* Overrides the shared .logical-model-filter-btn base rule's own
       margin-bottom:10px (logic-model-responses.css) - explorer.js now
       hides this button outright when the KPI level is active, so the
       stacked-icon gap this used to matter for doesn't apply anymore;
       kept at 0 for the non-kpi levels too, for one consistent value. */
    margin-bottom: 0;
  }

}

/* .cross-country-kpi (explorer.html.twig's embedded kpi component, see
   js/explorer.js's tabbar click handler) - hidden by default so it
   doesn't flash visible while the kpi component's own data is still
   loading (its own fetch can take several seconds); JS swaps this for
   .cx-main when the "Key Performance Indicators" level card (data-level
   ="kpi", the one level with no indicators of its own in this
   dataset) is selected. CSS default here (rather than relying on JS
   alone) covers the gap between page load and js/explorer.js's own
   setup() running. */
.cx-explorer .cross-country-kpi {
  display: none;
  margin-top: var(--cxe-gap-main);
}

/* kpi.html.twig's own "2021 - 2025 KPIs"/"Transform 2030 KPIs" top switch -
   redundant chrome here, the "Key Performance Indicators" level card
   above already IS that entry point into this embedded instance. */
.cross-country-kpi .kpi-view-switch-wrap {
  display: none;
}

/* Wraps the included data-sources component (see explorer.html.twig) -
   that component is self-contained (own max-width/margin), this just
   reproduces the design's outer <section> padding around it. */
.cx-srcs-section {
  padding: 0;
}

/* --------------------------------------------------------------------------
   Rail (indicator search + accordion list)
   -------------------------------------------------------------------------- */
.cx-rail {
  position: sticky;
  top: var(--cxe-sticky-top);
  /* was a flat 48px (24px top + 24px bottom margin) when --cxe-sticky-top
     was a flat 24px - now that it's header-relative, mirror it here too
     so the rail doesn't overflow past the viewport bottom */
  max-height: calc(100vh - var(--cxe-sticky-top) - 20px);
  background: var(--cxe-navy);
  color: var(--cxe-white);
  border-radius: var(--cxe-radius-rail);
  box-sizing: border-box;
  /* overflow:hidden, not auto - the actual scrolling moves to the inner
     .cx-rail-scroll div below. A native scrollbar painted on the SAME
     element as a border-radius corner doesn't clip cleanly in Chromium
     (the scrollbar sits flush against the border edge, same place the
     radius tries to round away) - a page-background notch showed through
     the rounded corner right where the scrollbar met the curve. Same bug,
     same fix as kpi's own left filter (kpi.css's .cx-rail-scroll). */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Top/bottom only - cx-rail-scroll (below) keeps its own left/right
     inset, but not top/bottom anymore, so the scrollbar's own scrollHeight
     reflects real content only, not padding it had to scroll past on
     either end. This outer, non-scrolling box provides that same visual
     inset instead - a single child (cx-rail-scroll) filling its content
     box, so padding here reads identically either way. */
  padding-top: var(--cxe-rail-pad);
  padding-bottom: var(--cxe-rail-pad);
}

/* The real overflow-y:auto/scrollbar element, wrapping .cx-rh + .cx-rail-
   list together (explorer.html.twig/explorer.stories.html) - flex:1 1
   auto/min-height:0, not height:100%: .cx-rail only ever declares
   max-height (never a plain height), and CSS percentage-height resolution
   needs the containing block to have an EXPLICIT height, not just
   max-height, to mean anything - height:100% here would silently do
   nothing (this exact mistake briefly shipped on kpi's own rail: the
   scrollbar vanished entirely, excess content just clipped away with no
   way to reach it). Flexbox's own sizing algorithm doesn't have that
   restriction. Left/right padding only - top/bottom moved to .cx-rail
   above (see its own comment). */
.cx-rail .cx-rail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 var(--cxe-rail-pad);
  box-sizing: border-box;
}

/* Off-canvas Filter drawer <=1024px - same mechanism as kpi.html.twig's
   own left filter (logic-model-responses-max-991.css's .aside-category-
   section, widened to 1024px for kpi too): hidden by default (left:
   -120%), slides in over .cx-main's content when .filter-show is toggled
   on .cx-explorer (js/explorer.js). Replaces the previous position:
   static/always-visible-stacked mobile behavior - "same filter as kpi"
   was explicit, not just a narrower sticky rail. */
@media (max-width: 1024px) {
  .cx-rail {
    position: absolute;
    left: -120%;
    top: 0;
    width: 100%;
    max-width: 400px;
    max-height: none;
    min-height: 100%;
    box-shadow: 0 0 6px 0px rgba(0, 0, 0, 0.2);
    transition: left 0.3s linear 0s;
    z-index: 1;
  }

  .cx-explorer.filter-show .cx-rail {
    left: 0;
  }
}

.cx-rh {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.26);
}

.cx-rh-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cx-rh-top h2 {
  margin: 0;
  font-size: var(--cxe-fs-rail-title);
  line-height: 1.35;
  font-weight: 700;
  color: var(--cxe-white);
}

.cx-rsub {
  margin: 0;
  font-size: var(--cxe-fs-rail-sub);
  color: rgba(255, 255, 255, 0.92);
}

.cx-count {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cxe-navy);
  color: var(--cxe-white);
  box-shadow: 0 6px 14px rgba(13, 30, 55, 0.14), inset 0 0 0 999px var(--cxe-navy-overlay);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  line-height: 2;
  padding: 0;
  font-size: 14px;
  font-weight: 700;
}

.cx-sbox {
  position: relative;
  margin-top: 6px;
}

/* box-sizing: content-box on both - the site's global `body, body *
   { box-sizing: border-box }` (components/common/css/base.css) reaches
   pseudo-elements too, which collapses this hand-tuned icon (circle
   shrinks because its border now counts inward, so the handle's
   position - tuned against the original content-box circle size - no
   longer lines up with its edge). Confirmed on the live site. */
.cx-sbox::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 11px;
  height: 11px;
  margin-top: -8px;
  border: 2px solid var(--cxe-ink);
  border-radius: 50%;
  box-sizing: content-box;
}

.cx-sbox::after {
  content: "";
  position: absolute;
  left: 28px;
  top: 50%;
  width: 6px;
  height: 2px;
  margin-top: 4px;
  background: var(--cxe-ink);
  transform: rotate(45deg);
  box-sizing: content-box;
}

.cx-search {
  width: 100%;
  min-height: 38px;
  padding: 0 16px 0 42px;
  border: 1px solid var(--cxe-line);
  border-radius: 20px;
  font: inherit;
  font-size: var(--cxe-fs-search);
  color: var(--cxe-ink);
  background: var(--cxe-white);
  box-sizing: border-box;
}

.cx-search::placeholder {
  color: var(--cxe-ink-muted);
}

.cx-acc {
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.cx-acc-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  font-size: var(--cxe-fs-acc-h);
  font-weight: 600;
  line-height: 1.4;
  color: var(--cxe-white);
  padding: 12px 4px 12px 0;
  cursor: pointer;
}

.cx-acc-h>span:first-child {
  border-bottom: 2pt solid transparent;
  padding-bottom: 2px;
}

/* .cx-acc-h:hover/:focus background/colour reset lives in
   ../../css/common.css (site override, shared across components) */
.cx-acc-h:hover>span:first-child {
  color: var(--cxe-accent);
}

.cx-acc-h .ic {
  flex: none;
  position: relative;
  width: 14px;
  height: 14px;
}

.cx-acc-h .ic::before,
.cx-acc-h .ic::after {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 14px;
  height: 2px;
  background: currentColor;
}

.cx-acc-h .ic::after {
  transform: rotate(90deg);
}

.cx-acc.is-open .cx-acc-h>span:first-child {
  color: var(--cxe-accent);
}

.cx-acc.is-open .cx-acc-h .ic {
  color: var(--cxe-accent);
}

.cx-acc.is-open .cx-acc-h .ic::after {
  display: none;
}

.cx-acc-b {
  display: none;
  background: var(--cxe-white);
  padding: 8px 0;
  margin: 0 0 14px;
  max-height: 260px;
  overflow: auto;
  border-top-left-radius: 10px;
  border-bottom-right-radius: 10px;
}

.cx-acc.is-open .cx-acc-b {
  display: block;
}

.cx-radio {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: var(--cxe-fs-radio);
  font-weight: 500;
  line-height: 1.45;
  color: var(--cxe-ink);
  padding: 8px 15px;
  min-height: 32px;
  cursor: pointer;
  box-sizing: border-box;
}

.cx-radio:hover {
  background: #F2F2F2;
  color: #00413C;
}

.cx-radio[aria-checked="true"] {
  background: #F2F2F2;
  color: #00413C;
  font-weight: 700;
}

.cx-rail .cx-radio:focus-visible {
  outline: 3px solid var(--cxe-navy);
  outline-offset: -3px;
}

.cx-none {
  font-size: var(--cxe-fs-radio);
  padding: 10px 4px;
  color: var(--cxe-white);
}

/* --------------------------------------------------------------------------
   Chart panel
   -------------------------------------------------------------------------- */
.cx-panel {
  background: var(--cxe-white);
  border: 1px solid var(--cxe-line);
  border-radius: var(--cxe-radius-panel);
  padding: var(--cxe-panel-pad);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  box-sizing: border-box;
}

.cx-st::after {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 16px;
  border-left: 2.5pt solid var(--cxe-accent);
  pointer-events: none;
}

.cx-panel-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  flex: 1 1 320px;
  min-width: 0;
}

.cx-panel-title-row h3 {
  margin: 0;
  font-size: var(--cxe-fs-title);
  line-height: 1.35;
  font-weight: 700;
  color: var(--cxe-ink);
}

.cx-title-divider {
  flex: none;
  align-self: stretch;
  width: 1px;
  background: #999999;
}

.cx-unit {
  margin: 0;
  font-size: var(--cxe-fs-unit);
  line-height: 1.5;
  color: var(--cxe-ink);
  white-space: nowrap;
}

.cx-show-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cx-show-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.cx-seg-l {
  font-size: var(--cxe-fs-seg-l);
  font-weight: 700;
  color: var(--cxe-ink);
}

.cx-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: #E3E3E3;
  border-radius: 999px;
}

.cx-seg-btn {
  white-space: nowrap;
  font: inherit;
  font-size: var(--cxe-fs-seg-btn);
  font-weight: 600;
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--cxe-ink);
  cursor: pointer;
}

.cx-seg-btn[aria-checked="true"] {
  background: var(--cxe-teal);
  color: var(--cxe-white);
}

.cx-seg-btn[aria-checked="false"]:hover {
  background: var(--cxe-white);
}

/* :hover/:focus colour reset lives in ../../css/common.css (site override) */

/* Download dropdown (.share-download-options etc, explorer.html.twig)
   - no component-scoped CSS of its own, same as MNCH's own widgets:
   base styling is entirely site-global (icons.css, always loaded) +
   visualisation.css (this component's own asset, see gff.libraries.yml) -
   only .cx-show-row's position:relative and this override belong here. */
.cx-explorer .share-download-options {
  position: static;
}

.cx-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cx-st {
  position: relative;
  background: var(--cxe-bg-soft);
  border-radius: var(--cxe-radius-stat);
  padding: 16px 16px 16px 34px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cx-st:nth-child(even) {
  border-radius: 16px 0 16px 0;
}

.cx-st b {
  font-size: var(--cxe-fs-stat-value);
  line-height: 1.05;
  font-weight: 700;
  color: var(--cxe-navy);
}

.cx-st span {
  font-size: var(--cxe-fs-stat-label);
  line-height: 1.45;
  color: var(--cxe-ink);
}

@media (max-width: 1000px) {
  .cx-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* sort by / view controls */
.cx-chartbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.cx-ctl {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
}

.cx-type {
  flex: 0 0 calc((100% - 36px) / 4);
}

.cx-type.cx-ctl {
  gap: 2px;
}

.cx-ctl .cx-seg-l {
  font-size: var(--cxe-fs-ctl-label);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #8A8A8A;
  margin-bottom: 1px;
}

.cx-ctl[hidden] {
  display: none;
}

.cx-ddl {
  position: relative;
}

.cx-ddl-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font: inherit;
  font-family: 'Poppins', 'Segoe UI', system-ui, sans-serif;
  font-size: var(--cxe-fs-ddl);
  font-weight: 400;
  min-height: 30px;
  padding: 0 2px 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--cxe-line);
  border-radius: 0;
  background: var(--cxe-white);
  color: var(--cxe-ink);
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

/* full :hover/:focus rule (colour + background/border-color reset)
   lives in ../../css/common.css (site override, shared across components) */

.cx-ddl-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-ddl-arrow {
  flex: none;
  color: inherit;
  transition: transform 0.2s ease;
}

.cx-ddl.is-open .cx-ddl-trigger {
  color: #0F37A9;
  border-bottom-color: #97BCE0;
}

.cx-ddl.is-open .cx-ddl-arrow {
  transform: rotate(180deg);
}

.cx-ddl-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 1px);
  z-index: 40;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background: var(--cxe-white);
  border-radius: 0;
  box-shadow: 0 10px 40px 8px rgba(13, 30, 55, 0.16);
  max-height: 0;
  overflow: hidden auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.18s ease, visibility 0.22s;
}

.cx-ddl.is-open .cx-ddl-list {
  max-height: 280px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.cx-ddl-opt {
  padding: 10px 16px;
  font-size: var(--cxe-fs-ddl-opt);
  font-weight: 400;
  line-height: 1.4;
  color: #405463;
  cursor: pointer;
}

.cx-ddl-opt:hover,
.cx-ddl-opt:focus {
  background: #F2F2F2;
  color: #00413C;
  outline: none;
}

.cx-ddl-opt.is-selected {
  font-weight: 700;
  color: var(--cxe-navy);
  background: #F2F2F8;
}

.cx-ddl-opt.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* country picker (Trend view) - checkbox list + its own search box inside the dropdown */
.cx-ddl-list-country {
  display: flex;
  flex-direction: column;
  padding: 12px 0 8px;
}

.cx-ddl-search {
  position: relative;
  flex: none;
  padding: 10px 14px;
  border-bottom: 1px solid #EDEDED;
}

.cx-ddl-search-icon {
  position: absolute;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cxe-ink-muted);
  pointer-events: none;
}

.cx-ddl-search .cx-search {
  min-height: 38px;
  font-size: 13px;
  padding-left: 40px;
  background: var(--cxe-bg-soft);
  border-color: var(--cxe-bg-soft);
}

.cx-ddl-search .cx-search:hover {
  border-color: #B9C4CE;
}

.cx-ddl-search .cx-search:focus {
  background: var(--cxe-white);
  border-color: var(--cxe-line);
}

.cx-ddl-list-country .cx-country-list {
  flex: 1 1 auto;
  overflow-y: auto;
  max-height: 220px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cx-ddl-opt-check {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cx-ddl-checkbox {
  flex: none;
  width: 13px;
  height: 14px;
  border: 1.5px solid #B9C4CE;
  border-radius: 4px;
  box-sizing: border-box;
  position: relative;
}

.cx-ddl-opt-check.is-selected .cx-ddl-checkbox {
  background: var(--cxe-navy);
  border-color: var(--cxe-navy);
}

.cx-ddl-opt-check.is-selected .cx-ddl-checkbox::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 3.5px;
  height: 7px;
  border: solid var(--cxe-white);
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}

.cx-ddl-opt-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-ddl-empty {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--cxe-ink-muted);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {

  .cx-ddl-list,
  .cx-ddl-arrow,
  .cx-tab {
    transition: none;
  }
}

/* legend - matches the design's #cx-legend override exactly (own font
   family/colour, distinct from the rest of the UI's Poppins/--cxe-ink) */
.cx-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 15px;
  margin-bottom: 6px;
  font-family: 'Source Sans 3', Arial, sans-serif;
  font-size: var(--cxe-fs-legend);
  color: #5b6b80;
}

.cx-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cx-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-sizing: border-box;
}

.cx-legend i.dash {
  width: 16px;
  height: 0;
  border-radius: 0;
  border-top: 2px dashed var(--cxe-accent);
}

/* selected-country chips (Trend view) - prepended ahead of the view's own
   swatch legend by js/explorer.js's renderCountryLegend(). Scoped under
   .cx-legend (not bare classes): the generic `.cx-legend i` / `.cx-legend
   span` rules above are a class+type selector, which beats a lone class
   on specificity - without this scoping, .cx-legend-divider's
   border-radius:0 and .cx-country-dot's display/size/border-radius all
   silently lose to those generic rules (divider renders round, the dot's
   flex-centering and 14px size are dropped). The design avoids this by
   scoping everything under #cx-legend (ID beats class+type); this does
   the equivalent with the class this component actually uses. */
.cx-legend .cx-country-legend-label {
  font-weight: 700;
  color: var(--cxe-ink);
}

.cx-legend .cx-legend-divider {
  width: 1px;
  height: 16px;
  min-width: 1px;
  border-radius: 0;
  background: #999999;
  margin: 0;
  box-sizing: border-box;
}

.cx-legend .cx-country-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cx-legend .cx-country-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 0;
  border-radius: 50%;
  box-sizing: border-box;
  cursor: pointer;
  flex: none;
  transition: box-shadow 0.15s ease;
}

.cx-legend .cx-country-dot:hover {
  box-shadow: 0 0 0 3px rgba(13, 30, 55, 0.12);
}

.cx-legend .cx-country-dot:focus-visible {
  outline: 3px solid var(--cxe-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .cx-legend .cx-country-dot {
    transition: none;
  }
}

/* chart */
.cx-chartbox {
  position: relative;
  border: 1px solid var(--cxe-line);
  border-radius: 8px;
  padding: 12px 8px 4px 0;
  /* js/explorer.js scrolls this into view on every view-dropdown change
     (see wireDropdown(viewCtl,...)) - without this, scrollIntoView would
     land its own top flush against the site's fixed header, same offset
     .cx-rail already accounts for via --cxe-sticky-top. */
  scroll-margin-top: var(--cxe-sticky-top);
}

/* js/explorer.js replaces .cx-chart's entire innerHTML on every view
   switch - Trend's chart is a fixed 400px-tall SVG, Progress/Equity's
   height scales with row count (can run past 1000px for a long
   indicator list). Without this, the browser's scroll anchoring picks a
   new anchor node somewhere inside that freshly-swapped, much-taller
   subtree and snaps the page to it, which reads as the page jumping to
   show the chart starting mid-way down instead of from its top. This
   opts the chart out of being used as (or containing) that anchor. */
.cx-chart {
  overflow-anchor: none;
}

/* Enlarge trigger (.maximize-popup) and the popup it opens (.cx-popup)
   use the exact same markup/classes as the MNCH widgets' own (see
   explorer.html.twig's doc comments on both) - all their chrome comes
   from already-loaded site CSS (icons.css, visualisation.css,
   inner-pages/common/css/common.css). position:relative above is what
   visualisation.css's .visualization-actions-block (position:absolute;
   right:0;top:0) anchors to - that lands it flush against .cx-chartbox's
   own corner (confirmed live: ~1px gap), so this nudges it off the edge
   with real breathing room instead. */
.cx-chartbox .visualization-actions-block {
  position: static;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding-bottom: 10px;
  padding-right: 10px;
}

/* Trend view only (js/explorer.js's openChartPopup sets this class) -
   #cx-chart-section has no padding of its own, so its cloned SVG (same
   markup as the inline .cx-chart) runs flush to .popup-content's
   site-scrollbar track once enlarged, crowding the right-most country
   labels. Progress/Equity don't need this: they don't end-label a line
   past the plotted area the same way. */
#cx-chart-section.cx-view-trend {
  box-sizing: border-box;
  padding-right: 24px;
}

.cx-chartbox svg text {
  font-family: 'Source Sans 3', Arial, sans-serif;
}

.cx-row {
  cursor: pointer;
}

.cx-row:hover .bg {
  fill: #e7eef7;
}

.cx-empty {
  padding: 40px;
  text-align: center;
  color: #5b6b80;
}

.cx-foot {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--cxe-line);
  font-size: var(--cxe-fs-foot);
  line-height: 1.55;
  color: var(--cxe-ink);
}

/* --------------------------------------------------------------------------
   Country profile drawer + hover tooltip - fixed to the viewport, not the
   rail/panel flow. Hovering a progress/equity row or a trend point shows
   the tooltip; clicking a progress/equity row (not a trend point - trend
   already shows several years per country, a click there wouldn't have
   one obvious target) opens the drawer. Both built entirely by
   js/explorer.js from the JSON dataset.
   -------------------------------------------------------------------------- */
.cx-label {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 0 10px 0 10px;
  background: var(--cxe-accent);
  color: #000000;
}

.cx-drawer {
  position: fixed;
  right: 0;
  /* site header is fixed too, with a much higher z-index (10000 vs this
     drawer's 95) - sitting at top:0 the same as it would put the header
     permanently over the drawer's top edge. --top-fixed-height
     (components/redesign/base/spacing/spacing.css, set on body) is the
     site's own var for "whatever's actually docked at the top right
     now" - header height plus any pinned second menu, reactive to the
     header hiding on scroll-down - exactly what a fixed drawer should
     clear, so prefer it over reading --header-height directly. */
  top: calc(var(--top-fixed-height, var(--header-height, 70px)) + 15px);
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--cxe-white);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
  transform: translateX(105%);
  transition: transform 0.25s;
  /* above .cx-info-fab (90) - otherwise the fixed info button shows
     through the open drawer instead of being covered by it */
  z-index: 95;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 24px 0 0 0;
}

.cx-drawer.open {
  transform: none;
}

/* fixed - stays visible while .cx-drawer__body scrolls */
.cx-drawer__head {
  flex: none;
  padding: 24px 24px 0;
}

.cx-drawer__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 24px;
}

/* fixed - stays visible while .cx-drawer__body scrolls */
.cx-drawer__foot {
  flex: none;
  padding: 16px 24px 24px;
}

.cx-drawer__foot:empty {
  padding: 0;
}

.cx-drawer h3 {
  margin: 12px 0 2px;
  font-size: 22px;
  color: var(--clr-blue);
  font-weight: var(--fw-bold);
}

.cx-drawer .cx-dsub {
  margin: 2px 0 12px;
  font-size: 13.5px;
}

.cx-drawer .x {
  float: right;
  border: 0;
  background: #E3E3E3;
  border-radius: 50%;
  width: 36px;
  /* !important: same site-wide mobile button-height rule as .cx-info-fab
     above (components/cross-country-analytics/css/common.css's own fix 5)
     - width stays 36px but height drops to 30px at <=767px without this,
     squashing this circle into an oval same as that one did. */
  height: 36px !important;
  padding: 0;
  cursor: pointer;
  font-size: 18px;
  font-weight: 400;
  color: var(--cxe-ink);
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* hover/focus values live in ../../css/common.css (same selector also
   neutralizes the site's body-button hover/focus leak there) - reuses
   the design's own .cx-info-close:hover convention (same round gray
   icon-close button family elsewhere in this page) */

.cx-drawer .di {
  border-bottom: 1px solid var(--cxe-line);
  padding: 10px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}

.cx-drawer .nm {
  font-size: 14px;
}

.cx-drawer .v {
  font-weight: 700;
  font-size: 16px;
  color: var(--cxe-navy);
  text-align: right;
}

.cx-drawer .ch {
  grid-column: 1 / -1;
  font-size: 12.5px;
}

.cx-drawer .up {
  color: var(--cxe-color-improved);
  font-weight: 600;
}

.cx-drawer .dn {
  color: #ED6E68;
  font-weight: 600;
}

/* "View country profile" - same markup/style as components/transform2030-
   page/shared-components/snapshot's .snapshot__profile-link (text + a
   yellow circular arrow that nudges right on hover), just cx-* prefixed
   for this component. href starts as data-profile-link-pattern with
   {iso} substituted, then js/explorer.js's applyRealCountryLink() swaps
   in the real URL from gff/country-links once that resolves. */
.cx-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: var(--cxe-fs-profile-link);
  font-weight: 700;
  color: var(--cxe-navy);
  text-decoration: none;
}

.cx-profile-link:hover,
.cx-profile-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cx-profile-link-arrow {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--cxe-accent);
  color: var(--cxe-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.cx-profile-link:hover .cx-profile-link-arrow,
.cx-profile-link:focus-visible .cx-profile-link-arrow {
  color: var(--cxe-white);
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .cx-profile-link-arrow {
    transition: none;
  }
}

.cx-tip {
  position: fixed;
  pointer-events: none;
  /* Fallbacks required here, unlike most --cxe-* usages elsewhere in
     this file - moved to <body> (js/explorer.js), it's no longer a
     descendant of .cx-explorer, which is where these custom properties
     are actually declared, so they'd otherwise resolve to nothing. */
  background: var(--cxe-ink, #4D4D4D);
  color: var(--cxe-white, #FFFFFF);
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 0 10px 0 10px;
  opacity: 0;
  transition: opacity 0.1s;
  /* Needs to clear .cx-popup (z-index:10001, also moved to <body> - see
     js/explorer.js's own comment) so it still shows while the popup is
     open, not just the rest of the page. */
  z-index: 10002;
  max-width: 280px;
  line-height: 1.4;
}

@media (prefers-reduced-motion: reduce) {

  .cx-drawer,
  .cx-tip {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Floating "About these indicators" info panel - fixed to the viewport,
   not the rail/panel flow, so these rules sit outside .cx-main on purpose.
   -------------------------------------------------------------------------- */
.cx-info-fab {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 90;
  width: 45px;
  /* !important: a site-wide rule (body button:not(.navbar-toggle)) forces
     height:30px/line-height:30px on every <button> at <=767px - higher
     specificity than this plain class alone, so width stayed 45px while
     height dropped to 30px, squashing this circle into an oval. .cx-seg-
     btn/.cx-ddl-trigger (also real <button>s here) happen to use min-
     height instead of height, a property that rule never touches, so
     they were never actually affected - this is the only one that was. */
  height: 45px !important;
  border-radius: 50%;
  border: 0;
  background: var(--clr-yellow-orange, #F8B323);
  color: var(--clr-gray-dark, #4D4D4D);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(13, 30, 55, 0.28);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.cx-info-fab:hover {
  background: var(--clr-primary);
  color: var(--clr-gray-dark, #4D4D4D);
  box-shadow: 0 12px 28px rgba(13, 30, 55, 0.34);
}

.cx-info-fab.is-open {
  background: var(--cxe-accent);
  color: #000000;
}

.cx-info-overlay {
  position: fixed;
  inset: 0;
  z-index: 88;
  background: rgba(13, 30, 55, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease;
}

.cx-info-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.cx-info-panel {
  position: fixed;
  top: 50%;
  right: 80px;
  z-index: 89;
  width: min(400px, calc(100vw - 140px));
  max-height: min(620px, 76vh);
  display: flex;
  flex-direction: column;
  background: var(--cxe-white);
  border-radius: var(--cxe-radius-panel);
  box-shadow: 0 20px 56px rgba(13, 30, 55, 0.24), 0 4px 14px rgba(13, 30, 55, 0.1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-50%) translateX(10px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.cx-info-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0) scale(1);
}

.cx-info-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 20px 0 24px;
}

.cx-info-head h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--cxe-navy);
}

.cx-info-close {
  display: none;
}

.cx-info-close:hover {
  background: var(--cxe-line);
  color: #00413C;
}

.cx-info-body {
  padding: 14px 24px 24px;
  overflow: auto;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--cxe-ink);
}

.cx-info-body a {
  color: var(--cxe-navy);
  font-weight: 700;
  text-underline-offset: 3px;
}

/* "Discover More" link - a separate Link field (info_link_url/
   info_link_title), rendered by this twig below `intro`, not part of
   that field's own HTML. See explorer.html.twig's doc comment. */
.cx-info-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  text-decoration: none;
}

.cx-info-link:hover {
  text-decoration: underline;
}

.cx-info-link-arrow {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--cxe-accent);
  color: var(--cxe-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, transform 0.2s ease;
}

.cx-info-link:hover .cx-info-link-arrow {
  color: var(--cxe-white);
  transform: translateX(4px);
}

@media (prefers-reduced-motion: reduce) {
  .cx-info-link-arrow {
    transition: none;
  }
}

@media (max-width: 560px) {
  .cx-info-panel {
    top: 50%;
    left: 50%;
    right: auto;
    width: calc(100vw - 40px);
    max-height: 72vh;
    transform: translate(-50%, -50%) scale(0.98);
  }

  .cx-info-panel.is-open {
    transform: translate(-50%, -50%) scale(1);
  }

  .cx-info-fab {
    right: 16px;
    width: 48px;
    /* !important: same site-wide button-height rule as the base rule
       above - still active at this breakpoint too (both are <=767px). */
    height: 48px !important;
  }
}

@media (max-width: 767px) {
  .cx-panel-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .cx-title-divider {
    display: none;
  }

  .cx-show-group {
    gap: 5px;
  }

  .cx-seg {
    flex-wrap: nowrap;
  }

  .cx-seg-btn {
    white-space: pre-wrap;
    /* !important: site-wide mobile button-height rule again (common.css's
       own fix 5/fix for .cx-tab et al doesn't cover this one - .cx-seg-btn
       normally relies on its own min-height:34px, a property that rule
       never touches, but wrapped text at this width needs real multi-line
       height, which min-height alone won't force past a fixed height:30px
       still fighting it from the other side). */
    height: auto !important;
    line-height: 1.3 !important;
    font-size: 12px;
    padding: 4px 10px;
  }

  /* .cx-chartbar holds exactly 2 .cx-ctl groups (Sort by / View) - grid
     instead of the base flex-wrap so both take equal width side by side
     instead of each sizing to its own content. */
  .cx-chartbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  /* Overrides the custom property itself (base rule: --cxe-gap-main:24px,
     line 63), not .cx-tablist's own gap declaration directly - scoped to
     this element only, doesn't touch --cxe-gap-main's other consumers
     (.cx-main etc, different selectors, var() doesn't cascade sideways). */
  .cx-tablist {
    --cxe-gap-main: 15px;
  }
}

@media (max-width: 520px) {
  /* One per row below this - .cx-ddl-trigger is already width:100% of
     its own .cx-ddl, so a full-width grid column is enough to make the
     dropdown itself full width too, no extra rule needed there. */
  .cx-chartbar {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {

  .cx-info-panel,
  .cx-info-overlay,
  .cx-info-fab {
    transition: none;
  }
}
