/* The light beam button: a dark call to action on a black page, with beams of light running round its border.
   The border, its bloom and the light and dust inside are canvases the script draws; here are the button, the words
   and the page. */
:root {
  --page: #000000;          /* the page */
  --face: #0c0c10;          /* the button, at the bottom */
  --face-top: #191920;      /* the button, at the top */
  --head: #ffffff;          /* the bright head of a beam */
  --tint: #a594ff;          /* the beam just behind the head */
  --tail: #38bdf8;          /* the colour the tail fades into */
  --glow: #cdc4ff;          /* the soft light inside, under the pointer */
  --dust: #fff3dc;          /* the specks of dust in the light */
  --done: #4ade80;          /* the ring when the workspace is ready */
  --text: #f5f5f7;          /* the words */
  --muted: rgba(245, 245, 247, 0.46);
  --radius: 16px;           /* the corners of the button */
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--text);
  font-family: 'Geist 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: 40px 16px;
}

.cta {
  display: grid;
  justify-items: center;
  gap: 22px;
}

/* ---------------------------------------------------------------- the button */
.beam {
  position: relative;
  display: inline-grid;
  place-items: center;
  height: 58px;
  padding: 0 30px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 560;
  letter-spacing: -0.012em;
  cursor: pointer;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* the face: dark glass with a lit top edge and a hairline all round */
.beam__face {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--face-top), var(--face) 62%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.7),
    0 22px 44px -18px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.6);
}

.beam__inside {
  position: absolute;
  left: 0;
  top: 0;
}

/* the beams on the border, and their bloom: both spill out of the button */
.beam__bloom,
.beam__rim {
  position: absolute;
  pointer-events: none;
}

.beam__bloom {
  z-index: 1;
  filter: blur(7px);
  mix-blend-mode: screen;
}

.beam__rim {
  z-index: 3;
}

/* the words: three of them in the same place, one shown at a time */
.beam__labels {
  position: relative;
  z-index: 2;
  display: grid;
}

.beam__label {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: nowrap;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.beam__label[aria-hidden='true'] {
  visibility: hidden;
  opacity: 0;
}

.beam__arrow,
.beam__check {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the arrow: a chevron that grows its stem and steps forward under the pointer */
.beam__stem {
  transform: scaleX(0);
  transform-origin: 2.5px 8px;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.beam__tip {
  transform: translateX(-3px);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@media (hover: hover) and (pointer: fine) {
  .beam:hover .beam__stem {
    transform: scaleX(1);
  }

  .beam:hover .beam__tip {
    transform: translateX(0);
  }
}

.beam:focus-visible .beam__stem {
  transform: scaleX(1);
}

.beam:focus-visible .beam__tip {
  transform: translateX(0);
}

.beam__check {
  color: var(--done);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.beam:focus-visible {
  outline: 1.5px solid rgba(255, 255, 255, 0.9);
  outline-offset: 6px;
}

html[data-using='pointer'] .beam:focus-visible {
  outline: none;
}

/* the line under the button: empty at rest, so its height is kept and nothing moves when it speaks */
.cta__note {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  text-align: center;
}

.cta__note span {
  display: inline-block;
}

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