/* The dandelion button: a graphite pill on a black page, with a dandelion clock in its round right end. The seed
   head, its stalk and the seeds in flight are drawn by script.js on two canvases (their colours come from here): a
   small one in the button for the head, and one over the whole page for the seeds blown away. The pill, the words
   and the states are CSS. */
:root {
  --page: #000000;          /* the page */
  --pill: #18191b;          /* the pill, at its top */
  --pill-deep: #0d0e0f;     /* the pill, at its foot */
  --rim: #2b2d31;           /* the hairline edge of the pill */
  --rim-lit: #3d4045;       /* the edge with the pointer over it */
  --ink: #f2efe8;           /* the words */
  --fluff: #f4f2ec;         /* the pappus of every seed, the white fluff, where the light falls on it */
  --beak: #d9d8cf;          /* the long thin beak that carries the pappus */
  --achene: #a88b5e;        /* the achene, the seed itself, a warm olive brown */
  --stalk: #7f9a68;         /* the stalk and the little leaves bent down under the head */
  --receptacle: #e3dcbd;    /* the receptacle, the pitted dome the seeds grow from */
  --focus: #f2efe8;         /* the ring of the keyboard's focus */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Newsreader Variable', 'Newsreader', Georgia, 'Times New Roman', 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: 72px 16px;
}

.wish {
  display: grid;
  justify-items: center;
}

/* ---------------------------------------------------------------- the pill */
.wish__btn {
  position: relative;
  display: block;
  width: min(272px, calc(100vw - 32px));
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background:
    radial-gradient(70% 120% at 22% 0%, rgba(255, 255, 255, 0.045), transparent 70%),
    linear-gradient(180deg, var(--pill), var(--pill-deep));
  /* a hairline edge, a lit rim along the top and a dark one along the foot */
  box-shadow:
    inset 0 0 0 1px var(--rim),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), box-shadow 240ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .wish__btn:hover {
    box-shadow:
      inset 0 0 0 1px var(--rim-lit),
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.6);
  }
}

.wish__btn:active {
  transform: scale(0.97);
}

.wish__btn[aria-disabled='true'] {
  cursor: default;
}

.wish__btn[aria-disabled='true']:active {
  transform: none;
}

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

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

/* the head: a canvas a little larger than the round end of the pill, centred on it, so the fluff stirred by the
   breeze is never cut */
.wish__head {
  position: absolute;
  right: -11px;
  top: -13px;
  width: 84px;
  height: 84px;
  pointer-events: none;
}

/* the seeds blown away fly over the whole page, never under the pointer */
.wish__air {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the words */
/* they stand in the pill left of the head, so the seeds, which fly up and to the right, never cross them */
.wish__label {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  right: 62px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.wish__face {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 1px;
  font-size: 17.5px;
  font-weight: 460;
  letter-spacing: 0.002em;
  line-height: 1;
  white-space: nowrap;
}

.wish__face[data-face='done'] {
  opacity: 0;
}

.wish__tick {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: -2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@media (prefers-reduced-motion: reduce) {
  .wish__btn,
  .wish__btn:active {
    transform: none;
  }

  .wish__btn:active {
    filter: brightness(1.15);
  }
}
