/* Metrics: a dark image band (96.4vw wide like the 1851px Figma frame) with three glass cards that overhang its bottom edge.
   Band = 1851 x 639 Figma px. Band contents are placed in vw; each card scales with its own width (cqw). cqw only works
   inside a card, so a card's own padding uses % and its radius uses vw. */
.metrics { --edge: 1.8vw; padding-bottom: 4vw; }                                 /* room for the overhanging cards + gap */

.metrics__band { position: relative; width: calc(100% - 2 * var(--edge)); margin: 0 auto; aspect-ratio: 1851 / 639; color: #fff; }
.metrics__bg { position: absolute; inset: 0; border-radius: 2.1vw; overflow: hidden; background: #3a0013; }
.metrics__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .9s var(--ease); }

/* Video background. The clip is 16:9 and the band is ~2.9:1. We fit the video to the band's HEIGHT (nothing is cropped, so the
   head and rings are always fully visible) and fill the sides with a blurred copy of the same frame (.metrics__ambient), so the red
   glow simply continues to the edges. The video's own left/right edges are feathered into that glow. */
.metrics__ambient { position: absolute; inset: -10%; width: 120%; height: 120%; filter: blur(30px) saturate(1.15); opacity: 0; transition: opacity .9s var(--ease); }
.metrics__frame {
  position: absolute; bottom: 0; left: 50%; height: 92%; width: auto; aspect-ratio: 16 / 9;   /* 92% tall, anchored to the bottom = headroom above his head, even when zoomed */ max-width: none; display: block;
  opacity: 0; transition: opacity .9s var(--ease); transform-origin: 50% 18%;   /* zoom around his face */
  /* feather the left, right and top edges into the glow behind (intersection of two gradients) */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 1.5%, #000 17%, #000 83%, transparent 98.5%, transparent 100%), linear-gradient(180deg, transparent 0, transparent 1.5%, #000 16%);
  -webkit-mask-composite: source-in;
          mask-image: linear-gradient(90deg, transparent 0, transparent 1.5%, #000 17%, #000 83%, transparent 98.5%, transparent 100%), linear-gradient(180deg, transparent 0, transparent 1.5%, #000 16%);
          mask-composite: intersect;
  will-change: transform; pointer-events: none;
  clip-path: inset(2% 2% 0 2%);                       /* drops the outermost pixel columns/rows, so no hairline can show at the edge */
}
.metrics__bg.is-video .metrics__frame, .metrics__bg.is-video .metrics__ambient { opacity: 1; }
/* the real <video> is never shown: it is played once, quickly, so the script can store its frames (see metrics.js) */
.metrics__video { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; z-index: -1; }   /* fixed + inside the screen: browsers throttle off-screen videos, which would starve the frame capture */
.metrics__bg.is-video .metrics__poster { opacity: 0; }

.metrics__head { position: absolute; left: 0; right: 0; top: 8.3vw; text-align: center; }
.metrics__label { font-size: max(11px, .73vw); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.metrics__title { margin-top: 1.1vw; font-size: clamp(2rem, 4.17vw, 5.2rem); line-height: 1.15; font-weight: 600; letter-spacing: -.02em; }

.metrics__cards {
  --gap: clamp(.75rem, 1.56vw, 1.9rem);
  --cw: calc((min(73.4vw, 1410px) - 2 * var(--gap)) / 3);                          /* one card's width */
  position: absolute; left: 50%; bottom: calc(var(--cw) * -0.0636); transform: translateX(-50%);   /* hangs 28/440 of a card below the band, at any width */
  width: min(73.4vw, 1410px);                                                        /* same container as the footer */
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap);
}
.metric-card {
  container-type: inline-size; min-height: calc(var(--cw) * 0.684); padding: 9.5% 9.5% 7%; position: relative; overflow: hidden;   /* design ratio 440:301 is the minimum; taller if the text needs it */
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); border-radius: min(1.15vw, 22px);
  backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2);
  box-shadow: 0 1.6vw 3.4vw rgba(30,0,10,.18);
}
.metric-card__num { display: flex; align-items: baseline; font-size: 22.7cqw; line-height: 1; font-weight: 500; letter-spacing: -.02em; height: 22.7cqw; }
.metric-card__text { width: 76cqw; margin-top: 9.8cqw; font-size: max(14px, 4.5cqw); line-height: 1.5; font-weight: 400; color: rgba(255,255,255,.92); }

.digit { display: inline-block; height: 1em; overflow: hidden; }
.digit__strip { display: flex; flex-direction: column; will-change: transform; }
.digit__strip span { display: block; height: 1em; line-height: 1; }
.counter__suffix { margin-left: .04em; }

@media (max-width: 1000px) {
  .metrics { padding-bottom: 3rem; }
  .metrics__band { aspect-ratio: auto; border-radius: 1.5rem; padding: 3rem 0 0; }
  .metrics__bg { border-radius: 1.5rem; }
  .metrics__poster { object-position: 46% 6%; }
  .metrics__head { position: relative; top: auto; padding-inline: 1rem; }
  .metrics__label { font-size: .75rem; }
  .metrics__title { margin-top: .6rem; font-size: clamp(2rem, 8vw, 3.5rem); }
  .metrics__cards { position: relative; left: auto; bottom: auto; transform: none; width: calc(100% - 2rem); margin: 2rem auto 0; padding-bottom: 1.25rem; gap: .75rem; }
  .metric-card { border-radius: 1.1rem; }
}
@media (max-width: 700px) {
  /* phones: the cards stack and cover most of the band, so show the video at the top, just below the heading */
  .metrics__frame { top: 12.5%; bottom: auto; height: 38%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, transparent 1.5%, #000 17%, #000 83%, transparent 98.5%, transparent 100%), linear-gradient(180deg, transparent 0, transparent 1.5%, #000 16%, #000 78%, transparent 97%, transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, transparent 1.5%, #000 17%, #000 83%, transparent 98.5%, transparent 100%), linear-gradient(180deg, transparent 0, transparent 1.5%, #000 16%, #000 78%, transparent 97%, transparent 100%);   /* the video floats mid-band here, so its bottom edge is feathered too */
  }
  .metrics__cards { margin-top: 10.5rem; }          /* leaves room for his face between the heading and the first card */
  .metrics__cards { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
  .metric-card { min-height: 15rem; padding-bottom: 1.5rem; }
  .metric-card__num { font-size: 4.2rem; height: auto; }
  .metric-card__text { width: auto; margin-top: 1.2rem; font-size: 1.1rem; }
}
