:root {
  --paper: #f6f2ea;        /* the warm white page */
  --card: #fffdf9;         /* the product card */
  --tile: #f2ece2;         /* the soft tile the caramel sits on */
  --ink: #1c1a17;          /* titles, the pill */
  --muted: #8b857a;        /* small print */
  --line: #ebe5da;         /* hairlines */
  --accent: #c9592b;       /* the single accent: the caramel */
  --candy-light: #f3b27a;  /* the caramel highlight */
  --candy-deep: #8f3512;   /* the caramel shade */
  --cello-line: #d8cdbd;   /* the pleats of the cellophane */
  --kraft: #d9c2a0;        /* the paper bag */
  --kraft-light: #e8d6bb;  /* the bag's top edge */
  --kraft-dark: #b99a72;   /* the inside of the bag */
  --kraft-deep: #9d7f58;   /* the deep shadow in the mouth */
  --kraft-crease: #c4a983; /* the creases of the bag */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.stage {
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 2vh 14px;
}

.shop {
  width: min(600px, 92vw);
  background: var(--card);
  border: 1px solid #ebe4d8;
  border-radius: min(26px, 4.6vh);
  padding: min(18px, 3.2vh) min(18px, 4vw) min(16px, 3vh);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 2px rgba(50, 35, 10, .05), 0 22px 46px -22px rgba(60, 40, 10, .28);
  display: flex;
  flex-direction: column;
  gap: min(14px, 2.4vh);
}

.shop__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-weight: 640;
  font-size: 13px;
  letter-spacing: -.01em;
}
.brand span {
  font: 500 10px/1 "JetBrains Mono Variable", ui-monospace, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 6px;
}

.bagcount {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 500 11px/1 "JetBrains Mono Variable", ui-monospace, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.bagcount svg { width: 15px; height: 15px; color: var(--ink); }

.count {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--card);
  overflow: hidden;
  font: 600 11px/22px "JetBrains Mono Variable", ui-monospace, monospace;
  letter-spacing: 0;
}
.count__roll {
  position: absolute;
  inset: 0 0 auto 0;
  display: block;
}
.count__roll span {
  display: block;
  height: 22px;
  text-align: center;
}

/* ---- the scene ---- */
.scene {
  position: relative;
  height: min(300px, 36vh);
}

.tile {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 58%;
  border-radius: min(18px, 3vh);
  background: var(--tile);
  overflow: hidden;
}
.tile__glow {
  position: absolute;
  inset: -30% -20% auto auto;
  width: 80%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .8), rgba(255, 255, 255, 0));
}
.tile__shadow {
  position: absolute;
  left: 0;
  top: 0;
  width: 70px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(70, 40, 15, .3), rgba(70, 40, 15, 0));
}

.bag {
  position: absolute;
  right: 4%;
  bottom: 0;
  width: 30%;
  height: 80%;
}
.bag__shadow {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -6px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(70, 40, 15, .28), rgba(70, 40, 15, 0));
}
.bag__body {
  position: absolute;
  inset: 0;
}
.bag__back, .bag__front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.bag__back { z-index: 1; }
/* the body itself is never transformed: each layer squashes on its own, so the caramel can sit between them */
.bag__layer { position: absolute; inset: 0; }
.bag__layer--pile { z-index: 2; }
.bag__layer--front { z-index: 3; }
.bag__layer--fold { z-index: 5; pointer-events: none; }
.bag__front { filter: drop-shadow(0 -1px 0 rgba(255, 255, 255, .4)); }

.pile {
  position: absolute;
  width: 34%;
  aspect-ratio: 60 / 40;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, var(--candy-light), var(--accent) 55%, var(--candy-deep));
  box-shadow: 0 2px 3px rgba(80, 30, 10, .25);
}
.pile--a { left: 12%; top: 11%; transform: rotate(-12deg); }
.pile--b { left: 50%; top: 9%; transform: rotate(9deg); }
.pile--c { left: 31%; top: 13%; transform: rotate(3deg); filter: brightness(.92); }

.bag__label {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 38%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  border: 1px solid rgba(90, 60, 25, .35);
  display: grid;
  place-items: center;
}
.bag__label span {
  font: 600 clamp(8px, 1.6vh, 11px)/1 "Mona Sans Variable", system-ui, sans-serif;
  font-stretch: 85%;
  letter-spacing: .04em;
  color: rgba(70, 45, 15, .7);
}

.bag__fold {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 4%;
  height: 22%;
  background: linear-gradient(var(--kraft-light), var(--kraft) 70%, var(--kraft-crease));
  border-radius: 2px 2px 3px 3px;
  box-shadow: 0 2px 3px rgba(70, 45, 15, .22);
  transform-origin: 50% 0;
  transform: scaleY(0);
}

.candy, .wrap {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}
.candy { z-index: 2; width: 64px; }
.candy svg { display: block; width: 100%; height: auto; overflow: visible; }
.wrap { z-index: 6; width: 30px; }
.wrap svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 1px 1px rgba(80, 60, 30, .18)); }

/* ---- info and pill ---- */
.info {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}
.info__name {
  font-size: clamp(17px, 3.2vh, 25px);
  font-weight: 620;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.info__meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.info__price {
  font: 600 15px/1 "JetBrains Mono Variable", ui-monospace, monospace;
  white-space: nowrap;
}
.info__price span { font-size: 11px; font-weight: 500; color: var(--muted); }

.pill {
  position: relative;
  height: min(48px, 8vh);
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--card);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
.pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pill__fill {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(120% 140% at 50% 120%, #3a352e, var(--ink) 60%);
}
/* every label sits out of the flow, centred over the whole pill: a hidden label can never widen anything */
.pill__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: .005em;
  white-space: nowrap;
  pointer-events: none;
}
.pill__label--done { opacity: 0; }
.pill__label--done svg { width: 16px; height: 16px; flex: none; }
.pill__label--done path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
