/* The tip button: a glass jar and a green button on a white page. The script draws the jar, the pile of coins and
   the coins in the air in one SVG over the whole component. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1d2a25;           /* the words */
  --muted: #7d8a84;
  --button: #1f5c46;        /* the button */
  --button-ink: #fbf5e6;
  --gold: #f2b632;          /* the coins */
  --gold-dark: #c98a12;
  --glass: #c9d6d1;         /* the jar */
}

* {
  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: 'Afacad 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;
}

.tip {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.tip__total {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
}

.tip__roll {
  display: inline-block;
  height: 1.25em;
  overflow: hidden;
  vertical-align: bottom;
  color: var(--ink);
  font-size: 30px;
  font-weight: 700;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}

.tip__roll span {
  display: inline-block;
}

/* the jar's place: the drawing over the whole component paints it here */
.tip__jar {
  width: 168px;
  height: 196px;
}

/* the drawing covers the whole component and more, for the coins in the air */
.tip__art {
  position: absolute;
  left: -60px;
  top: -60px;
  width: calc(100% + 120px);
  height: calc(100% + 120px);
  overflow: visible;
  pointer-events: none;
}

.tip__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 26px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 19px;
  font-weight: 650;
  cursor: pointer;
  box-shadow: 0 12px 24px -14px rgba(20, 60, 45, 0.7);
  -webkit-tap-highlight-color: transparent;
}

/* the coin on the button, where every coin starts from */
.tip__coin {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #ffe08a, var(--gold) 55%, var(--gold-dark));
  box-shadow: inset 0 0 0 2.5px color-mix(in srgb, var(--gold-dark) 70%, transparent);
}

.tip__btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

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

/* ---------------------------------------------------------------- the drawing */
.tip__glass {
  fill: color-mix(in srgb, var(--glass) 22%, transparent);
  stroke: var(--glass);
  stroke-width: 3;
}

.tip__lip {
  fill: none;
  stroke: var(--glass);
  stroke-width: 6;
  stroke-linecap: round;
}

.tip__gleam {
  fill: none;
  stroke: #ffffff;
  stroke-width: 5;
  stroke-linecap: round;
  opacity: 0.8;
}

.tip__label {
  fill: color-mix(in srgb, var(--glass) 70%, var(--ink));
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.tip__face {
  fill: var(--gold);
  stroke: var(--gold-dark);
  stroke-width: 1.4;
}

.tip__edge {
  fill: var(--gold-dark);
}

.tip__plus {
  fill: var(--button);
  font-size: 18px;
  font-weight: 700;
}
