/* ==========================================================================
   Stats (index-v3 .who). Starts white and, as it scrolls in, a navy-900
   shade fades over it and the theme flips to dark (js/numbers.js). That
   shade is the seam from About into the dark band. Behind the copy, the
   giant outlined "AGENT". Under the heading, one 16:9 photo whose bottom
   lines up with the last metric. Stats share one edge, level with the heading.
   Reduced motion: static navy, final numbers.
   ========================================================================== */
/* The section keeps a white ground in both themes; the shade supplies the navy */
.numbers.light, .numbers.dark { background: var(--white); }
.numbers {
  overflow: hidden; isolation: isolate;
  padding-block: clamp(6rem, 12vw, 10rem);
  transition: color var(--dur-hover) ease;
}
.numbers h2, .numbers .eyebrow { transition: color var(--dur-hover) ease; }
.numbers__shade { position: absolute; inset: 0; z-index: -1; background: var(--navy-900); opacity: 0; }

/* The outlined word: the company name, sized to the section's width (an
   estimate from its length here; view.js measures and fits it exactly) */
.numbers__word {
  position: absolute; z-index: 0; pointer-events: none;
  inset-block-start: clamp(1rem, 4vw, 3rem); left: 50%; translate: -50% 0; inline-size: max-content;
  font-family: var(--font-head); font-size: calc(94vw / (var(--chars, 9) * .68)); font-weight: 700;
  line-height: .8; letter-spacing: -.04em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1.5px var(--outline);
  transition: -webkit-text-stroke-color var(--dur-reveal) ease;
}
.numbers__word:lang(ar), :lang(ar) .numbers__word { line-height: 1.1; font-family: var(--font-ar-head); }


.numbers__grid { position: relative; z-index: 1; display: grid; gap: 3rem; }
.numbers h2 { font-size: clamp(2.2rem, 1rem + 3.4vw, 3.6rem); max-inline-size: 22ch; }
/* The photo: rounded like the site's other images, with the standard hover zoom */
.numbers__media {
  margin-block-start: 2rem; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-md); background: var(--navy-700);
}
.numbers__media img { inline-size: 100%; block-size: 100%; object-fit: cover; transition: transform var(--dur-reveal) var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .numbers__media:hover img { transform: scale(1.05); } }

/* The figures share one column (subgrid), so every number starts on the same
   edge and every label starts on the same edge */
.stats { display: grid; grid-template-columns: auto 1fr; column-gap: 1.25rem; row-gap: 1.25rem; }
.stat {
  position: relative; grid-column: 1 / -1;
  display: grid; grid-template-columns: subgrid; align-items: baseline;
  padding-block: 1.25rem; border-block-start: 1px solid var(--outline);
}
/* Hover: the divider fills cyan in reading direction */
.stat::before {
  content: ""; position: absolute; inset-inline: 0; inset-block-start: -1px; block-size: 1px;
  background: var(--cyan); transform: scaleX(0); transform-origin: left;
  transition: transform var(--dur-hover) ease-out;
}
[dir="rtl"] .stat::before { transform-origin: right; }
.stat__num {
  font-family: var(--font-head); font-size: clamp(3.2rem, 7vw, 5.6rem); font-weight: 300;
  line-height: 1; letter-spacing: -.05em; color: var(--fg);
  font-variant-numeric: tabular-nums;
  transform-origin: left center;
  transition: color var(--dur-hover) ease, transform var(--dur-hover) ease-out;
}
[dir="rtl"] .stat__num { transform-origin: right center; }
.stat__num em { font-style: normal; font-weight: 500; color: var(--cyan); }
/* Slightly dimmer at rest, so the hover can brighten it to white */
.stat__label { max-inline-size: 16ch; font-weight: 600; line-height: 1.35; color: var(--fg-2); transition: color var(--dur-hover) ease-out; }
/* Desktop: on hover. Touch screens: .is-lit plays the same thing as each
   figure scrolls into view (staggered) and again on tap (view.js). */
.stat.is-lit::before { transform: scaleX(1); }
.stat.is-lit .stat__num { transform: translateX(6px) scale(1.04); }
[dir="rtl"] .stat.is-lit .stat__num { transform: translateX(-6px) scale(1.04); }
.stat.is-lit .stat__label { color: var(--fg); }
@media (hover: hover) and (pointer: fine) {
  .stat:hover::before { transform: scaleX(1); }
  .stat:hover .stat__num { transform: translateX(6px) scale(1.04); }
  [dir="rtl"] .stat:hover .stat__num { transform: translateX(-6px) scale(1.04); }
  .stat:hover .stat__label { color: var(--fg); }
}
@media (hover: none), (pointer: coarse) {
  .stat { cursor: pointer; -webkit-tap-highlight-color: transparent; }
  /* A touch slower than the hover, so the effect reads without a pointer */
  .stat::before { transition-duration: var(--dur-menu); }
  .stat__num { transition: color var(--dur-hover) ease, transform var(--dur-menu) var(--ease-out); }
  .stat__label { transition-duration: var(--dur-menu); }
}

/* 12 columns; the intro shares the heading's edge and the stats share one edge */
@media (min-width: 1024px) {
  .numbers__grid { grid-template-columns: repeat(12, 1fr); align-items: start; }
  /* Seven columns: wide enough for the statement in two lines from 1200px */
  .numbers__grid { align-items: stretch; }
  /* Both columns stretch to the taller one: the photo drops to the bottom of
     the text column and the metrics spread down theirs, so the photo's
     bottom and the last metric's bottom line up */
  .numbers__text { grid-column: 1 / 8; display: flex; flex-direction: column; align-items: flex-start; }
  .numbers__media { align-self: stretch; margin-block-start: auto; }
  .numbers h2 { margin-block-end: 2rem; }
  /* The stats column starts level with the heading (below the eyebrow line) */
  .stats { grid-column: 8 / 13; margin-block-start: calc(.84rem * 1.65 + 1.2rem); align-content: space-between; }
  .stat:last-child { padding-block-end: 0; }
  /* The label sits under its number, so short numbers leave no gap */
  .stats { grid-template-columns: 1fr; }
  .stat { row-gap: .55rem; }
  .stat__label { max-inline-size: 24ch; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .numbers__text { grid-column: 1 / 7; }
  .stats { grid-column: 7 / 13; }
  .stat__num { font-size: clamp(3rem, 5.6vw, 4.4rem); }
}
/* Phones and tablets: figures in a single column, labels given room */
@media (max-width: 1023px) {
  .stat__label { max-inline-size: 20ch; }
}

@media (prefers-reduced-motion: reduce) {
  .numbers, .numbers h2, .numbers .eyebrow, .stat__num, .stat__label, .stat::before, .numbers__media img, .numbers__word { transition: none; }
  .stat:hover .stat__num, .stat.is-lit .stat__num, .numbers__media:hover img { transform: none !important; }
}
.numbers .lead { margin-block-end: 1rem; }
