:root {
  --fondo: #f6f2ec;
  --card: #ffffff;
  --inchiostro: #1b1916;
  --grigio: #77716a;
  --grigio-chiaro: #b4aca3;
  --linea: rgba(27, 25, 22, 0.08);
  --campo: #f4efe8;
  --accento: #d0632f;
  --accento-tenue: #fbeee6;
}

* { 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", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  position: relative;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vmin, 20px);
  overflow: hidden;
}

/* the card: measured on the height too, so it sits whole in the phone's box */
.recipe {
  width: min(380px, 100%);
  background: var(--card);
  border-radius: 20px;
  border: 1px solid var(--linea);
  box-shadow: 0 1px 2px rgba(27, 25, 22, 0.05), 0 22px 50px -24px rgba(60, 40, 20, 0.28);
  overflow: hidden;
}

.dish { position: relative; height: clamp(54px, 15vh, 128px); overflow: hidden; }
.dish__img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 54%; }
/* a soft shade at the top so the tag reads on the bright photo */
.dish::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(27, 25, 22, 0.14), transparent 45%); }
.dish__tag {
  position: absolute; left: 12px; top: 10px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  background: rgba(255, 255, 255, 0.86); color: #3f6a2f;
  padding: 3px 8px; border-radius: 999px; z-index: 1;
  backdrop-filter: blur(4px);
}

.recipe__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: clamp(8px, 2.2vh, 16px) 18px clamp(4px, 1vh, 8px);
}
.recipe__brand { font-size: 11px; color: var(--grigio); font-weight: 500; }
.recipe__title { font-size: clamp(16px, 4.6vh, 21px); font-weight: 680; letter-spacing: -0.015em; line-height: 1.15; }
.recipe__time {
  display: flex; align-items: center; gap: 4px;
  font-size: 12.5px; color: var(--grigio); font-weight: 560; white-space: nowrap;
}
.recipe__time svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.unit { margin-left: 2px; }

/* the rolling number: the old value slides out, the new one in, inside a mask that fades the edges */
.roll {
  position: relative; display: inline-flex; justify-content: flex-end;
  height: 1.25em; line-height: 1.25em; overflow: hidden; vertical-align: bottom;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.roll__in { display: block; white-space: nowrap; }
.roll__out { position: absolute; right: 0; top: 0; white-space: nowrap; }

.serve {
  display: flex; align-items: center; gap: 10px;
  margin: 0 18px; padding: clamp(6px, 1.4vh, 10px) 0;
  border-top: 1px solid var(--linea); border-bottom: 1px solid var(--linea);
}
.serve__label { font-size: 12.5px; font-weight: 600; }
.serve__note { margin-left: auto; font-size: 11.5px; color: var(--grigio); white-space: nowrap; }
.stepper {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--campo); border-radius: 999px; padding: 3px;
}
.stepper__btn {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: #ffffff; color: var(--inchiostro); cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 1px 2px rgba(27, 25, 22, 0.12);
  transition: background 0.2s, opacity 0.2s;
}
.stepper__btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.stepper__btn:disabled { opacity: 0.35; cursor: default; }
.stepper__btn:focus-visible, .foot__btn:focus-visible, .ing:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
@media (hover: hover) {
  .stepper__btn:not(:disabled):hover { background: var(--accento-tenue); color: var(--accento); }
  .foot__btn:hover { background: #2a2622; }
  .ing:hover .box { border-color: var(--accento); }
}
.stepper__num { min-width: 26px; justify-content: center; font-size: 14px; font-weight: 680; }

.ingredients { list-style: none; padding: clamp(2px, 0.6vh, 6px) 18px; }
.ing {
  position: relative;
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px;
  height: clamp(24px, 6.2vh, 32px);
  font-size: 13px; cursor: pointer; user-select: none;
}
.ing + .ing { border-top: 1px solid var(--linea); }
.box {
  width: 16px; height: 16px; border-radius: 5px;
  border: 1.5px solid #cfc7bd; background: #fff;
  display: grid; place-items: center;
  transition: border-color 0.2s;
}
.box svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ing__name { position: relative; justify-self: start; color: var(--inchiostro); transition: color 0.3s; }
.ing__strike {
  position: absolute; left: -2px; right: -2px; top: 54%; height: 1.4px;
  background: var(--grigio); transform: scaleX(0); transform-origin: left center;
}
.ing__qty { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 600; color: var(--inchiostro); }
.ing__unit { display: inline-block; color: var(--grigio); font-weight: 500; font-size: 12px; min-width: 2.1em; text-align: left; }
.ing.is-done .ing__name { color: var(--grigio-chiaro); }
.ing.is-done .ing__qty { color: var(--grigio-chiaro); }

.recipe__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: clamp(6px, 1.6vh, 12px) 18px clamp(10px, 2.2vh, 16px);
}
.foot__left { font-size: 12px; color: var(--grigio); white-space: nowrap; }
.foot__btn {
  position: relative; display: grid; border: 0; cursor: pointer;
  height: 34px; padding: 0 14px; border-radius: 999px;
  background: var(--inchiostro); color: #fff;
  font: inherit; font-size: 12.5px; font-weight: 600; font-variation-settings: "wdth" 100;
  overflow: hidden; transition: background 0.2s;
}
.foot__a, .foot__b { grid-area: 1 / 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.foot__b { opacity: 0; }
.foot__b svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.foot__btn.is-added { background: var(--accento); }

.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  pointer-events: none; z-index: 5; opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}
.ghost path { fill: #1b1916; stroke: #ffffff; stroke-width: 1.4; stroke-linejoin: round; }

@media (max-width: 360px) {
  .recipe__head, .ingredients, .recipe__foot { padding-left: 14px; padding-right: 14px; }
  .serve { margin: 0 14px; }
  .serve__note { display: none; }
  .ing { font-size: 12.5px; }
}

/* on a large screen the card grows a little, like a tablet propped on the counter */
@media (min-width: 1000px) and (min-height: 760px) {
  .recipe { transform: scale(1.3); }
}
