/* country-listing - "Partner countries" page (/countries), ported from
   gff-country-listing-4.html. Header (title, count, FCV note, search), live
   country card grid and the "Countries to be launched" panel.

   Colors checked against base/color/color.css first: #4D4D4D -> exact
   match --clr-gray-dark, #FFFFFF -> --clr-white, #DBDBDB -> exact match
   --clr-gray-light, #F3F5F7 (diff 1) -> --clr-neutral-100, #B3B3B3 (diff
   12) -> --clr-neutral-440, #305588 (diff 20) -> --clr-blue (same reuse as
   the mnch/mortality widget), #EEB648 (diff 14) -> --clr-yellow-500.
   Only the hover shadow tint and the radii specific to this design are
   minted locally below. The pale-teal header leaf (#E3EEEE) lives in
   img/header-pattern.svg. */

/* ---------- page shell (/countries only) ----------
   Replaces the spacing set by components/inner-pages/country/css/
   country-listing.css; body-qualified so it wins regardless of load order. */
body.path-countries {
  background-color: var(--clr-neutral-200);
}

body.path-countries .page-header {
  display: none;
}

body.path-countries .main-container {
  padding-left: clamp(12px, 2vw, 30px);
  padding-right: clamp(12px, 2vw, 30px);
}

body.path-countries .page-content-area {
  max-width: 1380px;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

/* ---------- component ---------- */
.country-listing {
  --cl-text: var(--clr-gray-dark);
  --cl-link: var(--clr-blue);
  --cl-surface: var(--clr-white);
  --cl-muted-surface: var(--clr-neutral-100);
  --cl-border: var(--clr-gray-light);
  --cl-dashed: var(--clr-neutral-440);
  --cl-accent: var(--clr-yellow-500);
  --cl-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  --cl-shadow-hover: 0 8px 20px rgba(30, 50, 80, 0.14);
  --cl-card-radius: 0 var(--radius-xs) 0 var(--radius-xs);
  --cl-media-radius: 0 14px 0 14px;
  --cl-panel-radius: 28px;
  --cl-inner-x: clamp(14px, 4.9vw, 70px);
  --cl-gap: 16px;
  --cl-card-min: 290px;

  max-width: 1380px;
  margin: 0 auto;
  font-family: var(--primary-ff);
  /* explicit base - the site body sets 14px / 20px, which the design
     (and the stories page) don't use */
  font-size: var(--fs-16);
  line-height: normal;
  color: var(--cl-text);
}

.country-listing a:focus-visible,
.country-listing input:focus-visible {
  outline: 3px solid var(--cl-accent);
  outline-offset: 2px;
}

.country-listing__section {
  padding-top: var(--sp8);
}

/* ---------- header ---------- */
.country-listing__header {
  position: relative;
  border-radius: var(--cl-panel-radius);
  overflow: hidden;
}

.country-listing__header-pattern {
  position: absolute;
  right: 0;
  bottom: -60px;
  width: 214px;
  height: 275px;
  pointer-events: none;
  background: url("/themes/custom/gff/templates/components/country-listing/css/../img/header-pattern.svg") no-repeat right bottom / contain;
  opacity: 0;
}

.country-listing__header-inner {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  padding: clamp(16px, 2vw, 24px) var(--cl-inner-x);
}

.country-listing__intro {
  flex: 1 1 360px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
}

.country-listing__title {
  margin: 0;
  font-size: clamp(32px, 3.2vw, 42px);
  line-height: 1.2;
  font-weight: var(--fw-bold);
  color: var(--cl-text);
}

/* CMS text (page description) - its own <p>s: the first one is the intro /
   count line ("Explore data for the 34 GFF partner countries."), the rest
   is the smaller FCV note */
.country-listing__note {
  margin: 0;
  font-size: var(--fs-14);
  line-height: 1.6;
  color: var(--cl-text);
}

/* the theme sets p { font-size: 16px } site-wide - keep the CMS text at
   the note's own size */
.country-listing__note p {
  margin: 0;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

.country-listing__note p:first-child:not(:only-child) {
  margin-bottom: var(--sp3);
  font-size: var(--fs-16);
  line-height: 1.75;
}

.country-listing__note p+p {
  margin-top: var(--sp1);
}

/* search */
.country-listing__search {
  flex: 1 1 420px;
  max-width: 620px;
}

.country-listing__search-field {
  position: relative;
  display: flex;
}

.country-listing__search-input {
  width: 100%;
  min-height: 50px;
  margin: 0;
  padding: 0 52px 0 22px;
  font: inherit;
  font-size: var(--fs-16);
  color: var(--cl-text);
  background: var(--cl-surface);
  border: 1px solid var(--cl-border);
  border-radius: 999px;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.country-listing__search-input::placeholder {
  color: var(--clr-gray-600);
  opacity: 1;
}

.country-listing__search-input:focus {
  border-color: var(--cl-link);
  box-shadow: none;
}

.country-listing__search-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.country-listing__search-icon {
  position: absolute;
  top: 50%;
  right: 18px;
  display: flex;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--cl-text);
}

/* ---------- grid ---------- */
.country-listing__body {
  padding: 0 var(--cl-inner-x);
  display: flex;
  flex-direction: column;
  gap: var(--cl-gap);
}

.country-listing__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--cl-card-min)), 1fr));
  gap: var(--cl-gap);
}

.country-listing__item {
  display: flex;
  margin: 0;
}

.country-listing__item[hidden],
.country-listing__empty[hidden] {
  display: none !important;
}

.country-listing__empty {
  margin: 0;
  padding: 24px;
  font-size: var(--fs-16);
  color: var(--cl-text);
  background: var(--cl-surface);
  border-radius: 0 var(--radius-sm) 0 var(--radius-sm);
}

/* ---------- card ----------
   Single row, vertically centered: flag, then country name + FCV/Non-FCV
   status stacked, then a static arrow (live) or the "Coming soon" badge
   (upcoming) trailing the row. */
.country-card {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: 74px;
  gap: var(--sp6);
  padding: 12px 16px 12px 12px;
  background-color: var(--cl-surface);
  border: 0;
  border-radius: var(--cl-card-radius);
  box-shadow: var(--cl-shadow);
  text-decoration: none;
  color: var(--cl-text);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

a.country-card:hover,
a.country-card:focus {
  text-decoration: none;
  color: var(--cl-text);
}

a.country-card:hover,
a.country-card:focus-visible {
  box-shadow: var(--cl-shadow-hover);
  transform: translateY(-2px);
}

.country-card__body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.country-card__flag {
  display: block;
  flex: none;
  width: 60px;
  height: 45px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--cl-border);
  background-color: var(--cl-muted-surface);
}

.country-card__flag img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.country-card__title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: var(--fw-bold);
  color: var(--cl-text);
  transition: color 0.2s ease;
}

a.country-card:hover .country-card__title,
a.country-card:focus-visible .country-card__title {
  color: var(--cl-link);
}

.country-card__type {
  font-size: var(--fs-12);
  line-height: 1.4;
  color: var(--clr-gray-600);
}

/* static arrow (orange circle), trailing the row and vertically centered
   with the flag/name - no longer pinned to the body's bottom corner since
   the card is a single centered row rather than a top-aligned column. */
.country-card__arrow {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1f3a60;
  background: var(--clr-yellow-orange);
  border-radius: 999px;
}

/* ---------- upcoming ("Coming soon") card ---------- */
.country-card--upcoming {
  background: var(--cl-muted-surface);
  border: 1px dashed var(--cl-dashed);
  box-shadow: none;
}

.country-card--upcoming .country-card__flag {
  opacity: 0.6;
}

.country-card__badge {
  align-self: flex-start;
  padding: 3px 10px;
  font-size: var(--fs-12);
  line-height: 1.5;
  font-weight: var(--fw-bold);
  color: var(--cl-text);
  background: var(--cl-surface);
  border-radius: 999px;
}

/* ---------- "Countries to be launched" panel ---------- */
.country-listing__upcoming {
  display: flex;
  flex-direction: column;
  gap: var(--sp5_5);
  padding: clamp(24px, 3vw, 40px) var(--cl-inner-x);
  /* background: var(--cl-surface); */
  border-radius: var(--cl-panel-radius);
}

.country-listing__upcoming-title {
  margin: 0;
  font-size: var(--fs-22);
  line-height: 1.3;
  font-weight: var(--fw-bold);
  color: var(--cl-text);
}

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

  .country-card,
  .country-card__title {
    transition: none;
  }

  a.country-card:hover,
  a.country-card:focus-visible {
    transform: none;
  }
}
