/* ==========================================================================
   IRETI campaign progress meter
   One track, three facts: what has been raised, what is already in the field,
   and what the next gift would buy. Replaces the Goal/Raised/Spent triple bar.

   Contrast: fill (#a97a08) against track (#e9edf4) measures 3.1:1, meeting
   WCAG 2.1 SC 1.4.11 for non-text contrast. Do not lighten the fill.
   ========================================================================== */

.ip-meter {
  --ip-gold: #a97a08;
  --ip-gold-lift: #d9a520;
  --ip-deployed: #6f4f05;
  --ip-track: #e9edf4;
  --ip-tick: #c3cddd;
  --ip-ink: #14203a;
  --ip-soft: #5a6478;
  --ip-rule: #dfe5ee;

  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: Karla, ui-sans-serif, system-ui, sans-serif;
  container-type: inline-size;
}

/* ---------- headline figures ---------- */
.ip-figures {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.ip-raised {
  margin: 0;
  font-family: "Bricolage Grotesque", Karla, sans-serif;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--ip-ink);
  font-variant-numeric: tabular-nums;
}
.ip-raised span {
  font-family: Karla, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ip-soft);
}
.ip-goal {
  margin: 0;
  font-size: 14px;
  color: var(--ip-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- the track ---------- */
.ip-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--ip-track);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgb(20 32 58 / 0.10);
}
.ip-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--pct, 0%);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--ip-gold-lift) 0%, var(--ip-gold) 42%, var(--ip-gold) 100%);
  transform-origin: left center;
}
/* the portion of what was raised that has already gone out to the field */
.ip-deployed {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--dpct, 0%);
  border-radius: 999px 0 0 999px;
  background: var(--ip-deployed);
  border-right: 1px solid rgb(255 255 255 / 0.55);
}
.ip-track:has(.ip-fill[style*="100%"]) .ip-deployed { border-radius: 999px; }

/* quarter waypoints — passed ones sit on the fill, unpassed on the track */
.ip-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--at);
  width: 1px;
  background: var(--ip-tick);
  z-index: 2;
}
.ip-tick[data-passed] { background: rgb(255 255 255 / 0.42); }

/* ---------- footer line ---------- */
.ip-foot {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  font-size: 13.5px;
  color: var(--ip-soft);
  font-variant-numeric: tabular-nums;
}
.ip-foot b { color: var(--ip-ink); font-weight: 700; }
.ip-pct {
  font-weight: 700;
  color: var(--ip-ink);
  background: #f2ecdc;
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 12.5px;
}
.ip-sep {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--ip-tick);
  flex: none;
}

/* ---------- deployed legend ---------- */
.ip-legend {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--ip-soft);
  font-variant-numeric: tabular-nums;
}
.ip-legend i {
  width: 10px; height: 10px; border-radius: 2px;
  background: var(--ip-deployed);
  flex: none;
}

/* ---------- defensive resets ------------------------------------------
   The six legacy stylesheets style bare <b> inside .fund-bars and
   .campaign-large — notably `.fund-bars b{position:absolute;left:16px;top:8px}`,
   which drags the meter's own <b> out of flow and stacks it on the figure.
   progress.css loads last, and these selectors outrank the legacy ones.
   They can be deleted once the stylesheets are consolidated.
   --------------------------------------------------------------------- */
.ip-meter .ip-figures b,
.ip-meter .ip-foot b,
.ip-meter .ip-first b,
.ip-meter .ip-legend b {
  position: static;
  left: auto;
  top: auto;
  margin: 0;
  font-size: inherit;
  color: inherit;
  font-weight: 700;
}
.ip-meter .ip-figures span,
.ip-meter .ip-foot span,
.ip-meter .ip-first span { position: static; }
.ip-meter .ip-track i { margin: 0; }

/* art.css draws a gold dot via `.campaign-large b::before` to decorate the old
   "FUNDRAISING PROGRESS" label. That label is gone; the dot must go with it. */
.ip-meter .ip-figures b::before,
.ip-meter .ip-foot b::before,
.ip-meter .ip-first b::before,
.ip-meter .ip-legend b::before { content: none; }

/* Hold two lines whether or not the first-gift copy wraps, so cards in a row
   keep their actions on a shared baseline. */
.ip-meter[data-state="empty"] .ip-first { min-height: 2.9em; }

/* ---------- states ---------- */
.ip-meter[data-state="empty"] .ip-track { background: repeating-linear-gradient(105deg, #edf1f7 0 9px, #e4eaf3 9px 18px); }
.ip-meter--feature[data-state="empty"] .ip-track {
  background: repeating-linear-gradient(105deg, rgb(255 255 255 / 0.10) 0 10px, rgb(255 255 255 / 0.19) 10px 20px);
}
.ip-meter[data-state="empty"] .ip-raised { color: var(--ip-ink); }
.ip-meter[data-state="empty"] .ip-first {
  margin: 0;
  font-size: 13.5px;
  color: var(--ip-soft);
}
.ip-meter[data-state="empty"] .ip-first b { color: var(--ip-ink); font-weight: 700; }

.ip-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #14562f;
  background: #dcf0e5;
  padding: 3px 8px;
  border-radius: 3px;
}
.ip-meter[data-state="funded"] .ip-fill { background: linear-gradient(180deg, #2f8f5b 0%, #1b6b41 45%); }
.ip-meter[data-state="funded"] .ip-deployed { background: #13502f; }
.ip-meter[data-state="funded"] .ip-pct { background: #dcf0e5; color: #14562f; }
.ip-meter[data-state="funded"] .ip-legend i { background: #13502f; }

/* ---------- feature variant: the homepage fund meter, on navy ---------- */
.ip-meter--feature {
  --ip-gold: #e8b73c;
  --ip-gold-lift: #f7d572;
  --ip-deployed: #a97a08;
  --ip-track: rgb(255 255 255 / 0.16);
  --ip-tick: rgb(255 255 255 / 0.3);
  --ip-ink: #fff;
  --ip-soft: rgb(255 255 255 / 0.76);
  gap: 13px;
}
.ip-meter--feature .ip-track { height: 18px; box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.28); }
.ip-meter--feature .ip-raised { font-size: clamp(32px, 4vw, 46px); }
.ip-meter--feature .ip-raised span { font-size: 17px; }
.ip-meter--feature .ip-goal { font-size: 16px; }
.ip-meter--feature .ip-foot { font-size: 15px; }
.ip-meter--feature .ip-pct { background: rgb(255 255 255 / 0.15); color: #fff; }
.ip-meter--feature .ip-legend { font-size: 13.5px; }
.ip-meter--feature .ip-deployed { border-right-color: rgb(11 46 110 / 0.5); }
.ip-meter--feature .ip-badge { color: #d6f5e3; background: rgb(255 255 255 / 0.14); }

/* ---------- compact variant: small campaign cards ---------- */
.ip-meter--compact { gap: 7px; }
.ip-meter--compact .ip-raised { font-size: 20px; }
.ip-meter--compact .ip-raised span { font-size: 13px; }
.ip-meter--compact .ip-goal { font-size: 13px; }
.ip-meter--compact .ip-track { height: 9px; }
.ip-meter--compact .ip-foot { font-size: 12.5px; gap: 3px 7px; }
.ip-meter--compact .ip-legend { display: none; }

@container (max-width: 300px) {
  .ip-foot .ip-sep:last-of-type,
  .ip-foot > span:last-child { display: none; }
}

/* ---------- motion: enhancement only, never required to read the value ---------- */
.ip-track .ip-fill,
.ip-track .ip-deployed { transition: width 1.1s cubic-bezier(0.22, 0.85, 0.25, 1); }

@media (prefers-reduced-motion: reduce) {
  .ip-track .ip-fill,
  .ip-track .ip-deployed { transition: none; }
}
