:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --inchiostro: #141416;
  --grigio: #6f6e74;
  --grigio-chiaro: #a9a8ad;
  --linea: rgba(20, 20, 22, 0.08);
  --tinta: #2f6b4f;
  --tinta-chiara: #e7f0eb;
  --mug: #f3ebe1;
  --candle: #eef0e6;
  --book: #e8edf3;
}

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

html, body { height: 100%; overflow: hidden; }

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

.stage {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: grid;
  place-items: center;
}

/* the whole card is drawn in pixels and the wrapper scales it to fit the box, height included */
.fit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 384px;
  height: 404px;
  display: grid;
  place-items: center;
  transform-origin: 50% 50%;
}

.card {
  position: relative;
  width: 336px;
  background: var(--carta);
  border-radius: 20px;
  border: 1px solid var(--linea);
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.04), 0 14px 36px -12px rgba(20, 20, 22, 0.16);
  padding: 16px 16px 16px;
  overflow: hidden;
}
.card.is-b { width: 384px; }

/* the header: the two titles share one place and cross over */
.head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  height: 30px;
  margin-bottom: 12px;
}
.head__a, .head__b {
  grid-area: 1 / 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.head__b { visibility: hidden; opacity: 0; align-items: center; gap: 10px; }
.head__title { font-size: 17px; font-weight: 640; letter-spacing: -0.01em; font-stretch: 96%; }
.head__count { font-size: 12px; color: var(--grigio); font-weight: 480; }
.shop {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--grigio);
}
.shop svg { width: 14px; height: 14px; fill: none; stroke: var(--tinta); stroke-width: 1.4; stroke-linejoin: round; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 26px;
  padding: 0 9px 0 5px;
  border-radius: 999px;
  border: 1px solid var(--linea);
  background: #fff;
  font: inherit;
  font-size: 11.5px;
  font-weight: 540;
  color: var(--inchiostro);
  cursor: pointer;
}
.back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .back:hover { background: #f6f6f5; } }

.body { display: flex; gap: 12px; }

.side { display: none; flex-direction: column; gap: 10px; flex: 0 0 44px; }
.is-b .side { display: flex; }

.list { list-style: none; display: flex; flex-direction: column; flex: 1 1 auto; }
.is-b .list { display: none; }

.row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--linea);
}
.row:first-child { padding-top: 2px; }
.slot { width: 44px; height: 44px; }
.row__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row__name { font-size: 13.5px; font-weight: 580; }
.row__meta { font-size: 11.5px; color: var(--grigio); }
.row__price { font-size: 13.5px; font-weight: 560; }

.thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 2px rgba(20, 20, 22, 0.06);
}
.thumb img {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}
/* a hairline over the photo, so the light ones keep their edge on the white card */
.thumb::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(20, 20, 22, 0.07); pointer-events: none; }
.thumb--mug { background: var(--mug); }
.thumb--candle { background: var(--candle); }
.thumb--book { background: var(--book); }
.thumb__count {
  position: absolute;
  right: -5px;
  z-index: 1;
  top: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--inchiostro);
  color: #fff;
  font-size: 10px;
  font-weight: 620;
  display: grid;
  place-items: center;
  opacity: 0;
}

/* the faint copy a thumbnail leaves behind as it flies */
.ghost {
  position: absolute;
  border-radius: 11px;
  border: 1px solid rgba(47, 107, 79, 0.35);
  pointer-events: none;
}

.form { display: none; flex-direction: column; gap: 10px; flex: 1 1 auto; min-width: 0; }
.is-b .form { display: flex; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field__label { font-size: 11px; color: var(--grigio); font-weight: 520; }
.field__box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(20, 20, 22, 0.12);
  background: #fff;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field.is-focus .field__box { border-color: var(--tinta); box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.14); }
.field__card { width: 20px; height: 14px; flex: 0 0 auto; fill: none; stroke: var(--grigio); stroke-width: 1.2; }

.sum { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; }
.sum__line { display: none; justify-content: space-between; font-size: 12px; color: var(--grigio); }
.is-b .sum__line { display: flex; }
.sum__total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
}
.is-b .sum__total { height: 38px; border-top: 1px solid var(--linea); margin-top: 4px; padding-top: 4px; }
.sum__label { display: grid; font-size: 13px; font-weight: 560; }
.sum__la, .sum__lb { grid-area: 1 / 1; }
.sum__lb { opacity: 0; }
.total { display: inline-block; font-size: 16px; font-weight: 660; letter-spacing: -0.01em; }
.total span { display: inline-block; transform-origin: 100% 60%; }

.cta {
  position: relative;
  width: 100%;
  height: 46px;
  margin-top: 12px;
  border: 0;
  border-radius: 13px;
  background: var(--inchiostro);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.cta__fill { position: absolute; inset: 0; background: var(--tinta); transform: scaleX(0); transform-origin: 0 50%; }
.cta__label { grid-area: 1 / 1; position: relative; display: inline-flex; align-items: center; gap: 7px; }
.cta__label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.cta__label--b, .cta__label--c { opacity: 0; }
@media (hover: hover) { .cta:hover { background: #26262a; } }

.pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  fill: #141416;
  stroke: #fff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

@media (prefers-reduced-motion: reduce) {
  .pointer { display: none; }
}
