/* The rising dough: a warm card on a white page with a stoneware bowl in the middle. The bowl, the dough, the flour
   and the crust are painted by script.js with these colours; the card, the words and the button are plain CSS. */
:root {
  --page: #ffffff;          /* the page */
  --card: #f6f0e7;          /* the order card */
  --ink: #2b2019;           /* the words */
  --muted: #8a7a6c;         /* the quieter words */
  --dough: #f2e0c3;         /* the raw dough */
  --dough-deep: #dcbf95;    /* the raw dough in shadow */
  --flour: #fffdf8;         /* the flour dusted on top */
  --crust: #b5652a;         /* the baked crust */
  --crust-deep: #7c3d14;    /* the crust where it is darkest */
  --glaze: #34566b;         /* the bowl's glaze */
  --glaze-light: #6d93a8;   /* the glaze where the light falls */
  --clay: #d8c2a2;          /* the raw clay of the bowl's foot */
  --ready: #2f7a4f;         /* the tick when it is ready */
  --button: #2b2019;        /* the button */
  --button-ink: #fff8ee;    /* its words */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap, no zoom */
html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Instrument Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the card */
.proof {
  --soft: 0;
  position: relative;
  width: min(380px, 100%);
  padding: 18px 20px 16px;
  border-radius: 26px;
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, 0.05);
}

.proof__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.proof__words {
  min-width: 0;
}

/* the title is set in Fraunces, and its SOFT axis follows the dough: the letters round off as it rises */
.proof__title {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 21px;
  font-weight: 560;
  font-variation-settings: 'SOFT' var(--soft), 'WONK' 0, 'opsz' 36;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

.proof__meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 460;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

.proof__swap {
  display: inline-block;
}

.proof__swap b {
  color: var(--ink);
  font-weight: 600;
}

/* the figure on the right: the price, then the percentage, then the tick */
.proof__figure {
  position: relative;
  flex: none;
  min-width: 52px;
  height: 24px;
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 19px;
  font-weight: 560;
  font-variation-settings: 'SOFT' var(--soft), 'opsz' 30;
  line-height: 24px;
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
}

.proof__pct {
  display: inline-block;
}

.proof__pct.is-quiet {
  color: var(--muted);
  font-size: 15px;
  font-weight: 460;
}

.proof__tick {
  position: absolute;
  right: -2px;
  top: -1px;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--ready);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  visibility: hidden;
}

/* ---------------------------------------------------------------- the bowl */
/* the canvas keeps the shape of the drawing, 340 by 196 units, and scales with the card */
.proof__bowl {
  position: relative;
  aspect-ratio: 340 / 196;
  margin: 6px -4px 8px;
}

.proof__paint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.proof__paint.is-over {
  cursor: pointer;
}

/* ---------------------------------------------------------------- the items and the button */
.proof__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.proof__items {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 540;
  line-height: 1.3;
  white-space: nowrap;
}

.proof__items .sep {
  color: var(--muted);
  font-weight: 400;
}

/* the button: its words widen on the width axis under the pointer, and it squashes a little when pressed */
.proof__btn {
  position: relative;
  flex: none;
  height: 38px;
  padding: 0 18px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 38px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.proof__label {
  display: inline-block;
  font-stretch: 86%;
  transition: font-stretch 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* while the order is being made the button can only cancel it: it steps back */
.proof__btn.is-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 16%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .proof__btn:hover .proof__label {
    font-stretch: 100%;
  }

  .proof__btn:hover {
    background: color-mix(in srgb, var(--button) 84%, var(--crust));
  }

  .proof__btn.is-quiet:hover {
    background: color-mix(in srgb, var(--ink) 6%, transparent);
  }
}

.proof__btn:focus-visible {
  outline: 2px solid var(--crust);
  outline-offset: 3px;
}

@media (max-width: 370px) {
  .proof {
    padding: 16px 16px 14px;
  }

  .proof__items {
    font-size: 12.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proof__label {
    transition: none;
  }
}
