/* ==========================================================================
   NEXT VISION — booking: calendar picker + Typeform-style intake flow
   Shared by index.html and card.html. Depends on tokens in site.css.
   ========================================================================== */

/* ---------- Calendar card ---------- */
.cal {
  position: relative;
  background: #fff; color: var(--text);
  border-radius: var(--r-xl);
  box-shadow: inset 0 0 0 1px var(--line), 0 50px 100px -50px rgba(11,19,102,.4), 0 2px 6px rgba(10,11,16,.04);
  overflow: hidden;
}
.cal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.cal-avatar { width: 44px; height: 44px; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--sky-200); }
.cal-avatar img { display: block; width: 44px; height: 44px; object-fit: cover; transform: translateY(-3px) scale(1.13); }
.cal-head .who { font-size: 13px; color: var(--muted); }
.cal-head .what { font-size: 16px; font-weight: 500; letter-spacing: -0.02em; }
.cal-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.cal-meta span {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px;
  background: var(--mist); font-size: 12.5px; color: var(--muted); white-space: nowrap;
}
.cal-meta svg { width: 13px; height: 13px; }
@media (max-width: 560px) { .cal-meta { display: none; } }

.cal-body { display: grid; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cal-body { grid-template-columns: 1.25fr 1fr; } }

.cal-month { padding: 18px 16px 20px; }
@media (min-width: 720px) { .cal-month { padding: 22px 24px 24px; border-right: 1px solid var(--line); } }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 4px; }
.cal-nav h4 { font-size: 17px; font-weight: 500; letter-spacing: -0.02em; }
.cal-nav .arrows { display: flex; gap: 4px; }
.cal-nav button {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  transition: background .2s, opacity .2s;
}
.cal-nav button:hover:not(:disabled) { background: var(--mist); }
.cal-nav button:disabled { opacity: .25; cursor: default; }
.cal-nav svg { width: 16px; height: 16px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--faint); padding: 6px 0 8px; text-transform: uppercase; }
.day {
  position: relative; aspect-ratio: 1; max-height: 52px; width: 100%;
  display: grid; place-items: center;
  border-radius: 14px; font-size: 15px; font-variant-numeric: tabular-nums;
  color: var(--faint); cursor: default;
  transition: background .25s, color .25s, transform .35s var(--spring);
}
.day.avail { color: var(--text); font-weight: 500; cursor: pointer; background: var(--sky-50); }
.day.avail::after {
  content: ''; position: absolute; bottom: 7px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--blue-500);
}
@media (hover: hover) { .day.avail:hover { background: var(--sky-100); } }
.day.avail:active { transform: scale(.92); }
.day.today { box-shadow: inset 0 0 0 1px var(--line-2); }
.day.sel { background: var(--ink) !important; color: #fff; }
.day.sel::after { background: #fff; }
.day.blank { visibility: hidden; }

.cal-tz {
  display: flex; align-items: center; gap: 8px; margin-top: 14px; padding: 0 4px;
  font-size: 13px; color: var(--muted);
}
.cal-tz svg { width: 14px; height: 14px; flex: none; }

.cal-slots { padding: 18px 16px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; min-height: 280px; }
@media (min-width: 720px) { .cal-slots { border-top: 0; padding: 22px 22px 24px; max-height: 470px; } }
.cal-slots h5 { margin: 0 0 12px; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.cal-slots h5 small { display: block; font-size: 13px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.slot-list {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 2px; margin: -2px;
}
@media (min-width: 720px) { .slot-list { grid-template-columns: 1fr; } }
.slot {
  position: relative; height: 48px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--line-2); color: var(--text);
  transition: box-shadow .25s, background .25s, color .25s, transform .3s var(--spring);
}
@media (hover: hover) { .slot:hover { box-shadow: inset 0 0 0 1.5px var(--blue-500); color: var(--blue-600); } }
.slot:active { transform: scale(.97); }
.slot.sel { background: var(--ink); color: #fff; box-shadow: none; }
.slots-empty { margin: auto; text-align: center; color: var(--muted); font-size: 14px; display: grid; gap: 10px; justify-items: center; padding: 24px 0; }
.slots-empty svg { width: 28px; height: 28px; color: var(--sky-300); }

.cal-cta { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line-2); display: grid; gap: 8px; }
.cal-cta .picked { font-size: 13.5px; color: var(--muted); text-align: center; }
.cal-cta .picked b { color: var(--text); font-weight: 500; }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--mist) 0%, #fff 50%, var(--mist) 100%); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 14px; }
@keyframes sk { to { background-position: -200% 0 } }

.demo-note {
  display: flex; align-items: center; gap: 8px; margin: 0 16px 16px; padding: 10px 12px; border-radius: 12px;
  background: #fff8e6; color: #8a5a00; font-size: 12.5px;
}
.demo-note svg { width: 14px; height: 14px; flex: none; }

/* ---------- Flow (Typeform-style sheet) ---------- */
.flow {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
  visibility: hidden; pointer-events: none;
}
.flow.is-open { visibility: visible; pointer-events: auto; }
.flow-backdrop {
  position: absolute; inset: 0; background: rgba(5,6,10,.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .22s var(--ease);
}
.flow.is-open .flow-backdrop { opacity: 1; }
.flow-panel {
  position: relative; width: 100%;
  height: calc(100% - var(--safe-t) - 10px);
  background: #fff; color: var(--text);
  border-radius: 28px 28px 0 0;
  display: flex; flex-direction: column;
  transform: translateY(102%);
  transition: transform .3s var(--ease);
  box-shadow: 0 -20px 60px -20px rgba(5,6,10,.4);
  overflow: hidden;
  overscroll-behavior: contain;
}
.flow.is-open .flow-panel { transform: translateY(var(--drag, 0px)); }
.flow.is-dragging .flow-panel { transition: none; }
@media (min-width: 760px) {
  .flow { align-items: center; padding: 24px; }
  .flow-panel {
    max-width: 720px; height: min(780px, calc(100dvh - 48px));
    border-radius: 32px;
    transform: translateY(24px) scale(.97); opacity: 0;
    transition: transform .3s var(--ease), opacity .2s var(--ease);
  }
  .flow.is-open .flow-panel { transform: none; opacity: 1; }
}
.grabber { display: flex; flex-shrink: 0; justify-content: center; padding: 10px 0 2px; touch-action: none; cursor: grab; }
.grabber i { width: 40px; height: 5px; border-radius: 3px; background: rgba(10,11,16,.16); }
@media (min-width: 760px) { .grabber { display: none; } }

.flow-top { display: grid; flex-shrink: 0; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 12px; padding: 6px 14px 10px; touch-action: none; }
@media (min-width: 760px) { .flow-top { padding: 18px 20px 12px; } }
.flow-top .icon-btn { width: 44px; height: 44px; box-shadow: none; background: var(--mist); }
.flow-top .icon-btn:disabled { opacity: .4; pointer-events: none; }
.flow-top .back.is-unavailable { visibility: hidden; }
@media (hover: hover) { .flow-top .icon-btn:hover { background: var(--ink); color: #fff; } }
.progress { display: flex; gap: 4px; }
.progress i { flex: 1; height: 4px; border-radius: 4px; background: var(--mist-2); overflow: hidden; position: relative; }
.progress i::after { content: ''; position: absolute; inset: 0; background: var(--grad-btn); transform: scaleX(0); transform-origin: left; transition: transform .6s var(--ease); }
.progress i.done::after { transform: scaleX(1); }

.flow-steps { position: relative; flex: 1; min-height: 0; }
.fstep {
  position: absolute; inset: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 14px 22px 24px;
  opacity: 0; visibility: hidden;
  pointer-events: none;
}
.fstep.is-active { opacity: 1; visibility: visible; pointer-events: auto; animation: stepIn .18s var(--ease); }
@keyframes stepIn { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 760px) { .fstep { padding: 24px 56px 28px; } }

.q-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--blue-700); }
.q-kicker svg { width: 12px; height: 12px; }
.q-title { margin-top: 12px; font-size: clamp(26px, 6.4vw, 36px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.08; text-wrap: balance; }
.q-title .serif { color: var(--blue-600); }
.q-hint { margin-top: 10px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.q-body { margin-top: 20px; display: grid; gap: 10px; }
.fstep[data-step='biz'] .q-body { gap: 18px; }
.fstep[data-step='done'] .q-body { margin-top: 0; }

/* choice options */
.opts { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opt {
  position: relative; display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 60px; padding: 12px 16px 12px 12px; border-radius: 18px;
  background: var(--mist); text-align: left; font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background .25s, box-shadow .25s, transform .35s var(--spring);
}
@media (hover: hover) { .opt:hover { background: var(--mist-2); } }
.opt:active { transform: scale(.985); }
.opt .key {
  width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: #fff; font-family: var(--mono); font-size: 12px; color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background .25s, color .25s;
}
.opt .ico { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--blue-600); box-shadow: inset 0 0 0 1px var(--line); }
.opt .ico svg { width: 16px; height: 16px; }
.opt .t { flex: 1; }
.opt .t small { display: block; font-weight: 400; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.opt .tick {
  width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--line-2); color: #fff;
  transition: background .25s, box-shadow .25s, transform .35s var(--spring);
}
.opt .tick svg { width: 12px; height: 12px; opacity: 0; transform: scale(.5); transition: opacity .2s, transform .35s var(--spring); }
.opt[aria-pressed='true'], .opt[aria-checked='true'] { background: var(--sky-50); box-shadow: inset 0 0 0 1.5px var(--blue-500); }
.opt[aria-pressed='true'] .tick, .opt[aria-checked='true'] .tick { background: var(--blue-500); box-shadow: none; }
.opt[aria-pressed='true'] .tick svg, .opt[aria-checked='true'] .tick svg { opacity: 1; transform: none; }
.opt[aria-checked='true'] .key { background: var(--blue-500); color: #fff; box-shadow: none; }
.opt.flash { animation: flash .35s var(--ease) 2; }
@keyframes flash { 50% { background: var(--sky-100); } }

/* inputs: no zoom (>=16px), no harsh borders on focus */
.field { display: grid; gap: 7px; }
.field label { font-size: 13.5px; font-weight: 500; color: var(--muted); padding-left: 4px; }
.field label em { font-style: normal; color: var(--faint); font-weight: 400; }
.input {
  width: 100%; height: 58px; padding: 0 18px;
  border: 0; border-radius: 16px;
  background: var(--mist);
  font-size: 17px; letter-spacing: -0.01em; color: var(--text);
  -webkit-appearance: none; appearance: none;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color .25s, box-shadow .3s;
  caret-color: var(--blue-500);
}
textarea.input { height: auto; min-height: 140px; padding: 16px 18px; line-height: 1.5; resize: none; }
.input::placeholder { color: var(--muted); }
/* background-color, not background: the shorthand would wipe the select's arrow image */
.input:hover { background-color: var(--mist-2); }
.input:focus, .input:focus-visible {
  outline: none; background-color: #fff;
  box-shadow: inset 0 0 0 1px rgba(61,92,255,.55), 0 0 0 4px rgba(61,92,255,.1);
}
.input.err { box-shadow: inset 0 0 0 1px rgba(220,38,38,.55), 0 0 0 4px rgba(220,38,38,.08); background-color: #fff; }
.err-msg { font-size: 13px; color: #b91c1c; padding-left: 4px; min-height: 0; }
.fields { display: grid; gap: 14px; }
@media (min-width: 560px) { .fields.two { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt {
  height: 44px; padding: 0 16px; border-radius: 999px; background: var(--mist); font-size: 15px; font-weight: 500;
  box-shadow: inset 0 0 0 1px transparent; transition: background .2s, box-shadow .2s, color .2s, transform .3s var(--spring);
}
.chip-opt:active { transform: scale(.96); }
.chip-opt[aria-checked='true'], .chip-opt[aria-pressed='true'] { background: var(--ink); color: #fff; }
.sub-q { margin-top: 18px; font-size: 15px; font-weight: 500; }
.sub-q:first-child { margin-top: 0; }
.sub-q + .chips { margin-top: 10px; }

/* selected slot summary inside flow */
.slot-pill {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px;
  background: var(--sky-50); box-shadow: inset 0 0 0 1px rgba(61,92,255,.2);
}
.slot-pill .cal-ic { width: 46px; height: 50px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); display: grid; place-items: center; text-align: center; line-height: 1; flex: none; }
.slot-pill .cal-ic small { font-family: var(--mono); font-size: 9.5px; color: var(--blue-700); letter-spacing: .08em; text-transform: uppercase; }
.slot-pill .cal-ic b { font-size: 19px; font-weight: 500; display: block; margin-top: 3px; }
.slot-pill .info { flex: 1; font-size: 15px; }
.slot-pill .info b { font-weight: 500; display: block; }
.slot-pill .info span { color: var(--muted); font-size: 13.5px; }
.slot-pill button { font-size: 14px; color: var(--blue-600); font-weight: 500; padding: 8px; }

.flow .cal { box-shadow: inset 0 0 0 1px var(--line); border-radius: 22px; }
.flow .cal-head { display: none; }
.flow .cal-slots { min-height: 0; }
.flow .cal-cta { display: none; }

.flow-foot {
  display: grid; flex-shrink: 0; gap: 8px;
  padding: 8px 22px calc(14px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
@media (min-width: 760px) { .flow-foot { padding: 10px 56px 20px; } }
.flow-foot .btn { width: 100%; }
.btn[disabled] { opacity: .4; pointer-events: none; box-shadow: none; }
.btn.is-loading { pointer-events: none; }
.btn .spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* success */
.done-wrap { display: grid; justify-items: center; text-align: center; padding-top: 18px; }
.done-badge { width: 64px; height: 64px; border-radius: 50%; background: var(--sky-50); color: var(--blue-600); display: grid; place-items: center; }
.done-badge > svg { width: 30px; height: 30px; }
.done-wrap .q-title { margin-top: 22px; }
.done-wrap .q-hint { max-width: 40ch; }
.recap { width: 100%; max-width: 440px; margin-top: 26px; border-radius: 20px; background: var(--mist); text-align: left; overflow: hidden; }
.recap div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 18px; font-size: 14.5px; border-bottom: 1px solid var(--line); }
.recap div:last-child { border-bottom: 0; }
.recap dt, .recap span:first-child { color: var(--muted); }
.recap b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.done-actions { width: 100%; max-width: 440px; margin-top: 16px; display: grid; gap: 8px; }

/* lock scroll when sheet is open */
html.flow-lock, html.flow-lock body { overflow: hidden; }
@media (min-width: 720px) {
  .slot-list { -webkit-mask-image: linear-gradient(180deg, #000 85%, transparent); mask-image: linear-gradient(180deg, #000 85%, transparent); padding-bottom: 24px; }
}

/* Compact native choices, persistent guidance, and terminal actions. */
select.input { padding-right: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6172' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; background-size: 18px; }
select.input:invalid { color: var(--muted); }
select.input option { color: var(--text); }
.foot-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.step-help { font-size: 12px; line-height: 1.4; color: var(--muted); }
.scroll-more { display: inline-flex; align-items: center; gap: 4px; flex: none; min-height: 44px; color: var(--blue-700); font-size: 12px; font-weight: 500; }
.scroll-more svg { width: 14px; height: 14px; transform: rotate(90deg); }
.flow .btn:disabled { opacity: 1; background: var(--mist-2); color: var(--muted); box-shadow: none; }
.flow .btn.is-loading { background: var(--blue-600); color: #fff; }
.done-wrap .q-hint b { color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.request-badge { border-radius: 18px; }
.done-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; }
.done-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; font-size: 14px; font-weight: 500; color: var(--blue-700); text-decoration: underline; text-underline-offset: 4px; }
.done-link:hover { color: var(--ink); }

.flow-brand { display:flex; align-items:center; gap:8px; margin-bottom:16px; font-size:14px; font-weight:600; color:var(--ink); }
.flow-brand img { flex:none; }
.flow-brand .logo-wordmark { width:164px; height:auto; filter:none; }
.flow-brand .logo-mark { width:34px; height:32px; object-fit:contain; }
.cal-body > * { min-width: 0; }
.cal-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }

/* Mobile editing: reserve the visible screen for fields, not the action footer. */
.flow-top-middle { min-width: 0; }
.typing-done { display: none; min-height: 44px; padding: 0 12px; font-size: 14px; font-weight: 500; color: var(--blue-700); }
@media (max-width: 759px) {
  html.flow-lock body { position: fixed; top: var(--flow-scroll-y, 0px); left: 0; right: 0; width: 100%; }
  .flow-panel { position: absolute; top: calc(var(--flow-top, 0px) + var(--safe-t) + 10px); height: calc(var(--flow-height, 100dvh) - var(--safe-t) - 10px); }
  .flow.is-editing .flow-panel { top: var(--flow-top, 0px); height: var(--flow-height, 100dvh); border-radius: 16px 16px 0 0; }
  .flow.is-editing .grabber, .flow.is-editing .flow-foot, .flow.is-editing .progress, .flow.is-editing .flow-brand { display: none; }
  .flow.is-editing .typing-done { display: block; margin-left: auto; }
  .flow.is-editing .flow-top { padding-top: 4px; padding-bottom: 4px; }
  .flow.is-editing .fstep { padding-top: 8px; padding-bottom: 16px; scroll-padding: 12px; }
  .flow.is-editing textarea.input { min-height: 104px; }
  .flow.is-editing .input { scroll-margin: 12px; }
}

/* Headings receive focus for screen-reader announcements, not interaction. */
.flow .q-title[tabindex="-1"]:focus,
.flow .q-title[tabindex="-1"]:focus-visible { outline: none; }
