/* Running Numbers (numbers-banner-v2) - Amili brand */
.nb2 {
  --nb2-gap-x: var(--space-48, 48px);
  --nb2-gap-y: var(--space-48, 48px);
  --nb2-divider: color-mix(in srgb, currentColor 18%, transparent);
}

@media (min-width: 1200px) {
  .nb2 { --nb2-gap-y: var(--space-96, 96px); }
}

/* ---------- Top section: heading + description ---------- */
.nb2__top {
  display: flex;
  flex-direction: column;
  gap: var(--space-16, 16px);
  margin-bottom: var(--space-48, 48px);
  max-width: 760px;
}

.nb2__top--center { align-items: center; text-align: center; margin-inline: auto; }
.nb2__top--right { align-items: flex-end; text-align: right; margin-left: auto; }

/* Banner heading uses the theme's size classes (Header font size), like every other module. */
.nb2 .nb2__heading { margin: 0; }

.nb2 .nb2__description { margin: 0; }

/* ---------- Grid ---------- */
.nb2__grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(var(--nb2-cols-mobile, 1), minmax(0, 1fr));
  column-gap: var(--nb2-gap-x);
  row-gap: var(--nb2-gap-y);
}

@media (min-width: 768px) and (max-width: 1199px) {
  .nb2__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nb2__grid[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 1200px) {
  .nb2__grid { grid-template-columns: repeat(var(--nb2-cols, 4), minmax(0, 1fr)); }
}

.nb2__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-12, 12px);
  margin: 0;
  padding: 0;
  min-width: 0;
}

/* "Description above number" is handled in the HTML order, so item headings stay on top. */
.nb2--centered .nb2__item { text-align: center; align-items: center; justify-items: center; }

/* Row alignment: every item shares the same heading / number / description rows (subgrid),
   so numbers line up even when only some items have a heading or a heading wraps. */
.nb2__slot-empty { min-height: 1lh; }
@supports (grid-template-rows: subgrid) {
  /* Row spacing between item rows comes from item padding, not grid row-gap,
     so the tight gap inside each item is not inflated by the larger row gap. */
  .nb2__grid { row-gap: 0; margin-bottom: calc(-1 * var(--nb2-gap-y)); }
  .nb2__item {
    display: grid;
    grid-row: span var(--nb2-slots, 2);
    grid-template-rows: subgrid;
    row-gap: var(--space-12, 12px);
    align-content: start;
    padding-bottom: var(--nb2-gap-y);
  }
  .nb2.nb2--divider .nb2__item::before { bottom: var(--nb2-gap-y); }
  .nb2__slot-empty { min-height: 0; }
}

/* Dividers: a line in the middle of each column gap; the first column's line is clipped off. */
.nb2--divider .nb2__grid { overflow: hidden; }
.nb2--divider .nb2__item { position: relative; }
.nb2--divider .nb2__item::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--nb2-gap-x) / -2);
  border-left: 1px solid var(--nb2-divider);
}

@media (max-width: 767px) {
  .nb2--divider .nb2__grid[data-cols-mobile="1"] .nb2__item::before { display: none; }
}

/* ---------- Number + label ---------- */
.nb2 .nb2__value {
  position: relative;
  margin: 0;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.05; /* big numbers: trim built-in leading so spacing looks even */
}

.nb2 .nb2__label { margin: 0; }

/* Heading above each number: fixed to the theme's smallest heading style (h5). */
.nb2 .nb2__item-heading { margin: 0; }

/* Number colours - Amili palette.
   Signal / Mild turquoise: use on Black or Darkest turquoise backgrounds.
   Dark / Darkest turquoise: use on white or light backgrounds. */
.nb2--num-signal .nb2__value { color: #00E2E2; }
.nb2--num-teal .nb2__value { color: #47CCCC; }
.nb2--num-dark-turquoise .nb2__value { color: #008A8A; }
.nb2--num-teal-deep .nb2__value { color: #006262; }
.nb2--num-ink .nb2__value { color: #0A0D0D; }
.nb2--num-white .nb2__value { color: #FFFFFF; }

/* ---------- Brand background not in the theme: Darkest turquoise ---------- */
.nb2-bg-teal-deep { background-color: #006262 !important; color: #FFFFFF; }
.nb2-bg-teal-deep .nb2__heading,
.nb2-bg-teal-deep .nb2__description,
.nb2-bg-teal-deep .nb2__label { color: #FFFFFF; }

/* ---------- Background image + overlay ----------
   The background colour choice still decides text colour (dark = white text),
   and the overlay is tinted to match it so text stays readable on any photo. */
.nb2-has-image {
  --nb2-overlay-color: 10, 13, 13; /* ink */
  position: relative;
  isolation: isolate;
  background-repeat: no-repeat;
}
.nb2-has-image[class*="background-light"],
.nb2-has-image.background-default { --nb2-overlay-color: 255, 255, 255; }
.nb2-has-image.nb2-bg-teal-deep { --nb2-overlay-color: 0, 98, 98; }
.nb2-has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(var(--nb2-overlay-color), var(--nb2-overlay, 0.6));
  pointer-events: none;
}
.nb2-overlay-0 { --nb2-overlay: 0; }
.nb2-overlay-40 { --nb2-overlay: 0.4; }
.nb2-overlay-60 { --nb2-overlay: 0.6; }
.nb2-overlay-80 { --nb2-overlay: 0.8; }

/* ---------- Running numbers ----------
   The real value stays in the DOM (opacity 0 while counting, so it also reserves the width).
   The ticking value is CSS-generated content from a data attribute: it is never DOM text,
   so crawlers and screen readers only ever get the final number. */
.nb2__value.is-counting .nb2__value-text { opacity: 0; }
.nb2__value.is-counting::after {
  content: attr(data-nb2-current);
  content: attr(data-nb2-current) / "";
  position: absolute;
  inset: 0;
}

@media (prefers-reduced-motion: reduce) {
  .nb2__value.is-counting .nb2__value-text { opacity: 1; }
  .nb2__value.is-counting::after { content: none; }
}
