/* The streak button of a habit app: one card alone on white, a single ember accent. */
:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --bordo: #e8e7e5;
  --tinta: #f4f3f1;          /* the empty days of the week, the button when done */
  --testo: #141312;
  --testo-2: #625f5a;
  --testo-3: #a8a49e;
  --scuro: #161514;          /* the button before today is done */
  --accento: #f0600f;        /* the single accent: the lit flame, the days of the streak, the tick */
  --accento-tenue: #fff0e6;
  --ombra: 24, 18, 12;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html { font-size: clamp(10px, min(3.9vw, 3.4vh), 17px); }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.stage { height: 100vh; display: grid; place-items: center; padding: 2vh 4vw; }

/* the card: a body, a 1px edge that warms at the top, three soft shadows */
.card {
  position: relative;
  width: min(20.5em, 92vw);
  padding: 1.15em 1.25em 1.25em;
  border-radius: 1.5em;
  background: var(--carta);
  box-shadow:
    0 1px 1px rgba(var(--ombra), .05),
    0 6px 14px -6px rgba(var(--ombra), .10),
    0 24px 48px -24px rgba(var(--ombra), .22);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  isolation: isolate;
  overflow: clip;
}
.card__edge {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 5;
  padding: 1px;
  background: linear-gradient(180deg, rgba(240, 96, 15, .26), var(--bordo) 22%, var(--bordo) 82%, #dfddda);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}
.card__glow {
  position: absolute; top: 0; left: 0; width: 40%; height: 1px; z-index: 6; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(240, 96, 15, .9), transparent);
  opacity: 0;
}

.head { display: flex; align-items: baseline; justify-content: space-between; gap: 1em; }
.head__title { font-size: .98em; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.head__meta { font-size: .72em; font-weight: 540; color: var(--testo-3); white-space: nowrap; }

/* the streak: the drawn flame, the number that rolls digit by digit, the unit */
.streak { display: flex; align-items: center; gap: .55em; margin: 1.05em 0 1.1em; }
.flame { width: 2.5em; height: 3em; flex: none; display: block; }
.flame svg { width: 100%; height: 100%; display: block; overflow: visible; }
.flame__body { fill: transparent; stroke: var(--testo-3); stroke-width: 2.2; stroke-linejoin: round; }
.flame__core { fill: transparent; stroke: var(--testo-3); stroke-width: 1.8; stroke-linejoin: round; opacity: .55; }
.streak__num {
  display: inline-flex; align-items: flex-start; height: 1em; overflow: hidden;
  font-size: 2.7em; font-weight: 700; letter-spacing: -.045em; line-height: 1;
  font-variant-numeric: tabular-nums; font-stretch: 92%;
}
.streak__num .col { display: block; }
.streak__num .col > span { display: block; height: 1em; line-height: 1; }
.streak__unit { font-size: .82em; font-weight: 560; color: var(--testo-2); align-self: flex-end; margin-bottom: .55em; }

/* the week: seven letters, the days of the streak joined by one bar of colour */
.week {
  position: relative;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3em;
  margin-bottom: 1.15em;
}
.week__bar {
  position: absolute; top: 0; bottom: 0; left: 0; width: 0;
  border-radius: .7em; background: var(--accento);
  box-shadow: 0 4px 10px -6px rgba(240, 96, 15, .7), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.week__day {
  position: relative; z-index: 1;
  height: 2.2em; display: grid; place-items: center;
  border-radius: .7em; background: var(--tinta);
  font-size: .78em; font-weight: 620; color: var(--testo-3);
  transition: background-color .3s ease;
}
.week__day.is-on { background: transparent; color: #fff; }
.week__day.is-today { box-shadow: inset 0 0 0 1.5px rgba(var(--ombra), .22); color: var(--testo); }
.week__day.is-today.is-on { box-shadow: none; color: #fff; }

/* the button: a pill that swells, its two faces stacked in one place so neither can widen the other */
.btn {
  position: relative; display: block; width: 100%; height: 3.3em;
  border-radius: 999px; isolation: isolate;
  outline: none;
}
.btn__bg {
  position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: var(--scuro);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .12) inset, 0 8px 18px -10px rgba(var(--ombra), .6);
}
.btn:focus-visible .btn__bg { box-shadow: 0 0 0 3px rgba(240, 96, 15, .28); }
.btn__face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: .5em;
  white-space: nowrap; pointer-events: none;
}
.btn__label { font-size: .98em; font-weight: 620; letter-spacing: -.01em; font-stretch: 100%; line-height: 1; }
.btn__face--todo { color: #fff; }
.btn__face--done { color: var(--accento); opacity: 0; }
.btn__tick { width: 1.05em; height: 1.05em; flex: none; display: block; }
.btn__tick path { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
