/* t2030-gender - SRHR "Gender and rights" section body: the "Countries
   reporting measurable progress" bar chart card (View tabs: Gender / Equity /
   Commodities / CSO and youth) beside the "Cervical cancer" and
   "Gender-based violence in FCV settings" text cards. Section header and the
   dark navy backdrop are rendered by the master twig.

   Design colors matched to tokens where exact: #4D4D4D --clr-gray-dark,
   #DBDBDB --clr-gray-light, #21568C --clr-blue, #1FA29C --clr-teal-500,
   #F8B323 --clr-yellow-orange. No token for the rest - scoped below. */
.t2030-gender {
  --gd-ink: var(--clr-gray-dark, #4d4d4d);
  --gd-muted: #6b6b6b;
  --gd-border: var(--clr-gray-light, #dbdbdb);
  --gd-grid: #f3f5f7;
  --gd-navy: var(--clr-blue, #21568c);
  --gd-teal: var(--clr-teal-500, #1fa29c);
  --gd-gold: var(--clr-yellow-orange, #f8b323);
  --gd-title: #15766f;
  --gd-seg-bg: #e3e3e3;
  --gd-row-hover: #edf5f5;
  --gd-lw: 70px;
  --gd-val-w: 72px;
  --gd-row-h: 46px;
  --gd-bar-h: 24px;
  --gd-th-bg: #efefef;
  /* Download bar height above the chart card; the side column starts this
     far down (+ the main gap) so both columns' cards line up. */
  --gd-toolbar-h: 33px;
  --gd-main-gap: 6px;

  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: stretch;
  min-width: 0;
  font-family: var(--primary-ff, 'Poppins', sans-serif);
  color: var(--gd-ink);
}

.t2030-gender [hidden] {
  display: none !important;
}

/* ---------- top download ---------- */
.t2030-gender__main {
  flex: 3 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gd-main-gap);
}

.t2030-gender__toolbar-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: var(--gd-toolbar-h);
}

/* Site visualisation.css positions every .share-download-options absolutely
   (align-top: top -40px, right 0), which drops the bar out of the column and
   breaks the side-column alignment on Drupal pages. Keep it in flow here. */
.t2030-gender__toolbar-top .share-download-options {
  position: static;
  inset: auto;
  padding: 0;
}

/* Site download chrome (share-download-options) is styled by the site; only
   the hover/focus reveal is needed for it to function standalone. Icon/
   label colour is NOT set here - reusing the exact same .icon--download/
   .text-icon-clr1 markup as MNCH (mnch/death, mnch/mortality) means the
   master twig's own section wrapper (.odd-even-style,
   base/odd-even-styles/odd-even-styles.css + elements/icons/icons.css)
   already supplies the right colour per section, light or dark, with no
   per-component override needed. */
.t2030-gender .options-field {
  position: relative;
}

.t2030-gender .maximize-popup,
.t2030-gender .icon--download {
  cursor: pointer;
}

.t2030-gender .options-field-list {
  display: none;
  /* Site chrome positions this flush against the download icon (top:100%,
     no gap) - adds visible space between them. */
  margin-top: var(--sp2, 8px);
}

.t2030-gender .options-field:hover .options-field-list,
.t2030-gender .options-field:focus-within .options-field-list {
  display: block;
}

/* ---------- chart card ---------- */
.t2030-gender__card {
  /* .t2030-gender (row) stretches .t2030-gender__main's height to match
     the taller side column; without this, .main's column gives that
     extra height only to itself (flex children default to flex-grow:0),
     so the gap shows as bare page background below the card instead of
     the card itself growing to meet it. */
  flex: 1 1 auto;
  min-width: 0;
  background: var(--clr-white, #fff);
  border-radius: 0 24px 0 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-sizing: border-box;
}

.t2030-gender__card-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ---------- view tabs (radios; teal select when the column is narrow) ---------- */
.t2030-gender__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 32px;
}

.t2030-gender__seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.t2030-gender__seg--select {
  display: none;
}

.t2030-gender__seg-label {
  font-size: var(--fs-14, 14px);
  font-weight: var(--fw-bold, 700);
  color: var(--gd-ink);
}

.t2030-gender__seg-group {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--gd-seg-bg);
  border-radius: 999px;
}

/* The site's button.css sets `body button:hover, body button:focus` to
   teal bg + white text, which beats this one-class rule. Applying the
   base colours to :hover/:focus too keeps them; the state rules below
   (hover / checked / selected) still win. */
.t2030-gender__seg-btn,
.t2030-gender__seg-btn:hover,
.t2030-gender__seg-btn:focus {
  white-space: nowrap;
  font: inherit;
  font-size: var(--fs-13, 13px);
  font-weight: var(--fw-semibold, 600);
  min-height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gd-ink);
  cursor: pointer;
}

.t2030-gender__seg-btn[aria-checked="false"]:hover {
  background: var(--clr-white, #fff);
}

.t2030-gender__seg-btn[aria-checked="true"] {
  background: var(--gd-teal);
  color: var(--clr-white, #fff);
}

.t2030-gender__select-wrap {
  position: relative;
  display: flex;
}

.t2030-gender__select {
  font: inherit;
  font-size: var(--fs-14, 14px);
  font-weight: var(--fw-bold, 700);
  min-height: 40px;
  padding: 0 42px 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--gd-teal);
  color: var(--clr-white, #fff);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.t2030-gender__select option {
  color: var(--gd-ink);
  background: var(--clr-white, #fff);
}

.t2030-gender__select-chevron {
  position: absolute;
  right: 14px;
  top: 50%;
  margin-top: -9px;
  color: var(--clr-white, #fff);
  pointer-events: none;
}

.t2030-gender__seg-btn:focus-visible,
.t2030-gender__select:focus-visible {
  outline: 2px solid var(--gd-navy);
  outline-offset: 2px;
}

@container (max-width: 720px) {
  .t2030-gender__seg--radio { display: none; }
  .t2030-gender__seg--select { display: flex; }
}

/* ---------- text cards ---------- */
.t2030-gender__side {
  flex: 2 1 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Lines up with the chart card's own top, below the download bar added
     to .t2030-gender__main above. */
  padding-top: calc(var(--gd-toolbar-h) + var(--gd-main-gap));
}

/* ---------- t2030-gender--no-chart ---------- */
.t2030-gender--no-chart .t2030-gender__main {
  display: none;
}

.t2030-gender--no-chart .t2030-gender__side {
  flex: 1 1 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  padding-top: 0;
}

.t2030-gender--no-chart .t2030-gender__text-card:nth-child(1) {
  border-radius: 0 24px 0 24px;
}

.t2030-gender--no-chart .t2030-gender__text-card:nth-child(2) {
  border-radius: 24px 0 24px 0;
}

.t2030-gender__text-card {
  min-width: 0;
  box-sizing: border-box;
  padding: 24px;
  background: var(--clr-white, #fff);
  border-radius: 24px 0 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.t2030-gender__text-title {
  margin: 0;
  font-size: var(--fs-20, 20px);
  line-height: 1.3;
  font-weight: var(--fw-bold, 700);
  color: var(--gd-ink);
}

.t2030-gender__figs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.t2030-gender__fig {
  padding-left: 18px;
  border-left: 3px solid var(--gd-gold);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.t2030-gender__fig-value {
  font-size: var(--fs-34, 34px);
  line-height: 1.05;
  font-weight: var(--fw-bold, 700);
  color: var(--gd-navy);
}

.t2030-gender__fig-label {
  font-size: var(--fs-15, 15px);
  line-height: 1.55;
  color: var(--gd-ink);
}

.t2030-gender__text-body {
  font-size: var(--fs-15, 15px);
  line-height: 1.65;
  color: var(--gd-ink);
}

.t2030-gender__text-body > * {
  margin: 0;
}

.t2030-gender__text-body > * + * {
  margin-top: 10px;
}

/* ---------- chart card heading ---------- */
.t2030-gender__title-row {
  display: flex;
  /* nowrap, not wrap - .title-group has its own internal flex-wrap (title/
     sub stack when long) and min-width:0 to shrink, so it always yields
     space to .card-actions on the SAME line. If this row itself wraps,
     .card-actions can end up alone on its own line, where
     justify-content:space-between has nothing to space between and
     collapses it to the start (left) instead of staying pinned right. */
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.t2030-gender__title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  min-width: 0;
}

.t2030-gender__card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

/* Site visualisation.css (loaded on Drupal pages) positions every
   .visualization-actions-block absolutely (top/right of its card). Here the
   Enlarge button sits in the title-row flex row, so keep it in flow. */
.t2030-gender__card-actions .visualization-actions-block {
  position: static;
  inset: auto;
}

.t2030-gender__divider {
  width: 1px;
  height: 30px;
  background: var(--gd-teal);
}

.t2030-gender__title {
  margin: 0;
  font-size: var(--fs-20, 20px);
  line-height: 1.35;
  font-weight: var(--fw-bold, 700);
  color: var(--gd-title);
}

.t2030-gender__sub {
  margin: 0 0 0 16px;
  padding-left: 16px;
  border-left: 2px solid var(--gd-teal);
  font-size: var(--fs-14, 14px);
  line-height: 1.5;
  color: var(--gd-ink);
}

.t2030-gender__chart-col {
  flex: 2 1 460px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  container-type: inline-size;
}

/* ---------- bar chart (design bars() builder) ---------- */
.t2030-gender__chart {
  border: 1px solid var(--gd-border);
  border-radius: 8px;
  padding: 12px 8px 0 0;
  background: var(--clr-white, #fff);
}

.t2030-gender__chart-inner {
  position: relative;
}

.t2030-gender__grid {
  position: absolute;
  top: 0;
  bottom: 26px;
  left: var(--gd-lw);
  right: var(--gd-val-w);
  pointer-events: none;
}

.t2030-gender__grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--gd-grid);
}

.t2030-gender__rows {
  position: relative;
  display: flex;
  flex-direction: column;
}

.t2030-gender__row {
  display: flex;
  align-items: center;
  height: var(--gd-row-h);
  border-radius: 4px;
  cursor: default;
}

.t2030-gender__row:hover,
.t2030-gender__row:focus-visible {
  background: var(--gd-row-hover);
}

.t2030-gender__row:focus-visible {
  outline: 2px solid var(--gd-navy);
  outline-offset: 1px;
}

.t2030-gender__label {
  flex: 0 0 var(--gd-lw);
  padding-right: 12px;
  box-sizing: border-box;
  text-align: right;
  font-size: var(--fs-13, 13px);
  line-height: 1.3;
  color: var(--gd-ink);
}

.t2030-gender__track {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
}

.t2030-gender__bar {
  display: block;
  height: var(--gd-bar-h);
  border-radius: 0 4px 4px 0;
  transition: width 0.25s ease;
}

.t2030-gender__val {
  flex: 0 0 var(--gd-val-w);
  text-align: right;
  font-size: var(--fs-13, 13px);
  font-weight: var(--fw-bold, 700);
  color: var(--gd-ink);
}

.t2030-gender__axis {
  display: flex;
  height: 26px;
  margin-top: 4px;
}

.t2030-gender__axis-pad {
  flex: 0 0 var(--gd-lw);
}

.t2030-gender__axis-pad--val {
  flex-basis: var(--gd-val-w);
}

.t2030-gender__axis-track {
  position: relative;
  flex: 1 1 auto;
  border-top: 1px solid var(--gd-border);
}

.t2030-gender__tick {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  font-size: var(--fs-11, 11px);
  color: var(--gd-ink);
  white-space: nowrap;
}

.t2030-gender__source {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--gd-border);
  font-size: var(--fs-13, 13px);
  line-height: 1.55;
  color: var(--gd-ink);
}

/* ---------- tooltip ---------- */
.t2030-gender__tip {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
  max-width: 280px;
  padding: 8px 12px;
  background: var(--clr-white, #fff);
  border: 1px solid var(--gd-border);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(30, 50, 80, 0.18);
  font-size: var(--fs-12, 12px);
  line-height: 1.45;
  color: var(--gd-ink);
  pointer-events: none;
}

.t2030-gender__tip-name {
  font-size: var(--fs-13, 13px);
  margin-bottom: 2px;
}

.t2030-gender__tip-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.t2030-gender__tip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: none;
}

.t2030-gender__tip-note {
  color: var(--gd-muted);
}

/* The chart column sits directly in the column-direction card here (no
   aside beside it), so it must not take the 460px row basis as a height. */
.t2030-gender__chart-col {
  flex: 0 0 auto;
}

/* ---------- table ---------- */
.t2030-gender__table-wrap {
  overflow: auto;
  /* border: 1px solid var(--gd-border); */
  /* border-radius: 8px; */
}

.t2030-gender__table {
  width: 100%;
  border-collapse: collapse;
}

.t2030-gender__table th,
.t2030-gender__table td {
  text-align: left;
}

.t2030-gender__table thead th {
  position: sticky;
  top: 0;
}

.t2030-gender__table .is-num {
  text-align: right;
}

/* ---------- enlarge popup (site chrome; only functional rules here) ---------- */
.t2030-gender__popup {
  display: none;
}

.t2030-gender__popup.is-active {
  display: flex;
}

.t2030-gender__popup .popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 35, 0.55);
  z-index: 55;
}

.t2030-gender__popup .popup-tab-content {
  display: none;
}

.t2030-gender__popup .popup-tab-content.is-active {
  display: block;
}

/* gender.js moves .t2030-gender__controls into the popup's own Download
   row on enlarge (and back on close), so it sits outside .popup-content's
   scroll area instead of scrolling away with the chart rows. Lay the two
   out as one row: controls on the left, the existing Download link on
   the right. */
.t2030-gender__popup .popup-download-options {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* justify-content:space-between (instead of this) only positions the
   Download link right when .t2030-gender__controls is also present - on
   the Table tab, .controls gets hidden (see setTabView), leaving it as
   the only flex child, which space-between would then place at
   flex-start (left) instead. margin-left:auto keeps it pinned right
   regardless. */
.t2030-gender__popup .popup-download-options > ul {
  margin-left: auto;
}

.t2030-gender__popup .t2030-gender__controls {
  justify-content: flex-start;
  gap: 12px 20px;
}

.t2030-gender__popup .t2030-gender__select {
  font-size: 13px;
  min-height: 34px;
}

.t2030-gender__popup .custom-modal-close-field {
  cursor: pointer;
}

body.gender-lock-scroll {
  overflow: hidden;
}

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .t2030-gender__sub {
    border-left: 0;
    padding-left: 0;
    margin-left: 0;
  }
}

@media (max-width: 767px) {
  .t2030-gender {
    --gd-val-w: 56px;
  }

  .t2030-gender__popup .t2030-gender__controls {
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .t2030-gender__seg-btn { padding: 0 12px; }

  .t2030-gender__card,
  .t2030-gender__text-card {
    padding: 18px 14px;
  }

  .t2030-gender__fig-value {
    font-size: var(--fs-28, 28px);
  }

  .t2030-gender__divider {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .t2030-gender__bar {
    transition: none;
  }
}
