/* The call the waiter button with the wait that shortens. A warm dark room (a low lamp behind, a little grain), and
   in the middle one pill of smoked lacquer with a brass edge. Inside, layered in one rounded box (.cw__body, moved
   only by GSAP): the lacquer fill, a warm light that grows from the disc as the waiter comes closer, the light under
   the pointer, the reflection that crosses at the end and the lacquer's edges on top. Then the row: the disc (bell,
   initial, ring, check), two lines of words and the chip with the wait. */
:root {
  --page: #0d0a08;            /* the room */
  --lamp: #3a2414;            /* the low lamp behind the button */
  --brass: #dcb36d;           /* the brass: edge, ring, bell */
  --amber: #f2a057;           /* the warm light of the call */
  --lacquer: #1a1512;         /* the button's smoked lacquer */
  --ink: #f6efe6;             /* the words */
  --muted: rgba(246, 239, 230, 0.58); /* the small line under the words */
  --avatar-a: #c9714a;        /* the waiter's disc, first colour */
  --avatar-b: #8a3f2b;        /* the waiter's disc, second colour */
}

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

/* the room: a low warm lamp behind the button and a fine grain over everything */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(70vw, 520px) min(46vh, 320px) at 50% 46%, color-mix(in srgb, var(--lamp) 85%, transparent), transparent 72%),
    radial-gradient(min(120vw, 900px) min(80vh, 600px) at 50% 120%, rgba(60, 36, 20, 0.35), transparent 70%),
    var(--page);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  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.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 0.9 0 0 0 0 0.8 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

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

/* the warm light the button throws on the table under it */
.cw__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 110%;
  height: 44px;
  margin: -16px 0 0 -55%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--amber) 55%, transparent), color-mix(in srgb, var(--brass) 18%, transparent) 55%, transparent);
  filter: blur(14px);
  opacity: 0.22;
  pointer-events: none;
}

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

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

.cw__body {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: block;
  width: min(86vw, 304px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.8),
    0 8px 18px -10px rgba(0, 0, 0, 0.9),
    0 24px 48px -24px rgba(0, 0, 0, 1),
    0 12px 30px -18px color-mix(in srgb, var(--amber) 40%, transparent);
}

.cw__fill,
.cw__warm,
.cw__shine,
.cw__sweep,
.cw__lacquer {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* smoked lacquer: a deep fill, lighter at the top */
.cw__fill {
  background:
    linear-gradient(180deg, rgba(255, 240, 220, 0.09), rgba(255, 240, 220, 0.015) 50%, rgba(0, 0, 0, 0.25)),
    var(--lacquer);
}

/* the warm light that spreads from the disc as the waiter comes closer (GSAP scales it) */
.cw__warm-light {
  position: absolute;
  left: -30px;
  top: -40%;
  width: 150px;
  height: 180%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--amber) 42%, transparent), color-mix(in srgb, var(--amber) 14%, transparent) 55%, transparent);
  transform-origin: 30px 50%;
  opacity: 0;
}

/* the light under the pointer */
.cw__shine {
  background: radial-gradient(100px 64px at var(--mx) var(--my), rgba(255, 228, 190, 0.16), rgba(255, 228, 190, 0.04) 50%, transparent 72%);
  opacity: 0;
}

/* the reflection that crosses the lacquer when the waiter arrives */
.cw__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  background: linear-gradient(100deg, transparent 0%, rgba(255, 236, 205, 0.05) 30%, rgba(255, 236, 205, 0.3) 50%, rgba(255, 236, 205, 0.05) 70%, transparent 100%);
  transform: translateX(-140%) skewX(-16deg);
}

/* the edges: a brass hairline that catches the light at the top and goes dark at the bottom, and a wet highlight */
.cw__lacquer {
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brass) 26%, transparent),
    inset 0 1px 0 color-mix(in srgb, var(--brass) 70%, white),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.7);
}

.cw__lacquer::after {
  content: '';
  position: absolute;
  left: 9%;
  right: 9%;
  top: 1px;
  height: 44%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 240, 220, 0.09), rgba(255, 240, 220, 0));
}

.cw__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 9px 0 8px;
  gap: 11px;
}

/* the disc on the left: bell at rest, then the waiter's initial with the ring of the wait, then the check */
.cw__disc {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.cw__disc > * {
  grid-area: 1 / 1;
  position: relative;
}

.cw__disc-plate {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 236, 205, 0.14), transparent 60%),
    linear-gradient(180deg, #2a221c, #15110e);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brass) 22%, transparent),
    inset 0 1px 0 rgba(255, 236, 205, 0.22),
    0 2px 6px rgba(0, 0, 0, 0.55);
}

.cw__ring {
  width: 44px;
  height: 44px;
  overflow: visible;
}

.cw__ring circle {
  fill: none;
  stroke-width: 1.5;
}

.cw__ring-track {
  stroke: rgba(255, 236, 205, 0);
}

.cw__ring-done {
  opacity: 0;
  stroke: var(--brass);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--amber) 70%, transparent));
}

.cw__bell {
  width: 24px;
  height: 24px;
  overflow: visible;
}

.cw__dome {
  fill: var(--brass);
}

.cw__dome-shine {
  fill: none;
  stroke: rgba(255, 248, 232, 0.75);
  stroke-width: 1.1;
  stroke-linecap: round;
}

.cw__plunger,
.cw__base {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.cw__base {
  stroke: color-mix(in srgb, var(--brass) 80%, #7a5a2a);
  stroke-width: 1.8;
}

.cw__mark {
  fill: none;
  stroke: color-mix(in srgb, var(--brass) 85%, white);
  stroke-width: 1.3;
  stroke-linecap: round;
  opacity: 0;
}

.cw__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 34% 26%, rgba(255, 230, 200, 0.45), transparent 52%),
    linear-gradient(150deg, var(--avatar-a), var(--avatar-b));
  box-shadow: inset 0 0 0 1px rgba(255, 230, 200, 0.22), 0 2px 6px rgba(0, 0, 0, 0.5);
  opacity: 0;
}

.cw__avatar-letter {
  font-size: 15px;
  font-weight: 640;
  font-variation-settings: 'wdth' 108;
  color: #fff6ea;
  text-shadow: 0 1px 1px rgba(60, 20, 10, 0.5);
}

.cw__check {
  width: 22px;
  height: 22px;
  overflow: visible;
}

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

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

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

.cw__state + .cw__state {
  opacity: 0;
}

.cw__title {
  font-size: 15.5px;
  font-weight: 580;
  font-variation-settings: 'wdth' 102;
  letter-spacing: 0.002em;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

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

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

/* the chip: the usual wait at rest, the seconds while he comes, Now at the end */
.cw__chip {
  flex: none;
  display: grid;
  place-items: center;
  width: 58px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 236, 205, 0.09), rgba(255, 236, 205, 0.02));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brass) 20%, transparent),
    inset 0 1px 0 rgba(255, 236, 205, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.cw__chip-face {
  grid-area: 1 / 1;
  font-size: 12px;
  font-weight: 560;
  font-variation-settings: 'wdth' 94;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.cw__chip-face + .cw__chip-face {
  opacity: 0;
}

.cw__chip-face--eta {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  color: color-mix(in srgb, var(--brass) 80%, white);
}

.cw__eta {
  grid-area: 1 / 1;
  text-align: right;
  min-width: 2ch;
}

.cw__eta + .cw__eta {
  opacity: 0;
}

.cw__unit {
  grid-column: 2;
  grid-row: 1;
  margin-left: 1px;
}
