/* §4 "Clinic-inspired results. Without the clinic price." — Figma 1186:4746 / 1405:4832.
   The chart is real layout, not an image, so the numbers stay selectable and translatable. */

.cp-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.cp-copy {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.cp-intro,
.cp-detail {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.cp-lede {
  font-size: var(--rd-fs-lede);
  line-height: var(--rd-lh-lede);
}
.cp-footnote {
  font-size: 12px;
  line-height: 1.45;
}

.cp-chart {
  margin: 0;
  padding: 26px;
  border: 1px solid var(--rd-hairline);
  border-radius: var(--rd-radius-card);
  background: var(--rd-surface);
}
.cp-chart__plot {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
  height: 430px;
  padding-top: 10px;
}
.cp-axis {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--base-font-family), system-ui, sans-serif;
  font-size: var(--rd-fs-note);
  color: var(--rd-body);
  text-align: right;
  /* nudge so each label sits on its gridline rather than below it */
  transform: translateY(-0.5em);
}

.cp-bars {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8%;
  align-items: end;
  padding-inline: 6%;
  border-bottom: 1px solid var(--rd-ink-2);
  /* horizontal gridlines every $50 = 1/8 of the plot */
  background-image: repeating-linear-gradient(
    to top,
    transparent 0 calc(12.5% - 1px),
    #dcdcdc calc(12.5% - 1px) 12.5%
  );
}
.cp-bar {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.cp-bar__fill {
  border-radius: 2px 2px 0 0;
}
.cp-bar--clinic .cp-bar__fill {
  height: 100%;
  padding-top: 18px;
  background: var(--rd-ink);
  text-align: center;
}
.cp-bar__value {
  margin: 0;
  font-family: var(--base-font-family), system-ui, sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1.1;
  color: #fff;
}
.cp-bar__unit {
  margin: 2px 0 0;
  font-size: 14px;
  color: rgb(255 255 255 / 0.82);
}

/* Qure column: a dashed "headroom" box showing the money not spent, with the
   $20 bar at the bottom. */
.cp-bar--qure {
  justify-content: flex-end;
}
.cp-bar__saving {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed #b9b9b9;
  border-bottom: 0;
  text-align: center;
}
.cp-saving__label {
  margin: 0;
  font-size: var(--rd-fs-label);
  color: var(--rd-body);
}
.cp-saving__value {
  margin: 0;
  font-family: var(--base-font-family), system-ui, sans-serif;
  font-weight: 600;
  font-size: 21px;
  color: var(--rd-ink);
}
.cp-saving__unit {
  margin: 0;
  font-size: 14px;
  color: var(--rd-body);
}
.cp-saving__product {
  position: absolute;
  right: 2px;
  bottom: -6px;
  width: auto;
  height: 104px;
}
.cp-bar--qure .cp-bar__fill {
  height: 12.5%; /* $50 gridline ≈ the $20 chip row */
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--rd-mint);
}
.cp-bar__chip {
  margin: 0;
  font-family: var(--base-font-family), system-ui, sans-serif;
  font-size: 15px;
  color: var(--rd-ink);
}
.cp-bar__chip strong {
  font-size: 19px;
  font-weight: 600;
}

.cp-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8%;
  padding: 14px 6% 0;
  text-align: center;
}
.cp-legend__title {
  margin: 0;
  font-family: var(--base-font-family), system-ui, sans-serif;
  font-weight: 600;
  font-size: var(--rd-fs-label);
  color: var(--rd-ink);
}
.cp-legend__sub,
.cp-legend__total {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--rd-body);
}
.cp-legend__total {
  font-weight: 600;
}

@media (max-width: 1023px) {
  /* Osh's 360 frame runs heading -> lede -> CHART -> tick list -> footnote. On desktop
     the copy is one column beside the chart. `display: contents` lets .cp-copy's two
     halves join the grid directly on mobile so the chart can sit between them without
     duplicating any markup. */
  .cp-grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }
  .cp-copy {
    display: contents;
  }
  .cp-intro {
    order: 1;
  }
  .cp-chart {
    order: 2;
    padding: 14px 10px;
  }
  .cp-detail {
    order: 3;
    gap: 18px;
  }
  .cp-chart__plot {
    height: 300px;
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .cp-bar__value {
    font-size: 20px;
  }
  .cp-bar__unit,
  .cp-saving__label,
  .cp-saving__unit {
    font-size: 13px;
  }
  .cp-saving__value {
    font-size: 18px;
  }
  .cp-bar__chip {
    font-size: 13px;
  }
  .cp-bar__chip strong {
    font-size: 16px;
  }
  .cp-saving__product {
    height: 62px;
  }
  .cp-legend {
    padding-top: 10px;
  }
  .cp-legend__title {
    font-size: 13px;
  }
  .cp-legend__sub,
  .cp-legend__total {
    font-size: 12px;
  }
  .cp-axis {
    font-size: 12px;
  }
  .cp-footnote {
    text-align: center;
  }
}
