/* The Generate report button with the growing bars. One rounded box (.gr__body, moved only by GSAP) holds a clip
   layer with the ink base, the violet layer of the done state, the SVG bar chart, the pointer light and the
   reflection; over it the rim that catches the light and the row with the icon, the words and the chip or arrow. */
:root {
  --page: #ffffff;              /* the page */
  --pill: #15161c;              /* the body of the button */
  --ink: #f5f5f8;               /* the words */
  --muted: rgba(245, 245, 248, 0.58); /* the small words */
  --accent: #6c5cff;            /* the bars and the done state */
  --accent-hi: #b9b0ff;         /* the top of the bars */
  --done: #5b4bf5;              /* the pill when the report is ready */
  --edge: rgba(255, 255, 255, 0.1);  /* the edge of the pill */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

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

.gr {
  position: relative;
  display: grid;
  place-items: center;
}

/* the soft violet light the button throws on the white floor */
.gr__floor {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 92%;
  height: 34px;
  margin: -18px 0 0 -46%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 60%, transparent), transparent);
  filter: blur(14px);
  opacity: 0.12;
  pointer-events: none;
}

.gr__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.gr__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
}

.gr__body {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(86vw, 312px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(16, 14, 40, 0.18),
    0 4px 10px -4px rgba(16, 14, 40, 0.28),
    0 18px 34px -16px rgba(30, 20, 90, 0.38),
    0 34px 60px -34px rgba(30, 20, 90, 0.4);
}

.gr__clip,
.gr__base,
.gr__done,
.gr__shine,
.gr__sweep,
.gr__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.gr__clip,
.gr__sweep {
  overflow: hidden;
}

/* ink: lighter at the top, a little darker at the bottom */
.gr__base {
  background:
    radial-gradient(120% 140% at 85% 120%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 50%, rgba(0, 0, 0, 0.2)),
    var(--pill);
}

/* the violet of the ready report, faded in over the ink */
.gr__done {
  opacity: 0;
  background:
    radial-gradient(90% 120% at 20% -10%, rgba(255, 255, 255, 0.28), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--done) 82%, white), var(--done) 55%, color-mix(in srgb, var(--done) 80%, black));
}

.gr__chart {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gr__axis {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
}

.gr__slots rect {
  fill: rgba(255, 255, 255, 0.07);
}

.gr__bars rect {
  fill: url(#gr-bar);
}

.gr__glows rect {
  fill: var(--accent);
}

/* the small cap that sits for a moment on top of the bar that has just grown */
.gr__caps rect {
  fill: #ffffff;
}

.gr__pct {
  fill: var(--ink);
  font-size: 10.5px;
  font-weight: 580;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' 92;
  letter-spacing: 0.02em;
}

/* the light under the pointer */
.gr__shine {
  background: radial-gradient(110px 70px at var(--mx) var(--my), rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04) 50%, transparent 72%);
  opacity: 0;
}

/* the reflection that crosses the pill when the report is ready */
.gr__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.32) 50%, rgba(255, 255, 255, 0.05) 70%, transparent 100%);
}

/* the 1px edge, the light on the top lip and the shadow on the bottom one */
.gr__rim {
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    inset 0 -12px 18px -14px rgba(0, 0, 0, 0.55);
}

.gr__rim::after {
  content: '';
  position: absolute;
  left: 14%;
  right: 14%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  opacity: 0.6;
}

.gr__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 10px 0 12px;
  gap: 11px;
}

.gr__icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}

.gr__icon svg {
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gr__mini-axis {
  stroke: rgba(255, 255, 255, 0.34);
  stroke-width: 1.4;
}

.gr__mini {
  fill: var(--accent-hi);
}

.gr__mini + .gr__mini {
  fill: color-mix(in srgb, var(--accent-hi) 70%, var(--accent));
}

.gr__mini + .gr__mini + .gr__mini {
  fill: #ffffff;
}

.gr__doc {
  stroke: #ffffff;
  stroke-width: 1.7;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.gr__doc--line {
  stroke-width: 1.5;
  stroke: rgba(255, 255, 255, 0.8);
}

.gr__labels {
  flex: 1;
  display: grid;
  text-align: left;
  min-width: 0;
}

.gr__label {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

.gr__main {
  font-size: 16px;
  line-height: 1.15;
  font-weight: 580;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.003em;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  .gr__btn:hover .gr__main {
    font-variation-settings: 'wdth' 110;
  }
}

/* Generating shimmers: a band of light slides through the letters (GSAP moves background-position) */
.gr__main--busy {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 38%, #ffffff 46%, var(--accent-hi) 50%, #ffffff 54%, var(--ink) 62%, var(--ink) 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.gr__sub {
  margin-top: 2px;
  font-size: 11.5px;
  line-height: 1.2;
  font-weight: 480;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.gr__sub--done {
  color: rgba(255, 255, 255, 0.78);
}

/* the month rolls: the old one goes up, the new one comes from below */
.gr__roll {
  position: relative;
  display: inline-grid;
  vertical-align: baseline;
  overflow: hidden;
  clip-path: inset(0 -2px);
  height: 1.2em;
  line-height: 1.2em;
  min-width: 1.7em;
  color: var(--ink);
}

.gr__roll > span {
  grid-area: 1 / 1;
  display: block;
  line-height: 1.2em;
}

.gr__end {
  flex: none;
  display: grid;
  place-items: center end;
}

.gr__chip,
.gr__go {
  grid-area: 1 / 1;
}

.gr__chip {
  display: grid;
  place-items: center;
  min-width: 68px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.gr__chip-face {
  font-size: 12px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' 92;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* the white disc with the arrow of Open report */
.gr__go {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #ecebff);
  box-shadow: 0 1px 1px rgba(20, 10, 80, 0.25), 0 6px 14px -6px rgba(20, 10, 80, 0.6), inset 0 -1px 0 rgba(60, 40, 180, 0.15);
  opacity: 0;
}

.gr__go svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--done);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* before the script runs, only the rest state shows */
.gr__label + .gr__label {
  opacity: 0;
}
