/* Booking: modal, in-page slot card, sticky call/book bar.
   All tokens from site.css, so this themes with everything else. */

.bk[hidden] { display: none; }
.bk {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
body.bk-open { overflow: hidden; }

.bk__scrim {
  position: absolute; inset: 0;
  background: rgba(8, 9, 12, .68);
  backdrop-filter: blur(4px);
  animation: bk-fade .18s ease;
}

/* The panel is a flex column, not a scroll box: a pinned head and a scrolling body.
   When the panel itself scrolled, the heading and the close button went with it, and
   a customer partway down the form had no visible way out of the modal. */
.bk__panel {
  position: relative;
  width: 100%; max-width: 620px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-4);
  animation: bk-rise .24s var(--ease);
}

@keyframes bk-fade { from { opacity: 0 } }
@keyframes bk-rise { from { opacity: 0; transform: translateY(16px) scale(.99) } }

.bk__x {
  position: absolute; top: 12px; right: 12px;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-pill);
  cursor: pointer; font-size: 1.4rem; line-height: 1; color: var(--text-2);
  transition: color .16s ease, border-color .16s ease;
}
.bk__x:hover { color: var(--crimson); border-color: var(--crimson); }

.bk__head {
  flex: 0 0 auto;
  padding: 2rem 4rem 1.3rem 2rem;   /* right side clear of the close button */
}
.bk__head h2 { font-size: 1.9rem; margin: 0 0 .5rem; }
.bk__sub { margin: 0; font-size: .95rem; color: var(--text-2); }
.bk__body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 2rem 2rem;
}

/* --- day strip --- */
.bk__days {
  display: flex; gap: .5rem;
  overflow-x: auto;
  /* the chips lift on hover; without headroom the scroll box shears the top edge */
  padding: 3px 3px .7rem; margin: -3px -3px 1.3rem;
  scrollbar-width: thin;
}
.bk__day {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  min-width: 78px; padding: .75rem .55rem;
  background: var(--bg); border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s var(--ease);
}
.bk__day:hover { border-color: var(--line-2); transform: translateY(-1px); }
.bk__day.is-on { background: var(--crimson); border-color: var(--crimson); }
.bk__dow {
  font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-3);
}
.bk__date { font-size: .95rem; font-weight: 700; color: var(--text); }
.bk__count { font-size: 0.78rem; color: var(--text-3); }
.bk__day.is-on .bk__dow,
.bk__day.is-on .bk__date,
.bk__day.is-on .bk__count { color: #fff; }
.bk__day.is-on .bk__count { opacity: .85; }

/* --- time slots --- */
.bk__slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(106px, 1fr));
  gap: .5rem;
  max-height: 268px; overflow-y: auto;
  padding: 3px; margin: -3px;
}
.bk__slot {
  padding: .8rem .4rem; min-height: 48px;
  background: var(--bg); border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--sans); font-size: .94rem; font-weight: 600; color: var(--text);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s var(--ease);
}
.bk__slot:hover {
  border-color: var(--crimson); color: var(--crimson);
  background: var(--crimson-soft); transform: translateY(-1px);
}

.bk__note { margin: 1rem 0 0; font-size: .92rem; color: var(--text-2); text-align: center; }

/* --- details step --- */
.bk__back {
  background: none; border: 0; padding: .3rem 0; cursor: pointer;
  font-family: var(--sans); font-size: .88rem; font-weight: 600; color: var(--text-2);
}
.bk__back:hover { color: var(--crimson); }
.bk__chosen {
  margin: .7rem 0 1.3rem; padding: .9rem 1.1rem;
  background: var(--crimson-soft);
  border-radius: var(--r-sm);
  font-size: .96rem; color: var(--text);
}
.bk__tz { color: var(--text-3); font-size: .85rem; }
.bk__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

.field__err {
  display: block; min-height: 1rem;
  font-size: .79rem; color: #d0453b; margin-top: .2rem;
}
.field--bad input, .field--bad textarea { border-color: #d0453b; }
.field--bad input:focus, .field--bad textarea:focus { box-shadow: 0 0 0 4px rgba(208, 69, 59, .16); }

.bk__error {
  margin: 0 0 1rem; padding: .85rem 1rem;
  background: rgba(208, 69, 59, .1);
  border-left: 3px solid #d0453b;
  border-radius: var(--r-xs);
  color: #d0453b; font-size: .9rem;
}
.bk__submit { width: 100%; margin-top: .4rem; }
.bk__submit:disabled { opacity: .55; cursor: default; transform: none; }
.bk__fine { margin: .9rem 0 0; text-align: center; font-size: .88rem; color: var(--text-2); }

/* --- confirmation --- */
.bk__step--done { text-align: center; padding: 1.5rem 0 .5rem; }
.bk__tick {
  width: 64px; height: 64px; margin: 0 auto 1.2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill); background: var(--crimson); color: #fff; font-size: 1.9rem;
}
.bk__step--done h3 { font-size: 1.6rem; margin-bottom: .6rem; }
.bk__when { font-size: 1.05rem; color: var(--text); margin-bottom: .8rem; }
.bk__links { margin-top: 1.2rem; font-size: .9rem; }

@media (max-width: 560px) {
  /* A bottom sheet. Sized in dvh, or Safari's URL bar pushes the foot of the sheet,
     and the confirm button with it, under the fold. */
  .bk { padding: 0; align-items: flex-end; }
  .bk__panel {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
  }
  .bk__head { padding: 1.35rem 3.4rem .8rem 1.2rem; }
  .bk__head h2 { font-size: 1.4rem; }
  .bk__body { padding: 0 1.2rem calc(1.4rem + env(safe-area-inset-bottom)); }
  .bk__x { top: 10px; right: 10px; width: 36px; height: 36px; }

  /* By the details step the intro has done its job, and on a phone it costs most of
     a screen of scrolling before the first field. */
  .bk__panel:has(.bk__step--who:not([hidden])) .bk__sub { display: none; }

  .bk__grid { grid-template-columns: 1fr; }
  /* the slot grid gets its own scrollbar on desktop; on a phone the sheet's body
     is the only scroller worth having */
  .bk__slots { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: none; }

  .bk .field { margin-bottom: .6rem; }
  /* Desktop reserves a blank line under every field so an error can't shift the
     layout. On a phone that reservation costs more than the shift does. */
  .bk .field__err { min-height: 0; }
  .bk .field--bad .field__err { margin-bottom: .15rem; }
  .bk .field input, .bk .field textarea { padding: .7rem .8rem; font-size: 16px; } /* 16px: iOS zooms the page in below it */
  .bk .field textarea { min-height: 88px; }
  .bk__chosen { margin: .6rem 0 1rem; padding: .75rem .9rem; }
}

/* ---------- in-page "pick a time" card ---------- */

.bookcard {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.9rem;
  box-shadow: var(--sh-4);
}
.bookcard__title {
  font-weight: 800; letter-spacing: -.01em;
  font-size: 1.2rem; color: var(--text); margin: 0 0 .25rem;
}
.bookcard__sub { margin: 0 0 1.4rem; font-size: .92rem; color: var(--text-2); }

.bookcard__day { display: flex; align-items: center; gap: .9rem; margin-bottom: .55rem; }
.bookcard__label {
  flex: 0 0 88px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
}
.bookcard__times { display: flex; gap: .4rem; flex: 1; flex-wrap: wrap; }
.bookcard__slot {
  flex: 1; min-width: 78px; min-height: 46px;
  padding: .6rem .3rem;
  background: var(--bg); border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--text);
  cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease, transform .16s var(--ease);
}
.bookcard__slot:hover {
  border-color: var(--crimson); color: var(--crimson);
  background: var(--crimson-soft); transform: translateY(-1px);
}

.bookcard__skeleton { display: grid; gap: .55rem; }
.bookcard__skeleton span {
  display: block; height: 46px; border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--line) 50%, var(--bg-sunken) 75%);
  background-size: 200% 100%;
  animation: bk-shimmer 1.3s infinite;
}
@keyframes bk-shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

.bookcard__all { width: 100%; margin-top: 1.1rem; }
.bookcard__alt { margin: .9rem 0 0; text-align: center; font-size: .88rem; color: var(--text-2); }

@media (max-width: 560px) {
  .bookcard { padding: 1.4rem; border-radius: var(--r-md); }
  .bookcard__day { flex-direction: column; align-items: stretch; gap: .35rem; margin-bottom: 1rem; }
  .bookcard__label { flex: none; }
}

/* ---------- sticky call/book bar (mobile) ----------
   The number used to live only in the footer, ~86% down the page. */
.callbar { display: none; }
@media (max-width: 900px) {
  .callbar {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90;
    display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
    padding: .5rem;
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: saturate(1.4) blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    box-shadow: var(--sh-3);
  }
  .callbar a, .callbar button {
    display: flex; align-items: center; justify-content: center; gap: .45rem;
    padding: .85rem .5rem; min-height: 48px;
    font-family: var(--sans); font-weight: 700; font-size: .9rem;
    border: 0; border-radius: var(--r-pill); cursor: pointer;
  }
  .callbar__call { background: var(--bg-sunken); color: var(--text); border: 1px solid var(--line); }
  .callbar__call:hover { color: var(--crimson); }
  .callbar__book { background: var(--crimson); color: #fff; }
  .callbar svg { width: 15px; height: 15px; fill: currentColor; }
  body { padding-bottom: 84px; }
  body.bk-open .callbar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bookcard__skeleton span, .bk__scrim, .bk__panel { animation: none !important; }
  .bk__slot:hover, .bookcard__slot:hover, .bk__day:hover { transform: none; }
}
