/* The Refresh button of a made-up analytics dashboard, Corvel, alone on white with the three values it refreshes.
   GSAP moves the button (width, lift, press), the arrow group, the clock hands, the label lines, the digit columns
   and the flash of each tile; the CSS never puts a transform on those elements. */
:root {
  --page: #ffffff;           /* the page */
  --ink: #14161c;            /* the words and the icon */
  --muted: #8a8f9c;          /* the small labels */
  --line: rgba(20, 22, 28, 0.09); /* the hairline borders */
  --pill-top: #ffffff;       /* the top of the button */
  --pill-bottom: #f5f6f9;    /* the bottom of the button */
  --accent: #4b5cf0;         /* the light of fresh data, the clock, the sparklines */
  --up: #1f8f5f;             /* a value that went up */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--page);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* the header strip: the values on the left, the button on the right */
.wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(612px, calc(100vw - 32px));
}

/* ---- the three values ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.tile {
  position: relative;
  overflow: hidden;
  height: 78px;
  padding: 11px 12px 10px;
  border-radius: 14px;
  background: linear-gradient(#ffffff, #fbfbfd);
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 2px rgba(20, 22, 28, 0.04),
    0 6px 16px -8px rgba(20, 22, 28, 0.1);
  display: grid;
  grid-template-rows: auto 1fr auto;
  transition: box-shadow 0.6s ease;
}
.tile.is-fresh {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent),
    0 1px 2px rgba(20, 22, 28, 0.04),
    0 8px 20px -8px color-mix(in srgb, var(--accent) 26%, transparent);
  transition-duration: 0.18s;
}

.tile__flash {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -50%;
  width: 200%;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--accent) 13%, transparent) 46%, color-mix(in srgb, var(--accent) 5%, transparent) 56%, transparent 78%);
}

.tile__label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.tile__value {
  position: relative;
  align-self: center;
  display: flex;
  font-size: 21px;
  font-weight: 620;
  font-variation-settings: "wdth" 96;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  height: 1.15em;
  overflow: hidden;
}

.tile__value > span { display: block; }

/* a digit is a column of 0 to 9; only its inner list moves */
.digit { position: relative; height: 1.15em; overflow: hidden; }
.digit__list { display: flex; flex-direction: column; }
.digit__list i { font-style: normal; height: 1.15em; display: block; }

.tile__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tile__delta {
  position: relative;
  height: 14px;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--up);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tile__delta > span { display: flex; align-items: center; gap: 2px; height: 14px; }
.tile__delta svg { width: 8px; height: 8px; fill: currentColor; }

.spark { width: 40px; height: 16px; flex: none; overflow: visible; }
.spark__line { fill: none; stroke: var(--accent); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.spark__fill { fill: color-mix(in srgb, var(--accent) 12%, transparent); stroke: none; }

/* ---- the button ---- */
.slot {
  flex: none;
  width: 214px;
  display: flex;
  justify-content: flex-end;
}

.refresh {
  position: relative;
  height: 60px;
  width: 132px;
  border: 0;
  border-radius: 30px;
  background: linear-gradient(var(--pill-top), var(--pill-bottom));
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  outline: none;
  box-shadow:
    0 0 0 1px rgba(20, 22, 28, 0.1),
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(20, 22, 28, 0.04),
    0 1px 2px rgba(20, 22, 28, 0.06),
    0 4px 10px -2px rgba(20, 22, 28, 0.07),
    0 14px 28px -12px rgba(20, 22, 28, 0.16);
  transition: box-shadow 0.3s ease;
}
.refresh:focus-visible {
  box-shadow:
    0 0 0 1px rgba(20, 22, 28, 0.1),
    0 0 0 4px color-mix(in srgb, var(--accent) 28%, transparent),
    0 4px 10px -2px rgba(20, 22, 28, 0.07);
}
.refresh.is-hot {
  box-shadow:
    0 0 0 1px rgba(20, 22, 28, 0.13),
    inset 0 1px 0 #ffffff,
    inset 0 -1px 0 rgba(20, 22, 28, 0.04),
    0 2px 3px rgba(20, 22, 28, 0.07),
    0 8px 16px -4px rgba(20, 22, 28, 0.09),
    0 20px 34px -14px rgba(20, 22, 28, 0.2);
}
.refresh.is-down {
  box-shadow:
    0 0 0 1px rgba(20, 22, 28, 0.13),
    inset 0 1px 2px rgba(20, 22, 28, 0.06),
    0 1px 1px rgba(20, 22, 28, 0.06),
    0 3px 8px -4px rgba(20, 22, 28, 0.1);
}

.refresh__halo {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent), 0 0 18px 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

/* a soft light on the top half of the button */
.refresh__sheen {
  position: absolute;
  inset: 1px 10px auto;
  height: 24px;
  border-radius: 30px 30px 14px 14px;
  background: linear-gradient(rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.refresh__in {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 0 19px;
  overflow: hidden;
  border-radius: inherit;
}

.ic { width: 20px; height: 20px; flex: none; overflow: visible; }
.ic__arc, .ic__head, .ic__hand {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ic__hand { stroke: var(--accent); }
.refresh.is-clock .ic__arc { stroke: var(--accent); }
.ic__arc { transition: stroke 0.4s ease; }

.lab {
  position: relative;
  flex: 1;
  height: 22px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
}
.lab__line {
  position: absolute;
  left: 0;
  top: 0;
  height: 22px;
  line-height: 22px;
  white-space: nowrap;
  display: flex;
}
.lab__line .muted { color: var(--muted); font-weight: 500; }
/* the label shimmers while it syncs */
.lab__line.is-sync {
  background: linear-gradient(100deg, var(--ink) 0%, var(--ink) 38%, color-mix(in srgb, var(--accent) 70%, #ffffff) 50%, var(--ink) 62%, var(--ink) 100%);
  background-size: 260% 100%;
  background-position: var(--sh, 100%) 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lab .digit { height: 22px; }
.lab .digit__list i { height: 22px; }

.measure {
  position: absolute;
  visibility: hidden;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}
.ghost path { fill: #14161c; stroke: #ffffff; stroke-width: 1.4; stroke-linejoin: round; }

/* the phone: the values above, the button below, in the middle */
@media (max-width: 640px) {
  .wrap { flex-direction: column; gap: 22px; width: min(420px, calc(100vw - 32px)); }
  .tiles { width: 100%; gap: 8px; }
  .tile { height: 74px; padding: 10px 10px 9px; }
  .tile__value { font-size: 19px; }
  .spark { width: 30px; }
  .slot { width: 100%; justify-content: center; }
}

@media (max-width: 360px) {
  .tile__value { font-size: 17px; }
  .spark { display: none; }
}
