/* Landing-page counter: one engraved panel, three cells, mechanical rolling digits.
   Uses the landing tokens (--panel, --line, --brass …) so the light theme follows automatically. */

.stats {
  width: min(calc(100% - var(--gutter, 24px) * 2), var(--max));
  margin: 0 auto;
  padding: clamp(48px, 6vw, 64px) 0 clamp(40px, 5vw, 56px);
  border-top: 1px solid var(--line);
}
.stats[hidden] { display: none; }

.stats-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line-2);
  border-radius: 22px;
  background:
    radial-gradient(90% 140% at 50% -30%, rgba(214, 162, 74, .14), transparent 62%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 40px 70px -48px rgba(0, 0, 0, .85);
  overflow: hidden;
  isolation: isolate;
}
.stat-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: clamp(28px, 3.4vw, 40px) clamp(24px, 3vw, 40px) clamp(26px, 3vw, 34px);
}
.stat-cell + .stat-cell::before {            /* engraved divider between cells */
  content: "";
  position: absolute;
  inset: 22px auto 22px 0;
  width: 1px;
  background: linear-gradient(180deg, transparent, var(--line-2) 22%, var(--line-2) 78%, transparent);
}

.stat-head { display: flex; align-items: center; gap: 12px; }
.stat-head i {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(240, 195, 120, .32);
  border-radius: 50%;
  background: linear-gradient(155deg, var(--panel-3), var(--panel-2));
  color: var(--brass-2);
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 16px -10px rgba(0, 0, 0, .7);
}
.stat-head h3 {
  margin: 0;
  color: var(--text);
  font: 600 15px/1.3 Inter, system-ui, sans-serif;
  letter-spacing: .005em;
}

/* ---------- odometer: one fixed-size tile per digit ---------- */
.stats .section-heading h2 { color: var(--text); }

.stat-num {
  --dh: 1.28em;                                /* tile height; the rolling column steps by this */
  --tile-bg: linear-gradient(180deg, #262c3b, #1b202c);
  --tile-line: rgba(255, 255, 255, .10);
  --tile-ink: var(--text);
  margin-top: clamp(20px, 2.6vw, 28px);
  font: 700 clamp(26px, 3vw, 38px)/1 "Space Grotesk", Inter, sans-serif;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--tile-ink);
}
.odo { display: inline-flex; align-items: flex-start; gap: .12em; height: var(--dh); }
.od {
  position: relative;
  display: block;
  flex: none;
  width: .78em;
  height: var(--dh);
  overflow: hidden;
  border-radius: .2em;
  border: 1px solid var(--tile-line);
  background: var(--tile-bg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -8px 12px -10px rgba(0, 0, 0, .55), 0 6px 12px -8px rgba(0, 0, 0, .6);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 12%, #000 88%, transparent 100%);
}
.od-col {
  display: block;
  transform: translateY(0);
  will-change: transform;
}
.od-col > i {
  display: block;
  height: var(--dh);
  line-height: var(--dh);
  font-style: normal;
  text-align: center;
}
.od-sep {
  display: flex;
  align-items: flex-end;
  height: var(--dh);
  padding: 0 .02em .14em;
  color: var(--brass);
  opacity: .9;
}

.stat-note {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font: 400 14px/1.5 Inter, system-ui, sans-serif;
}

/* ---------- small screens: stacked rows ---------- */
@media (max-width: 820px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-cell + .stat-cell::before {
    inset: 0 22px auto 22px;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-2) 22%, var(--line-2) 78%, transparent);
  }
  .stat-cell { padding: 24px 24px 22px; }
  .stat-num { margin-top: 16px; font-size: clamp(30px, 8.4vw, 38px); }
}
@media (max-width: 620px) {
  .stats { width: min(calc(100% - var(--gutter, 15px) * 2), var(--max)); }
}

@media (prefers-reduced-motion: reduce) {
  .od-col { transition: none !important; }
}

/* ---------- light theme ---------- */
html[data-theme="light"] .stats-grid {
  background:
    radial-gradient(90% 140% at 50% -30%, rgba(214, 162, 74, .16), transparent 62%),
    linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 40px 70px -50px rgba(20, 28, 48, .4);
}
html[data-theme="light"] .stat-head i {
  color: #9a6a12;
  border-color: rgba(185, 127, 20, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 8px 16px -12px rgba(20, 28, 48, .35);
}
html[data-theme="light"] .stats .section-heading h2 { color: #141A28; }
html[data-theme="light"] .stat-num {
  --tile-bg: linear-gradient(180deg, #F0F2F7, #E3E7EF);
  --tile-line: rgba(20, 28, 48, .14);
  --tile-ink: #141A28;                         /* black digits on the pale tiles */
}
html[data-theme="light"] .od {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .9), inset 0 -8px 12px -10px rgba(20, 28, 48, .25), 0 6px 12px -9px rgba(20, 28, 48, .35);
}
html[data-theme="light"] .od-sep { color: #B97F14; opacity: 1; }

/* on-screen diagnostics (?debug=stats) */
.stats-debug { display: grid; gap: 10px; padding: 22px 24px; border: 1px solid rgba(255, 120, 100, .45); border-radius: 16px; background: rgba(255, 90, 70, .08); color: var(--text); }
.stats-debug b { font: 600 16px/1.4 Inter, system-ui, sans-serif; }
.stats-debug p { margin: 0; color: var(--dim); font-size: 14px; line-height: 1.6; }
.stats-debug code { display: block; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .28); color: var(--brass-2); font: 12.5px/1.5 "JetBrains Mono", monospace; overflow-wrap: anywhere; }
.stats-debug small { color: var(--faint); font-size: 12px; }
