/*
 * Structural + motion layer for shared/booking.js. No colours, fonts or spacing personality:
 * each direction skins the flow on top of this. Override the custom properties on `.bk`.
 *
 *   --bk-ease-out     strong ease-out used for UI responses
 *   --bk-mark-color   stroke colour of the selection mark          (default: currentColor)
 *   --bk-mark-width   stroke width in SVG user units               (default: 2)
 *   --bk-mark-draw    how long the mark takes to draw              (default: 240ms)
 *   --bk-mark-inset   inset of enclosing marks (circle, box)       (default: -6px -10px)
 */
.bk {
  --bk-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --bk-mark-draw: 240ms;
  position: relative;
}

.bk-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* Panels stack in one grid cell so the outgoing and incoming steps can overlap mid-transition
   without absolute positioning; the viewport's height is animated explicitly by the engine. */
.bk-viewport { display: grid; }
.bk-viewport.is-animating { overflow: clip; overflow-clip-margin: 16px; }
.bk-panel { grid-area: 1 / 1; align-self: start; min-width: 0; }
.bk-panel[hidden] { display: none; }
.bk-panel-title:focus { outline: none; }

.bk-cal-head,
.bk-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }

.bk-choice { position: relative; -webkit-tap-highlight-color: transparent; }
.bk-choice > * { position: relative; }          /* keep text above enclosing marks */
.bk-role { cursor: pointer; }

/* ---------- selection marks ---------- */
.bk-mark { display: inline-block; flex: none; pointer-events: none; }
.bk-mark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bk-mark path {
  fill: none;
  stroke: var(--bk-mark-color, currentColor);
  stroke-width: var(--bk-mark-width, 2);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 2;
  stroke-dashoffset: 1.02;                       /* fully undrawn (no stray round cap) */
  transition: stroke-dashoffset 140ms var(--bk-ease-out);   /* un-draw: fast */
}
[data-selected="true"] > .bk-mark path {
  stroke-dashoffset: 0;
  transition-duration: var(--bk-mark-draw);       /* draw: deliberate */
}
[data-selected="true"] > .bk-mark path + path { transition-delay: calc(var(--bk-mark-draw) * 0.45); }

.bk-mark--circle,
.bk-mark--box { position: absolute !important; inset: var(--bk-mark-inset, -6px -10px); }

/* ---------- inline errors: height via grid rows, text via opacity ---------- */
.bk-error-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 220ms var(--bk-ease-out);
}
.bk-error-wrap > div { overflow: hidden; min-height: 0; }
.bk-error {
  margin: 0;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 140ms ease, transform 220ms var(--bk-ease-out);
}
[data-invalid] > .bk-error-wrap { grid-template-rows: 1fr; }
[data-invalid] > .bk-error-wrap .bk-error { opacity: 1; transform: none; }

/* ---------- optional group ---------- */
.bk-optional { border: 0; margin: 0; padding: 0; min-width: 0; }
.bk-roles { border: 0; margin: 0; padding: 0; min-width: 0; }
.bk-row { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 460px) { .bk-row { grid-template-columns: 1fr; } }

/* ---------- submit: labels crossfade through a slight blur ---------- */
.bk-submit { position: relative; }
.bk-submit-inner { display: inline-grid; }
.bk-submit-label {
  grid-area: 1 / 1;
  transition: opacity 180ms ease, filter 180ms ease, transform 220ms var(--bk-ease-out);
}
.bk-submit-label[data-for="loading"] { opacity: 0; filter: blur(2px); transform: translateY(4px); }
.bk-submit[data-state="loading"] { pointer-events: none; }
.bk-submit[data-state="loading"] .bk-submit-label[data-for="idle"] { opacity: 0; filter: blur(2px); transform: translateY(-4px); }
.bk-submit[data-state="loading"] .bk-submit-label[data-for="loading"] { opacity: 1; filter: blur(0); transform: none; }
.bk-dots i { font-style: normal; animation: bk-dot 1s infinite linear; }
.bk-dots i:nth-child(2) { animation-delay: 0.16s; }
.bk-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes bk-dot { 0%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.bk-done-mark { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
  .bk-mark path { stroke-dashoffset: 0; opacity: 0; transition: opacity 150ms ease; }
  [data-selected="true"] > .bk-mark path { opacity: 1; transition-delay: 0s !important; }
  .bk-error, .bk-submit-label { transform: none !important; }
  .bk-dots i { animation: none; opacity: 1; }
}
