.bb {
  --paper: #eceae6;
  --ink: #141413;
  --soft: #8b8983;
  --mark: #f2c81a;
  position: relative;
  width: 540px;
  height: 540px;
  background-color: var(--paper);
  /* the sheet under a low light from the upper left, and its grain */
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 45%, rgba(60, 52, 40, 0.07) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.18  0 0 0 0 0.15  0 0 0 0.9 -0.36'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: "Martian Mono Variable", monospace;
  font-stretch: 87.5%;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.bb * { box-sizing: border-box; }

.bb-cal { position: absolute; inset: 0; }

/* The heading: the selected date, set large, and the month the sheet shows. */
.bb-head {
  position: absolute;
  left: 32px;
  right: 32px;
  top: 30px;
  height: 96px;
}

.bb-caption {
  margin: 0;
  position: absolute;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.bb-date {
  display: block;
  min-width: 68px;
  margin-left: -5px;
  font-size: 106px;
  line-height: 78px;
  font-weight: 300;
  font-stretch: 75%;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.bb-weekday {
  font-size: 22px;
  line-height: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.bb-month {
  margin: 0;
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 22px;
  line-height: 24px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--soft);
}

/* The month: seven columns of 68 px, a hairline over every week. */
.bb-grid {
  position: absolute;
  left: 32px;
  top: 142px;
  width: 476px;
  border-collapse: collapse;
  table-layout: fixed;
}

.bb-grid th,
.bb-grid td { padding: 0; }

.bb-wd {
  height: 24px;
  vertical-align: top;
  text-align: left;
  font-size: 9.5px;
  line-height: 12px;
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--soft);
}

.bb-grid tbody td {
  position: relative;
  width: 68px;
  height: 68px;
  border-top: 1px solid rgba(20, 20, 19, 0.2);
}

.bb-grid tbody tr:last-child td { border-bottom: 1px solid rgba(20, 20, 19, 0.2); }

.bb-day {
  cursor: pointer;
  outline: none;
}

.bb-num {
  position: absolute;
  left: -2px;
  top: 5px;
  min-width: 15px;
  height: 14px;
  padding: 0 2px;
  font-size: 11px;
  line-height: 14px;
  font-weight: 500;
  font-stretch: 100%;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.bb-day[data-selected] .bb-num {
  background: var(--mark);
  font-weight: 700;
}

/* keyboard focus: a ring drawn round the day's dimple */
.bb-day:focus-visible .bb-dimple {
  outline: 1.5px solid var(--ink);
  outline-offset: 2px;
}

/* A day's dimple, pressed blind into the sheet: its upper-left wall is turned
   from the light, its lower-right wall towards it. */
.bb-dimple {
  position: absolute;
  left: 13px;
  top: 19px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c9c6bf 8%, #dedbd5 34%, #efede9 60%, #fdfdfc 92%);
  box-shadow:
    inset 1.5px 1.5px 2px rgba(52, 46, 36, 0.3),
    inset -1px -1px 1.5px rgba(255, 255, 255, 0.95),
    -0.75px -0.75px 0.5px rgba(255, 255, 255, 0.8),
    0.75px 0.75px 0.75px rgba(52, 46, 36, 0.12);
}

/* The ball, its shadows and the hand's hold on it, all placed from the simulation. */
.bb-ball,
.bb-grab,
.bb-shadow,
.bb-contact {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
}

.bb-ball {
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  pointer-events: none;
}

.bb-grab {
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
}

.bb-grab[data-held] { cursor: grabbing; }

.bb-shadow {
  width: 35px;
  height: 35px;
  margin: -17.5px 0 0 -17.5px;
  border-radius: 50%;
  background: #2a2520;
  pointer-events: none;
}

.bb-contact {
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(30, 26, 20, 0.7) 70%, rgba(30, 26, 20, 0.26) 84%, rgba(30, 26, 20, 0) 100%);
  pointer-events: none;
}
