/* The booking week · a real calendar, not an abstract grid.
   The previous version asked the reader to decode a heat map. This is the
   clinic's own week as they would actually see it: a card, a toolbar, a
   time gutter, and one discrete block per appointment. Routine bookings
   are muted; the ones that came in while the practice was shut are filled
   and carry the time they arrived. You can count them without a legend. */
.bw {
  --bw-row: 34px;
  --bw-gut: 54px;
  display: grid;
  gap: 18px;
}

.bw__card {
  background: #fdfbf6;
  border: 1px solid rgba(22, 50, 60, .14);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18), 0 24px 54px -28px rgba(0, 0, 0, .55);
  color: #16323c;
}

/* toolbar */
.bw__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(22, 50, 60, .12);
  background: #fffdf9;
}
.bw__today {
  font: 600 11.5px/1 var(--f-body);
  padding: 7px 12px;
  border: 1px solid rgba(22, 50, 60, .2);
  border-radius: 7px;
  color: #16323c;
}
.bw__nav { display: flex; gap: 3px; color: #6c7f87; }
.bw__nav span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font: 600 13px/1 var(--f-body);
}
.bw__month { font: 700 13.5px/1 var(--f-display); letter-spacing: -.01em; }
.bw__view {
  margin-left: auto;
  font: 600 11.5px/1 var(--f-body);
  padding: 7px 12px;
  border: 1px solid rgba(22, 50, 60, .2);
  border-radius: 7px;
  color: #16323c;
}

/* head + grid share one column template so they stay aligned */
.bw__head,
.bw__body { display: grid; grid-template-columns: var(--bw-gut) repeat(6, minmax(0, 1fr)); }

.bw__head { border-bottom: 1px solid rgba(22, 50, 60, .12); background: #fffdf9; }
.bw__head > span { padding: 9px 4px; text-align: center; border-left: 1px solid rgba(22, 50, 60, .08); }
.bw__head > span:first-child { border-left: 0; }
.bw__head b { display: block; font: 600 9.5px/1 var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: #8b9ba2; }
.bw__head i { display: block; font: 700 16px/1.25 var(--f-display); font-style: normal; color: #16323c; }
.bw__head span.is-shut i,
.bw__head span.is-shut b { color: #b3bfc4; }

.bw__body { position: relative; }
.bw__gut { display: grid; }
.bw__gut span {
  height: var(--bw-row);
  font: 500 9.5px/1 var(--f-mono);
  color: #96a4aa;
  display: grid;
  align-items: start;
  justify-items: end;
  padding: 3px 7px 0 0;
}
.bw__col { position: relative; border-left: 1px solid rgba(22, 50, 60, .08); }
.bw__col .bw__slot { height: var(--bw-row); border-bottom: 1px solid rgba(22, 50, 60, .06); }
.bw__col.is-shut { background: repeating-linear-gradient(135deg, rgba(22,50,60,.035) 0 6px, transparent 6px 12px); }
.bw__closed {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 9.5px/1 var(--f-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #a9b6bb;
}

/* one appointment */
.bw__ev {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  overflow: hidden;
  display: grid;
  align-content: center;
  gap: 1px;
  opacity: 0;
  transform: translateY(5px) scale(.97);
  animation: bw-settle .34s cubic-bezier(.2, .9, .25, 1.06) forwards;
}
@keyframes bw-settle { to { opacity: 1; transform: none; } }

/* routine, booked on the phone during the day: present but not the point */
.bw__ev--fill { background: #e8eef0; border: 1px solid rgba(22, 50, 60, .1); }
.bw__ev--fill b { font: 600 9.5px/1.15 var(--f-body); color: #5d7079; filter: blur(2.1px); }
.bw__ev--fill small { font: 500 8px/1 var(--f-mono); color: #93a2a8; filter: blur(1.6px); }

/* the ones that arrived while the lights were off */
.bw__ev--new { background: #2f8a6d; border: 1px solid #27775d; color: #fff; }
.bw__ev--new b { font: 700 9.5px/1.15 var(--f-body); }
.bw__ev--new small { font: 600 8px/1 var(--f-mono); color: rgba(255, 255, 255, .85); }
.bw__ev--new.is-pop { animation: bw-settle .34s cubic-bezier(.2, .9, .25, 1.06) forwards, bw-lift 1.5s ease-out .3s 1; }
@keyframes bw-lift {
  0% { box-shadow: 0 0 0 0 rgba(47, 138, 109, .5); }
  100% { box-shadow: 0 0 0 9px rgba(47, 138, 109, 0); }
}

/* the readout */
.bw__read { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 22px; align-items: center; }
.bw__big {
  grid-row: span 2;
  font: 800 clamp(52px, 9vw, 84px)/.86 var(--f-display);
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  color: #8fd0b6;
}
.bw__read p { margin: 0; font-size: 16.5px; line-height: 1.45; max-width: 38ch; }
.bw__keys { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.bw__k { display: inline-flex; align-items: center; gap: 8px; font: 500 13.5px/1 var(--f-body); color: var(--invert-muted); }
.bw__k i { width: 13px; height: 13px; border-radius: 4px; display: block; }
.bw__k i.fill { background: #e8eef0; border: 1px solid rgba(22, 50, 60, .18); }
.bw__k i.new { background: #2f8a6d; }
.bw__k b { font-variant-numeric: tabular-nums; color: var(--invert-fg); font-weight: 700; }

.bw__replay {
  justify-self: start;
  background: none;
  border: 1px solid var(--invert-line);
  color: inherit;
  border-radius: 999px;
  padding: 8px 15px;
  font: 600 12.5px/1 var(--f-body);
  cursor: pointer;
}
.bw__replay:hover { background: var(--invert-line); }

@media (max-width: 860px) {
  .bw { --bw-row: 30px; --bw-gut: 42px; }
  .bw__head i { font-size: 13.5px; }
  .bw__ev { padding: 3px 5px; }
  .bw__ev--fill b, .bw__ev--new b { font-size: 8.5px; }
  .bw__ev small { display: none; }
}
/* phones: the whole week shrinks to fit the card, never scrolls sideways */
@media (max-width: 620px) {
  .bw { --bw-row: 28px; --bw-gut: 30px; }
  .bw__bar { gap: 6px; padding: 9px 10px; }
  .bw__today, .bw__view { font-size: 10.5px; padding: 6px 8px; }
  .bw__nav span { width: 18px; }
  .bw__month { font-size: 12.5px; white-space: nowrap; }
  .bw__head > span { padding: 7px 0; }
  .bw__head b { font-size: 8px; letter-spacing: .02em; }
  .bw__head i { font-size: 12px; }
  .bw__gut span { font-size: 7.5px; padding: 3px 3px 0 0; white-space: nowrap; }
  .bw__closed { font-size: 7px; letter-spacing: .02em; writing-mode: vertical-rl; }
  .bw__ev { left: 2px; right: 2px; padding: 2px 3px; border-radius: 4px; }
  .bw__ev--fill b, .bw__ev--new b { font-size: 7.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .bw__read { grid-template-columns: 1fr; }
  .bw__big { grid-row: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .bw__ev, .bw__ev--new.is-pop { animation: none; opacity: 1; transform: none; box-shadow: none; }
}
