/* ==========================================================================
   Book a demo page. Builds on styles.css tokens and components.
   ========================================================================== */

.page-demo { background:
  radial-gradient(900px 520px at 85% -120px, rgba(143,203,239,.35), transparent 70%),
  radial-gradient(700px 420px at -10% 10%, rgba(43,127,255,.08), transparent 70%),
  var(--page); }

.demo { padding: clamp(112px, 12vw, 148px) var(--gutter) clamp(72px, 8vw, 112px); }
.demo-grid {
  max-width: var(--wrap); margin: 0 auto;
  display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(32px, 5vw, 72px); align-items: start;
}

/* ── Left column ─────────────────────────────────────────────────── */
.demo-copy { position: sticky; top: 112px; animation: demo-in 700ms var(--ease-out) both; }
.demo-title {
  margin-top: 16px; font-size: clamp(2.4rem, 4.6vw, 3.6rem); line-height: 1.04; letter-spacing: -0.045em;
  font-weight: 700; color: var(--ink); text-wrap: balance;
}
.demo-steps { margin-top: 36px; display: grid; gap: 4px; }
.demo-steps li { display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.demo-steps li:first-child { border-top: 0; }
.demo-num { align-self: start; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--blue-deep); background: var(--blue-wash); padding: 3px 0; border-radius: 6px; text-align: center; }
.demo-steps b { display: block; font-size: 16px; color: var(--ink); }
.demo-steps p { margin-top: 3px; font-size: 14.5px; line-height: 1.5; color: var(--muted); }

.demo-bridge { margin-top: 28px; display: flex; align-items: flex-end; gap: 10px; }
.demo-bridge svg { width: 64px; height: 64px; flex: none; animation: demo-bob 3.2s ease-in-out infinite; }
.demo-bubble { margin-bottom: 30px; padding: 8px 14px; border-radius: 16px 16px 16px 4px; background: var(--card); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); font-size: 14px; font-weight: 650; }

/* ── Right column: the booking card ───────────────────────────────── */
.demo-card {
  background: var(--card); border-radius: var(--radius-lg); padding: clamp(14px, 2vw, 22px);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(20,20,43,.05);
  animation: demo-in 700ms 80ms var(--ease-out) both;
}

.demo-switch {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px;
  background: #EDF0F4; box-shadow: inset 0 1px 2px rgba(20,20,43,.06);
}
.demo-switch button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; border-radius: 999px; font-size: 14.5px; font-weight: 650; color: var(--muted);
  transition: color 200ms ease, transform 160ms var(--ease-out);
}
.demo-switch button svg { width: 18px; height: 18px; }
.demo-switch button[aria-selected="true"] { color: var(--ink); }
.demo-switch button:active { transform: scale(.97); }
.demo-switch-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: #fff; box-shadow: 0 1px 2px rgba(20,20,43,.08), 0 4px 12px -4px rgba(20,20,43,.14);
  transition: transform 380ms var(--ease-drawer);
}
.demo-switch[data-active="form"] .demo-switch-thumb { transform: translateX(100%); }

.demo-panel { padding: 18px 6px 4px; }
.demo-panel:not([hidden]) { animation: panel-in 320ms var(--ease-out) both; }
.demo-panel-note { font-size: 14.5px; color: var(--muted); margin-bottom: 16px; }

/* Calendar */
.cal-frame { position: relative; min-height: 760px; border-radius: 18px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.cal-frame iframe { position: relative; z-index: 1; display: block; width: 100%; height: 760px; border: 0; opacity: 0; transition: opacity 300ms ease; }
.cal-frame.is-loaded iframe { opacity: 1; }
.cal-loading { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; gap: 6px; }
.cal-loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); opacity: .3; animation: cal-dot 1.1s ease-in-out infinite; }
.cal-loading span:nth-child(2) { animation-delay: .15s; }
.cal-loading span:nth-child(3) { animation-delay: .3s; }
.cal-frame.is-loaded .cal-loading { display: none; }
.demo-alt { margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }
.link-btn { color: var(--blue-deep); font-weight: 650; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(27,111,212,.35); }
@media (hover: hover) { .link-btn:hover { text-decoration-color: currentColor; } }

/* Form */
.demo-form { display: grid; gap: 16px; }
.demo-form[hidden], .form-done[hidden], .demo-panel[hidden] { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-size: 13.5px; font-weight: 650; color: var(--text-2); padding: 0; }
.field em { font-style: normal; color: var(--blue); }
.field input, .field textarea {
  width: 100%; font: inherit; font-size: 15.5px; color: var(--ink);
  padding: 12px 14px; border-radius: 14px; border: 0; background: #F7F8FA;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 150ms ease, background-color 150ms ease;
}
.field textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: #A0A6B1; }
.field input:hover, .field textarea:hover { box-shadow: inset 0 0 0 1px #CFD5DD; }
.field input:focus, .field textarea:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 1.5px var(--blue), 0 0 0 4px rgba(43,127,255,.12); }
.field input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--live); background: #FFF8F8; }
.field legend { margin-bottom: 7px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 999px;
  font-size: 14px; font-weight: 600; color: var(--text-2); background: #F7F8FA; box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 160ms var(--ease-out);
}
.chips label:active span { transform: scale(.96); }
@media (hover: hover) { .chips label:hover span { box-shadow: inset 0 0 0 1px #CFD5DD; } }
.chips input:checked + span { background: var(--blue-wash); color: var(--blue-deep); box-shadow: inset 0 0 0 1.5px var(--blue); }
.chips input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-error { padding: 10px 14px; border-radius: 12px; background: var(--live-wash); color: #B42328; font-size: 14px; font-weight: 600; }
.demo-form .btn[disabled] { opacity: .7; cursor: progress; }
.form-fine { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: -4px; }

.form-done { display: grid; justify-items: center; text-align: center; padding: 48px 16px 40px; outline: none; }
.form-done:not([hidden]) { animation: panel-in 400ms var(--ease-out) both; }
.form-done svg { width: 84px; height: 84px; animation: demo-bob 3.2s ease-in-out infinite; }
.form-done h2 { margin-top: 18px; font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -0.03em; color: var(--ink); text-wrap: balance; }
.form-done p { margin-top: 8px; max-width: 26em; color: var(--muted); font-size: 15.5px; }
.form-done .btn { margin-top: 24px; }

@keyframes demo-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes demo-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes cal-dot { 0%, 100% { opacity: .25; transform: scale(.9); } 40% { opacity: 1; transform: scale(1); } }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .demo-grid { grid-template-columns: 1fr; }
  .demo-copy { position: static; }
  .demo-bridge { display: none; }
  .demo-steps { margin-top: 24px; }
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .demo-switch button { font-size: 13.5px; gap: 6px; }
  .demo-switch button svg { display: none; }
  .demo-panel { padding: 16px 2px 2px; }
  .cal-frame, .cal-frame iframe { min-height: 820px; height: 820px; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-copy, .demo-card, .demo-panel:not([hidden]), .form-done:not([hidden]) { animation: none; }
  .demo-bridge svg, .form-done svg { animation: none; }
  .demo-switch-thumb { transition: none; }
}
