/* private-sector - "Private sector share of care at birth" bar chart card.
   Section header and the blue (#21568C) section backdrop come from the
   master twig - not part of this component.

   Colors: #4D4D4D -> --clr-gray-dark, #DBDBDB -> --clr-gray-light,
   #21568C -> --clr-blue, #1FA29C -> --clr-teal-500 (bar colors come from
   data.json), #EEF2F6 -> --clr-blue08 (exact). No token for the segmented
   control track #E3E3E3, bar track #F3F5F7 or caption grey #6B6B6B -
   minted locally. */
.private-sector {
  --private-sector-ink: var(--clr-gray-dark, #4d4d4d);
  --private-sector-border: var(--clr-gray-light, #dbdbdb);
  --private-sector-blue: var(--clr-blue, #21568c);
  --private-sector-hover: var(--clr-blue08, #eef2f6);
  --private-sector-seg-bg: #e3e3e3;
  --private-sector-track: #f3f5f7;
  --private-sector-caption: #6b6b6b;
  --private-sector-cols: minmax(96px, 200px) minmax(0, 1fr) 64px;

  font-family: var(--primary-ff, 'Poppins', sans-serif);
  color: var(--private-sector-ink);
}

.private-sector *,
.private-sector *::before,
.private-sector *::after {
  box-sizing: border-box;
}

.private-sector__card {
  background: var(--clr-white, #fff);
  border: 1px solid var(--private-sector-border);
  border-radius: 0 24px 0 24px;
  padding: 24px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.private-sector__titles {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.private-sector__title {
  margin: 0;
  font-size: var(--fs-20, 20px);
  line-height: 1.35;
  font-weight: var(--fw-bold, 700);
  color: var(--private-sector-ink);
}

.private-sector__sub {
  margin: 0;
  font-size: var(--fs-14, 14px);
  line-height: 1.6;
  color: var(--private-sector-ink);
}

.private-sector__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* ---------- segmented controls ---------- */
.private-sector__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
}

.private-sector__seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  background: var(--private-sector-seg-bg);
  border-radius: 999px;
}

.private-sector__seg[hidden] {
  display: none;
}

/* 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. */
.private-sector__seg-btn,
.private-sector__seg-btn:hover,
.private-sector__seg-btn:focus {
  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;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--private-sector-ink);
}

.private-sector__seg-btn[aria-checked="false"]:hover {
  background: var(--clr-white, #fff);
}

.private-sector__seg-btn.is-active {
  background: var(--private-sector-blue);
  color: var(--clr-white, #fff);
}

.private-sector__seg-btn:focus-visible,
.private-sector__row:focus-visible {
  outline: 3px solid var(--clr-yellow-orange, #f8b323);
  outline-offset: 2px;
}

/* ---------- detail line ---------- */
.private-sector__detail {
  margin: 0;
  min-height: 1.6em;
  font-size: var(--fs-14, 14px);
  line-height: 1.6;
  color: var(--private-sector-ink);
}

/* ---------- bars ---------- */
.private-sector__chart {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.private-sector__head {
  display: grid;
  grid-template-columns: var(--private-sector-cols);
  gap: 12px;
  padding: 0 6px 4px;
  font-size: var(--fs-12, 12px);
  font-weight: var(--fw-bold, 700);
  color: var(--private-sector-caption);
}

.private-sector__val-head {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.private-sector__rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.private-sector__row {
  display: grid;
  grid-template-columns: var(--private-sector-cols);
  gap: 12px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: default;
}

.private-sector__row.is-hover {
  background: var(--private-sector-hover);
}

.private-sector__row-label {
  font-size: var(--fs-14, 14px);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.private-sector__track {
  position: relative;
  height: 16px;
  background: var(--private-sector-track);
  border-radius: 2px;
}

.private-sector__ref {
  position: absolute;
  top: -4px;
  bottom: -4px;
  border-left: 1px dashed var(--private-sector-ink);
}

.private-sector__bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  transition: width 0.25s ease;
}

.private-sector__row-val {
  font-size: var(--fs-14, 14px);
  font-weight: var(--fw-bold, 700);
  text-align: right;
}

.private-sector__refs-notes:empty {
  display: none;
}

.private-sector__ref-note {
  margin: 0;
  font-size: var(--fs-12, 12px);
  color: var(--private-sector-caption);
}

.private-sector__source {
  margin: 0;
  font-size: var(--fs-12, 12px);
  line-height: 1.6;
  color: var(--private-sector-caption);
}

.private-sector__source[hidden] {
  display: none;
}

@media (max-width: 600px) {
  .private-sector__seg {
    flex-wrap: nowrap;
    max-width: 100%;
  }

  .private-sector__seg-btn {
    padding: 0 10px;
    font-size: var(--fs-12, 12px);
  }
}

@media (max-width: 559px) {
  .private-sector {
    --private-sector-cols: minmax(72px, 112px) minmax(0, 1fr) 40px;
  }

  .private-sector__card {
    padding: 20px 16px;
  }

  .private-sector__row,
  .private-sector__head {
    gap: 8px;
    padding-left: 4px;
    padding-right: 4px;
  }

  .private-sector__row-label {
    font-size: var(--fs-13, 13px);
  }

  .private-sector__row-val {
    font-size: var(--fs-13, 13px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .private-sector__bar {
    transition: none;
  }
}
