/*
 * results: the numbers.
 *
 * The black room that #work opened, kept black: a head row on a hairline, then the
 * heading at display size, then two figures as large as the page will carry them.
 * Under all of it a fine ruled desk runs away in perspective and fades at its
 * horizon. No panel, no card and no second ground: the figures sit on the black.
 *
 * The page scrolls through this section like any other. It is not pinned and nothing
 * here is sticky, so it cannot hold anyone and cannot fall out of step with the
 * scroll bar.
 *
 * There are no hidden starting states in this file. results.js sets its own, so
 * without it (no JS, a failed script, reduced motion) the whole section is simply
 * drawn, figures and all.
 */

.results {
  --rs-rule: rgba(238, 237, 232, .16);
  --rs-soft: var(--mist);
  --rs-desk-line: rgba(238, 237, 232, .075);
  position: relative;
  overflow: clip;
  isolation: isolate;
  padding-block: clamp(56px, 7vw, 112px) var(--section-y);
}

/*
 * The desk: one plane laid back into perspective, hairlines every 24px, masked so it
 * fades out at the horizon. Static: nothing here animates but the plane's own drift
 * (a transform, in results.js). The wrapper clips; the plane is the ::before.
 */
.rs-desk {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  perspective: 1000px;
  perspective-origin: 50% 38%;
  pointer-events: none;
}
.rs-desk::before {
  content: '';
  position: absolute;
  left: -90%;
  width: 280%;
  top: 38%;
  height: 130%;
  transform: translateZ(-420px) rotateX(74deg);
  transform-origin: 50% 0;
  background:
    repeating-linear-gradient(0deg, var(--rs-desk-line) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, var(--rs-desk-line) 0 1px, transparent 1px 24px);
  -webkit-mask-image: radial-gradient(118% 86% at 50% 100%, #000 6%, rgba(0, 0, 0, .55) 46%, transparent 84%);
  mask-image: radial-gradient(118% 86% at 50% 100%, #000 6%, rgba(0, 0, 0, .55) 46%, transparent 84%);
}

/* ---------- the head row: label, what kind of campaign, a hairline ---------- */

.results__head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-bottom: 14px;
}
.results__meta { color: var(--rs-soft); }
.results__rule { transform-origin: 0 50%; }

/* ---------- the heading and the context ---------- */

.results__head {
  display: grid;
  gap: clamp(20px, 3vw, 32px);
  margin-top: clamp(36px, 6vw, 88px);
}
.results__title { max-width: 12ch; }
.results__plain {
  max-width: 38ch;
  color: var(--paper);
}

/* ---------- the two figures ---------- */

.rs-figures {
  position: relative;
  display: grid;
  margin-top: clamp(40px, 6vw, 96px);
  padding-bottom: clamp(22px, 2.6vw, 36px);
}
.rs-fig {
  /* Its own size container, so the figure can be bounded by its own length. */
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding-block: clamp(20px, 3vw, 28px);
  border-top: 1px solid var(--rs-rule);
}
.rs-fig__v {
  display: block;
  /* The uncovering (results.js) is a clip on the number inside; this is its window, with
     room for the heavy face's overshoot so nothing is shaved at rest. */
  padding: .06em .04em .02em 0;
  margin: -.06em -.04em -.02em 0;
  font-family: var(--f-display);
  font-weight: 900;
  font-stretch: 100%;
  /* The first size is the fallback for an engine without container units. The second
     divides the column by the figure's own length (--rs-chars, from PHP), so "42" is as
     big as its column allows and a longer figure still fits on one line. */
  font-size: clamp(7rem, 2rem + 15vw, 16.5rem);
  font-size: min(clamp(7rem, 2rem + 15vw, 16.5rem), calc(150cqi / var(--rs-chars, 2)));
  line-height: .84;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rs-fig__n { display: inline-block; }
.rs-fig--lead .rs-fig__v { color: var(--lime); }
.rs-fig__k {
  display: block;
  margin-top: clamp(14px, 1.6vw, 24px);
  font-family: var(--f-display);
  font-weight: 800;
  font-stretch: 92%;
  font-size: clamp(1.25rem, 1rem + 1.1vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

/* The line: a hairline under both figures that the highlighter runs along. */
.rs-run {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--rs-rule);
}
.rs-run i {
  position: absolute;
  inset: 0;
  background: var(--lime);
  transform-origin: 0 50%;
}

/* ---------- what the campaign was, the caveat and the way on ---------- */

.results__foot {
  display: grid;
  gap: 28px;
  margin-top: clamp(28px, 3.4vw, 52px);
}
.rs-source { margin: 0; }
.rs-source__row {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--rs-rule);
  align-items: baseline;
}
.rs-source__row:first-child { padding-top: 0; }
.rs-source__k { color: var(--rs-soft); line-height: 1.5; }
.rs-source__v { margin: 0; font-size: var(--fs-small); line-height: 1.45; }
.results__caveat { color: var(--rs-soft); max-width: 44ch; }
.results__cta { margin-top: 6px; }

/* ---------- screenshots from the ad account (only when one is approved) ---------- */

.rs-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin: 26px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--rs-rule);
  list-style: none;
}
.rs-shots__item { position: relative; }
.rs-shots__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-family: var(--f-display);
  font-weight: 700;
  font-stretch: 88%;
  color: var(--paper);
  text-decoration: none;
}
.rs-shots__icon { width: 20px; height: 20px; color: var(--lime); }
.rs-shots__t { background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 100% 1.5px; padding-bottom: .2em; }
.rs-dialog {
  width: min(1200px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100svh - 24px);
  padding: 0;
  border: 1px solid rgba(238, 237, 232, .2);
  border-radius: 8px;
  background: var(--night-2);
  color: var(--paper);
  overflow: hidden;
  --focus: var(--lime);
}
.rs-dialog::backdrop { background: rgba(8, 8, 7, .82); }
.rs-dialog[open] { display: flex; flex-direction: column; }
.rs-dialog__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 0 8px 0 18px;
  border-bottom: 1px solid var(--rs-rule);
}
.rs-dialog__title { color: var(--mist); }
.rs-dialog__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-stretch: 88%;
  color: var(--paper);
}
.rs-dialog__close svg { width: 18px; height: 18px; }
.rs-dialog__body { overflow: auto; overscroll-behavior: contain; background: #fff; }
.rs-dialog__img { display: block; width: 100%; height: auto; }

/* ---------- tablet up: the two figures side by side ---------- */

@media (min-width: 768px) {
  .rs-figures {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: end;
    border-top: 1px solid var(--rs-rule);
    padding-top: clamp(28px, 3.4vw, 52px);
  }
  .rs-fig { padding-block: 0; border-top: 0; }
  /* The second figure stands off a hairline of its own. */
  .rs-fig + .rs-fig {
    padding-left: clamp(24px, 3.4vw, 56px);
    border-left: 1px solid var(--rs-rule);
  }
  .results__foot { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: var(--gutter); align-items: start; }
  .results__close { justify-self: end; max-width: 360px; }
}

/* ---------- desktop: heading left, context right ---------- */

@media (min-width: 1024px) {
  .results__head {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: end;
  }
  .results__title { grid-column: 1 / 8; }
  .results__plain { grid-column: 9 / -1; padding-bottom: .5em; }
  .results__foot { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .rs-source { grid-column: 1 / 7; }
  .results__close { grid-column: 9 / -1; justify-self: start; max-width: none; }
}
