/* The add to wishlist button with the dropping price tag. A sheet of warm paper with a soft window light and a fine
   grain; in the middle one pill of espresso lacquer with a brass eyelet near its right end. From the eyelet a thin
   cotton thread holds a price tag of cream card stock (front: shop, piece, price, size; back: the price watch). The
   pill body (.wt__body) is moved only by GSAP; the tag box (.wt__tag) only by the pendulum in script.js, and its
   child (.wt__card) only by GSAP for the spin. */
:root {
  --paper: #efe9df;            /* the sheet of paper behind */
  --paper-light: #fbf8f2;      /* the window light on the paper */
  --paper-shade: #ddd4c6;      /* the paper in shadow, at the edges */
  --lacquer: #221d19;          /* the pill's espresso lacquer */
  --lacquer-top: #3a322b;      /* the lacquer where the light hits */
  --cream: #f6f0e6;            /* the words on the pill */
  --heart: #e2475a;            /* the heart, the new price's badge */
  --heart-deep: #a8243a;       /* the heart in shadow */
  --card: #fbf7ef;             /* the tag's card stock */
  --card-edge: #e3d9c8;        /* the tag's cut edge */
  --ink: #1d1916;              /* the words on the tag */
  --muted: #8a7f72;            /* the small lines on the tag, the old price */
  --brass: #c9a46a;            /* the eyelet and the hole's ring */
  --thread: #6f6458;           /* the cotton thread */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--paper);
  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 paper: a window light from the top left, the edges a little in shadow, a fine grain */
.stage {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background:
    radial-gradient(min(80vw, 620px) min(60vh, 420px) at 38% 30%, var(--paper-light), transparent 70%),
    radial-gradient(140% 120% at 50% 50%, transparent 55%, color-mix(in srgb, var(--paper-shade) 80%, transparent) 100%),
    var(--paper);
}

.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* the piece: the pill on top, the space where the tag hangs below. Shifted a little to the left, so pill and tag
   together sit in the middle */
.wt {
  --w: min(244px, 72vw);
  position: relative;
  z-index: 1;
  width: calc(var(--w) + 36px);
  height: min(214px, 52vh);
  translate: 0 -10px;
}

/* the soft shadow the pill throws on the paper */
.wt__floor {
  position: absolute;
  left: 6%;
  width: calc(var(--w) * 0.86);
  top: 44px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60, 40, 25, 0.26), transparent);
  filter: blur(7px);
  pointer-events: none;
}

/* ---------------------------------------------------------------- the pill */
.wt__btn {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: var(--w);
  height: 60px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--cream);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 999px;
  outline: none;
}

.wt__btn:focus-visible .wt__edge {
  box-shadow:
    0 0 0 2px var(--paper),
    0 0 0 4px var(--heart),
    inset 0 1px 0 rgba(255, 244, 228, 0.22),
    inset 0 0 0 1px rgba(255, 240, 220, 0.08);
}

.wt__body {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  border-radius: 999px;
  box-shadow:
    0 1px 1px rgba(40, 25, 15, 0.22),
    0 6px 14px -4px rgba(40, 25, 15, 0.32),
    0 18px 34px -14px rgba(40, 25, 15, 0.42);
}

.wt__fill {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, var(--lacquer-top), var(--lacquer) 58%, #17130f),
    var(--lacquer);
}

/* a very fine grain inside the lacquer */
.wt__fill::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.12 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* the light under the pointer */
.wt__light {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(120px 70px at var(--lx, 50%) var(--ly, 0%), rgba(255, 230, 205, 0.2), transparent 70%);
}

/* the reflection that crosses the pill when the heart fills */
.wt__sheen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.wt__sheen-band {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 46%;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 214, 0.18) 45%, rgba(255, 240, 222, 0.3) 52%, transparent);
}

/* the edges: a light line on top, a shadow at the bottom, a hairline all round */
.wt__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 228, 0.22),
    inset 0 -2px 3px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 240, 220, 0.08);
}

.wt__row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 44px 0 8px;
}

/* the heart sits in a small dark well */
.wt__disc {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, #2f2822, #15110e 80%);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 240, 220, 0.09);
}

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

.wt__heart-line {
  fill: none;
  stroke: var(--cream);
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.wt__heart-fill {
  fill: var(--heart);
}

.wt__heart-gloss {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0;
}

.wt__rays path {
  fill: none;
  stroke: var(--heart);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.wt__words {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 22px;
  overflow: hidden;
}

.wt__label {
  position: absolute;
  inset: 0;
  font-size: 15.5px;
  line-height: 22px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the brass eyelet the thread goes through */
.wt__eyelet {
  position: absolute;
  right: 18px;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 0;
  border-radius: 50%;
  background: radial-gradient(circle, #0c0a08 0 2.4px, transparent 2.9px);
  box-shadow:
    inset 0 0 0 2.2px var(--brass),
    inset 0 1px 0 2.2px #f2d9a8,
    0 1px 1px rgba(0, 0, 0, 0.5);
}

/* ---------------------------------------------------------------- the thread */
.wt__thread {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

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

.wt__thread-line {
  stroke: var(--thread);
  stroke-width: 1.15;
}

.wt__thread-shade {
  stroke: rgba(50, 35, 22, 0.16);
  stroke-width: 1.4;
  transform: translate(2px, 4px);
  filter: blur(1px);
}

/* ---------------------------------------------------------------- the tag */
.wt__tag {
  --tw: 100px;
  --th: 136px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: var(--tw);
  height: var(--th);
  transform-origin: 50% 12px;
  filter: drop-shadow(0 2px 2px rgba(60, 40, 25, 0.12)) drop-shadow(3px 10px 12px rgba(60, 40, 25, 0.18));
  will-change: transform;
}

.wt__card {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  --sh: 0;
}

.wt__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 10px 10px;
  background:
    linear-gradient(170deg, #fffdf8, var(--card) 40%, #f3ecdf),
    var(--card);
  border-radius: 9px 9px 7px 7px;
  box-shadow:
    inset 0 0 0 1px rgba(150, 125, 95, 0.18),
    inset 0 -1px 0 var(--card-edge),
    inset 0 1px 0 #ffffff;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  text-align: center;
}

/* the card stock's fibres, and the shadow the face takes while it turns away from the light */
.wt__face::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.4 0.5' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.42 0 0 0 0 0.32 0 0 0 0.14 0'/%3E%3C/filter%3E%3Crect width='90' height='90' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wt__face::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: var(--sh);
  background: linear-gradient(100deg, rgba(70, 50, 30, 0.5), rgba(70, 50, 30, 0.15));
}

.wt__face--back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  gap: 7px;
  padding-top: 28px;
}

/* the punched hole with its brass ring */
.wt__hole {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--paper) 0 2.3px, transparent 2.8px);
  box-shadow:
    inset 0 0 0 2px var(--brass),
    inset 0 1px 0 2px #ecd3a2,
    0 0.5px 1px rgba(80, 55, 25, 0.35);
}

.wt__brand {
  font-size: 7.5px;
  line-height: 1;
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
}

.wt__item {
  margin-top: 4px;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 10.5px;
  line-height: 1.1;
  font-style: italic;
  font-variation-settings: 'opsz' 14, 'SOFT' 60;
  white-space: nowrap;
  color: var(--muted);
}

.wt__rule {
  width: 62%;
  height: 1px;
  margin: 8px 0 0;
  background: linear-gradient(90deg, transparent, rgba(120, 100, 75, 0.35), transparent);
}

/* the price: the old one waits above, struck through after the drop; the big one rolls down */
.wt__price {
  position: relative;
  width: 100%;
  height: 52px;
  margin-top: 2px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.wt__was {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 12px;
  line-height: 1;
  font-weight: 420;
  font-variant-numeric: tabular-nums lining-nums;
  font-variation-settings: 'opsz' 14;
  color: var(--muted);
  white-space: nowrap;
}

.wt__strike {
  position: absolute;
  left: -3px;
  right: -3px;
  top: 50%;
  width: calc(100% + 6px);
  height: 8px;
  margin-top: -4px;
  overflow: visible;
}

.wt__strike path {
  fill: none;
  stroke: var(--heart);
  stroke-width: 1.3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.wt__now {
  display: flex;
  align-items: flex-start;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 30px;
  line-height: 1;
  font-weight: 460;
  font-variant-numeric: tabular-nums lining-nums;
  font-variation-settings: 'opsz' 72, 'SOFT' 30;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.wt__cur {
  font-size: 0.5em;
  line-height: 1;
  margin: 0.18em 0.06em 0 0;
  font-weight: 500;
}

/* one window per digit; inside it a column of digits that rolls down */
.wt__dg {
  position: relative;
  display: block;
  height: 1em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(180deg, transparent, #000 18%, #000 82%, transparent);
  padding: 0 0.01em;
}

.wt__col {
  display: block;
}

.wt__col > span {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: center;
}

.wt__foot {
  position: relative;
  margin-top: auto;
  width: 100%;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.wt__size {
  font-size: 7.5px;
  font-weight: 560;
  font-stretch: 104%;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.wt__off {
  font-size: 7.5px;
  line-height: 14px;
  height: 14px;
  padding: 0 5px;
  border-radius: 7px;
  font-weight: 680;
  font-stretch: 108%;
  letter-spacing: 0.03em;
  color: #fff8f2;
  background: linear-gradient(180deg, #ea5a6b, var(--heart-deep));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(120, 20, 35, 0.3);
  opacity: 0;
}

.wt__bell {
  width: 18px;
  height: 18px;
  overflow: visible;
}

.wt__bell path {
  fill: none;
  stroke: var(--heart);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wt__note {
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 13px;
  line-height: 1.15;
  font-style: italic;
  font-weight: 420;
  font-variation-settings: 'opsz' 24, 'SOFT' 80;
  color: var(--ink);
  padding: 0 2px;
}

.wt__watch {
  margin-top: auto;
  font-size: 6.4px;
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: 0.14em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--muted);
}
