.problem {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 85% 0%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(700px 420px at 0% 100%, rgba(0, 0, 0, 0.18), transparent 60%),
    var(--opt-green);
}

.problem__grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(900px 500px at 50% 30%, #000, transparent 80%);
  mask-image: radial-gradient(900px 500px at 50% 30%, #000, transparent 80%);
  pointer-events: none;
}

.problem .container {
  position: relative;
}

.problem__wrap {
  display: flex;
  flex-direction: column;
  gap: 64px;
  max-width: 1152px;
  width: 100%;
  min-width: 0;
}

.problem__body {
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.problem__extra {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.problem__more {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* The intro paragraph starts at the top of the heading, level with its first line, when the two
   sit side by side (about 950px and up). It was aligned to the bottom edge of the heading
   (flex-end), so the paragraph sat beside "leaves you with." Stacked (below that) there is one
   item per row and the alignment makes no difference. */
.problem__head {
  display: flex;
  flex-wrap: wrap;
  /* align-items: flex-end; */
  align-items: flex-start;
  gap: 24px 56px;
}

.problem__head-title {
  flex: 1 1 480px;
  min-width: 0;
}

.problem__title {
  margin-top: 0;
  color: var(--opt-white);
}

.problem__lead {
  flex: 1 1 380px;
  min-width: 0;
  max-width: 480px;
  margin: 0;
  font-size: 20px;
  line-height: 1.5;
  color: #e6f6ec;
}

.problem__cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.problem-card {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  border: 1px solid #e6e9ee;
  border-radius: 24px;
  background-color: var(--opt-white);
  box-shadow: 0 30px 60px -36px rgba(0, 0, 0, 0.35);
}

.problem-card__text {
  max-width: 490px;
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  color: #4b5563;
}

.problem-card__text strong {
  font-weight: 700;
  color: var(--opt-ink);
}

.problem-card__tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--opt-ink);
}

.problem-chart {
  position: relative;
}

.problem-chart__svg {
  display: block;
  width: 100%;
  height: auto;
}

.problem-chart__axis {
  stroke: #e6e9ee;
}

.problem-chart__grid {
  stroke: #e6e9ee;
  stroke-dasharray: 3 5;
}

.problem-chart__label {
  font-size: 11px;
  fill: #7f948a;
}

.problem-chart__area {
  animation: problem-area 6s ease-in-out infinite;
}

.problem-chart__line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 900;
  animation: problem-draw 6s ease-in-out infinite;
}

.problem-chart__guide {
  stroke: #3fd18a;
  stroke-width: 1.5;
  stroke-dasharray: 3 4;
  opacity: 0.7;
}

.problem-chart__point {
  fill: #0c1611;
  stroke: #7fd3a4;
  stroke-width: 2;
}

.problem-chart__point--end {
  fill: #3fd18a;
  stroke: #0c1611;
}

.problem-chart__pulse {
  fill: #3fd18a;
  opacity: 0.35;
  animation: problem-pulse 1.6s infinite;
}

.problem-chart__tip {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  top: 16%;
  left: 33%;
  min-width: 160px;
  padding: 10px 14px;
  border-radius: 12px;
  background-color: var(--opt-white);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  animation: problem-tip 6s ease-in-out infinite;
}

.problem-chart__tip-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--opt-muted-strong);
}

.problem-chart__tip-row strong {
  font-weight: 700;
  color: #111111;
}

.problem-chart__tip-bars {
  display: flex;
  gap: 3px;
}

.problem-chart__tip-bars span {
  width: 4px;
  height: 3px;
  border-radius: 2px;
  background-color: var(--opt-line-green);
}

.problem-chart__tip-bars span:first-child {
  width: 14px;
  background-color: var(--opt-green);
}

.problem-score {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 396px;
  padding: 14px 18px 22px;
  border: 1px solid #cdebd8;
  border-radius: 22px;
  background-color: #f1faf4;
  box-shadow: 0 30px 60px -40px rgba(0, 135, 68, 0.35);
}

.problem-score__badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a, #4ade80);
  box-shadow: 0 0 24px rgba(74, 222, 128, 0.45);
  font-size: 13.5px;
  font-weight: 500;
  color: #04140a;
}

.problem-score__badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 2px solid #04140a;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.problem-score__body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.problem-score__foot {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* The two label blocks are as tall as the taller one (the grid below stretches the columns),
   with the name at the top and its caption at the bottom. When one name wraps and the other
   does not, the captions still sit on one line; when neither wraps there is no extra space. */
.problem-score__text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: space-between;
  gap: 2px;
}

.problem-score__rings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  /* align-items: start; */
  align-items: stretch;
}

.problem-score__ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: center;
}

.problem-score__ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border: 6px solid;
  border-radius: 50%;
  font-size: 38px;
  font-weight: 700;
}

.problem-score__ring--before {
  border-color: #f5a524;
  background-color: #fff6e5;
  box-shadow: 0 0 24px rgba(245, 165, 36, 0.25);
  color: #b86e00;
}

.problem-score__ring--after {
  border-color: #16b85a;
  background-color: #e3f6ea;
  box-shadow: 0 0 28px rgba(22, 184, 90, 0.3);
  color: var(--opt-green);
}

.problem-score__name {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--opt-ink);
}

.problem-score__sub {
  margin: 0;
  font-size: 12px;
  color: #5f6368;
}

.problem-score__note {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
  color: #4b5563;
}

.problem-score__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 28px;
  font-size: 12.5px;
  color: #3c4043;
}

.problem-score__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.problem-score__shape {
  display: block;
}

.problem-score__shape--red {
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-bottom: 10px solid #e5293a;
  border-left: 6px solid transparent;
}

.problem-score__shape--amber {
  width: 10px;
  height: 10px;
  background-color: #f5a524;
}

.problem-score__shape--green {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: #16b85a;
}

.problem__sub {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--opt-white);
}

.problem__small-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.problem-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.problem-card--small {
  flex: 1 1 260px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  padding: 22px;
  box-shadow: none;
}

.problem-card__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: #fce4e8;
  color: #c2334a;
}

.problem-card__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--opt-ink);
}

.problem-card__copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.problem-card__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #5f6368;
}

.problem__banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 20px 26px;
  border-radius: 20px;
  background-color: #d7f5e7;
}

.problem__banner-icon {
  flex: 0 0 auto;
  fill: var(--opt-green);
}

.problem__banner-text {
  flex: 1;
  min-width: 240px;
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--opt-green);
}

@keyframes problem-area {
  0%,
  35% {
    opacity: 0;
  }

  60%,
  100% {
    opacity: 1;
  }
}

@keyframes problem-draw {
  0% {
    stroke-dashoffset: 900;
  }

  55%,
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes problem-pulse {
  0%,
  100% {
    opacity: 0.35;
  }

  50% {
    opacity: 1;
  }
}

@keyframes problem-tip {
  0%,
  50% {
    opacity: 0;
    transform: translateY(6px);
  }

  62%,
  92% {
    opacity: 1;
    transform: translateY(0);
  }

  100% {
    opacity: 0;
  }
}

@media (max-width: 865.98px) {
  .problem__cards {
    grid-template-columns: 1fr;
  }
}

/* Tablet and below: the three small cards become full-width rows instead of two
   side by side with one stretched underneath. */
@media (max-width: 991.98px) {
  /* One white card holding three rows with hairline dividers: it reads as a list,
     which is what it is, and is lighter than three separate boxes on green. */
  .problem__small-cards {
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    border: 1px solid #e6e9ee;
    border-radius: 20px;
    background-color: var(--opt-white);
  }

  /* In a column the 260px flex-basis would become a height. */
  .problem__small-cards .problem-card--small {
    flex: 0 0 auto;
    border: 0;
    border-bottom: 1px solid #eef1f4;
    border-radius: 0;
    background-color: transparent;
  }

  .problem__small-cards .problem-card--small:last-child {
    border-bottom: 0;
  }
}

/* Phones. The desktop sizes (20px intro, 18px card text, 28px card padding, 64px
   between blocks) leave a 360px-wide column with six-line paragraphs and a lot of air. */
@media (max-width: 575.98px) {
  .problem__wrap {
    gap: 32px;
  }

  .problem__body {
    gap: 32px;
  }

  .problem__head {
    gap: 16px;
  }

  .problem__lead {
    font-size: 16px;
    line-height: 1.55;
  }

  .problem__cards {
    gap: 16px;
  }

  .problem-card {
    gap: 16px;
    padding: 20px;
    border-radius: 20px;
  }

  .problem-card__body {
    gap: 8px;
  }

  .problem-score {
    gap: 16px;
  }

  .problem-score__body,
  .problem-score__foot {
    gap: 16px;
  }

  /* Was: two lines reserved for the ring labels with min-height: 2.6em. That held the
     captions level when "With LeadX Optimiser" wraps (below about 410px) but left a 20px
     hole under "Before" from 414px to 575px, where nothing wraps. The captions are now kept
     level by .problem-score__text below, at every width. */
  .problem-score__name {
    /* min-height: 2.6em; */
    line-height: 1.3;
  }

  .problem-card__text {
    font-size: 16px;
    line-height: 1.55;
  }

  /* The score box no longer needs its desktop height, which left empty space under the legend. */
  .problem-score {
    min-height: 0;
    padding: 14px 14px 18px;
  }

  .problem-card--small {
    gap: 16px;
    padding: 16px;
  }
}

/* Tablet and small laptop (below 1200px). */
@media (max-width: 1199.98px) {
  /* 396px is the desktop height of this box, where the chart in the card beside it is 357px
     tall. Here that chart is 247-296px, so the fixed height left 100-120px of empty green
     under the legend and stretched the other card to match. The box now takes its content's
     height and only fills the card if the grid makes the card taller. */
  .problem-score {
    flex: 1 1 auto;
    min-height: 0;
  }
}

/* One card per row. The chart is an SVG scaled to its container, so its 11px axis labels
   grew with it: 20px at 768px, bigger than the paragraph above. Capped at 460px (13.7px
   labels) and centred, from phones up to where the card turns into two columns, so there is
   no jump in size at 576px. Below about 460px the container is narrower than the cap and
   nothing changes. */
@media (max-width: 751.98px) {
  /* width:100% as well: in the card's flex column an auto side margin switches off the
     stretch, and the SVG inside would fall back to its 300px default. */
  .problem-chart {
    width: 100%;
    max-width: 460px;
    margin-inline: auto;
  }
}

/* The paragraph stopped at 490px and left a blank strip beside it in a 650px-wide card. */
@media (min-width: 576px) and (max-width: 751.98px) {
  .problem__cards .problem-card__text {
    max-width: none;
  }
}

/* One card per row, wide tablet. Text on the left and its picture on the right instead of
   a 680px-wide chart (478px tall, 20px labels) under a paragraph that stopped at 490px and
   left a blank strip beside it. Each card drops from about 700px to about 350px tall, and the
   chart lands at 350-415px wide, the width it is drawn for. Starts at 752px: below that
   "With LeadX Optimiser" wraps in the narrower score box. Scoped to .problem__cards because
   the three small cards also carry .problem-card. */
@media (min-width: 752px) and (max-width: 865.98px) {
  .problem__cards .problem-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    align-items: start;
    gap: 22px 32px;
  }

  .problem__cards .problem-card__text {
    max-width: none;
  }
}

/* The closing line lost "away." to a line of its own next to the See how button. */
@media (min-width: 576px) and (max-width: 991.98px) {
  .problem__banner-text {
    text-wrap: balance;
  }
}

/* The intro under the title ended on "away." alone at 992px (four lines, the last a single word). */
@media (min-width: 576px) and (max-width: 1199.98px) {
  .problem__lead {
    text-wrap: balance;
  }
}

@media (prefers-reduced-motion: reduce) {
  .problem-chart__area,
  .problem-chart__line,
  .problem-chart__pulse,
  .problem-chart__tip {
    animation: none;
  }

  .problem-chart__line {
    stroke-dashoffset: 0;
  }

  .problem-chart__tip {
    opacity: 1;
  }
}
