.wp-block-brandspeak-stats {
  background: #fff9f1;
  padding: 4em 0;
}

.wp-block-brandspeak-stats__inner {
  max-width: 1400px;
  margin: 0 auto;
  /* padding: 0 1.5em; */
}

.stats__header {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 2rem;
}

.stats__header h2,
.stats__header h3,
.stats__intro {
  margin: 0;
}

.stats__header h2,
.stats__header h3 {
  font-weight: 500;
}

.stats__grid {
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 1400px;
  margin-top: 2rem;
  aspect-ratio: 1610 / 914;
  grid-template-columns: repeat(48, minmax(0, 1fr));
  grid-template-rows: repeat(24, minmax(0, 1fr));
}

/* Mosaic mapping */
.stats__card:nth-child(1) { grid-column: 1 / 21;  grid-row: 1 / 10; }  /* Focus */
.stats__card:nth-child(2) { grid-column: 21 / 33; grid-row: 1 / 10; }  /* Years */
.stats__card:nth-child(3) { grid-column: 33 / 49; grid-row: 1 / 13; }  /* Quant */
.stats__card:nth-child(4) { grid-column: 1 / 17;  grid-row: 10 / 17; } /* Markets */
.stats__card:nth-child(5) { grid-column: 17 / 33; grid-row: 10 / 25; } /* Participants */
.stats__card:nth-child(6) { grid-column: 1 / 17;  grid-row: 17 / 25; } /* Languages */
.stats__card:nth-child(7) { grid-column: 33 / 49; grid-row: 13 / 25; } /* Interviews */

.stats__card:nth-child(n + 8) {
  grid-area: auto;
}

.stats__card {
  border-radius: 5px;
  padding: 1.9rem;
  color: var(--stats-text-color, #fff);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
  z-index: 1;
  box-shadow: 0 10px 24px rgba(15, 15, 25, 0.06);
}

.stats__number {
  font-size: clamp(2.8rem, 5vw, 5.625rem);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.stats__label {
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 500;
}

.stats__card .stats__number,
.stats__card .stats__label {
  position: relative;
  z-index: 1;
}

.stats__accent {
  position: absolute;
  opacity: 0.65;
  z-index: 0;
  pointer-events: none;
}

.stats__accent--quote {
  width: 230px;
  height: 275px;
  bottom: -44px;
  right: -36px;
}

.stats__accent--curve {
  width: 170%;
  height: 170%;
  bottom: -112px;
  right: -198px;
  mix-blend-mode: color-burn;
}

.stats__accent--wave {
  width: 400px;
  height: 400px;
  bottom: -35px;
  left: -64px;
}

.stats__accent svg {
  width: 100%;
  height: 100%;
}

.stats__card:not([data-stat-index="0"]) .stats__accent--quote {
  display: none;
}

.stats__card:not([data-stat-index="2"]) .stats__accent--curve {
  display: none;
}

.stats__card:not([data-stat-index="4"]) .stats__accent--wave {
  display: none;
}

@media (max-width: 960px) {
  .stats__grid {
    aspect-ratio: auto;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-template-rows: auto;
    grid-template-areas:
      "stat1 stat2"
      "stat4 stat5"
      "stat6 stat7";
  }

  /* Keep accent svgs contained on tablet */
  .stats__accent--quote {
    width: 65%;
    height: 65%;
    right: -10%;
    bottom: -10%;
  }

  .stats__accent--curve {
    width: 130%;
    height: 130%;
    right: -30%;
    bottom: -30%;
  }

  .stats__accent--wave {
    width: 70%;
    height: 70%;
    left: -12%;
    bottom: -8%;
  }
}

@media (max-width: 600px) {
  .stats__header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(140px, auto));
    gap: 0.5rem;
    margin-top: 1.5rem;
    grid-template-areas:
      "stat1 stat1"
      "stat2 stat3"
      "stat4 stat4"
      "stat5 stat6";
  }

  .stats__card:nth-child(1) { grid-area: stat1 !important; }
  .stats__card:nth-child(2) { grid-area: stat2 !important; }
  .stats__card:nth-child(3) { grid-area: stat3 !important; }
  .stats__card:nth-child(4) { grid-area: stat4 !important; }
  .stats__card:nth-child(5) { grid-area: stat5 !important; }
  .stats__card:nth-child(6) { grid-area: stat6 !important; }
  .stats__card:nth-child(7) { grid-area: auto !important; }

  /* Further shrink accents on mobile to stay inside each card */
  .stats__accent--quote {
    width: 130%;
    height: 130%;
    right: -42%;
    bottom: -20%;
  }

  .stats__accent--curve {
    width: 200%;
    height: 200%;
    right: -47%;
    bottom: -71%;
  }

  .stats__accent--wave {
    width: 120%;
    height: 120%;
    left: 7%;
    bottom: -15%;
  }
}
