/* The florist's cart: a white cart on a white page; the colour is in the flowers, the kraft paper and the ribbon. */
:root {
  --page: #ffffff;          /* the page */
  --panel: #ffffff;         /* the cart */
  --edge: #e8e5df;          /* the cart's edge and the lines between */
  --table: #f2f3ee;         /* the table the bouquet lies on */
  --ink: #1f2521;           /* the text */
  --muted: #7a817b;         /* the quieter text */
  --stem: #5c7f4c;          /* the stems */
  --ranunculus: #f19b78;    /* the ranunculus */
  --tulip: #c9304f;         /* the tulip */
  --anemone: #fbfaf7;       /* the anemone's petals */
  --anemone-heart: #262a40; /* the anemone's dark heart */
  --eucalyptus: #94b3a6;    /* the eucalyptus leaves */
  --kraft: #d9b88c;         /* the kraft paper */
  --kraft-dark: #bb9163;    /* the paper in the shade */
  --ribbon: #7b2236;        /* the ribbon */
  --free: #2f6b47;          /* free delivery */
  --pay: #22362a;           /* the pay button */
  --pay-ink: #f4f6f1;       /* the words on it */
  --done: #2f6b47;          /* the pay button once the order is placed */
}

* {
  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: 'Wix Madefor Text Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* the cart hangs from the top: lines going and coming move its bottom, never the bouquet */
.stage {
  min-height: 100svh;
  display: grid;
  justify-items: center;
  align-content: start;
  padding: max(24px, 7vh) 16px 24px;
}

.cart {
  width: min(390px, 100%);
  padding: 18px 16px 16px;
  border: 1px solid var(--edge);
  border-radius: 26px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(31, 37, 33, 0.04), 0 24px 48px -28px rgba(31, 37, 33, 0.22);
}

.cart__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px;
}

.cart__title {
  margin: 0;
  font: 400 21px/1.1 'Young Serif', Georgia, serif;
  letter-spacing: -0.005em;
}

.cart__count {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 520;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the bouquet */
/* the stems pulled out leave the frame at its edge: nothing of the bouquet ever goes over the words round it */
.table {
  position: relative;
  margin-top: 12px;
  padding: 12px 0 2px;
  border-radius: 18px;
  background: var(--table);
  overflow: hidden;
}

.bouquet {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  touch-action: pan-y;
}

/* what is left to free delivery sits beside the stems, low on the left, where the bouquet never goes */
.goal {
  position: absolute;
  left: 14px;
  bottom: 12px;
  width: 31%;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  text-wrap: balance;
}

.goal strong {
  color: var(--ink);
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.goal.is-free {
  color: var(--free);
  font-weight: 620;
}

/* a stem: the outer group fades, the inner one steps back while another line is pointed at */
.stem__in {
  transition: opacity 0.25s ease;
}

.stem__in.is-dim {
  opacity: 0.38;
}

.stem__line {
  fill: none;
  stroke: var(--stem);
  stroke-width: 2.1;
  stroke-linecap: round;
}

.stem--eucalyptus .stem__line {
  stroke: color-mix(in srgb, var(--eucalyptus) 55%, #5d5a4a);
  stroke-width: 1.7;
}

/* the drawings */
.st-ra-hi { stop-color: color-mix(in srgb, var(--ranunculus) 55%, #fff4e8); }
.st-ra { stop-color: var(--ranunculus); }
.ra-out { fill: url(#g-ranunculus); stroke: color-mix(in srgb, var(--ranunculus) 80%, #8a3a24); stroke-width: 0.6; }
.ra-mid { fill: color-mix(in srgb, var(--ranunculus) 70%, #fff3e6); stroke: color-mix(in srgb, var(--ranunculus) 85%, #8a3a24); stroke-width: 0.6; }
.ra-shade { fill: color-mix(in srgb, var(--ranunculus) 78%, #7d2f1c); opacity: 0.5; }
.ra-heart { fill: color-mix(in srgb, var(--ranunculus) 30%, #4e6b3a); }

.st-tu-hi { stop-color: color-mix(in srgb, var(--tulip) 70%, #ffd9df); }
.st-tu { stop-color: var(--tulip); }
.tu-back { fill: color-mix(in srgb, var(--tulip) 70%, #3c0d18); }
.tu-side { fill: color-mix(in srgb, var(--tulip) 88%, #4a1020); }
.tu-front { fill: url(#g-tulip); }
.tu-gleam { fill: none; stroke: #ffffff; stroke-opacity: 0.4; stroke-width: 1.2; stroke-linecap: round; }
.tu-leaf { fill: color-mix(in srgb, var(--stem) 80%, #c9dcae); }

.st-an-in { stop-color: color-mix(in srgb, var(--anemone) 80%, #c7c9d6); }
.st-an { stop-color: var(--anemone); }
.an-petal { fill: url(#g-anemone); stroke: color-mix(in srgb, var(--anemone) 78%, #6f6a62); stroke-width: 0.7; }
.an-ring { fill: none; stroke: var(--anemone-heart); stroke-width: 2.8; stroke-dasharray: 0.6 1.7; stroke-linecap: round; opacity: 0.85; }
.an-gleam { fill: #ffffff; opacity: 0.35; }
.an-heart { fill: var(--anemone-heart); }

.eu-leaf { fill: var(--eucalyptus); stroke: color-mix(in srgb, var(--eucalyptus) 75%, #3c4a40); stroke-width: 0.5; }
.eu-bloom { fill: none; stroke: #ffffff; stroke-opacity: 0.45; stroke-width: 1.1; stroke-linecap: round; }

/* the kraft paper and the ribbon */
.paper-back { fill: color-mix(in srgb, var(--kraft) 82%, #ffffff); stroke: var(--kraft-dark); stroke-width: 0.8; stroke-linejoin: round; }
.paper-back-fold { fill: none; stroke: var(--kraft-dark); stroke-opacity: 0.35; stroke-width: 0.8; }
.paper-front { fill: var(--kraft); stroke: var(--kraft-dark); stroke-width: 0.8; stroke-linejoin: round; }
.paper-front--r { fill: color-mix(in srgb, var(--kraft) 88%, var(--kraft-dark)); }
.paper-lip { fill: color-mix(in srgb, var(--kraft) 55%, #ffffff); stroke: var(--kraft-dark); stroke-width: 0.6; stroke-linejoin: round; }
.ribbon { fill: var(--ribbon); }
.ribbon--dark { fill: color-mix(in srgb, var(--ribbon) 75%, #000000); }
.ribbon--knot { fill: color-mix(in srgb, var(--ribbon) 88%, #ffffff); }
.ribbon-fold { fill: none; stroke: #000000; stroke-opacity: 0.25; stroke-width: 0.8; stroke-linecap: round; }
.twine path { fill: none; stroke: var(--kraft-dark); stroke-width: 1.3; stroke-linecap: round; }
.twine-wrap { transition: opacity 0.3s ease; }
.bouquet.is-bare .twine-wrap { opacity: 0; }

/* with nothing left in the cart, the way back to a bouquet */
.restart {
  position: absolute;
  inset: 0;
  width: max-content;
  height: 38px;
  margin: auto;
  padding: 0 16px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: 620 13.5px 'Wix Madefor Text Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.restart[hidden] {
  display: none;
}

.restart:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .restart:hover {
    border-color: color-mix(in srgb, var(--edge) 40%, var(--ink));
  }
}

/* ---------------------------------------------------------------- the lines */
.lines {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.line {
  position: relative;
  overflow: hidden;
}

.line + .line .line__body,
.line + .line .undo {
  border-top: 1px solid var(--edge);
}

.line__body {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 6px 4px;
}

.line__body[hidden] {
  display: none;
}

.thumb {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--table);
}

.thumb svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.line__name {
  margin: 0;
  font: 400 15.5px/1.15 'Young Serif', Georgia, serif;
}

.line__each {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.line__total {
  margin: 0;
  justify-self: end;
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.remove {
  padding: 2px 0;
  border-radius: 6px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 520 13px 'Wix Madefor Text Variable', system-ui, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .remove:hover {
    color: var(--tulip);
  }
}

.qty {
  display: flex;
  align-items: center;
  justify-self: end;
  margin-top: 2px;
  border-radius: 999px;
  background: var(--table);
}

.qty button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.12s ease;
}

.qty button:active {
  transform: scale(0.9);
}

@media (hover: hover) {
  .qty button:hover {
    background: color-mix(in srgb, var(--table) 70%, var(--edge));
  }
}

.qty button[aria-disabled='true'] {
  color: color-mix(in srgb, var(--muted) 50%, transparent);
  cursor: default;
}

.qty svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.qty__n {
  display: inline-block;
  min-width: 16px;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* a line removed: what it was, and Undo, with the time left drawn round the arrow */
.undo {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  padding: 0 4px;
}

.undo[hidden] {
  display: none;
}

.undo .thumb {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  opacity: 0.5;
}

.undo__text {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.undo__btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font: 620 13.5px 'Wix Madefor Text Variable', system-ui, sans-serif;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.undo__btn:active {
  transform: scale(0.96);
}

@media (hover: hover) {
  .undo__btn:hover {
    border-color: color-mix(in srgb, var(--edge) 40%, var(--ink));
  }
}

.undo__btn svg {
  width: 20px;
  height: 20px;
  overflow: visible;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.undo__ring {
  stroke: var(--edge);
  stroke-width: 1.6;
}

.undo__left {
  stroke: var(--ink);
  stroke-width: 1.6;
}

.undo__arrow {
  stroke: currentColor;
  stroke-width: 1.7;
}

/* ---------------------------------------------------------------- the sums and the pay button */
.sums {
  margin-top: 4px;
  padding: 10px 4px 0;
  border-top: 1px solid var(--edge);
}

.sums__row {
  display: flex;
  justify-content: space-between;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.sums__n {
  display: inline-flex;
  gap: 6px;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.sums__was {
  color: var(--muted);
  font-weight: 500;
}

.sums__was:empty {
  display: none;
}

.sums__n.is-free {
  color: var(--free);
}

.pay {
  position: relative;
  display: block;
  width: 100%;
  height: 50px;
  margin-top: 10px;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: var(--pay);
  color: var(--pay-ink);
  font: 640 16px 'Wix Madefor Text Variable', system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.14s ease, background-color 0.3s ease;
}

.pay:active {
  transform: scale(0.98);
}

@media (hover: hover) {
  .pay:hover {
    background: color-mix(in srgb, var(--pay) 88%, #ffffff);
  }
}

.pay.is-done {
  background: var(--done);
}

.pay[aria-disabled='true'] {
  background: color-mix(in srgb, var(--pay) 30%, #ffffff);
  cursor: default;
}

.pay__face {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 100%;
}

.pay__label {
  font-variant-numeric: tabular-nums;
}

.pay__spin,
.pay__tick {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: none;
}

.pay.is-busy .pay__spin,
.pay.is-done .pay__tick {
  display: block;
}

/* the focus rings show for the keys, not after a finger or the mouse */
.cart button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.pay:focus-visible {
  outline-offset: 3px;
}

.qty button:focus-visible {
  outline-offset: -2px;
}

html[data-using='pointer'] .cart button:focus-visible {
  outline: none;
}
