:root {
  --fondo: #ffffff;
  --carta: #fcfdfc;
  --inchiostro: #121715;
  --grigio: #66706b;
  --tenue: #a6aeaa;
  --linea: rgba(18, 23, 21, 0.08);
  --accento: #0f7a5e;
  --accento-chiaro: #2fb38a;
  --accento-tenue: rgba(15, 122, 94, 0.09);
  --avviso: #b4561f;
  --font: 'Mona Sans Variable', system-ui, sans-serif;
  --cifra: 1em;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 32px) 12px;
}

/* the card */
.due {
  --mx: 80%;
  --my: 0%;
  position: relative;
  width: min(384px, 92vw);
  padding: clamp(14px, 3.4vh, 22px) clamp(14px, 4.4vw, 22px) clamp(10px, 2.4vh, 16px);
  border-radius: 22px;
  background:
    radial-gradient(120% 60% at 100% 0%, rgba(47, 179, 138, 0.08), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
    var(--carta);
  border: 1px solid rgba(18, 23, 21, 0.07);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.95) inset,
    0 1px 2px rgba(18, 23, 21, 0.05),
    0 10px 24px -8px rgba(18, 23, 21, 0.12),
    0 34px 70px -28px rgba(11, 79, 64, 0.3);
  isolation: isolate;
}
.due__edge {
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(170px 130px at var(--mx) var(--my), rgba(15, 122, 94, 0.6), rgba(15, 122, 94, 0) 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
  z-index: 3;
}

.due__head { display: flex; align-items: center; gap: 11px; }
.mark { width: 36px; height: 36px; flex: none; border-radius: 10px; box-shadow: 0 4px 10px -4px rgba(11, 79, 64, 0.5); }
.mark svg { display: block; width: 100%; height: 100%; }
.due__who { display: grid; gap: 1px; min-width: 0; }
.due__firm { font-size: 14.5px; font-weight: 640; font-stretch: 105%; letter-spacing: -0.01em; }
.due__client { font-size: 12px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the big count */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  margin-top: clamp(10px, 2.8vh, 20px);
}
.hero__count { display: flex; align-items: flex-end; gap: 10px; min-width: 0; }
.days {
  display: inline-flex;
  font-size: clamp(44px, 11vh, 60px);
  line-height: 1;
  height: var(--cifra);
  font-weight: 560;
  font-stretch: 88%;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  -webkit-mask: linear-gradient(transparent, #000 16%, #000 84%, transparent);
  mask: linear-gradient(transparent, #000 16%, #000 84%, transparent);
}
.digit { display: block; overflow: hidden; height: var(--cifra); width: 0.54em; transition: width 0.4s cubic-bezier(.3, 1.4, .5, 1); }
.digit.is-off { width: 0; }
.digit__strip { display: flex; flex-direction: column; will-change: transform; }
.digit__strip span { display: block; height: var(--cifra); text-align: center; }
.hero__unit { display: grid; gap: 2px; padding-bottom: 0.45em; font-size: 12.5px; }
.hero__unit-word { font-weight: 600; }
.hero__date { color: var(--grigio); white-space: nowrap; }
.hero__what {
  margin: clamp(4px, 1vh, 8px) 0 0;
  font-size: 13px;
  display: flex; gap: 6px; align-items: center;
  white-space: nowrap; overflow: hidden;
}
.hero__what [data-name] { font-weight: 600; }
.hero__sep { color: var(--tenue); }
.hero__state { color: var(--grigio); display: inline-flex; align-items: center; gap: 5px; }
.hero__state.is-warn { color: var(--avviso); }
.hero__state svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* add to calendar */
.add {
  position: relative;
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px;
  padding: 0 12px 0 10px;
  margin-bottom: 0.5em;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: #fff;
  box-shadow: 0 0 0 1px var(--linea), 0 1px 2px rgba(18, 23, 21, 0.06), 0 6px 14px -8px rgba(18, 23, 21, 0.25);
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow 0.25s;
}
.add__fill {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--accento-chiaro), var(--accento));
  clip-path: circle(0% at 18% 50%);
  z-index: -1;
}
.add__icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.add__tick { stroke-width: 2; opacity: 0; }
.add__labels { position: relative; display: grid; justify-items: start; height: 16px; overflow: hidden; }
.add__label { grid-area: 1 / 1; line-height: 16px; white-space: nowrap; }
.add__label--on { color: #fff; }
.add[aria-pressed="true"] { color: #fff; box-shadow: 0 0 0 1px rgba(11, 79, 64, 0.4), 0 8px 18px -8px rgba(15, 122, 94, 0.7); }
.add:focus-visible, .row:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }

/* the bar of the coming weeks */
.track {
  position: relative;
  height: 34px;
  margin-top: clamp(8px, 2.2vh, 16px);
}
.track__rail, .track__fill {
  position: absolute; left: 0; right: 0; top: 9px;
  height: 6px; border-radius: 6px;
}
.track__rail {
  background: repeating-linear-gradient(90deg, rgba(18, 23, 21, 0.09) 0 2px, transparent 2px 5px);
}
.track__fill {
  right: auto; width: 100%;
  background: linear-gradient(90deg, rgba(47, 179, 138, 0.35), var(--accento-chiaro) 70%, var(--accento));
  transform-origin: 0 50%;
  transform: scaleX(0.1);
  overflow: hidden;
  box-shadow: 0 2px 8px -2px rgba(15, 122, 94, 0.45);
}
.track__glint {
  position: absolute; top: 0; bottom: 0; left: 0; width: 30%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  transform: translateX(-120%);
}
.track__today {
  position: absolute; left: 0; top: 3px; width: 2px; height: 18px; border-radius: 2px;
  background: var(--inchiostro);
}
.track__months span {
  position: absolute; top: 22px;
  font-size: 10.5px; color: var(--tenue); letter-spacing: 0.02em;
  transform: translateX(-50%);
}
.track__months span:first-child { transform: none; color: var(--grigio); font-weight: 600; }
.notch {
  position: absolute; top: 18px; width: 1px; height: 4px; background: rgba(18, 23, 21, 0.2);
}
.tick {
  position: absolute; top: 4px; width: 2px; height: 16px; margin-left: -1px; border-radius: 2px;
  background: rgba(18, 23, 21, 0.28);
  transform-origin: 50% 50%;
}
.tick.is-on { background: var(--accento); }

/* the deadlines */
.list { position: relative; display: grid; margin-top: clamp(4px, 1.2vh, 10px); }
.list__pill {
  position: absolute; left: -8px; right: -8px; top: 0; height: 40px;
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, #f7faf8);
  box-shadow: 0 0 0 1px rgba(18, 23, 21, 0.06), 0 1px 2px rgba(18, 23, 21, 0.05), 0 8px 18px -10px rgba(11, 79, 64, 0.35);
  pointer-events: none;
}
.row {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px;
  height: clamp(38px, 8vh, 48px);
  text-align: left;
  border-radius: 12px;
}
.row + .row { box-shadow: 0 -1px 0 var(--linea); }
.row.is-on + .row, .row.is-on { box-shadow: none; }
.tile {
  display: grid; place-items: center; align-content: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--linea);
  line-height: 1;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}
.tile__m { font-size: 7.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--avviso); }
.tile__d { font-size: 13px; font-weight: 650; margin-top: 1px; font-variant-numeric: tabular-nums; }
.row.is-on .tile { background: var(--accento); color: #fff; box-shadow: 0 4px 10px -4px rgba(15, 122, 94, 0.7); }
.row.is-on .tile__m { color: #c9f0e2; }
.row__text { display: grid; gap: 1px; min-width: 0; }
.row__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: font-stretch 0.3s; }
.row__sub { font-size: 11.5px; color: var(--grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row__days { font-size: 12px; color: var(--grigio); font-variant-numeric: tabular-nums; padding-right: 2px; white-space: nowrap; }
.row.is-on .row__days { color: var(--inchiostro); font-weight: 600; }
.row.is-added .row__days::after {
  content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 5px; vertical-align: -1px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><rect x='3' y='4' width='14' height='13' rx='3' fill='none' stroke='black' stroke-width='2'/><path d='M7 11l2 2 4-4' fill='none' stroke='black' stroke-width='2'/></svg>") center / contain no-repeat;
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><rect x='3' y='4' width='14' height='13' rx='3' fill='none' stroke='black' stroke-width='2'/><path d='M7 11l2 2 4-4' fill='none' stroke='black' stroke-width='2'/></svg>") center / contain no-repeat;
  color: var(--accento);
}

@media (hover: hover) {
  .row:not(.is-on):hover .tile { box-shadow: 0 0 0 1px rgba(15, 122, 94, 0.35); }
  .row:not(.is-on):hover .row__name { font-stretch: 108%; }
  .add:not([aria-pressed="true"]):hover { box-shadow: 0 0 0 1px rgba(15, 122, 94, 0.35), 0 1px 2px rgba(18, 23, 21, 0.06), 0 8px 16px -8px rgba(15, 122, 94, 0.4); }
}
.row.is-hover:not(.is-on) .tile { box-shadow: 0 0 0 1px rgba(15, 122, 94, 0.35); }
.row.is-hover:not(.is-on) .row__name { font-stretch: 108%; }

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

@media (max-width: 370px) {
  .add { padding: 0 10px 0 9px; font-size: 11.5px; }
  .row__sub { font-size: 11px; }
}
