/* ============================================================
   Morley Management Group — Evidence charts

   Three stat cards that draw themselves when scrolled into view.
   Every animation keys off `.is-visible`, the class the existing
   reveal observer already adds, so no new scroll machinery.
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
}

.stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: var(--space-7);
  transition:
    transform var(--duration-base) var(--ease-standard),
    background-color var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard);
}
/* Copper rule that runs across the top on hover */
.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-copper);
  transform: scaleX(0.14);
  transform-origin: left center;
  transition: transform var(--duration-slow) var(--ease-standard);
}
.stat-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(241, 157, 106, 0.38);
}
.stat-card:hover::before { transform: scaleX(1); }

.stat-card__label {
  font-family: var(--font-display);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 var(--space-6);
}

.stat-card__figure {
  position: relative;
  margin-bottom: var(--space-6);
}

.stat-card__value {
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: var(--step-5);
  line-height: 1;
  color: var(--copper-300);
  margin: 0;
}

.stat-card blockquote { margin: 0 0 var(--space-4); flex: 1; }
.stat-card blockquote p {
  font-size: var(--step-0);
  line-height: 1.6;
  font-style: italic;
  color: rgba(255, 255, 255, 0.86);
  margin: 0;
}
.stat-card cite {
  font-style: normal;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--copper-300);
  margin-top: auto;
}
.stat-card cite::before { content: "\2014\00a0"; }

/* ------------------------------------------------------------
   1. Line, drawn with stroke-dashoffset

   pathLength="100" normalises the geometry so the dash values are
   just percentages. No need to measure the real path length.
   ------------------------------------------------------------ */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart__grid { stroke: rgba(255, 255, 255, 0.1); stroke-width: 1; }

.chart__line {
  fill: none;
  stroke: var(--copper-300);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1500ms var(--ease-out);
}
.is-visible .chart__line { stroke-dashoffset: 0; }

.chart__dot {
  fill: var(--copper-300);
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  opacity: 0;
  transition:
    transform 420ms var(--ease-out) 1200ms,
    opacity 240ms linear 1200ms;
}
.is-visible .chart__dot { transform: scale(1); opacity: 1; }
/* Soft halo so the endpoint reads as an arrival */
.chart__halo {
  fill: var(--copper-300);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0.4);
}
.is-visible .chart__halo { animation: haloPulse 2.6s var(--ease-out) 1500ms infinite; }
@keyframes haloPulse {
  0%   { opacity: 0.35; transform: scale(0.5); }
  70%  { opacity: 0;    transform: scale(2.1); }
  100% { opacity: 0;    transform: scale(2.1); }
}

/* ------------------------------------------------------------
   2. Donut
   ------------------------------------------------------------ */
.chart--donut { max-width: 190px; margin-inline: auto; }
.chart__track { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 10; }
.chart__arc {
  fill: none;
  stroke: var(--copper-300);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1600ms var(--ease-out) 150ms;
}
/* 86 percent of the ring drawn, so 14 left undrawn */
.is-visible .chart__arc { stroke-dashoffset: 14; }

.chart-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.chart-center .stat-card__value { font-size: var(--step-4); color: #fff; }

/* ------------------------------------------------------------
   3. Bars, built in CSS rather than SVG so the labels are real
      text that the count-up can drive
   ------------------------------------------------------------ */
.bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(1.25rem, 0.5rem + 2.4vw, 2.5rem);
  height: 170px;
  padding-bottom: var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.bars__item {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  flex: 0 1 92px;
}
.bars__val {
  font-family: var(--font-display);
  font-weight: var(--weight-black);
  font-size: var(--step-2);
  line-height: 1;
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 var(--space-2);
}
.bars__item--accent .bars__val { color: var(--copper-300); font-size: var(--step-3); }

.bars__bar {
  width: 100%;
  height: var(--h);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(255, 255, 255, 0.22);
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: transform 900ms var(--ease-out);
}
.bars__item--accent .bars__bar { background: var(--gradient-copper); }
.is-visible .bars__item:nth-child(1) .bars__bar { transform: scaleY(1); transition-delay: 200ms; }
.is-visible .bars__item:nth-child(2) .bars__bar { transform: scaleY(1); transition-delay: 420ms; }

.bars__cap {
  position: absolute;
  bottom: -1.9em;
  font-family: var(--font-display);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
  white-space: nowrap;
}
.bars__item { position: relative; }
.stat-card--bars .stat-card__figure { padding-bottom: var(--space-6); }

/* ---- Closing line ------------------------------------------- */
.evidence__note {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.evidence__note p {
  margin: 0;
  flex: 1 1 460px;
  font-size: var(--step-1);
  color: rgba(255, 255, 255, 0.88);
}

/* ---- Responsive --------------------------------------------- */
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: minmax(0, 1fr); max-width: 520px; }
}
@media (max-width: 640px) {
  .stat-card { padding: var(--space-6); }
  .evidence__note { flex-direction: column; align-items: flex-start; }
  .evidence__note p { flex: 0 1 auto; }
}

/* ---- Reduced motion ------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .chart__line { stroke-dashoffset: 0; }
  .chart__arc  { stroke-dashoffset: 14; }
  .chart__dot  { transform: none; opacity: 1; }
  .chart__halo { display: none; }
  .bars__bar   { transform: scaleY(1); }
  .stat-card::before { transform: scaleX(1); }
}
