/* ==========================================================================
   booking.css — on-page booking widget.
   Every selector begins `.bk-` (plus @keyframes named `bk-…`). Tokens only —
   see assets/css/tokens.css. Loaded after site.css on index.html.
   ========================================================================== */

.bk {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: clamp(20px, 3vw, 32px);
  box-sizing: border-box;
  text-align: left;
}
/* Defensive: whatever the host's own grid/flex tracks do, the widget itself
   must never be the thing that widens its container. */
.bk > * {
  min-width: 0;
  max-width: 100%;
}

/* ---- Header (title + meta row) ---- */
.bk-header {
  margin-bottom: 20px;
}
.bk-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-regular);
  color: var(--ink-strong);
  margin: 0 0 8px;
}
.bk-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: var(--fs-tiny);
  color: var(--ink-soft);
}
.bk-meta__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bk-icon {
  display: inline-flex;
  flex-shrink: 0;
  color: var(--ink-faint);
}
.bk-icon svg {
  display: block;
}
.bk-summary .bk-icon,
.bk-confirm-icon .bk-icon {
  color: inherit;
}

/* ---- Status region ---- */
.bk-status {
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--accent-wash);
  color: var(--accent-ink);
  border-radius: 0;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.bk-status[hidden] {
  display: none;
}
.bk-status a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---- Body / state transitions ---- */
.bk-body {
  flex: 1;
  min-width: 0;
}
.bk-state {
  animation: bk-fade-in var(--dur-fast) var(--ease-out);
}
@keyframes bk-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---- Skeleton (initial load only) ----
   Mirrors State 1's own layout rhythm (label, 72px day strip, label with its
   22px top margin, time grid) rather than arbitrary bars, so replacing it
   with the real State 1 markup doesn't visibly jump the card. Each piece
   carries its own margin instead of a flex `gap` so those margins can match
   `.bk-label`'s real ones exactly. */
.bk-skeleton__label,
.bk-skeleton__days,
.bk-skeleton__times {
  border-radius: 0;
  background: var(--paper-2);
  animation: bk-pulse 1.2s ease-in-out infinite;
}
.bk-skeleton__label {
  width: 112px;
  height: 12px;
  margin: 0 0 10px;
  border-radius: 0;
}
.bk-skeleton__label--2 {
  margin-top: 22px;
}
.bk-skeleton__days {
  height: 72px;
  margin-bottom: 8px;
}
.bk-skeleton__times {
  /* A typical few-rows-of-times footprint — real data can still reflow it,
     this just avoids the common case of a visible height jump. */
  height: 136px;
}
@keyframes bk-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* ---- Step labels ("[ 1 · Choose a Day ]") ----
   The bracket style itself (sans, medium, accent, CSS brackets) is the shared label rule in site.css. */
.bk-label {
  line-height: 1;
  margin: 0 0 10px;
}
.bk-state--1 .bk-label:not(:first-child) {
  margin-top: 22px;
}

/* ---- Day strip ---- */
.bk-days-wrap {
  position: relative;
}
.bk-days-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 8px;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--surface));
  pointer-events: none;
}
.bk-days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 8px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.bk-days::-webkit-scrollbar {
  display: none;
}
.bk-day {
  flex-shrink: 0;
  scroll-snap-align: start;
  min-width: 64px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.bk-day:hover {
  background: var(--surface-hover);
}
.bk-day__wd {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
  color: var(--ink-subtle);
}
.bk-day__num {
  font-size: 20px;
  font-weight: var(--fw-regular);
  line-height: 1;
  color: var(--ink-strong);
}
.bk-day__mo {
  font-size: 12px;
  color: var(--ink-soft);
}
.bk-day.is-selected {
  background: var(--btn-dark);
  border-color: var(--btn-dark);
}
.bk-day.is-selected:hover {
  background: var(--btn-dark);
}
.bk-day.is-selected .bk-day__wd,
.bk-day.is-selected .bk-day__num,
.bk-day.is-selected .bk-day__mo {
  color: var(--btn-dark-ink);
}
.bk-day--later {
  border-style: dashed;
  border-color: var(--line-dashed);
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: var(--fw-medium);
  padding: 0 12px;
  text-align: center;
}
.bk-day--later:hover {
  border-color: var(--ink-subtle);
  color: var(--ink);
}
.bk-day--later:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---- Time grid ---- */
.bk-times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 236px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}
.bk-times::-webkit-scrollbar {
  width: 6px;
}
.bk-times::-webkit-scrollbar-thumb {
  background: var(--line-pill);
  border-radius: var(--radius-pill);
}
.bk-time {
  height: 40px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-pill);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}
.bk-time:hover {
  border-color: var(--ink-subtle);
}
.bk-time.is-selected {
  background: var(--btn-dark);
  border-color: var(--btn-dark);
  color: var(--btn-dark-ink);
}

/* ---- State 2 — summary row ---- */
.bk-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  margin-bottom: 24px;
}
.bk-summary__text {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  color: var(--ink-strong);
}
/* Keep the time range itself unbreakable — the only place this line may
   legally wrap is between the date and the range, never inside "2:00 – 2:30
   pm" (which otherwise wraps as "2:00 – 2:30 / pm" in a narrow column). */
.bk-summary__time {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .bk-summary__text {
    font-size: 15px;
  }
}
.bk-change {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: var(--fw-medium);
  color: var(--ink);
  border-bottom: 1px solid var(--ink-faint);
  cursor: pointer;
}
.bk-change:hover {
  border-bottom-color: var(--ink);
}

/* ---- Form ---- */
.bk-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.bk-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bk-field__label {
  font-size: var(--fs-tiny);
  color: var(--ink-2);
}
.bk-field__input {
  height: 44px;
  padding: 0 14px;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-pill);
  border-radius: 0;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.bk-field__input::placeholder {
  color: var(--ink-faint);
}
.bk-field__input:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: var(--focus-ring);
}
.bk-field__input[aria-invalid="true"] {
  border-color: var(--accent-ink);
}
.bk-field__error {
  font-size: 12.5px;
  color: var(--accent-ink);
  margin: 0;
}
.bk-field__error[hidden] {
  display: none;
}

/* Honeypot — visually hidden but present and reachable by bots' scripts,
   not display:none, so form-filling bots still find and fill it. */
.bk-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  left: -9999px;
  top: auto;
}

.bk-privacy {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: -4px 0 0;
}
.bk-privacy a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Submit button ---- */
.bk-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 0;
  background: var(--btn-dark);
  color: var(--btn-dark-ink);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out);
}
.bk-submit:hover:not(:disabled) {
  background: var(--btn-dark-hover);
}
.bk-submit:active:not(:disabled) {
  transform: translateY(1px);
}
.bk-submit:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}
.bk-submit:disabled {
  cursor: default;
  opacity: 0.85;
}
.bk-icon--spinner svg {
  animation: bk-spin 800ms linear infinite;
}

/* ---- State 3 — confirmation ---- */
.bk-state--3 {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-block: 12px;
  gap: 4px;
}
.bk-confirm-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--ok-wash);
  color: var(--ok-ink);
  margin-bottom: 12px;
}
.bk-tick-path {
  stroke-dasharray: 24;
  stroke-dashoffset: 24;
  animation: bk-tick-draw 420ms var(--ease-out) 120ms forwards;
}
@keyframes bk-tick-draw {
  to {
    stroke-dashoffset: 0;
  }
}
.bk-confirm-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-regular);
  color: var(--ink-strong);
  margin: 4px 0 2px;
}
.bk-confirm-when {
  font-size: 16px;
  color: var(--ink-strong);
  margin: 0;
}
.bk-confirm-tz {
  font-size: var(--fs-tiny);
  color: var(--ink-soft);
  margin: 0;
}
.bk-confirm-email {
  font-size: var(--fs-small);
  color: var(--ink-2);
  margin: 10px 0 0;
}
.bk-confirm-test {
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: var(--ls-kicker);
  color: var(--ink-subtle);
  margin: 14px 0 0;
}

@keyframes bk-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Small containers (phones / narrow embeds) ---- */
@media (max-width: 480px) {
  .bk-times {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---- Motion ---- */
@media (prefers-reduced-motion: reduce) {
  .bk-state {
    animation: none;
  }
  .bk-skeleton__label,
  .bk-skeleton__days,
  .bk-skeleton__times {
    animation: none;
    opacity: 0.8;
  }
  .bk-tick-path {
    animation: none;
    stroke-dashoffset: 0;
  }
  .bk-icon--spinner svg {
    animation: none;
  }
}
