/* The redeem points button with the brushed metal coin. A dark room with a soft champagne lamp behind and a fine
   grain, and in the middle one pill of satin black. Inside, layered in one rounded box (.rp__body, moved only by
   GSAP): the satin fill, the light under the pointer, the champagne wash of the success, the edge light that turns
   towards the pointer, the satin edges and the beam that runs round while it works. Then the row: the coin of
   circular brushed metal, two lines of words and the chip with the points. Over everything, outside the pill, the
   thin anamorphic streak of the success. */
:root {
  --page: #0b0a09;            /* the room */
  --lamp: #2b2318;            /* the soft lamp behind the button */
  --satin: #161412;           /* the button's satin black */
  --champagne: #e9d3a4;       /* the champagne: edge, beam, wash, streak */
  --gold: #b8925a;            /* the deeper metal of the coin and the wash */
  --ink: #f5efe6;             /* the words */
  --muted: rgba(245, 239, 230, 0.56); /* the small line under the words */
  --done-ink: #241a0d;        /* the words on the champagne wash */
}

* {
  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 soft champagne 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(44vh, 300px) at 50% 47%, color-mix(in srgb, var(--lamp) 90%, transparent), transparent 72%),
    radial-gradient(min(120vw, 900px) min(80vh, 600px) at 50% 125%, rgba(70, 54, 30, 0.3), 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.95 0 0 0 0 0.85 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;
}

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

/* the light the button throws on the table under it */
.rp__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 104%;
  height: 40px;
  margin: -16px 0 0 -52%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--champagne) 50%, transparent), color-mix(in srgb, var(--gold) 16%, transparent) 55%, transparent);
  filter: blur(14px);
  opacity: 0.16;
  pointer-events: none;
}

/* the anamorphic streak: a hairline of light much wider than the pill, with a soft glow around it */
.rp__streak {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% + 2 * min(46px, 5vw));
  height: 0;
  transform: translateX(-50%);
  z-index: 3;
  pointer-events: none;
  mix-blend-mode: screen;
}

.rp__streak-line,
.rp__streak-glow {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
}

.rp__streak-line {
  top: -1px;
  height: 1.5px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--champagne) 70%, transparent) 22%, #fffaf0 50%, color-mix(in srgb, var(--champagne) 70%, transparent) 78%, transparent);
}

.rp__streak-glow {
  top: -11px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--champagne) 45%, transparent), transparent);
  filter: blur(4px);
}

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

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

.rp__body {
  --mx: 50%;
  --my: 50%;
  --ea: 200deg;
  position: relative;
  display: block;
  width: min(86vw, 312px);
  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 -20px color-mix(in srgb, var(--champagne) 30%, transparent);
}

.rp__fill,
.rp__shine,
.rp__wash,
.rp__edge,
.rp__satin {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* satin black: a deep fill, a little lighter at the top, with a horizontal grain like brushed lacquer */
.rp__fill {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, rgba(0, 0, 0, 0.03) 1px 2px),
    linear-gradient(180deg, rgba(255, 245, 225, 0.08), rgba(255, 245, 225, 0.012) 52%, rgba(0, 0, 0, 0.28)),
    var(--satin);
}

/* the light under the pointer */
.rp__shine {
  background: radial-gradient(110px 66px at var(--mx) var(--my), rgba(255, 238, 205, 0.13), rgba(255, 238, 205, 0.03) 50%, transparent 72%);
  opacity: 0;
}

/* the champagne wash of the success: brushed metal across, uncovered from the coin by GSAP (clip-path) */
.rp__wash {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, rgba(90, 60, 20, 0.05) 1px 2px),
    linear-gradient(180deg, #f6e8c8, var(--champagne) 42%, color-mix(in srgb, var(--gold) 80%, var(--champagne)) 100%);
  clip-path: inset(0 100% 0 0 round 999px);
}

/* a soft bright band that slides along the wash as the streak crosses it */
.rp__wash-sheen {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 46%;
  background: linear-gradient(90deg, transparent, rgba(255, 252, 244, 0.7) 50%, transparent);
  opacity: 0;
}

/* the edge light: a champagne arc on the hairline, turned towards the pointer (--ea) */
.rp__edge {
  z-index: 3;
  padding: 1px;
  background: conic-gradient(from calc(var(--ea) - 60deg), transparent 0deg, color-mix(in srgb, var(--champagne) 85%, white) 60deg, transparent 120deg, 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 satin's edges: a champagne hairline, light at the top, dark at the bottom, a soft highlight */
.rp__satin {
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--champagne) 16%, transparent),
    inset 0 1px 0 rgba(255, 246, 228, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    inset 0 -12px 18px -12px rgba(0, 0, 0, 0.6);
}

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

/* the beam that runs round the edge while it works (its rect is measured by the script) */
.rp__beam {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  overflow: visible;
  pointer-events: none;
  opacity: 0;
}

.rp__beam rect {
  fill: none;
  stroke: color-mix(in srgb, var(--champagne) 85%, white);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 0.12 0.88;
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--champagne) 80%, transparent));
}

.rp__beam .rp__beam-tail {
  stroke: var(--champagne);
  stroke-width: 1;
  stroke-dasharray: 0.3 0.7;
  opacity: 0.25;
  filter: none;
}

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

/* the coin: circular brushed metal, an engraved cup, a reflection that turns with the light */
.rp__coin {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}

.rp__coin-face {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.45);
}

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

.rp__coin-metal,
.rp__coin-sheen,
.rp__coin-rim {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

/* the metal: fine concentric grooves over a champagne body, lighter at the top */
.rp__coin-metal {
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.09) 0 0.6px, rgba(70, 45, 10, 0.08) 0.6px 1.3px),
    radial-gradient(circle at 50% 30%, #f8ecd0, var(--champagne) 42%, var(--gold) 78%, #7e5e30);
}

/* the anisotropic reflection of circular brushing: two bright lobes facing each other, two dark ones across */
.rp__coin-sheen {
  background:
    conic-gradient(from -24deg, rgba(255, 252, 240, 0) 0deg, rgba(255, 252, 240, 0.85) 24deg, rgba(255, 252, 240, 0) 50deg, rgba(60, 38, 8, 0) 70deg, rgba(60, 38, 8, 0.32) 114deg, rgba(60, 38, 8, 0) 160deg, rgba(255, 252, 240, 0) 180deg, rgba(255, 252, 240, 0.6) 204deg, rgba(255, 252, 240, 0) 230deg, rgba(60, 38, 8, 0) 250deg, rgba(60, 38, 8, 0.32) 294deg, rgba(60, 38, 8, 0) 340deg);
  -webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0.25) 0 18%, #000 60%);
  mask: radial-gradient(circle, rgba(0, 0, 0, 0.25) 0 18%, #000 60%);
  mix-blend-mode: overlay;
}

/* the rim: a bright bevel outside, a shadowed step inside */
.rp__coin-rim {
  box-shadow:
    inset 0 1px 0 rgba(255, 252, 240, 0.85),
    inset 0 -1px 0 rgba(90, 60, 20, 0.6),
    inset 0 0 0 3px rgba(255, 246, 225, 0.12),
    inset 0 0 0 3.6px rgba(90, 60, 20, 0.28);
}

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

.rp__cup path {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* engraved: a dark cut with a light lip just under it */
.rp__cup-low path {
  stroke: rgba(255, 250, 236, 0.75);
  transform: translateY(0.7px);
}

.rp__cup-high path {
  stroke: rgba(78, 52, 18, 0.85);
}

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

.rp__check path {
  fill: none;
  stroke: #2b1f0f;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

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

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

.rp__state + .rp__state {
  opacity: 0;
}

.rp__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);
}

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

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

/* on the champagne wash the words go dark, engraved */
.rp__state--done .rp__title {
  color: var(--done-ink);
  text-shadow: 0 1px 0 rgba(255, 250, 238, 0.55);
}

.rp__state--done .rp__sub {
  color: color-mix(in srgb, var(--done-ink) 66%, transparent);
}

/* the chip: the points balance; on hover the cost slides in */
.rp__chip {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 74px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 246, 228, 0.08), rgba(255, 246, 228, 0.02));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--champagne) 18%, transparent),
    inset 0 1px 0 rgba(255, 246, 228, 0.15),
    0 1px 2px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: background 0.5s, box-shadow 0.5s;
}

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

.rp__chip-main {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.rp__chip-num {
  font-size: 12.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 96;
  color: var(--ink);
  letter-spacing: 0.01em;
  transition: color 0.5s;
}

.rp__chip-unit {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.5s;
}

.rp__chip-cost {
  font-size: 12.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 96;
  color: var(--champagne);
  letter-spacing: 0.01em;
  opacity: 0;
}

.is-done .rp__chip {
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.5), rgba(255, 252, 244, 0.18));
  box-shadow:
    inset 0 0 0 1px rgba(90, 60, 20, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 1px 2px rgba(90, 60, 20, 0.25);
}

.is-done .rp__chip-num {
  color: var(--done-ink);
}

.is-done .rp__chip-unit {
  color: color-mix(in srgb, var(--done-ink) 60%, transparent);
}
