/* The espresso recipe with the extraction curve drawing itself on scroll. Colours in :root (the Playground palette). */
:root {
  --fondo: #f6f2ec;
  --carta: #ffffff;
  --inchiostro: #1b1714;
  --spento: #bdb4aa;
  --secondario: #7a7068;
  --bordo: rgba(27, 23, 20, 0.08);
  --griglia: rgba(27, 23, 20, 0.06);
  --accento: #b8562a;
  --accento-tenue: rgba(184, 86, 42, 0.1);
  --pressione: #3f4a5c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--fondo); }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.corsa { position: relative; height: 300vh; }
.palco {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.7vh, 16px);
  padding: clamp(8px, 2.6vh, 36px) clamp(10px, 4vw, 64px);
  overflow: hidden;
  text-align: center;
}

.occhiello {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  background: var(--carta);
  color: var(--secondario);
  font-size: clamp(9.5px, min(1.15vw, 1.9vh), 13px);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(27, 23, 20, 0.04);
}
.occhiello svg { width: 1.15em; height: 1.15em; fill: none; stroke: var(--accento); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.titolo {
  font-size: clamp(17px, min(4.2vw, 5.2vh), 52px);
  line-height: 1.04;
  font-weight: 640;
  font-stretch: 90%;
  letter-spacing: -0.02em;
}
.titolo__spento { color: var(--spento); font-weight: 560; }

/* ---- the card ---- */
.carta {
  width: min(680px, 94vw, 112vh);
  background: var(--carta);
  border: 1px solid var(--bordo);
  border-radius: clamp(14px, 2.2vh, 20px);
  box-shadow: 0 1px 1px rgba(27, 23, 20, 0.04), 0 18px 40px -22px rgba(60, 34, 18, 0.32);
  padding: clamp(10px, 2vh, 20px) clamp(11px, 2.4vh, 22px) clamp(9px, 1.8vh, 18px);
  text-align: left;
}
.carta__testa { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chicco { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chicco__nome { font-size: clamp(12px, min(1.6vw, 2.3vh), 16px); font-weight: 640; }
.chicco__info { font-size: clamp(9.5px, min(1.15vw, 1.75vh), 12px); color: var(--secondario); }
.stato {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(27, 23, 20, 0.05);
  color: var(--secondario);
  font-size: clamp(9.5px, min(1.15vw, 1.75vh), 12px);
  font-weight: 560;
  white-space: nowrap;
  transition: background-color 0.35s ease, color 0.35s ease;
}
.stato.is-corre { background: var(--accento-tenue); color: var(--accento); }
.stato.is-fatto { background: var(--inchiostro); color: #fff; }

/* ---- the numbers ---- */
.numeri {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: clamp(7px, 1.5vh, 14px) 0 clamp(6px, 1.3vh, 12px);
}
.numero { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.numero dt { font-size: clamp(8.5px, min(1.05vw, 1.6vh), 11px); color: var(--secondario); white-space: nowrap; }
.numero dd {
  font-size: clamp(14px, min(2.4vw, 3.4vh), 26px);
  font-weight: 620;
  /* no tabular-nums: in Mona Sans the tabular zero has a slash */
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.numero dd span { display: inline-block; }
.numero small { font-size: 0.5em; font-weight: 520; color: var(--secondario); margin-left: 2px; letter-spacing: 0; }

/* ---- the chart ---- */
.grafico {
  position: relative;
  height: clamp(86px, 27vh, 250px);
  margin: 0 0 clamp(22px, 4vh, 34px);
}
.griglia span {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--y);
  height: 1px;
  background: var(--griglia);
}
.linee { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.linee path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.fantasma { stroke: rgba(27, 23, 20, 0.1); stroke-width: 1; stroke-dasharray: 2 4; }
.ombra { display: none; }
.area { fill: url(#sotto) !important; stroke: none; }
.linea--g { stroke: var(--accento); stroke-width: 2.2; }
.linea--p { stroke: var(--pressione); stroke-width: 1.3; stroke-dasharray: 5 4; opacity: 0.7; }

.testina { position: absolute; top: 0; bottom: 0; left: 0; width: 0; pointer-events: none; }
.testina__filo { position: absolute; top: -4px; bottom: 0; left: 0; width: 1px; background: rgba(27, 23, 20, 0.22); }
.testina__punto {
  position: absolute;
  left: 0;
  top: 0;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--carta);
  border: 2px solid var(--accento);
  box-shadow: 0 2px 6px -1px rgba(184, 86, 42, 0.35);
}

.fasi { position: absolute; inset: 0; pointer-events: none; }
.fase {
  position: absolute;
  left: var(--x);
  top: 0;
  bottom: 0;
}
.fase i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(to bottom, rgba(27, 23, 20, 0.18) 0 3px, transparent 3px 6px);
  transform: scaleY(0);
  transform-origin: 50% 100%;
  transition: transform 0.55s cubic-bezier(0.2, 0.9, 0.25, 1.06);
}
.fase b {
  position: absolute;
  top: -2px;
  left: 5px;
  font-size: clamp(8px, min(1vw, 1.55vh), 10.5px);
  font-weight: 560;
  color: var(--secondario);
  white-space: nowrap;
  padding: 0 3px;
  margin-left: -3px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.4), color 0.3s ease;
}
.fase--fine b { left: auto; right: 5px; }
/* the full pressure label sits one row lower, so it never touches the first drops label */
.fase[data-fase="2"] b { top: clamp(9px, 1.9vh, 14px); }
.fase.is-passata i { transform: scaleY(1); }
.fase.is-passata b { opacity: 1; transform: translateY(0); }
.fase.is-ora b { color: var(--accento); }

.assi {
  position: absolute;
  left: 0;
  right: 0;
  bottom: clamp(-17px, -2.4vh, -13px);
  display: flex;
  justify-content: space-between;
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: clamp(8px, min(0.95vw, 1.5vh), 10px);
  color: var(--spento);
}
.legenda {
  position: absolute;
  right: 0;
  bottom: clamp(-34px, -4.6vh, -25px);
  display: flex;
  gap: 12px;
  font-size: clamp(8px, min(1vw, 1.5vh), 10.5px);
  color: var(--secondario);
}
.legenda__voce { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legenda__voce i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }
.legenda__g { background: var(--accento); }
.legenda__p { background: repeating-linear-gradient(to right, var(--pressione) 0 4px, transparent 4px 7px); opacity: 0.7; }

/* ---- tasting notes and ratio ---- */
.fondo-carta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: clamp(7px, 1.4vh, 12px);
  border-top: 1px solid var(--bordo);
  min-height: clamp(30px, 5vh, 44px);
}
.note { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.nota {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--bordo);
  background: #fbf8f4;
  font-size: clamp(9px, min(1.1vw, 1.7vh), 12px);
  font-weight: 540;
  white-space: nowrap;
}
.rapporto {
  flex: none;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(184, 86, 42, 0.45);
  color: var(--accento);
  font-family: 'JetBrains Mono Variable', ui-monospace, monospace;
  font-size: clamp(10px, min(1.2vw, 1.8vh), 13px);
  white-space: nowrap;
}
.rapporto b { font-weight: 700; }

.piede { padding: 22px; text-align: center; font-size: 12px; color: var(--secondario); }

@media (max-width: 520px) {
  .numeri { grid-template-columns: repeat(2, 1fr); row-gap: 4px; }
  .legenda { display: none; }
  .note .nota:nth-child(3) { display: none; }
}
