/* The glass Enhance button with the progress on its edge. The glass is three layers inside one rounded box: two slow
   blurred colours at the bottom (.eb__tint), a frosted pane with a little grain over them (.eb__frost) and a soft
   light that follows the pointer (.eb__shine). An SVG laid on the edge draws the faint track, the comet and the
   progress; the words sit on top. The box (.eb__glass) is moved only by GSAP, its children only by CSS or GSAP. */
:root {
  --page: #000000;            /* the page */
  --violet: #8f7bff;          /* the first colour of the light */
  --cyan: #5fd8ff;            /* the second colour of the light */
  --ink: #f3f2f8;             /* the words */
  --muted: rgba(243, 242, 248, 0.78); /* the small words in the chip */
  --glass: rgba(255, 255, 255, 0.07); /* the frosted pane */
  --edge: rgba(255, 255, 255, 0.12);  /* the edge at rest */
  --success: #9ff0c8;         /* the check */
}

* {
  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 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

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

/* the light the button throws on the floor under it */
.eb__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 120%;
  height: 46px;
  margin: -14px 0 0 -60%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--violet) 60%, transparent), color-mix(in srgb, var(--cyan) 22%, transparent) 55%, transparent);
  filter: blur(14px);
  opacity: 0.32;
  pointer-events: none;
}

.eb__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;
}

.eb__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--cyan) 70%, white);
  outline-offset: 5px;
}

.eb__glass {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(80vw, 252px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.7),
    0 10px 24px -12px color-mix(in srgb, var(--violet) 70%, transparent),
    0 28px 56px -28px rgba(0, 0, 0, 1);
}

.eb__tint,
.eb__frost,
.eb__shine,
.eb__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

.eb__tint {
  background: #0b0a12;
}

.eb__blob {
  position: absolute;
  width: 62%;
  height: 170%;
  top: -35%;
  border-radius: 50%;
  filter: blur(20px);
  opacity: 0.46;
}

.eb__blob--a {
  left: -14%;
  background: var(--violet);
}

.eb__blob--b {
  left: 52%;
  background: var(--cyan);
  opacity: 0.26;
}

/* the frosted pane: lighter at the top, a 1px edge that catches the light above, a darker one below, and grain */
.eb__frost {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.28 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 52%, rgba(0, 0, 0, 0.22));
  background-size: 120px 120px, 100% 100%;
  background-color: var(--glass);
  backdrop-filter: blur(10px) saturate(1.4);
  -webkit-backdrop-filter: blur(10px) saturate(1.4);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    inset 0 -10px 18px -12px rgba(0, 0, 0, 0.6);
}

/* a wet highlight on the upper half of the glass */
.eb__frost::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 1px;
  height: 46%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0));
}

/* the light under the pointer */
.eb__shine {
  background: radial-gradient(90px 60px at var(--mx) var(--my), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 50%, transparent 72%);
  opacity: 0;
}

/* the reflection that crosses the glass at 100% */
.eb__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 38%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 255, 255, 0.05) 70%, transparent 100%);
  transform: translateX(-120%) skewX(-16deg);
}

.eb__edge {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.eb__edge path {
  fill: none;
  stroke-linecap: round;
}

.eb__track {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.eb__glow path {
  stroke: url(#eb-grad);
  stroke-width: 5;
}

.eb__done,
.eb__comet path {
  stroke: url(#eb-grad);
  stroke-width: 1.8;
}

.eb__comet path.eb__head {
  stroke: #ffffff;
  stroke-width: 2;
}

.eb__done {
  opacity: 0.7;
}

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

.eb__icon {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
}

.eb__icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.eb__spark {
  fill: var(--ink);
}

.eb__spark--s {
  fill: var(--cyan);
}

.eb__check {
  fill: none;
  stroke: var(--success);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

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

.eb__label {
  grid-area: 1 / 1;
  font-size: 16px;
  font-weight: 560;
  font-variation-settings: 'wdth' 104;
  letter-spacing: 0.005em;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

/* Enhancing shimmers: a light band slides through the letters (GSAP moves background-position) */
.eb__label--busy {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 38%, #ffffff 46%, var(--cyan) 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;
}

.eb__chip {
  flex: none;
  display: grid;
  place-items: center;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), 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.16), 0 1px 2px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.eb__chip-face {
  grid-area: 1 / 1;
  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;
}

/* before the script runs, only the rest state shows */
.eb__label + .eb__label,
.eb__chip-face + .eb__chip-face {
  opacity: 0;
}
