/* The request the bill button in porcelain with the gold rim. A warm linen table lit by a window on the upper left,
   with a fine grain, and in the middle one pill of glazed white porcelain. Inside, layered in one rounded box
   (.pb__body, moved only by GSAP): the glaze, the window's reflection, the light under the pointer, the bright sweep
   of the success, the SVG with the gold line (pale and unfired at rest, painted and fired when it works), the two
   brush tips, the edge light that turns to the pointer and the porcelain's rolled edge. Then the row: the small well
   with the cobalt bill, the words and the chip with the total. */
:root {
  --linen: #ebe5da;           /* the tablecloth */
  --window: #fffdf8;          /* the light from the window */
  --porcelain: #fbfaf6;       /* the glaze */
  --porcelain-low: #e6e1d6;   /* the glaze turning away from the light */
  --cobalt: #24408f;          /* the cobalt of the bill, the check and the fired chip */
  --gold: #b68a3f;            /* the gold of the rim */
  --gold-hi: #f3deaa;         /* the gold where it catches the light */
  --ink: #1f2433;             /* the words */
  --muted: rgba(31, 36, 51, 0.54); /* the small line under the words */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--linen);
  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;
}

/* the table: window light from the upper left, a soft falloff below, a fine grain like linen */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(80vw, 640px) min(50vh, 360px) at 34% 30%, color-mix(in srgb, var(--window) 85%, transparent), transparent 70%),
    radial-gradient(min(120vw, 900px) min(70vh, 520px) at 50% 120%, rgba(150, 125, 90, 0.2), transparent 70%),
    linear-gradient(180deg, #efeae0, var(--linen) 60%, #e3dccf);
}

.stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  background:
    repeating-linear-gradient(0deg, rgba(120, 100, 70, 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 100, 70, 0.02) 0 1px, transparent 1px 3px);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.6;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.18 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

.pb {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

/* the shadow the porcelain throws on the linen, long towards the lower right */
.pb__shadow {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 96%;
  height: 26px;
  margin: -20px 0 0 -46%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(70, 52, 28, 0.34), rgba(70, 52, 28, 0.1) 60%, transparent);
  filter: blur(9px);
  pointer-events: none;
}

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

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

.pb__body {
  --mx: 30%;
  --my: 30%;
  --ea: 320deg;
  position: relative;
  display: block;
  width: min(86vw, 324px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 0 0 0.5px rgba(80, 64, 40, 0.16),
    0 1px 1px rgba(80, 60, 30, 0.14),
    0 4px 8px -4px rgba(80, 60, 30, 0.2),
    0 14px 26px -14px rgba(80, 60, 30, 0.34),
    0 30px 50px -30px rgba(80, 60, 30, 0.4);
}

.pb__glaze,
.pb__window,
.pb__shine,
.pb__sweep,
.pb__edge,
.pb__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* the glaze: bright where the window lights it, a cooler grey as it turns under, a faint warmth in the body */
.pb__glaze {
  background:
    radial-gradient(120% 140% at 30% 0%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 55%),
    radial-gradient(90% 120% at 80% 120%, rgba(190, 196, 210, 0.35), transparent 60%),
    linear-gradient(180deg, var(--porcelain) 0%, #f5f2ea 48%, var(--porcelain-low) 100%);
}

/* the window's reflection on the glaze: two soft panes split by a mullion; GSAP slides the pane with the pointer */
.pb__window-pane {
  position: absolute;
  top: 5px;
  left: 14%;
  width: 34%;
  height: 16px;
  border-radius: 10px 10px 6px 6px;
  background:
    linear-gradient(90deg, transparent 0 47%, rgba(255, 255, 255, 0) 47% 53%, transparent 53%),
    linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.35));
  -webkit-mask: linear-gradient(90deg, #000 0 46%, transparent 46% 54%, #000 54%);
  mask: linear-gradient(90deg, #000 0 46%, transparent 46% 54%, #000 54%);
  filter: blur(0.8px);
  opacity: 1;
}

/* the light under the pointer, a warm bloom in the glaze */
.pb__shine {
  background: radial-gradient(120px 70px at var(--mx) var(--my), rgba(255, 255, 255, 0.85), rgba(255, 250, 238, 0.25) 45%, transparent 72%);
  mix-blend-mode: soft-light;
  opacity: 0;
}

/* the bright sweep across the glaze when the gold is fired */
.pb__sweep-band {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 38%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.95) 50%, transparent);
  opacity: 0;
}

/* the gold line (its paths are measured by the script) */
.pb__gold {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

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

/* unfired: a pale line of gold paste, matte and thin */
.pb__ghost {
  stroke: color-mix(in srgb, var(--gold) 34%, #d8cdb8);
  stroke-width: 1;
  opacity: 0.75;
}

.pb__line {
  stroke: url(#pb-gold);
  stroke-width: 1.6;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1;
}

.pb__fired {
  filter: drop-shadow(0 0.5px 0 rgba(255, 255, 255, 0.9)) drop-shadow(0 -0.5px 0 rgba(110, 78, 30, 0.25));
}

/* the glint that runs round the fired gold once */
.pb__glint {
  stroke: #fffaf0;
  stroke-width: 2;
  stroke-dasharray: 0.07 0.93;
  filter: drop-shadow(0 0 2.5px rgba(255, 226, 160, 0.95)) drop-shadow(0 0 6px rgba(230, 180, 90, 0.6));
  opacity: 0;
}

/* the gilder's brush tips: a small bright bead of wet gold where the line is being painted */
.pb__tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fffbef, rgba(246, 222, 160, 0.9) 35%, rgba(214, 170, 90, 0.35) 65%, transparent);
  pointer-events: none;
  opacity: 0;
}

/* the edge light: a white arc on the porcelain's edge, turned towards the pointer (--ea) */
.pb__edge {
  z-index: 4;
  padding: 1px;
  background: conic-gradient(from calc(var(--ea) - 55deg), transparent 0deg, rgba(255, 255, 255, 1) 55deg, transparent 110deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
}

/* the rolled edge of the porcelain: bright lip on top, a soft grey where it turns under */
.pb__rim {
  z-index: 4;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    inset 0 -1px 0 rgba(120, 110, 95, 0.22),
    inset 0 -10px 14px -10px rgba(110, 100, 90, 0.28);
}

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

/* the well: a small dish pressed into the porcelain, holding the cobalt bill */
.pb__well {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, #ffffff, #f1ede5 70%, #e4dfd4);
  box-shadow:
    inset 0 2px 3px rgba(100, 85, 60, 0.22),
    inset 0 -1px 0 rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.9);
}

.pb__well-face {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.pb__well-face > svg {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
  overflow: visible;
}

.pb__bill-paper {
  fill: rgba(255, 255, 255, 0.7);
  stroke: var(--cobalt);
  stroke-width: 1.45;
  stroke-linejoin: round;
}

.pb__bill-ln {
  fill: none;
  stroke: var(--cobalt);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

.pb__check path {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.pb__check {
  opacity: 0;
}

/* cobalt glaze in the well once the bill is on its way */
.pb__well::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 50% 60%, #3556ad, var(--cobalt) 70%, #172c66);
  box-shadow: inset 0 -1px 2px rgba(10, 20, 60, 0.45), 0 1px 2px rgba(20, 40, 100, 0.3);
  transform: scale(var(--dot, 0));
  opacity: var(--dot-o, 0);
}

.pb__well-face {
  z-index: 1;
}

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

.pb__state {
  grid-area: 1 / 1;
  display: grid;
  gap: 1px;
  min-width: 0;
}

.pb__state + .pb__state {
  opacity: 0;
}

.pb__title {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 16.5px;
  font-weight: 560;
  font-variation-settings: 'opsz' 24;
  letter-spacing: -0.005em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* while it works the words catch the gold (GSAP moves background-position) */
.pb__title--busy {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 36%, #b68a3f 44%, #f0d89a 50%, #b68a3f 56%, var(--ink) 64%, var(--ink) 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.pb__sub {
  font-size: 11.5px;
  font-weight: 470;
  font-variation-settings: 'wdth' 96;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the chip: the total in a shallow porcelain dish; on hover the share per guest slides in; fired, it turns cobalt */
.pb__chip {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  min-width: 78px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: linear-gradient(180deg, #efebe3, #f8f6f1);
  box-shadow:
    inset 0 1px 2px rgba(100, 85, 60, 0.2),
    inset 0 -1px 0 rgba(255, 255, 255, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.9);
  overflow: hidden;
}

.pb__chip > * {
  grid-area: 1 / 1;
  white-space: nowrap;
}

.pb__chip-glaze {
  grid-area: auto;
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, #3253a6, var(--cobalt) 60%, #1b3170);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), inset 0 -1px 1px rgba(10, 20, 60, 0.4);
  clip-path: inset(0 100% 0 0 round 999px);
}

.pb__chip-main,
.pb__chip-each {
  position: relative;
  font-size: 12.5px;
  font-weight: 620;
  font-variation-settings: 'wdth' 96;
  letter-spacing: 0.01em;
  color: var(--cobalt);
  font-variant-numeric: tabular-nums;
}

.pb__chip-each {
  font-weight: 560;
  opacity: 0;
}

@media (max-width: 380px) {
  .pb__title {
    font-size: 15.5px;
  }
  .pb__chip {
    min-width: 72px;
    padding: 0 9px;
  }
  .pb__row {
    gap: 9px;
  }
}
