/* The analytics app loader: the loading card of a made-up analytics app (Quorra) on a warm white page. The points
   fall onto the grid like drops, a line sews them, the area fills, the number rolls and the months appear. */
:root {
  --page: #eeece7;          /* the page */
  --page-light: #f8f7f3;    /* the soft light on the page */
  --card: #fbfaf8;          /* the body of the card */
  --ink: #15161a;           /* the words, the digits, the points before they are sewn */
  --muted: #7a7b80;         /* the small words */
  --faint: #b9b9bd;         /* the grid labels and the digits still loading */
  --line: rgba(21, 22, 26, 0.07); /* the grid and the thin lines */
  --accent: #4a57f2;        /* indigo: the line, the area, the sewn points, the growth pill */
  --accent-soft: rgba(74, 87, 242, 0.1); /* the pill and the halo */
  --rim: #ffffff;           /* the light the edge of the card catches */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(70% 60% at 30% 16%, var(--page-light), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: min(4vw, 4vh);
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the card */
.card {
  --pad: clamp(14px, min(4.8vw, 4.4vh), 24px);
  --lx: 24%;
  --ly: 0%;
  --lit: 0.55;
  position: relative;
  width: min(420px, 100%);
  padding: var(--pad) var(--pad) calc(var(--pad) * 0.8);
  border-radius: clamp(18px, min(5vw, 5vh), 24px);
  background: linear-gradient(180deg, #fefefd, var(--card) 40%);
  box-shadow:
    0 0 0 1px rgba(21, 22, 26, 0.06),
    0 1px 1px rgba(21, 22, 26, 0.04),
    0 4px 8px -2px rgba(21, 22, 26, 0.05),
    0 18px 32px -12px rgba(21, 22, 26, 0.12),
    0 44px 70px -30px rgba(21, 22, 26, 0.18);
  opacity: 0;
}

.card__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(240px 180px at var(--lx) var(--ly), rgba(255, 255, 255, var(--lit)), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 30%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 3;
}

.card__shine {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(320px 220px at var(--lx) var(--ly), rgba(255, 255, 255, calc(var(--lit) * 0.7)), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.card > *:not(.card__rim):not(.card__shine) {
  position: relative;
  z-index: 1;
}

/* ---------------------------------------------------------------- the head */
.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(12.5px, min(3.6vw, 3.4vh), 14.5px);
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: clamp(18px, min(5vw, 4.6vh), 22px);
  height: auto;
  fill: var(--ink);
  stroke: none;
}

.brand__mark path {
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 6px;
  border-radius: 99px;
  background: rgba(21, 22, 26, 0.035);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(9px, min(2.6vw, 2.5vh), 10.5px);
  letter-spacing: 0.01em;
  color: var(--muted);
}

.status__icon {
  width: 12px;
  height: 12px;
  overflow: visible;
}

.status__track {
  fill: none;
  stroke: rgba(21, 22, 26, 0.1);
  stroke-width: 1.6;
}

.status__arc {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.status__check {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}

.status__slot {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  height: 1.3em;
  line-height: 1.3em;
}

.status__text {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.status__text + .status__text {
  opacity: 0;
}

/* ---------------------------------------------------------------- the number */
.kpi {
  margin-top: clamp(12px, min(4vw, 3.6vh), 22px);
}

.kpi__label {
  margin: 0;
  font-size: clamp(11px, min(3.1vw, 3vh), 12.5px);
  color: var(--muted);
  font-weight: 460;
}

.kpi__row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.value {
  display: inline-flex;
  font-size: clamp(30px, min(10vw, 9.4vh), 44px);
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}

.digit {
  position: relative;
  display: inline-block;
  height: 1.2em;
  overflow: hidden;
  -webkit-mask: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
  mask: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

.digit__nudge,
.digit__col {
  display: block;
}

.digit__col span {
  display: block;
  height: 1.2em;
  line-height: 1.2em;
}

.comma {
  display: inline-block;
  line-height: 1.2em;
  margin-right: -0.04em;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px 4px 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(74, 87, 242, 0.14), 0 1px 0 rgba(255, 255, 255, 0.8);
  color: var(--accent);
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(10.5px, min(3vw, 2.9vh), 12px);
  font-weight: 560;
  opacity: 0;
}

.pill__arrow {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the chart */
.chart {
  position: relative;
  margin-top: clamp(8px, min(3vw, 2.6vh), 16px);
  touch-action: pan-y;
}

.chart__svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.grid line {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.grid line.grid__base {
  stroke: rgba(21, 22, 26, 0.12);
  stroke-dasharray: none;
}

.grid text {
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: 7.5px;
  fill: var(--faint);
}

#q-area stop {
  stop-color: var(--accent);
}

.line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.glint {
  fill: none;
  stroke: #fff;
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0;
}

.shadow {
  fill: #15161a;
  opacity: 0;
}

.pt__ring {
  fill: #fff;
  stroke: var(--ink);
  stroke-width: 1.4;
  transition: stroke 0.35s ease;
}

.pt.is-sewn .pt__ring {
  stroke: var(--accent);
}

.pt__core {
  fill: var(--accent);
}

.cross {
  opacity: 0;
}

.cross__line {
  stroke: rgba(21, 22, 26, 0.28);
  stroke-width: 1;
  stroke-dasharray: 2 2.5;
}

.marker {
  opacity: 0;
  pointer-events: none;
}

.marker__halo {
  fill: var(--accent-soft);
  stroke: rgba(74, 87, 242, 0.25);
  stroke-width: 1;
}

.marker__dot {
  fill: var(--accent);
  stroke: #fff;
  stroke-width: 1.6;
}

/* the tooltip: GSAP moves .tip, the CSS centres the box above the point */
.tip {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

.tip__box {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  transform: translate(-50%, calc(-100% - 12px));
  padding: 5px 9px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 6px 14px -4px rgba(21, 22, 26, 0.35);
}

.tip__m {
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tip__v {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------- the months */
.months {
  height: 0;
  overflow: hidden;
}

.months__row {
  position: relative;
  height: clamp(20px, min(6vw, 5.6vh), 26px);
}

.month {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
}

.month span {
  display: block;
  font-family: 'Geist Mono Variable', 'Geist Mono', ui-monospace, monospace;
  font-size: clamp(8px, min(2.4vw, 2.3vh), 10px);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.month.is-on span {
  color: var(--ink);
}

/* ---------------------------------------------------------------- the pointer on its own */
.cursor {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: var(--ink);
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
  opacity: 0;
  z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
  .pt__ring {
    transition: none;
  }
}
