/**
 * APCC cohort directory — approved design ("Explore African population cohorts",
 * apcc-conference-companion-preview.pages.dev/cohorts). Component rules are the
 * design's page stylesheet, scoped under .apcc-cd so theme styles cannot leak in.
 */

/* Base (from the design's layout stylesheet) */
.apcc-cd { --apcc-cd-primary:var(--apcc-green-600); --apcc-cd-dark:var(--apcc-green-900); color:var(--apcc-ink); font-size:16px; line-height:1.65; }
.apcc-cd *, .apcc-cd *::before, .apcc-cd *::after { box-sizing:border-box; }
.apcc-cd a { color:inherit; }
.apcc-cd .cohort-container { width:100%; max-width:var(--site-wrapper-width,1400px); margin-inline:auto; padding-inline:var(--site-wrapper-gutter,2rem); }
.apcc-cd h1, .apcc-cd h2, .apcc-cd h3 { color:inherit; letter-spacing:-0.035em; overflow-wrap:break-word; margin:0; line-height:1.12; font-weight:400; text-transform:none; }
.apcc-cd h1 { max-width:820px; font-size:clamp(44px, 5.4vw, 72px); }
.apcc-cd h2, .apcc-cd h3 { color:var(--apcc-cd-dark); }
.apcc-cd h3 { font-size:24px; }
.apcc-cd h1::after, .apcc-cd h2::after, .apcc-cd h3::after { content:none; display:none; }
.apcc-cd .cohort-eyebrow { color:var(--apcc-cd-primary); letter-spacing:0.12em; text-transform:uppercase; margin:0 0 8px; font-size:12px; font-weight:900; line-height:1.4; }
.apcc-cd :focus-visible { outline:3px solid var(--apcc-gold-bright); outline-offset:2px; }
.apcc-cd button { font-family:inherit; text-transform:none; letter-spacing:normal; box-shadow:none; }
.apcc-cd select { appearance:auto; -webkit-appearance:auto; height:auto; margin:0; box-shadow:none; }
.apcc-cd form { margin:0; }
.apcc-cd [hidden] { display:none !important; }

/* Design component rules */
.apcc-cd.cohort-discovery {
  min-width: 0;
}
.apcc-cd .sr-only {
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  position: absolute;
  overflow: hidden;
}
/* Header: the site-wide light page header (theme .page-header, network map layer) */
.apcc-cd .cohort-discovery-hero {
  position: relative;
}
.apcc-cd .cohort-discovery-hero-content > p {
  margin: 12px 0 0;
}
.apcc-cd .cohort-discovery-search {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  margin-top: 28px;
  padding: 6px 6px 6px 18px;
  color: var(--apcc-green-900);
  background: var(--apcc-white);
  border: 1px solid var(--apcc-mint-300);
  border-radius: 12px;
}
.apcc-cd .cohort-discovery-search svg {
  color: var(--apcc-green-600);
  flex: none;
}
.apcc-cd .cohort-discovery-search input {
  color: var(--apcc-green-900);
  min-width: 0;
  font: inherit;
  background: 0 0;
  border: 0;
  outline: 0;
  flex: auto;
}
.apcc-cd .cohort-discovery-search input::placeholder {
  color: var(--apcc-muted);
  opacity: 1;
}
.apcc-cd .cohort-discovery-search-clear {
  color: var(--apcc-green-900);
  cursor: pointer;
  background: var(--apcc-mint-100);
  border: 0;
  border-radius: 9px;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  display: grid;
}
.apcc-cd .cohort-discovery-search:focus-within {
  border-color: var(--apcc-green-600);
  box-shadow: 0 0 0 3px var(--apcc-mint-100);
}
.apcc-cd .cohort-discovery-body {
  min-width: 0;
  padding-block: 24px 88px;
}
.apcc-cd .cohort-discovery-clear {
  color: var(--apcc-green-700);
  min-height: 40px;
  font: inherit;
  text-underline-offset: 3px;
  cursor: pointer;
  background: 0 0;
  border: 0;
  padding: 5px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
}
.apcc-cd .cohort-discovery-results {
  min-width: 0;
}
.apcc-cd .cohort-discovery-chips {
  flex-wrap: wrap;
  gap: 8px;
  margin: -6px 0 22px;
  display: flex;
}
.apcc-cd .cohort-discovery-chips button:not(.cohort-discovery-clear) {
  color: var(--apcc-green-900);
  max-width: 100%;
  min-height: 40px;
  font: inherit;
  cursor: pointer;
  background: var(--apcc-mint-100);
  border: 1px solid var(--apcc-mint-300);
  border-radius: 999px;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
}
.apcc-cd .cohort-discovery-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
  display: grid;
}
/* Cohort cards (approved directory design) */
.apcc-cd .cohort-discovery-card {
  background: var(--apcc-white);
  border: 1px solid var(--apcc-mint-200);
  border-radius: 15px;
  flex-direction: column;
  min-width: 0;
  padding: 22px;
  display: flex;
  box-shadow: none;
}
.apcc-cd .cohort-discovery-card-flags {
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin-bottom: 15px;
  display: flex;
}
.apcc-cd .cohort-discovery-card-flags span,
.apcc-cd .cohort-discovery-domain-list span {
  overflow-wrap: break-word;
  border-radius: 999px;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  display: inline-flex;
}
.apcc-cd .cohort-discovery-card-flags span {
  color: var(--apcc-green-900);
  background: var(--apcc-mint-100);
}
.apcc-cd .cohort-discovery-card-flags span + span {
  color: var(--apcc-ochre);
  background: var(--apcc-ochre-soft);
}
.apcc-cd .cohort-discovery-card h3 {
  letter-spacing: -0.02em;
  font-size: 21px;
  line-height: 1.25;
}
.apcc-cd .cohort-discovery-card h3 a {
  display: inline-block;
  padding-block: 2px;
  color: inherit;
  text-decoration: none;
}
.apcc-cd .cohort-discovery-card h3 a:hover { color: var(--apcc-green-700); text-decoration: underline; text-underline-offset: 3px; }
.apcc-cd .cohort-discovery-card-location {
  color: var(--apcc-text);
  flex-wrap: wrap;
  gap: 7px 11px;
  min-width: 0;
  margin-top: 12px;
  font-size: 13px;
  display: flex;
}
.apcc-cd .cohort-discovery-card-location span {
  overflow-wrap: break-word;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
  display: inline-flex;
}
.apcc-cd .cohort-discovery-card-location svg {
  color: var(--apcc-green-600);
  flex: none;
  margin-top: 2px;
}
.apcc-cd .cohort-discovery-card > p {
  -webkit-line-clamp: 3;
  color: var(--apcc-text);
  -webkit-box-orient: vertical;
  margin: 15px 0 0;
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  overflow: hidden;
}
.apcc-cd .cohort-discovery-card dl {
  border-top: 1px solid var(--apcc-mint-200);
  gap: 8px;
  margin: 17px 0 0;
  padding-top: 15px;
  display: grid;
}
.apcc-cd .cohort-discovery-card dl div {
  grid-template-columns: minmax(80px, 0.8fr) minmax(0, 1.2fr);
  gap: 9px;
  min-width: 0;
  display: grid;
}
.apcc-cd .cohort-discovery-card dt,
.apcc-cd .cohort-discovery-card dd {
  overflow-wrap: break-word;
  min-width: 0;
  margin: 0;
  font-size: 13px;
}
.apcc-cd .cohort-discovery-card dt {
  color: var(--apcc-muted);
  gap: 5px;
  font-weight: 750;
  display: flex;
}
.apcc-cd .cohort-discovery-card dd {
  color: var(--apcc-green-900);
  font-weight: 760;
}
.apcc-cd .cohort-discovery-domain-list {
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
  display: flex;
}
.apcc-cd .cohort-discovery-domain-list span {
  color: var(--apcc-green-700);
  background: var(--apcc-mint-100);
  border: 1px solid var(--apcc-mint-200);
}
.apcc-cd .cohort-discovery-card-link {
  align-items: center;
  gap: 7px;
  width: fit-content;
  min-height: 44px;
  margin-top: auto;
  padding-top: 17px;
  font-size: 14px;
  font-weight: 850;
  text-decoration: none;
  display: inline-flex;
  color: var(--apcc-green-700);
}
.apcc-cd .cohort-discovery-card-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.apcc-cd .cohort-discovery-card-link svg {
  transition: transform 0.18s;
}
.apcc-cd .cohort-discovery-card-link:hover svg {
  transform: translate(3px);
}
.apcc-cd .cohort-discovery-message {
  text-align: center;
  background: var(--apcc-white);
  border: 1px dashed var(--apcc-mint-300);
  border-radius: 15px;
  padding: 42px 24px;
}
.apcc-cd .cohort-discovery-message h3 {
  font-size: 23px;
}
.apcc-cd .cohort-discovery-message p {
  color: var(--apcc-muted);
  margin: 8px 0 0;
}
.apcc-cd .cohort-discovery-message button,
.apcc-cd .cohort-discovery-load-more button {
  color: var(--apcc-white);
  min-height: 46px;
  font: inherit;
  cursor: pointer;
  background: var(--apcc-green-700);
  border: 0;
  border-radius: 9px;
  margin-top: 18px;
  padding: 10px 17px;
  font-weight: 820;
}
.apcc-cd .cohort-discovery-load-more {
  justify-items: center;
  margin-top: 30px;
  display: grid;
}
.apcc-cd .cohort-discovery-load-more span {
  color: var(--apcc-muted);
  margin-top: 8px;
  font-size: 13px;
}
@media (max-width: 1190px) {
.apcc-cd .cohort-discovery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 580px) {
.apcc-cd .cohort-discovery-search {
    min-height: 54px;
    padding-left: 13px;
  }
.apcc-cd .cohort-discovery-search input {
    font-size: 14px;
  }
.apcc-cd .cohort-discovery-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 350px) {
.apcc-cd .cohort-discovery-search {
    margin-top: 20px;
  }
.apcc-cd .cohort-discovery-search input::placeholder {
    color: #0000;
  }

}

/* WordPress additions: link-based chips/buttons for the no-JS fallback, apply button */
.apcc-cd .cohort-discovery-chip { color:var(--apcc-green-900); max-width:100%; min-height:40px; font:inherit; cursor:pointer; background:var(--apcc-mint-100); border:1px solid var(--apcc-mint-300); border-radius:999px; align-items:center; gap:7px; padding:7px 11px; font-size:13px; font-weight:750; display:inline-flex; text-decoration:none; line-height:1.3; }
.apcc-cd a.cohort-discovery-clear { display:inline-flex; align-items:center; }
.apcc-cd .cohort-discovery-button, .apcc-cd .cohort-discovery-apply { display:inline-flex; align-items:center; color:var(--apcc-white); min-height:46px; font:inherit; cursor:pointer; background:var(--apcc-green-700); border:0; border-radius:9px; margin-top:18px; padding:10px 17px; font-weight:820; text-decoration:none; }
.apcc-cd .cohort-discovery-apply { margin-top:0; justify-content:center; }

.apcc-cd .cohort-discovery-search input[type="search"] { border:0; border-radius:0; padding:0; margin:0; height:auto; min-height:44px; box-shadow:none; background:transparent; font-size:16px; line-height:1.4; width:auto; max-width:none; }
.apcc-cd .cohort-discovery-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; }
@media (max-width: 580px) { .apcc-cd .cohort-discovery-search input[type="search"] { font-size:14px; } }

/* Theme compatibility: the APCC theme header is position:fixed, and theme
   heading rules add margins/padding/centering. Offset the hero by the header
   height (set by the JS as --apcc-cd-header; 87px fallback) and reset headings. */
html body .apcc-cd.cohort-discovery h1,
html body .apcc-cd.cohort-discovery h2,
html body .apcc-cd.cohort-discovery h3 { margin:0; padding:0; text-align:left; border:0; background:none; }
html body .apcc-cd.cohort-discovery .cohort-discovery-message h3 { text-align:center; }
html body .apcc-cd.cohort-discovery .cohort-discovery-hero-content > p { margin-bottom:0; }
html body .apcc-cd.cohort-discovery .cohort-discovery-card h3 { font-size:var(--ax-fs-h3, 19px); line-height:1.35; font-weight:700; letter-spacing:0; color:var(--apcc-green-900); }
html body .apcc-cd.cohort-discovery .cohort-discovery-message h3 { font-size:23px; }

/* Display face on the directory headings (site-wide type) */
html body .apcc-cd.cohort-discovery :is(h1, h2, h3) { font-family: var(--apcc-font-display); }


/* ---------- Filters: a collapsible bar above the results, custom dropdowns ---------- */
.apcc-cd .cohort-discovery-filter-toggle {
  display: inline-flex; align-items: center; gap: 8px; flex: none; position: relative;
  min-width: 46px; min-height: 46px; margin-left: 4px; padding: 0 12px; justify-content: center;
  font: inherit; font-weight: 700; color: var(--apcc-green-900);
  background: transparent; border: 0; border-radius: 8px; cursor: pointer;
  transition: background-color .15s;
}
.apcc-cd .cohort-discovery-filter-toggle::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 1px; background: var(--apcc-mint-200); }
.apcc-cd .cohort-discovery-filter-toggle:hover { background: var(--apcc-mint-50); }
.apcc-cd .cohort-discovery-filter-toggle[aria-expanded="true"] { background: var(--apcc-mint-100); }
.apcc-cd .cohort-discovery-filter-toggle[aria-expanded="true"]::before { display: none; }
.apcc-cd .cohort-discovery-filter-toggle svg { flex: none; color: var(--apcc-green-700); }

/* result count and active filters, directly under the search */
.apcc-cd .cohort-discovery-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 16px; }
.apcc-cd .cohort-discovery-status > p { order: 2; margin: 0 0 0 auto; font-size: .875rem; font-weight: 400; color: var(--apcc-muted); }
.apcc-cd .cohort-discovery-status .cohort-discovery-chips { margin: 0; }
@media (max-width: 580px) { .apcc-cd .cohort-discovery-status { justify-content: center; text-align: center; } .apcc-cd .cohort-discovery-status > p { margin: 0 auto; } }

.apcc-cd .cohort-discovery-filter-count:empty { display: none; }
.apcc-cd .cohort-discovery-filter-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--apcc-green-700); color: var(--apcc-white);
  font-size: .875rem; font-weight: 700; line-height: 1;
}

.apcc-cd .cohort-discovery-filters {
  margin-top: 12px; padding: 20px;
  background: var(--apcc-white); border: 1px solid var(--apcc-mint-200); border-radius: 14px;
}
.apcc-cd.has-dropdowns .cohort-discovery-filters:not(.is-open) { display: none; }
.apcc-cd .cohort-discovery-filter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .apcc-cd .cohort-discovery-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .apcc-cd .cohort-discovery-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 580px) { .apcc-cd .cohort-discovery-filter-grid { grid-template-columns: minmax(0, 1fr); } }

/* no-JS: native selects */
.apcc-cd .cohort-discovery-filters label { display: grid; gap: 6px; min-width: 0; }
.apcc-cd .cohort-discovery-filters label > span { font-size: .875rem; font-weight: 700; color: var(--apcc-green-900); }
.apcc-cd .cohort-discovery-filters select {
  width: 100%; min-width: 0; min-height: 46px; padding: 9px 32px 9px 11px; font: inherit; font-size: 1rem;
  color: var(--apcc-green-900); background: var(--apcc-white); border: 1px solid var(--apcc-mint-300); border-radius: 8px;
}
.apcc-cd.has-dropdowns .cohort-discovery-filters label { display: none; }

/* dropdowns */
.apcc-cd .cd-dd { position: relative; display: grid; gap: 6px; min-width: 0; }
.apcc-cd .cd-dd__label { font-size: .875rem; font-weight: 700; color: var(--apcc-green-900); }
.apcc-cd .cd-dd__btn {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 46px; padding: 0 12px 0 14px; margin: 0;
  font: inherit; font-size: 1rem; text-align: left; color: var(--apcc-ink);
  background: var(--apcc-white); border: 1px solid var(--apcc-mint-300); border-radius: 8px;
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.apcc-cd .cd-dd__btn:hover { border-color: var(--apcc-green-600); }
.apcc-cd .cd-dd__value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apcc-cd .cd-dd__btn svg { flex: none; color: var(--apcc-green-700); transition: transform .2s var(--apcc-ease, ease); }
.apcc-cd .cd-dd.has-value .cd-dd__btn { border-color: var(--apcc-green-700); background: var(--apcc-mint-50); }
.apcc-cd .cd-dd.has-value .cd-dd__value { font-weight: 700; color: var(--apcc-green-900); }
.apcc-cd .cd-dd.is-open .cd-dd__btn { border-color: var(--apcc-green-600); }
.apcc-cd .cd-dd.is-open .cd-dd__btn svg { transform: rotate(180deg); }
.apcc-cd .cd-dd__list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 100%; width: max-content; max-width: min(340px, calc(100vw - 32px)); max-height: 300px;
  margin: 0; padding: 4px; list-style: none; overflow-y: auto; overscroll-behavior: contain;
  background: var(--apcc-white); border: 1px solid var(--apcc-mint-200); border-radius: 8px;
  box-shadow: 0 14px 34px -18px rgba(11, 58, 32, .35);
}
.apcc-cd .cd-dd--end .cd-dd__list { left: auto; right: 0; }
.apcc-cd .cd-dd__list[hidden] { display: none; }
.apcc-cd .cd-dd__list li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 10px 12px; margin: 0; border-radius: 8px;
  font-size: 1rem; line-height: 1.35; color: var(--apcc-ink); cursor: pointer;
}
.apcc-cd .cd-dd__list li svg { flex: none; color: var(--apcc-green-600); visibility: hidden; }
.apcc-cd .cd-dd__list li:hover, .apcc-cd .cd-dd__list li:focus { background: var(--apcc-mint-50); outline: none; }
.apcc-cd .cd-dd__list li:focus-visible { box-shadow: inset 0 0 0 2px var(--apcc-green-600); }
.apcc-cd .cd-dd__list li[aria-selected="true"] { background: var(--apcc-mint-100); color: var(--apcc-green-900); font-weight: 700; }
.apcc-cd .cd-dd__list li[aria-selected="true"] svg { visibility: visible; }
/* phones: the Filters button first and full width, the panel under it, then the title row;
   dropdown lists open inline */
@media (max-width: 820px) {
  .apcc-cd .cd-dd__list, .apcc-cd .cd-dd--end .cd-dd__list {
    position: static; width: auto; min-width: 0; max-width: none; max-height: 264px; box-shadow: none;
  }
}

/* phones: close the panel and jump to the results */
.apcc-cd .cohort-discovery-filter-footer { display: none; }
@media (max-width: 820px) {
  .apcc-cd .cohort-discovery-filters { padding: 18px 16px; }
  .apcc-cd .cohort-discovery-search { padding-left: 14px; }
  .apcc-cd .cohort-discovery-filter-footer { display: flex; margin-top: 18px; }
  .apcc-cd .cohort-discovery-show {
    flex: 1; min-height: 48px; padding: 0 18px; border: 0; border-radius: 8px;
    font: inherit; font-weight: 700; color: var(--apcc-white); background: var(--apcc-green-700); cursor: pointer;
    transition: background-color .15s;
  }
  .apcc-cd .cohort-discovery-show:hover { background: var(--apcc-green-900); }
}
.apcc-cd .cohort-discovery-status { scroll-margin-top: calc(var(--apcc-header-h, 54px) + 16px); }
@media (prefers-reduced-motion: reduce) {
  .apcc-cd .cd-dd__btn svg, .apcc-cd .cohort-discovery-card-link svg { transition: none; }
}
