/*
 * Clarity booking widget.
 *
 * Every colour and font reads the host page's custom properties with a
 * fallback, so dropping the widget on another page makes it look like that
 * page rather than like this one.
 */

.cbk {
  --cbk-bg:      var(--panel, #F2F3EE);
  --cbk-bg-2:    var(--bg, #E9EAE4);
  --cbk-line:    rgba(31, 42, 41, .16);
  --cbk-line-2:  rgba(31, 42, 41, .1);
  --cbk-text:    var(--text, #1F2A29);
  --cbk-dark:    var(--dark, #16211F);
  --cbk-muted:   rgba(31, 42, 41, .62);
  --cbk-primary: var(--primary, #8A3B4C);
  --cbk-second:  var(--secondary, #3E6E7A);
  --cbk-radius:  var(--r, 6px);
  --cbk-radius-s: var(--r-sm, 3px);
  --cbk-fb:      var(--fb, 'Assistant', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif);
  --cbk-fd:      var(--fd, 'Noto Serif Hebrew', 'Assistant', Georgia, serif);

  direction: rtl;
  font-family: var(--cbk-fb);
  color: var(--cbk-text);
  line-height: 1.7;
  font-size: 16px;
  text-align: right;
}

.cbk *, .cbk *::before, .cbk *::after { box-sizing: border-box; }

/*
 * :where() so this reset carries no specificity of its own. Written as
 * `.cbk button` it scored higher than `.cbk-btn` and quietly stripped the
 * background off every button the component styles afterwards.
 */
:where(.cbk) button {
  font-family: inherit; cursor: pointer;
  border: none; background: none; color: inherit;
}

/* ------------------------------------------------------------------ header */

.cbk-head { margin-bottom: 20px; }
.cbk-title {
  font-family: var(--cbk-fd); font-weight: 500;
  font-size: clamp(21px, 3vw, 26px); line-height: 1.3;
  color: var(--cbk-dark); margin: 0 0 6px;
}
.cbk-meta {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  font-size: 14px; color: var(--cbk-muted); margin: 0;
}
.cbk-meta span { display: inline-flex; align-items: center; gap: 6px; }
.cbk-meta svg { width: 15px; height: 15px; flex-shrink: 0; opacity: .75; }

/* ------------------------------------------------------------------- steps */

.cbk-steps {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 22px; padding: 0; list-style: none;
  font-size: 12.5px; color: var(--cbk-muted);
}
.cbk-steps li { display: flex; align-items: center; gap: 8px; }
.cbk-steps li::after {
  content: ''; width: 16px; height: 1px; background: var(--cbk-line);
}
.cbk-steps li:last-child::after { display: none; }
.cbk-steps .n {
  width: 21px; height: 21px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--cbk-line); font-size: 11.5px; font-weight: 600;
}
.cbk-steps li[aria-current="step"] { color: var(--cbk-dark); font-weight: 600; }
.cbk-steps li[aria-current="step"] .n,
.cbk-steps li[data-done] .n {
  background: var(--cbk-primary); border-color: var(--cbk-primary); color: var(--cbk-bg-2);
}

/* -------------------------------------------------------------- date picker */

.cbk-panel {
  background: var(--cbk-bg); border: 1px solid var(--cbk-line);
  border-radius: var(--cbk-radius); padding: 18px;
}

/*
 * Calendar and hours share a row as soon as there is room. Keeping both on
 * screen is the point: choosing a day should reveal the hours, not scroll them
 * into view. minmax(0, ...) stops a long slot grid from forcing the columns
 * wider than the modal.
 */
.cbk-when { display: grid; gap: 12px; align-items: start; }

@media (min-width: 760px) {
  .cbk-when { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
  .cbk-times { align-self: stretch; }
}

/* ------------------------------------------------------ idle, then awake */

.cbk-times {
  display: flex; flex-direction: column;
  transition: opacity .45s ease, border-color .45s ease, background .45s ease;
}
.cbk-slots-body { flex: 1; display: flex; flex-direction: column; }
.cbk-slots-body > .cbk-idle { flex: 1; }
.cbk-times[data-state="idle"],
.cbk-times[data-state="empty"] {
  opacity: .58;
  border-style: dashed;
  background: transparent;
}
.cbk-times[data-state="ready"] { opacity: 1; }

.cbk-idle {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 150px; height: 100%;
  text-align: center; color: var(--cbk-muted); padding: 10px;
}
.cbk-idle svg { width: 26px; height: 26px; opacity: .5; margin-bottom: 4px; }
.cbk-idle b { font-size: 15.5px; font-weight: 600; color: var(--cbk-text); }
.cbk-idle span { font-size: 13px; }

/*
 * The hint that a day is waiting to be picked: the marker under each free day
 * breathes, slowly and at low contrast. It stops the moment a day is chosen,
 * so it never competes with the choice the booker has already made.
 */
@keyframes cbk-breathe {
  0%, 100% { opacity: .3; transform: scale(1); }
  50%      { opacity: .95; transform: scale(1.35); }
}
.cbk-cal.is-hinting .cbk-day.is-free::after {
  animation: cbk-breathe 2.8s ease-in-out infinite;
}

/* The hours arriving. Small distance, short duration, tiny stagger. */
@keyframes cbk-rise {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

.cbk-cal-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cbk-month {
  font-family: var(--cbk-fd); font-size: 18px; font-weight: 500; color: var(--cbk-dark);
}
.cbk-nav { display: flex; gap: 6px; }
.cbk-nav button {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--cbk-line); border-radius: var(--cbk-radius-s);
  color: var(--cbk-text); transition: background .2s ease, border-color .2s ease;
}
.cbk-nav button:hover:not(:disabled) { background: var(--cbk-bg-2); border-color: var(--cbk-primary); }
.cbk-nav button:disabled { opacity: .35; cursor: default; }
.cbk-nav svg { width: 15px; height: 15px; }

.cbk-dow, .cbk-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cbk-dow {
  margin-bottom: 6px; font-size: 12px; color: var(--cbk-muted); text-align: center;
}
/*
 * Square cells, but capped: left to itself a seven-column grid in a wide panel
 * makes each day as tall as it is wide, and six rows of that push the hours
 * off the bottom of the screen.
 */
.cbk-day {
  aspect-ratio: 1 / 1; min-height: 34px; max-height: 44px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: var(--cbk-radius-s);
  font-size: 15px; color: rgba(31, 42, 41, .3);
  position: relative;
}
.cbk-day.is-free {
  color: var(--cbk-dark); font-weight: 600;
  background: var(--cbk-bg-2); border-color: var(--cbk-line-2);
}
.cbk-day.is-free:hover { border-color: var(--cbk-primary); }
.cbk-day.is-free::after {
  content: ''; position: absolute; bottom: 5px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--cbk-primary); opacity: .55;
}
.cbk-day[aria-pressed="true"] {
  background: var(--cbk-primary); border-color: var(--cbk-primary);
  color: var(--cbk-bg-2);
}
.cbk-day[aria-pressed="true"]::after { background: var(--cbk-bg-2); opacity: .8; }
.cbk-day:disabled { cursor: default; }
.cbk-day.is-empty { visibility: hidden; }

/* ------------------------------------------------------------------- slots */

.cbk-slots-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 0 0 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--cbk-line-2);
  animation: cbk-rise .3s ease both;
}
.cbk-slots-head h3 {
  font-family: var(--cbk-fd); font-size: 16.5px; font-weight: 500;
  color: var(--cbk-dark); margin: 0; line-height: 1.35;
}
.cbk-tzbar {
  margin: 12px 0 0; padding-top: 12px;
  border-top: 1px solid var(--cbk-line-2);
  font-size: 13px; color: var(--cbk-muted);
}
.cbk-tzbar b { color: var(--cbk-dark); font-weight: 600; }
.cbk-tznote { font-size: 12.5px; color: var(--cbk-muted); white-space: nowrap; }
.cbk-tz {
  font-size: 13px; color: var(--cbk-second);
  background: none; border: none; padding: 0;
  border-bottom: 1px dashed rgba(62, 110, 122, .5); cursor: pointer;
}
.cbk-tz:hover { color: var(--cbk-dark); border-bottom-color: var(--cbk-dark); }
.cbk-slots {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 7px;
}
.cbk-slot {
  padding: 10px 8px; text-align: center;
  border: 1px solid var(--cbk-line); border-radius: var(--cbk-radius-s);
  background: var(--cbk-panel, #F2F3EE); font-size: 15.5px; font-weight: 600; color: var(--cbk-dark);
  font-variant-numeric: tabular-nums;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
  animation: cbk-rise .34s ease both;
}
.cbk-slot:hover { border-color: var(--cbk-primary); color: var(--cbk-primary); }
.cbk-slot[aria-pressed="true"] {
  background: var(--cbk-primary); border-color: var(--cbk-primary); color: var(--cbk-bg-2);
}

/* -------------------------------------------------------------------- form */

.cbk-field { margin-bottom: 16px; }
.cbk-field label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--cbk-dark); margin-bottom: 6px;
}
.cbk-field .req { color: var(--cbk-primary); }
.cbk-field .help { font-weight: 400; color: var(--cbk-muted); font-size: 13px; }
.cbk-field input, .cbk-field textarea {
  width: 100%; padding: 11px 13px;
  background: var(--cbk-bg-2); color: var(--cbk-text);
  border: 1px solid var(--cbk-line); border-radius: var(--cbk-radius-s);
  font-family: inherit; font-size: 16px; line-height: 1.6;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cbk-field textarea { min-height: 92px; resize: vertical; }
.cbk-field input:focus, .cbk-field textarea:focus {
  outline: none; border-color: var(--cbk-primary);
  box-shadow: 0 0 0 3px rgba(138, 59, 76, .12);
}
.cbk-field.has-error input, .cbk-field.has-error textarea { border-color: var(--cbk-primary); }
.cbk-err {
  display: none; font-size: 13.5px; color: var(--cbk-primary); margin-top: 5px;
}
.cbk-field.has-error .cbk-err { display: block; }

/* ------------------------------------------------------------------ chosen */

.cbk-chosen {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; background: var(--cbk-bg-2);
  border: 1px solid var(--cbk-line-2); border-radius: var(--cbk-radius-s);
  padding: 13px 15px; margin-bottom: 20px;
}
.cbk-chosen b { display: block; font-size: 16px; color: var(--cbk-dark); font-weight: 600; }
.cbk-chosen small { display: block; font-size: 13px; color: var(--cbk-muted); }
.cbk-chosen button {
  font-size: 13.5px; color: var(--cbk-second); white-space: nowrap;
  border-bottom: 1px solid rgba(62, 110, 122, .4);
}

/* ----------------------------------------------------------------- buttons */

/*
 * The primary sits at the far left, where a right-to-left reader finishes, and
 * the way back sits on the right where they came from. space-between puts real
 * distance between them so the quiet one is never mistaken for the loud one.
 */
.cbk-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 20px; flex-wrap: wrap;
}
.cbk-actions > .cbk-btn { margin-inline-start: auto; }

.cbk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--cbk-primary); color: var(--cbk-bg-2);
  border: 2px solid var(--cbk-primary);
  padding: 13px 30px; border-radius: var(--r-lg, 3px);
  font-size: 17px; font-weight: 600;
  transition: background .25s ease, transform .25s ease, box-shadow .25s ease;
}
.cbk-btn:hover:not(:disabled) {
  background: #743243; border-color: #743243;
  transform: translateY(-1px); box-shadow: 0 6px 18px rgba(138, 59, 76, .22);
}
.cbk-btn:disabled { opacity: .5; cursor: default; transform: none; box-shadow: none; }

/* Reads as a button, but a quiet one: outline only, muted until hovered. */
.cbk-back {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 11px 18px; border-radius: var(--r-lg, 3px);
  border: 1px solid var(--cbk-line);
  background: transparent; color: var(--cbk-muted);
  font-size: 14.5px; font-weight: 500;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.cbk-back svg {
  width: 15px; height: 15px; flex-shrink: 0;
  transition: transform .25s ease;
}
.cbk-back:hover {
  color: var(--cbk-dark); border-color: rgba(31, 42, 41, .32);
  background: var(--cbk-bg-2);
}
/* Nudges the way it is about to go, which in RTL is rightwards. */
.cbk-back:hover svg { transform: translateX(3px); }

/* Neither a primary nor a way back: dismissals and destructive choices. */
.cbk-quiet {
  font-size: 14.5px; color: var(--cbk-muted);
  border-bottom: 1px solid var(--cbk-line); padding-bottom: 1px;
  transition: color .25s ease, border-color .25s ease;
}
.cbk-quiet:hover { color: var(--cbk-primary); border-color: var(--cbk-primary); }

/* ----------------------------------------------------------------- payment */

.cbk-price {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px;
}
.cbk-price .amt {
  font-family: var(--cbk-fd); font-size: 38px; line-height: 1; color: var(--cbk-dark);
}
.cbk-price .unit { font-size: 13px; letter-spacing: .06em; color: var(--cbk-muted); }
.cbk-paynote { font-size: 14px; color: var(--cbk-muted); margin: 12px 0 18px; }
.cbk-paynote a { color: var(--cbk-second); }
.cbk-paypal { max-width: 420px; min-height: 52px; }
.cbk-hold {
  font-size: 13px; color: var(--cbk-muted); margin-top: 14px;
}
.cbk-hold b { color: var(--cbk-dark); font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- success */

.cbk-done { text-align: center; padding: 8px 0 4px; }
.cbk-done .tick {
  width: 54px; height: 54px; margin: 0 auto 16px;
  display: grid; place-items: center; border-radius: 50%;
  background: rgba(138, 59, 76, .1); color: var(--cbk-primary);
}
.cbk-done .tick svg { width: 26px; height: 26px; }
.cbk-done h3 {
  font-family: var(--cbk-fd); font-size: 24px; font-weight: 500;
  color: var(--cbk-dark); margin: 0 0 8px;
}
.cbk-done p { margin: 0 0 14px; color: var(--cbk-muted); font-size: 15px; }
.cbk-done .cbk-chosen { text-align: right; }
.cbk-links {
  display: flex; flex-wrap: wrap; gap: 10px 18px; justify-content: center;
  font-size: 14.5px; margin-top: 6px;
}
.cbk-links a { color: var(--cbk-second); border-bottom: 1px solid rgba(62, 110, 122, .4); text-decoration: none; }

/* --------------------------------------------------------------- feedback */

.cbk-note {
  border-radius: var(--cbk-radius-s); padding: 12px 15px;
  font-size: 14.5px; margin: 0 0 16px;
}
.cbk-note.err { background: rgba(138, 59, 76, .08); border: 1px solid rgba(138, 59, 76, .3); color: var(--cbk-primary); }
.cbk-note.info { background: var(--cbk-bg-2); border: 1px solid var(--cbk-line-2); color: var(--cbk-muted); }
.cbk-note.test {
  background: rgba(142, 110, 52, .12); border: 1px solid rgba(142, 110, 52, .45);
  color: var(--gold, #8E6E34);
}
.cbk-note.test b { color: inherit; }
.cbk-note a { color: inherit; font-weight: 600; text-decoration: underline; }
.cbk-note code {
  direction: ltr; display: inline-block; font-size: 13px;
  background: rgba(31, 42, 41, .08); border-radius: 3px; padding: 1px 6px;
}
.cbk-note[hidden] { display: none; }


.cbk-loading { position: relative; min-height: 120px; }
.cbk-spin {
  width: 22px; height: 22px; margin: 26px auto;
  border: 2px solid var(--cbk-line); border-top-color: var(--cbk-primary);
  border-radius: 50%; animation: cbk-spin .7s linear infinite;
}
@keyframes cbk-spin { to { transform: rotate(360deg); } }

.cbk-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.cbk-step[hidden] { display: none; }

/*
 * Phones: the whole choice still has to fit above the fold, so everything
 * loses a little air. The calendar keeps square-ish cells but shrinks, and the
 * hours pack four to a row instead of three.
 */
@media (max-width: 560px) {
  .cbk { font-size: 15.5px; }
  .cbk-panel { padding: 12px; }
  .cbk-when { gap: 10px; }
  .cbk-head { margin-bottom: 14px; }
  .cbk-title { font-size: 20px; }
  .cbk-meta { font-size: 13px; gap: 4px 12px; }
  .cbk-steps { font-size: 11.5px; gap: 5px; margin-bottom: 14px; }
  .cbk-steps li::after { width: 9px; }
  .cbk-cal-top { margin-bottom: 8px; }
  .cbk-month { font-size: 16px; }
  .cbk-nav button { width: 30px; height: 30px; }
  /* Squareness costs too much height here: a fixed row height instead. */
  .cbk-day { aspect-ratio: auto; height: 36px; min-height: 0; max-height: none; font-size: 14px; }
  .cbk-dow { font-size: 11px; margin-bottom: 4px; }
  .cbk-slots { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .cbk-slot { padding: 9px 4px; font-size: 14.5px; }
  .cbk-idle { min-height: 96px; }
  .cbk-tzbar { font-size: 12.5px; margin-top: 10px; padding-top: 10px; }

  .cbk-actions { gap: 10px; }
  .cbk-btn { flex: 1 1 auto; padding: 13px 20px; font-size: 16px; }
  .cbk-back { padding: 12px 14px; }
}

/*
 * Short phones. The hours are the thing being chosen, so what gives way is
 * everything around them: the step rail, the calendar's row height, and the
 * air between blocks.
 */
@media (max-height: 720px) and (max-width: 560px) {
  .cbk-steps { display: none; }
  .cbk-head { margin-bottom: 10px; }
  .cbk-title { font-size: 18px; margin-bottom: 3px; }
  .cbk-meta { font-size: 12.5px; gap: 2px 10px; }
  .cbk-meta svg { width: 13px; height: 13px; }
  .cbk-panel { padding: 10px; }
  .cbk-when { gap: 8px; }
  .cbk-day { height: 31px; font-size: 13.5px; }
  .cbk-grid, .cbk-dow { gap: 3px; }
  .cbk-slots-head { margin-bottom: 8px; padding-bottom: 7px; }
  .cbk-slots-head h3 { font-size: 15px; }
  .cbk-slot { padding: 7px 4px; font-size: 14px; }
  .cbk-tzbar { margin-top: 8px; padding-top: 8px; font-size: 12px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  /* ::after included deliberately: the day-marker hint animates on it. */
  .cbk *, .cbk *::before, .cbk *::after {
    transition: none !important; animation: none !important;
  }
}
