/* Kitchen of Kindness — session booking calendar.
 *
 * Lives inside the shared Chabad.org minisite theme
 * (w2.chabad.org/images/Shluchim/minisites/themes/kitchen-of-kindness/), which we
 * do not own and must not fight: Bogue bold italic for display, DM Sans for
 * everything else, cream ground, coral primary. Both faces are already loaded by
 * the theme — this file declares neither.
 *
 * Everything is prefixed .kok- and scoped under #kok-booking so nothing here can
 * reach the rest of the page, and so the theme's own rules stay reachable.
 */

#kok-booking {
  --kok-cream: #fcf7dd;
  --kok-card: #fffbeb;
  --kok-coral: #f16457;
  --kok-orange: #f9a755;
  --kok-ink: #231f20;
  --kok-muted: rgba(35, 31, 32, .34);
  --kok-hair: rgba(35, 31, 32, .1);

  font-family: "DM Sans", sans-serif;
  color: var(--kok-ink);
  max-width: 880px;
  margin: 0 auto;
  font-size: 16px;
  line-height: 1.4;
  /* it sits inside a form column, so it sizes off its own box rather than the
     window - a 620px column in a 1400px window is still narrow. */
  container-type: inline-size;
}

#kok-booking *,
#kok-booking *::before,
#kok-booking *::after { box-sizing: border-box; }

/* Static fallback in the markup. JS removes it only once it has something to
 * render, so a dead feed or a thrown error leaves the phone number rather than
 * a blank hole. */
.kok-fallback { padding: 28px 0; }
.kok-ready .kok-fallback { display: none; }

.kok-panes {
  display: grid;
  /* the form column is narrower than a full page, so give the month what the
     time list does not need rather than holding a fixed 250 */
  grid-template-columns: minmax(0, 1fr) minmax(186px, 216px);
  gap: clamp(22px, 3.5vw, 40px);
  align-items: start;
}

/* ---- month grid ---------------------------------------------------------- */

.kok-monthbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}

/* Bogue bold italic, sized to echo the stat numerals on the homepage — the one
 * place this component is allowed to be expressive. */
.kok-month {
  font-family: "Bogue", serif;
  font-weight: 700;
  font-style: italic;
  font-size: 30px;
  line-height: 1;
  color: var(--kok-coral);
  margin: 0;
}

.kok-nav { display: flex; gap: 6px; flex: none; }

.kok-nav button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--kok-card);
  color: var(--kok-coral);
  font: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.kok-nav button:hover:not(:disabled) { background: var(--kok-coral); color: var(--kok-cream); }

.kok-nav button:disabled { color: var(--kok-muted); cursor: default; }

.kok-dow,
.kok-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.kok-dow {
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--kok-muted);
  text-align: center;
}

.kok-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  min-width: 0;
  padding: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--kok-muted);
  font: inherit;
  font-size: 15px;
  cursor: default;
  transition: background .15s, color .15s;
}

/* Open. The only cells that carry a fill, so the month reads as availability at
 * a glance rather than as a wall of boxes. */
.kok-day.is-open {
  background: var(--kok-card);
  color: var(--kok-ink);
  cursor: pointer;
}

.kok-day.is-open:hover { background: #fdeacd; }

.kok-day.is-selected,
.kok-day.is-selected:hover {
  background: var(--kok-coral);
  color: var(--kok-cream);
}

.kok-day.is-empty { visibility: hidden; }

/* Holiday name, under the numeral. Chanukah gets this on an open day; yom tov
 * gets it on a closed one — the label and the blocking are independent. */
.kok-tag {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-width: 100%;
  overflow: hidden;
  font-size: 8px;
  line-height: 1.15;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  opacity: .75;
}

.kok-day.is-open .kok-tag { color: var(--kok-orange); opacity: 1; }

/* ---- time column --------------------------------------------------------- */

.kok-times {
  min-height: 200px;
  padding-top: 52px;   /* .kok-month line box (30) + .kok-monthbar margin (22) */
}

.kok-chosen {
  font-family: "Bogue", serif;
  font-weight: 700;
  font-style: italic;
  font-size: 19px;
  line-height: 1.15;
  color: var(--kok-ink);
  margin: 0 0 4px;
}

.kok-sub {
  font-size: 12px;
  color: var(--kok-muted);
  margin: 0 0 18px;
}

.kok-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Half-hourly starts make this list long — around 21 on a full day — so it
 * scrolls beside the month rather than running past the bottom of it. Sized so
 * the pane ends near the day grid does and a partial chip shows at the cut, which
 * is what tells people there is more below. The grid is 5 or 6 rows depending on
 * the month, so this can only ever be approximately right. Room on the right so
 * the scrollbar never sits on top of a chip's border. */
/* two panes only when the component is genuinely wide. the time list scrolls
   beside the month and fades at the cut so it reads as "more below" rather than
   a chip sliced in half; js drops .is-scrollable at the bottom, otherwise the
   last chip stays faded with nothing left to scroll to. */
@container (min-width: 721px) {
  .kok-slots {
    max-height: 340px;
    overflow-y: auto;
    padding-right: 6px;
  }

  .kok-slots.is-scrollable {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 34px), transparent);
  }
}

/* narrow: give the month the whole column and wrap the times underneath, which
   is far more legible than squeezing seven day cells into 420px. */
@container (max-width: 720px) {
  .kok-panes { grid-template-columns: 1fr; gap: 26px; }
  .kok-times { padding-top: 0; }

  .kok-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    gap: 8px;
    max-height: none;
    overflow: visible;
  }

}

.kok-slot {
  padding: 11px 14px;
  border: 1.5px solid var(--kok-coral);
  border-radius: 999px;
  background: transparent;
  color: var(--kok-coral);
  font: inherit;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.kok-slot:hover { background: var(--kok-coral); color: var(--kok-cream); }

.kok-slot.is-selected { background: var(--kok-coral); color: var(--kok-cream); }

/* Taken and hand-blocked are deliberately identical — the spec is that a visitor
 * cannot tell a booked slot from a closed one. */
.kok-slot.is-taken {
  border-color: var(--kok-hair);
  background: transparent;
  color: var(--kok-muted);
  cursor: default;
}

.kok-slot.is-taken:hover { background: transparent; color: var(--kok-muted); }

.kok-hint { font-size: 13px; color: var(--kok-muted); margin: 0; }

/* ---- notices ------------------------------------------------------------- */

/* Set when someone submits with no slot chosen. The platform cannot enforce this
 * itself: the fields carrying the slot are hidden, and a hidden field may not be
 * required. */
#kok-booking.kok-unpicked::before {
  content: "Please choose a day and a time before submitting.";
  display: block;
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--kok-coral);
  color: var(--kok-cream);
  font-size: 13px;
}


/* Shown when the feed cannot be read. The calendar still renders, but every slot
 * would look open, so we say so rather than take a booking we cannot honour. */
.kok-notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fdeacd;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 720px) {
  .kok-panes { grid-template-columns: 1fr; gap: 30px; }
  .kok-times { padding-top: 0; }
  .kok-month { font-size: 26px; }
  .kok-day { font-size: 14px; border-radius: 10px; }
  .kok-tag { font-size: 7px; }
}
