:root {
  --fondo: #ffffff;
  --card: #ffffff;
  --inchiostro: #141414;
  --grigio: #6e6e73;
  --grigio-chiaro: #a3a3a8;
  --bordo: rgba(20, 20, 20, 0.08);
  --tessera: #f5f4f0;
  --accento: #2f7a4f;
  --accento-chiaro: #e7f2ea;
}

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

html, body { height: 100%; }

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

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* ---------- the order card ---------- */
.order {
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 20px;
  padding: clamp(14px, 4.2vmin, 20px);
  box-shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 18px 40px -22px rgba(20, 20, 20, 0.28);
}

.order__head { display: flex; align-items: center; gap: 10px; }
.order__mark {
  flex: none; width: 32px; height: 32px; padding: 6px;
  border-radius: 10px; background: var(--accento-chiaro);
  fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.order__title { flex: 1; min-width: 0; }
.order__brand { font-size: 14px; font-weight: 640; letter-spacing: -0.01em; }
.order__when { font-size: 12px; color: var(--grigio); margin-top: 1px; }
.order__state {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 560; color: var(--grigio);
  padding: 4px 8px 4px 6px; border-radius: 99px; background: var(--tessera);
}
.order__state svg { width: 13px; height: 13px; fill: none; stroke: var(--accento); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.items {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 2vmin, 10px);
  margin-top: clamp(12px, 3.6vmin, 18px);
}
.item { min-width: 0; }
.item__tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  background: var(--tessera);
  display: grid; place-items: center;
  transition: background-color 0.2s;
}
@media (hover: hover) { .item__tile:hover { background: #efede6; } }
.item__name { font-size: 11.5px; font-weight: 580; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item__qty { font-size: 10.5px; color: var(--grigio); margin-top: 1px; white-space: nowrap; }

/* the product photos: a small print sitting in its paper tile */
.item__art {
  width: 86%; height: 86%;
  display: block; object-fit: cover;
  border-radius: 10px;
  background: #e9e6de;
  box-shadow: 0 0 0 1px rgba(20, 20, 20, 0.06), 0 1px 1px rgba(20, 20, 20, 0.06), 0 6px 12px -8px rgba(20, 20, 20, 0.35);
  user-select: none; -webkit-user-drag: none;
}

/* the small «in cart» mark on a tile once its product has flown away */
.item__tile::after {
  content: "";
  position: absolute; right: 6px; top: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accento) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.6 10 16.6 18 8' fill='none' stroke='%23fff' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 11px no-repeat;
  opacity: 0; transform: scale(0.4);
  transition: opacity 0.18s, transform 0.32s cubic-bezier(0.34, 1.7, 0.5, 1);
}
.item__tile.is-sent::after { opacity: 1; transform: scale(1); }

.order__total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: clamp(12px, 3.4vmin, 16px); padding-top: clamp(10px, 3vmin, 14px);
  border-top: 1px solid var(--bordo);
  font-size: 12.5px; color: var(--grigio);
}
.order__sum { font-size: 15px; font-weight: 660; color: var(--inchiostro); letter-spacing: -0.01em; }

/* ---------- the Reorder button ---------- */
.reorder {
  position: relative;
  width: 100%;
  height: 48px;
  margin-top: clamp(10px, 3vmin, 14px);
  border: 0; border-radius: 14px;
  background: var(--inchiostro); color: #fff;
  font: inherit; font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  box-shadow: 0 10px 22px -12px rgba(20, 20, 20, 0.6);
  -webkit-tap-highlight-color: transparent;
}
.reorder:focus-visible { outline: 2px solid var(--accento); outline-offset: 3px; }
.reorder.is-hover { background: #262626; }
@media (hover: hover) { .reorder:hover { background: #262626; } }
.reorder__fill {
  position: absolute; inset: 0; z-index: -1;
  background: var(--accento);
  clip-path: circle(0% at 50% 50%);
}
.reorder__icon { position: relative; width: 20px; height: 20px; flex: none; }
.reorder__icon svg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.reorder__cart circle { fill: currentColor; stroke: none; }
.reorder__check path { stroke-width: 2.4; }
.reorder__labels { position: relative; display: grid; overflow: hidden; height: 20px; }
.reorder__label { grid-area: 1 / 1; line-height: 20px; white-space: nowrap; }
.reorder__label--done { opacity: 0; }
.reorder__count {
  position: relative;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12.5px; font-weight: 640;
  display: grid; place-items: center;
  overflow: hidden;
  opacity: 0; transform: scale(0.5);
}
.reorder__digit { display: block; line-height: 22px; }

/* ---------- the flying products and the drawn pointer ---------- */
.flyers { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.flyer { position: absolute; left: 0; top: 0; will-change: transform; }
.flyer .item__art { width: 100%; height: 100%; box-shadow: 0 0 0 1px rgba(20, 20, 20, 0.06), 0 10px 18px -10px rgba(20, 20, 20, 0.45); }
.flyer__shadow {
  position: absolute; left: 12%; right: 12%; bottom: -16%; height: 14%;
  border-radius: 50%; background: rgba(20, 20, 20, 0.22); filter: blur(4px);
}

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

@media (max-width: 380px) {
  .item__name { font-size: 10.5px; }
  .item__qty { font-size: 9.5px; }
  .order__state { font-size: 10.5px; }
}
