:root {
  --fondo: #000000;
  --pillola: #111113;
  --pillola-alta: #202024;
  --testo: #f4f2ee;
  --testo-spento: rgba(244, 242, 238, 0.5);
  --carta: #f7f4ee;
  --carta-retro: #e4ded3;
  --accento: #ff5a43;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

/* the pill: graphite with a hairline that takes the light on top, a warm rim once the event is in */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(300px, calc(100vw - 32px));
  height: 60px;
  padding: 0 13px 0 10px;
  border-radius: 30px;
  text-align: left;
  color: var(--testo);
  background: linear-gradient(180deg, var(--pillola-alta) 0%, var(--pillola) 60%, #0b0b0c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.11),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 12px 30px -14px rgba(255, 90, 67, calc(var(--alone, 0) * 0.55)),
    0 0 0 1px rgba(255, 90, 67, calc(var(--alone, 0) * 0.26));
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  outline: none;
  isolation: isolate;
}
.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow 0.25s ease;
}
.btn:focus-visible::after {
  box-shadow: 0 0 0 3px #000000, 0 0 0 5px var(--accento);
}

/* a soft warm light under the pointer, inside the graphite */
.btn__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}
.btn__light::before {
  content: "";
  position: absolute;
  left: var(--mx, 70%);
  top: var(--my, 0%);
  width: 200px;
  height: 130px;
  margin: -65px 0 0 -100px;
  background: radial-gradient(closest-side, rgba(255, 214, 196, 0.13), rgba(255, 214, 196, 0));
  opacity: var(--luce, 0);
}

/* ---- the calendar icon: a graphite body, two rings and a page hinged on top ---- */
.cal {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
}
.cal__body {
  position: absolute;
  left: 3px;
  top: 6px;
  width: 34px;
  height: 31px;
  border-radius: 8px;
  background: linear-gradient(180deg, #2a2a2f, #18181b);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 10px -4px rgba(0, 0, 0, 0.9);
  z-index: 1;
}
.cal__pocket {
  position: absolute;
  left: 3px;
  top: 4px;
  right: 3px;
  bottom: 3px;
  border-radius: 5px;
  background: linear-gradient(180deg, #050506, #111113);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.9);
}
.cal__ring {
  position: absolute;
  top: 3px;
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: linear-gradient(180deg, #d9d6d0, #8b8883);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
  z-index: 4;
}
.cal__ring--a { left: 12px; }
.cal__ring--b { right: 12px; }
.cal__lid {
  position: absolute;
  left: 6px;
  top: 9px;
  width: 28px;
  height: 25px;
  transform-origin: 50% 0;
  transform-style: preserve-3d;
  z-index: 3;
}
.face {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.face--grid {
  background: linear-gradient(180deg, #2e2e33, #232327);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.face__band {
  display: block;
  height: 6px;
  background: rgba(255, 90, 67, 0.55);
  color: #ffffff;
  font-size: 5px;
  line-height: 6px;
  font-weight: 700;
  font-stretch: 120%;
  letter-spacing: 0.12em;
  text-align: center;
}
.face__rows {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 9px;
  bottom: 4px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 4px);
  opacity: 0.8;
}
.face--date {
  background: linear-gradient(180deg, #ffffff, var(--carta));
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  opacity: 0;
}
.face__band--on { background: var(--accento); height: 7px; line-height: 7px; }
.face__day {
  display: block;
  text-align: center;
  color: #18120f;
  font-size: 13px;
  line-height: 17px;
  font-weight: 720;
  font-stretch: 92%;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.face__shine {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: 0;
  width: 10px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  transform: translateX(-14px) skewX(-18deg);
  mix-blend-mode: soft-light;
}
.face--back {
  background: linear-gradient(0deg, #3a3a40, #26262a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  transform: rotateX(180deg);
}

/* ---- the words: two rows, one shows at a time ---- */
.btn__words {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 40px;
  overflow: hidden;
}
.btn__row {
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.btn__label {
  line-height: 20px;
  font-size: 16px;
  font-weight: 590;
  font-stretch: 100%;
  letter-spacing: -0.006em;
  white-space: nowrap;
}
.btn__sub {
  line-height: 15px;
  font-size: 11.5px;
  font-weight: 480;
  font-stretch: 104%;
  color: var(--testo-spento);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
[data-done] { opacity: 0; }
[data-done] .btn__sub { color: rgba(255, 196, 182, 0.72); }

/* ---- the date page on the right: a tear-off sheet that folds along its middle ---- */
.btn__side {
  position: relative;
  flex: 0 0 32px;
  width: 32px;
  height: 40px;
}
.chip {
  position: absolute;
  left: 1px;
  top: 2px;
  width: 30px;
  height: 36px;
  perspective: 160px;
  z-index: 2;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.chip__half {
  position: absolute;
  left: 0;
  width: 30px;
  height: 18px;
}
.chip__half--bottom {
  top: 18px;
  overflow: hidden;
  border-radius: 0 0 5px 5px;
  background: var(--carta);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}
.chip__half--bottom .chip__sheet { top: -18px; }
.chip__half--top {
  top: 0;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  z-index: 2;
}
.chip__front, .chip__back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 5px 5px 0 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.chip__back {
  transform: rotateX(180deg);
  border-radius: 0 0 5px 5px;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.045) 0 1px, transparent 1px 4px),
    linear-gradient(180deg, var(--carta-retro), #d8d1c5);
}
.chip__sheet {
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 36px;
  background: linear-gradient(180deg, #ffffff 0%, var(--carta) 100%);
}
.chip__band {
  display: block;
  height: 10px;
  background: linear-gradient(180deg, #ff6c56, var(--accento));
  color: #ffffff;
  font-size: 6.5px;
  line-height: 10px;
  font-weight: 720;
  font-stretch: 125%;
  letter-spacing: 0.14em;
  text-align: center;
  box-shadow: inset 0 -1px 0 rgba(120, 20, 8, 0.25);
}
.chip__day {
  display: block;
  text-align: center;
  color: #18120f;
  font-size: 17px;
  line-height: 25px;
  font-weight: 740;
  font-stretch: 90%;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}
.chip__crease {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(40, 24, 12, 0.32), rgba(40, 24, 12, 0) 70%);
  opacity: 0;
}
.chip__gloss {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 30%, rgba(60, 30, 10, 0.28));
  opacity: 0;
}
.chip__shadow {
  position: absolute;
  left: 3px;
  top: 8px;
  width: 26px;
  height: 30px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  filter: blur(3px);
  opacity: 0.5;
  z-index: 1;
}

/* the check that is drawn where the page was */
.tick {
  position: absolute;
  left: 2px;
  top: 6px;
  width: 28px;
  height: 28px;
  overflow: visible;
  pointer-events: none;
}
.tick__ring { fill: none; stroke: rgba(255, 90, 67, 0.4); stroke-width: 1; }
.tick__mark { fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

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

.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #ffffff;
  stroke: #111114;
  stroke-width: 1.4;
  stroke-linejoin: round;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  z-index: 10;
}
