/* Booking widget (#mf-booking), confirmation page (#mf-confirmed) and manage-booking page (.mfm).
   Brand: sage #5f8f63, ink #2c3e50, warm white #fdfbf7, Merriweather headings (loaded by the site). */

#mf-booking, #mf-confirmed, .mfm {
  --mfb-sage: #5f8f63;
  --mfb-sage-deep: #4d7751;
  --mfb-sage-mist: #eef5ee;
  --mfb-sage-line: #cfe0cf;
  --mfb-ink: #2c3e50;
  --mfb-ink-soft: #56677a;
  --mfb-paper: #fdfbf7;
  --mfb-card: #ffffff;
  --mfb-line: #e7e2d8;
  --mfb-clay: #b4643c;
  --mfb-clay-mist: #fbf0ea;
  --mfb-r-lg: 16px;
  --mfb-r: 12px;
  --mfb-shadow: 0 1px 2px rgba(44, 62, 80, .05), 0 10px 30px -12px rgba(44, 62, 80, .14);
  --mfb-serif: 'Merriweather', Georgia, serif;
  --mfb-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--mfb-ink);
  font-family: var(--mfb-sans);
  line-height: 1.55;
}
#mf-booking *, #mf-confirmed *, .mfm * { box-sizing: border-box; }

/* ---------- shell ---------- */
.mfb {
  background: var(--mfb-paper);
  border: 1px solid var(--mfb-line);
  border-radius: var(--mfb-r-lg);
  box-shadow: var(--mfb-shadow);
  padding: 1.25rem 1rem 1.5rem;
  max-width: 760px;
  margin: 0 auto;
  position: relative;
}
@media (min-width: 640px) { .mfb { padding: 2rem 2.25rem 2.25rem; } }

.mfb-h {
  font-family: var(--mfb-serif);
  font-size: clamp(1.2rem, 3.4vw, 1.5rem);
  line-height: 1.3;
  margin: 0 0 .35rem;
  color: var(--mfb-ink);
  outline: none;
}
.mfb-sub { margin: 0 0 1.25rem; color: var(--mfb-ink-soft); font-size: .95rem; }

/* step path: three dots joined by a hairline */
.mfb-steps { display: flex; gap: .25rem; list-style: none; margin: 0 0 1.5rem; padding: 0; counter-reset: s; font-size: .8rem; }
.mfb-steps li {
  flex: 1; position: relative; padding-top: 1.15rem; color: var(--mfb-ink-soft); letter-spacing: .01em;
}
.mfb-steps li::before {
  content: ""; position: absolute; top: 0; left: 0; width: .7rem; height: .7rem; border-radius: 50%;
  background: var(--mfb-card); border: 2px solid var(--mfb-sage-line);
}
.mfb-steps li::after {
  content: ""; position: absolute; top: .3rem; left: 1rem; right: .35rem; height: 2px;
  background: var(--mfb-sage-line); border-radius: 2px;
}
.mfb-steps li:last-child::after { display: none; }
.mfb-steps li[aria-current="step"] { color: var(--mfb-ink); font-weight: 600; }
.mfb-steps li[aria-current="step"]::before { background: var(--mfb-sage); border-color: var(--mfb-sage); box-shadow: 0 0 0 4px var(--mfb-sage-mist); }
.mfb-steps li.done::before { background: var(--mfb-sage); border-color: var(--mfb-sage); }
.mfb-steps li.done::after { background: var(--mfb-sage); }

/* ---------- time zone line ---------- */
.mfb-tz { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .9rem; color: var(--mfb-ink-soft); margin-bottom: 1rem; }
.mfb-tz strong { color: var(--mfb-ink); font-weight: 600; }
.mfb-tz select {
  font: inherit; color: var(--mfb-ink); max-width: 100%; padding: .45rem .6rem; border-radius: 10px;
  border: 1px solid var(--mfb-line); background: var(--mfb-card);
}

/* ---------- date strip ---------- */
.mfb-strip-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.mfb-range { font-family: var(--mfb-serif); font-size: .98rem; margin: 0; }
.mfb-arrows { display: flex; gap: .4rem; }
.mfb-arrow {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--mfb-line); background: var(--mfb-card);
  color: var(--mfb-ink); font-size: 1.05rem; cursor: pointer; display: grid; place-items: center;
  transition: border-color .15s ease, background .15s ease;
}
.mfb-arrow:hover:not(:disabled) { border-color: var(--mfb-sage); background: var(--mfb-sage-mist); }
.mfb-arrow:disabled { opacity: .35; cursor: default; }

.mfb-days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .4rem; margin: 0 0 1.25rem; padding: 0; list-style: none;
}
.mfb-day {
  width: 100%; border: 1px solid var(--mfb-line); background: var(--mfb-card); border-radius: 12px;
  padding: .45rem 0 .5rem; cursor: pointer; color: var(--mfb-ink); font: inherit; line-height: 1.15;
  display: flex; flex-direction: column; align-items: center; gap: .1rem;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.mfb-day .wd { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--mfb-ink-soft); }
.mfb-day .dn { font-family: var(--mfb-serif); font-size: 1.05rem; font-weight: 700; }
.mfb-day .dot { width: .3rem; height: .3rem; border-radius: 50%; background: var(--mfb-sage); margin-top: .15rem; }
.mfb-day:hover:not(:disabled) { border-color: var(--mfb-sage); transform: translateY(-1px); }
.mfb-day[aria-pressed="true"] { background: var(--mfb-sage); border-color: var(--mfb-sage); color: #fff; }
.mfb-day[aria-pressed="true"] .wd { color: rgba(255, 255, 255, .85); }
.mfb-day[aria-pressed="true"] .dot { background: #fff; }
.mfb-day:disabled { background: transparent; border-style: dashed; color: #9aa6b2; cursor: default; }
.mfb-day:disabled .dot { visibility: hidden; }

/* ---------- slots ---------- */
.mfb-slots-h { font-size: .95rem; font-weight: 600; margin: 0 0 .6rem; }
.mfb-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; }
.mfb-slot {
  width: 100%; padding: .7rem .5rem; border-radius: 999px; border: 1px solid var(--mfb-sage-line);
  background: var(--mfb-card); color: var(--mfb-ink); font: inherit; font-weight: 600; font-variant-numeric: tabular-nums;
  cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.mfb-slot:hover { border-color: var(--mfb-sage); background: var(--mfb-sage-mist); }
.mfb-slot[aria-pressed="true"] { background: var(--mfb-sage); border-color: var(--mfb-sage); color: #fff; }

.mfb-empty {
  border: 1px dashed var(--mfb-line); border-radius: var(--mfb-r); padding: 1.1rem 1rem; color: var(--mfb-ink-soft);
  background: rgba(255, 255, 255, .6); font-size: .95rem;
}
.mfb-empty .mfb-link { margin-left: .25rem; }

/* skeleton while loading */
.mfb-skel { border-radius: 12px; height: 3.4rem; background: linear-gradient(90deg, #f3efe7 0%, #faf7f1 50%, #f3efe7 100%);
  background-size: 200% 100%; animation: mfb-shimmer 1.4s ease-in-out infinite; }
@keyframes mfb-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* chosen time bar */
.mfb-chosen {
  margin-top: 1.25rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .9rem 1rem; border-radius: var(--mfb-r); background: var(--mfb-sage-mist); border: 1px solid var(--mfb-sage-line);
}
.mfb-chosen p { margin: 0; font-size: .95rem; }
.mfb-chosen strong { font-family: var(--mfb-serif); }

/* ---------- buttons & links ---------- */
.mfb-btn, .mfm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.9rem;
  padding: .7rem 1.4rem; border-radius: 999px; border: 1px solid transparent; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.mfb-btn--primary, .mfm-btn--primary { background: var(--mfb-sage); color: #fff; box-shadow: 0 6px 16px -8px rgba(77, 119, 81, .7); }
.mfb-btn--primary:hover:not(:disabled), .mfm-btn--primary:hover { background: var(--mfb-sage-deep); }
.mfb-btn--quiet, .mfm-btn--quiet { background: var(--mfb-card); color: var(--mfb-ink); border-color: var(--mfb-line); }
.mfb-btn--quiet:hover, .mfm-btn--quiet:hover { border-color: var(--mfb-clay); color: var(--mfb-clay); }
.mfb-btn:disabled { opacity: .6; cursor: progress; }
.mfb-btn .spin { width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; animation: mfb-spin .8s linear infinite; }
@keyframes mfb-spin { to { transform: rotate(360deg); } }
.mfb-link { background: none; border: 0; padding: 0; font: inherit; color: var(--mfb-sage-deep); text-decoration: underline;
  text-underline-offset: 3px; cursor: pointer; }
.mfb-link:hover { color: var(--mfb-ink); }
.mfb-back { margin-bottom: 1rem; font-size: .9rem; }

#mf-booking :focus-visible, #mf-confirmed :focus-visible, .mfm :focus-visible {
  outline: 3px solid rgba(95, 143, 99, .55); outline-offset: 2px;
}

/* ---------- details form ---------- */
.mfb-grid { display: grid; gap: 1rem; }
@media (min-width: 640px) { .mfb-grid--2 { grid-template-columns: 1fr 1fr; } }
.mfb-field label, .mfb-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: .3rem; }
.mfb-field .opt { font-weight: 400; color: var(--mfb-ink-soft); }
.mfb-field input, .mfb-field textarea {
  width: 100%; font: inherit; color: var(--mfb-ink); background: var(--mfb-card); border: 1px solid #d9d3c7;
  border-radius: 10px; padding: .7rem .8rem; transition: border-color .15s ease, box-shadow .15s ease;
}
.mfb-field textarea { min-height: 6rem; resize: vertical; }
.mfb-field input:focus, .mfb-field textarea:focus { border-color: var(--mfb-sage); box-shadow: 0 0 0 3px var(--mfb-sage-mist); outline: none; }
.mfb-field [aria-invalid="true"] { border-color: var(--mfb-clay); background: #fffdfb; }
.mfb-help { font-size: .82rem; color: var(--mfb-ink-soft); margin: .3rem 0 0; }
.mfb-ferr { font-size: .85rem; color: var(--mfb-clay); margin: .3rem 0 0; }
.mfb-ferr:empty { display: none; }

.mfb-code { border-top: 1px solid var(--mfb-line); border-bottom: 1px solid var(--mfb-line); padding: .8rem 0; }
.mfb-code summary { cursor: pointer; font-size: .92rem; color: var(--mfb-sage-deep); list-style: none; }
.mfb-code summary::-webkit-details-marker { display: none; }
.mfb-code summary::before { content: "+"; display: inline-block; width: 1.1rem; font-weight: 700; }
.mfb-code[open] summary::before { content: "\2212"; }
.mfb-code-row { display: flex; gap: .5rem; margin-top: .7rem; }
.mfb-code-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .05em; }
.mfb-code-ok { color: var(--mfb-sage-deep); font-size: .88rem; margin: .4rem 0 0; }

.mfb-checks { display: grid; gap: .65rem; margin: .25rem 0 0; padding: 0; border: 0; }
.mfb-checks legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mfb-check, .mfm-check { display: flex; gap: .65rem; align-items: flex-start; font-size: .93rem; cursor: pointer; }
.mfb-check input, .mfm-check input { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; accent-color: var(--mfb-sage); flex: none; }
.mfb-check a { color: var(--mfb-sage-deep); }

/* summary card */
.mfb-summary {
  background: var(--mfb-card); border: 1px solid var(--mfb-line); border-radius: var(--mfb-r); padding: 1rem 1.1rem;
  display: grid; gap: .35rem; font-size: .95rem;
}
.mfb-summary .row { display: flex; justify-content: space-between; gap: 1rem; }
.mfb-summary .row span:first-child { color: var(--mfb-ink-soft); }
.mfb-summary .total { border-top: 1px dashed var(--mfb-line); padding-top: .5rem; margin-top: .2rem; font-weight: 700; }
.mfb-summary s { color: var(--mfb-ink-soft); font-weight: 400; margin-right: .35rem; }
.mfb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1.25rem; }
.mfb-fine { font-size: .82rem; color: var(--mfb-ink-soft); margin: .75rem 0 0; }

/* alerts */
.mfb-alert { border-radius: var(--mfb-r); padding: .8rem 1rem; font-size: .93rem; margin: 0 0 1rem; }
.mfb-alert--error { background: var(--mfb-clay-mist); border: 1px solid #efcdbb; color: #7a3c1d; }
.mfb-alert--info { background: var(--mfb-sage-mist); border: 1px solid var(--mfb-sage-line); }
.mfb-alert:empty { display: none; }

/* payment + done */
.mfb-checkout { min-height: 22rem; border-radius: var(--mfb-r); background: var(--mfb-card); border: 1px solid var(--mfb-line); padding: .5rem; }
.mfb-hold { font-size: .88rem; color: var(--mfb-ink-soft); margin: 0 0 .9rem; }
.mfb-done { text-align: center; padding: 1rem .5rem .5rem; }
.mfb-done .mark {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; margin: 0 auto 1rem; display: grid; place-items: center;
  background: var(--mfb-sage-mist); color: var(--mfb-sage-deep); font-size: 1.5rem; border: 1px solid var(--mfb-sage-line);
}
.mfb-done .when { font-family: var(--mfb-serif); font-size: 1.1rem; margin: .5rem 0; }
.mfb-done p { margin: .4rem auto; max-width: 30rem; }
.mfb-pulse { width: 2.6rem; height: 2.6rem; border-radius: 50%; margin: 0 auto 1rem; border: 3px solid var(--mfb-sage-line);
  border-top-color: var(--mfb-sage); animation: mfb-spin 1s linear infinite; }

.mfb-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

@media (prefers-reduced-motion: reduce) {
  #mf-booking *, #mf-confirmed *, .mfm * { animation: none !important; transition: none !important; }
}

/* ---------- manage-booking page (server-rendered) ---------- */
.mfm { padding: 2.5rem 1rem 3.5rem; max-width: 760px; }
.mfm-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--mfb-sage-deep); margin: 0 0 .4rem; font-weight: 600; }
.mfm-h1 { font-family: var(--mfb-serif); font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 1.25rem; }
.mfm h2 { font-family: var(--mfb-serif); font-size: 1.15rem; margin: 0 0 .4rem; }
.mfm-card {
  background: var(--mfb-paper); border: 1px solid var(--mfb-line); border-radius: var(--mfb-r-lg); box-shadow: var(--mfb-shadow);
  padding: 1.25rem 1.25rem; display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 1.5rem; border-left: 4px solid var(--mfb-sage);
}
.mfm-when p { margin: 0; }
.mfm-day { font-weight: 600; }
.mfm-time { font-family: var(--mfb-serif); font-size: 1.7rem; font-weight: 700; line-height: 1.25; margin: .15rem 0 .35rem !important; }
.mfm-time span { font-family: var(--mfb-sans); font-size: .9rem; font-weight: 400; color: var(--mfb-ink-soft); }
.mfm-sub { font-size: .9rem; color: var(--mfb-ink-soft); }
.mfm-status { margin: 0; font-size: .8rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; background: var(--mfb-sage-mist); color: var(--mfb-sage-deep); }
.mfm-status--cancelled, .mfm-status--expired { background: #f1eee8; color: var(--mfb-ink-soft); }
.mfm-lead { font-size: 1rem; }
.mfm-section { border-top: 1px solid var(--mfb-line); padding-top: 1.5rem; margin-top: 1.75rem; }
.mfm-hint { font-size: .9rem; color: var(--mfb-ink-soft); margin: 0 0 1rem; }
.mfm-pager { display: flex; justify-content: space-between; margin-bottom: .75rem; font-size: .92rem; }
.mfm-pager a { color: var(--mfb-sage-deep); }
.mfm-days { display: grid; gap: .9rem; margin-bottom: 1.25rem; }
.mfm-day-group { border: 0; padding: 0; margin: 0; }
.mfm-day-group legend { font-weight: 600; font-size: .92rem; margin-bottom: .45rem; padding: 0; }
.mfm-slots { display: flex; flex-wrap: wrap; gap: .45rem; }
.mfm-slot { position: relative; cursor: pointer; }
.mfm-slot input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mfm-slot span {
  display: inline-block; padding: .55rem 1rem; border-radius: 999px; border: 1px solid var(--mfb-sage-line); background: var(--mfb-card);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.mfm-slot input:checked + span { background: var(--mfb-sage); border-color: var(--mfb-sage); color: #fff; }
.mfm-slot input:focus-visible + span { outline: 3px solid rgba(95, 143, 99, .55); outline-offset: 2px; }
.mfm-empty { color: var(--mfb-ink-soft); }
.mfm-cancel summary { cursor: pointer; color: var(--mfb-clay); font-weight: 600; }
.mfm-cancel-body { padding: .75rem 0 0; }
.mfm-cancel-body form { display: grid; gap: 1rem; justify-items: start; }
.mfm-note { border-radius: var(--mfb-r); padding: .9rem 1rem; margin: 0 0 1.25rem; }
.mfm-note--ok { background: var(--mfb-sage-mist); border: 1px solid var(--mfb-sage-line); }
.mfm-note--error { background: var(--mfb-clay-mist); border: 1px solid #efcdbb; color: #7a3c1d; }
.mfm-foot { margin-top: 2.5rem; font-size: .88rem; color: var(--mfb-ink-soft); }

/* Touch targets: at least 44px tall on phones (Apple HIG / WCAG 2.5.5), without changing the look on desktop. */
.mfb-arrow { min-width: 44px; min-height: 44px; }
.mfb-link { min-height: 44px; padding: .55rem .15rem; display: inline-flex; align-items: center; }
.mfb-code summary { min-height: 44px; display: flex; align-items: center; }
.mfm-cancel summary { min-height: 44px; display: flex; align-items: center; }
#mf-booking .mfb-check a, #mf-booking label a { display: inline-block; padding: .35rem .1rem; margin: -.35rem 0; }
@media (pointer: coarse) {
  #mf-booking label { min-height: 44px; }
}

/* "Can't pay by card?" under the payment form; "Book another session" on the manage page */
.mfb-invoice { font-size: .88rem; color: var(--mfb-ink-soft); margin: 1rem 0 0; }
.mfb-invoice a { color: var(--mfb-sage-deep); text-underline-offset: 2px; }
.mfm-again { margin: 1.5rem 0 0; }
.mfm-again .mfm-btn { text-decoration: none; }

/* Phones: the booking card runs edge to edge, and the Stripe payment form gets the full screen width
   (at 320px it was squeezed into 236px). */
@media (max-width: 479px) {
  #mf-booking .mfb, #mf-confirmed .mfb { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); border-radius: 0; border-left: 0; border-right: 0; }
  #mf-booking .mfb-checkout { margin: 0 -1rem; border-radius: 0; border-left: 0; border-right: 0; padding: .25rem 0; }
}
/* time left to pay */
.mfb-left { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--mfb-ink); white-space: nowrap; }
.mfb-hold strong { color: var(--mfb-ink); font-weight: 600; }
.mfb-alert .mfb-btn { margin-top: .75rem; }
.mfb-alert p { margin: 0; }
/* checkboxes: a finger-sized box on touch screens */
@media (pointer: coarse) {
  .mfb-check input { width: 1.4rem; height: 1.4rem; margin-top: .1rem; }
}

/* headings get focus from script so screen readers start there; no box drawn around them */
#mf-booking .mfb-h:focus, #mf-confirmed .mfb-h:focus { outline: none; }
.mfb-next { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.25rem; margin: 1.25rem 0 0; font-size: .92rem; }
.mfb-next a { color: var(--mfb-sage-deep); display: inline-flex; align-items: center; min-height: 44px; }

/* manage page on phones: the "Move my session" button stays in reach while scrolling through the times,
   finger-sized week links and confirm boxes, long email addresses wrap */
.mfm-move > button[type="submit"] { position: sticky; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 2; box-shadow: 0 10px 24px -8px rgba(44, 62, 80, .45); }
.mfm-pager a { display: inline-flex; align-items: center; min-height: 44px; }
.mfm p { overflow-wrap: anywhere; }
@media (pointer: coarse) {
  .mfm-check { min-height: 44px; }
  .mfm-check input { width: 1.4rem; height: 1.4rem; margin-top: .1rem; }
}
