/* Proof Stats — structure and theming.
   Colours, sizes and spacing arrive as custom properties emitted per instance
   by module.html, so this file is instance-agnostic and is served once
   however many times the module appears on a page. */

/* ========================================================== section shell */

.pst {
  position: relative;
  padding: var(--p-pady, 88px) 24px;
  font-family: var(--p-font-body, inherit);
  color: var(--p-body, rgba(250, 250, 250, 0.7));
  box-sizing: border-box;
  overflow: hidden;
}

/* border-box explicitly rather than inherit: a UA stylesheet that sets
   content-box on an element otherwise wins, and min-height then stacks on
   top of padding instead of containing it. */
.pst *,
.pst *::before,
.pst *::after { box-sizing: border-box; }

.pst__inner {
  position: relative;
  z-index: 1;
  max-width: var(--p-max, 1080px);
  margin: 0 auto;
}

.pst--split .pst__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ============================================================== texture */

/* A faint engineering grid, faded out at the edges so it reads as depth
   rather than as a pattern with a visible border. */
.pst__texture {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(var(--p-accent-rgb, 59, 111, 245), 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(var(--p-accent-rgb, 59, 111, 245), 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 30%, #000 20%, transparent 78%);
  mask-image: radial-gradient(120% 80% at 50% 30%, #000 20%, transparent 78%);
}

/* ================================================================== copy */

.pst__copy { margin-bottom: 56px; }
.pst--split .pst__copy { margin-bottom: 0; }

.pst--align-center .pst__copy { text-align: center; }
.pst--align-center .pst__body { margin-left: auto; margin-right: auto; }

.pst--split .pst__copy { text-align: left; }
.pst--split .pst__body { margin-left: 0; margin-right: 0; }

.pst__kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 6px 14px 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--p-accent, #3b6ff5);
  background: rgba(var(--p-accent-rgb, 59, 111, 245), 0.1);
  border: 1px solid rgba(var(--p-accent-rgb, 59, 111, 245), 0.28);
  border-radius: 999px;
}

.pst__kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(var(--p-accent-rgb, 59, 111, 245), 0.22);
}

.pst__heading {
  margin: 0 0 18px;
  font-family: var(--p-font-head, inherit);
  line-height: 1.14;
  color: var(--p-heading, #fafafa);
  text-wrap: balance;
}

.pst__body {
  max-width: var(--p-copyw, 62ch);
  line-height: 1.65;
}

.pst__body > *:first-child { margin-top: 0; }
.pst__body > *:last-child { margin-bottom: 0; }

/* ================================================================ stats */

.pst__stats {
  display: grid;
  grid-template-columns: repeat(var(--p-count, 3), minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
}

.pst--split .pst__stats { grid-template-columns: minmax(0, 1fr); }

.pst__stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 24px;
  border: 1px solid var(--p-line, rgba(12, 83, 148, 0.45));
  border-radius: 16px;
  background:
    linear-gradient(180deg,
      rgba(var(--p-accent-rgb, 59, 111, 245), 0.06),
      transparent 42%),
    var(--p-card-bg, rgba(10, 23, 48, 0.55));
  transition: transform 260ms cubic-bezier(0.22, 0.61, 0.36, 1),
              border-color 260ms ease,
              box-shadow 260ms ease;
}

/* The plain treatment keeps the old typographic layout — no panel at all. */
.pst--d-plain .pst__stat {
  padding: 0 28px;
  border: 0;
  border-radius: 0;
  background: none;
}

.pst--d-plain .pst__stats { gap: 0; }
.pst--d-plain .pst__stat:first-child { padding-left: 0; }
.pst--d-plain .pst__stat:last-child { padding-right: 0; }
.pst--d-plain .pst__stat + .pst__stat {
  border-left: 1px solid var(--p-line, rgba(12, 83, 148, 0.45));
}

/* --- spotlight ----------------------------------------------------------- */

/* One radial highlight per panel, positioned from the two custom properties
   module.js writes on pointer move. It is a background layer, so moving the
   pointer never triggers layout or paint of anything else. */
.pst--spot .pst__stat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(
    260px circle at var(--p-mx, 50%) var(--p-my, -40%),
    rgba(var(--p-accent-rgb, 59, 111, 245), 0.16),
    transparent 68%
  );
  transition: opacity 260ms ease;
}

.pst--spot .pst__stats:hover .pst__stat::before { opacity: 1; }

/* --- hover lift ---------------------------------------------------------- */

.pst--lift .pst__stat:hover {
  transform: translateY(-4px);
  border-color: rgba(var(--p-accent-rgb, 59, 111, 245), 0.5);
  box-shadow:
    0 18px 40px -22px rgba(0, 0, 0, 0.9),
    0 0 0 1px rgba(var(--p-accent-rgb, 59, 111, 245), 0.12);
}

.pst--d-plain.pst--lift .pst__stat:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--p-line, rgba(12, 83, 148, 0.45));
}

/* --- reveal -------------------------------------------------------------- */

/* Held back only once module.js has confirmed it can observe the viewport.
   Without that class the panels are simply visible, so a failed script or a
   missing IntersectionObserver never leaves the section blank. */
.pst--reveal.is-armed .pst__stat {
  opacity: 0;
  transform: translateY(18px);
}

.pst--reveal.is-armed.is-in .pst__stat {
  opacity: 1;
  transform: none;
  transition: opacity 620ms cubic-bezier(0.22, 0.61, 0.36, 1) calc(var(--p-i, 0) * var(--p-stagger, 140ms)),
              transform 620ms cubic-bezier(0.22, 0.61, 0.36, 1) calc(var(--p-i, 0) * var(--p-stagger, 140ms));
}

/* ================================================================== dial */

.pst__dial {
  position: relative;
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
}

.pst__dial-svg {
  width: 100%;
  height: 100%;
  /* Start the arc at twelve o'clock rather than three. */
  transform: rotate(-90deg);
  overflow: visible;
}

.pst__dial-track {
  fill: none;
  stroke: var(--p-line, rgba(12, 83, 148, 0.45));
  stroke-width: 6;
}

.pst__dial-arc {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(var(--p-accent-rgb, 59, 111, 245), 0.45));
}

/* The figure sits inside the dial, so the number and the arc are one object
   rather than a number with a decoration next to it. */
.pst__dial .pst__value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;

  /* Inside a dial the ring sets the size, not the typography setting — a
     four-character value like "88%+" at the authored size overruns the
     stroke. Capped against the dial's inner diameter and tightened, so the
     figure always sits within the arc. */
  font-size: min(var(--p-value-size, 44px), 34px);
  letter-spacing: -0.03em;
  padding: 0 6px;
}

/* ================================================================ figure */

.pst__value {
  margin: 0;
  font-family: var(--p-font-head, inherit);
  font-size: var(--p-value-size, 44px);
  font-weight: var(--p-value-weight, 500);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--p-value, #3b6ff5);
  /* Digits must not change width as they count, or the layout jitters. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.pst--grad .pst__value {
  background: linear-gradient(135deg, var(--p-accent, #3b6ff5), var(--p-grad-end, #8b5cf6));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* ================================================================= meter */

.pst__meter {
  height: 6px;
  border-radius: 999px;
  background: var(--p-line, rgba(12, 83, 148, 0.45));
  overflow: hidden;
}

.pst__meter-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--p-accent, #3b6ff5), var(--p-grad-end, #8b5cf6));
  box-shadow: 0 0 10px rgba(var(--p-accent-rgb, 59, 111, 245), 0.5);
  transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ================================================================== meta */

.pst__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.pst__label {
  font-size: var(--p-label-size, 15px);
  line-height: 1.55;
  color: var(--p-label, rgba(250, 250, 250, 0.76));
  text-wrap: pretty;
}

.pst__source {
  font-size: 11.5px;
  line-height: 1.4;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--p-source, rgba(250, 250, 250, 0.42));
}

.pst__source a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(var(--p-accent-rgb, 59, 111, 245), 0.5);
  transition: color 160ms ease;
}

.pst__source a:hover { color: var(--p-accent, #3b6ff5); }

.pst__source a:focus-visible {
  outline: 2px solid var(--p-accent, #3b6ff5);
  outline-offset: 2px;
  border-radius: 2px;
}

/* =================================================================== cta */

.pst__cta { margin-top: 44px; text-align: center; }
.pst--align-left .pst__cta { text-align: left; }
.pst--split .pst__cta { grid-column: 1 / -1; margin-top: 40px; }

.pst__cta-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  color: var(--p-btn-ink, #fff);
  background: var(--p-btn-bg, #be02df);
  border-radius: 999px;
  overflow: hidden;
  transition: background-color 160ms ease, box-shadow 260ms ease, transform 160ms ease;
}

.pst__cta-btn > span { position: relative; z-index: 1; }

/* A sheen that crosses the button once on hover. */
.pst__cta-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: skewX(-18deg);
  transition: left 620ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.pst__cta-btn:hover {
  background: var(--p-btn-bg-hover, #d42bf0);
  transform: translateY(-1px);
  box-shadow: 0 14px 34px -12px rgba(var(--p-btn-rgb, 190, 2, 223), 0.75);
}

.pst__cta-btn:hover::after { left: 115%; }

.pst__cta-btn:focus-visible {
  outline: 2px solid var(--p-btn-bg, #be02df);
  outline-offset: 3px;
}

/* ====================================================== reduced motion */

@media (prefers-reduced-motion: reduce) {
  .pst__stat,
  .pst__meter-fill,
  .pst__cta-btn,
  .pst__cta-btn::after,
  .pst--spot .pst__stat::before { transition: none; }

  .pst--reveal.is-armed .pst__stat { opacity: 1; transform: none; }
  .pst--lift .pst__stat:hover { transform: none; }
  .pst__cta-btn:hover { transform: none; }
  .pst__cta-btn:hover::after { left: -60%; }
}

/* ============================================================ responsive */

@media (max-width: 900px) {
  .pst--split .pst__inner { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .pst--split .pst__stats { grid-template-columns: repeat(var(--p-count, 3), minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  /* Three dials at this width are three small dials. One column, with the
     dial beside its label, keeps the figure legible. */
  .pst__stats,
  .pst--split .pst__stats { grid-template-columns: minmax(0, 1fr); }

  .pst__stat,
  .pst--split .pst__stat {
    flex-direction: row;
    align-items: center;
    gap: 20px;
  }

  .pst--d-plain .pst__stat,
  .pst--d-plain.pst--split .pst__stat {
    padding: 20px 0;
    border-left: 0;
  }

  .pst--d-plain .pst__stat:first-child { padding-top: 0; }
  .pst--d-plain .pst__stat:last-child { padding-bottom: 0; }
  .pst--d-plain .pst__stat + .pst__stat {
    border-left: 0;
    border-top: 1px solid var(--p-line, rgba(12, 83, 148, 0.45));
  }

  .pst__dial { width: 104px; height: 104px; }
  .pst__dial .pst__value { font-size: min(var(--p-value-size, 44px), 27px); }
  .pst__meta { flex: 1 1 auto; }

  /* Without a dial the figure needs a reserved column, or every label starts
     at a different x. subgrid sizes it to the widest figure across all rows;
     min-width is the fallback where subgrid is missing. */
  .pst--d-plain .pst__value,
  .pst--d-bar .pst__value,
  .pst--d-card .pst__value { flex: 0 0 auto; min-width: 3.2ch; }

  @supports (grid-template-columns: subgrid) {
    .pst--d-plain .pst__stats,
    .pst--d-bar .pst__stats,
    .pst--d-card .pst__stats { grid-template-columns: auto minmax(0, 1fr); }

    .pst--d-plain .pst__stat,
    .pst--d-bar .pst__stat,
    .pst--d-card .pst__stat {
      display: grid;
      grid-column: 1 / -1;
      grid-template-columns: subgrid;
      align-items: center;
    }

    .pst--d-plain .pst__value,
    .pst--d-bar .pst__value,
    .pst--d-card .pst__value { min-width: 0; }
  }
}

@media (max-width: 640px) {
  .pst { padding: var(--p-pady-m, 44px) 16px; }

  .pst__copy { margin-bottom: 32px; }
  .pst__heading { font-size: clamp(26px, 7vw, 33px); }
  .pst__body { font-size: 16px; }

  /* A centred paragraph at phone width is harder to read than a ranged one,
     whatever the heading does. */
  .pst--align-center .pst__body { text-align: left; }

  .pst__stat { padding: 20px 18px; gap: 16px; }
  .pst__dial { width: 88px; height: 88px; }
  .pst__value { font-size: clamp(26px, 7.5vw, var(--p-value-size, 44px)); }
  .pst__dial .pst__value { font-size: min(var(--p-value-size, 44px), 23px); }

  .pst__cta { margin-top: 32px; }
  .pst__cta-btn { width: 100%; }
}
