/*
  The "Book your demo" form, in the visitor's scheme, light or dark: in a dialog (contact.js loads this file with
  the dialog, so it costs nothing before) or on a page of its own (/book-a-demo loads it in its head). The dialog
  is a card in the middle on a computer; on a phone a sheet from the bottom whose fields scroll while the send
  button stays on screen. On a page it is a card in the flow. Inputs are 16px, so iOS never zooms into them.
*/
html.demo-open { overflow: hidden; }
.demo { --field: #fff; --edge: color-mix(in srgb, var(--ink) 30%, var(--bg)); color: var(--ink); font: 400 16px/1.5 var(--sans); }
html.dark .demo { --field: var(--bg); --edge: color-mix(in srgb, var(--ink) 34%, var(--bg-2)); }
dialog.demo {
    width: min(560px, 100% - 32px); max-width: none; max-height: min(92vh, 920px); max-height: min(92dvh, 920px);
    margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 20px;
    background: var(--bg); box-shadow: 0 30px 70px -24px rgba(0, 0, 0, 0.5); overflow: hidden;
}
html.dark dialog.demo { background: var(--bg-2); }
.demo[open] { display: flex; flex-direction: column; animation: demo-pop 0.18s ease; }
.demo::backdrop { background: rgba(20, 17, 15, 0.62); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
@keyframes demo-pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes demo-rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .demo[open] { animation: none; } }

.demo-close {
    position: absolute; top: 14px; right: 14px; z-index: 2; width: 42px; height: 42px; padding: 0; border-radius: 50%;
    border: 1px solid var(--line); background: var(--bg); color: var(--ink); display: grid; place-items: center; cursor: pointer;
}
html.dark .demo-close { background: var(--bg-2); }
.demo-close:hover { background: var(--tint); }
.demo-close svg { width: 20px; height: 20px; }

.demo-view[hidden] { display: none; }
.demo-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.demo-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 30px 30px 8px; }
.demo h2 { font-size: 30px; line-height: 1.12; margin: 0 52px 8px 0; }
.demo h2:focus { outline: none; }
html.serif .demo h2 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.015em; }
.demo-sub { color: var(--soft); font-size: 16px; margin-bottom: 22px; }
.demo-off { margin: -6px 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--tint); color: var(--ink); font-size: 15px; }
.demo-off[hidden] { display: none; }
.demo a:not(.btn) { color: var(--accent); font-weight: 600; text-underline-offset: 3px; }

/* the fields */
.demo-row { display: grid; gap: 0 14px; }
@media (min-width: 560px) { .demo-row { grid-template-columns: 1fr 1fr; } }
.demo-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.demo-field > label, .demo-field > legend { display: block; margin-bottom: 6px; padding: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.demo-opt { margin-left: 4px; font-weight: 400; color: var(--soft); }
.demo input[type="text"], .demo input[type="email"], .demo select, .demo textarea {
    display: block; width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--edge); border-radius: 10px;
    background: var(--field); color: var(--ink); font: 400 16px/1.4 var(--sans); outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.demo select { appearance: none; padding-right: 40px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
    background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.demo textarea { min-height: 92px; resize: vertical; }
.demo ::placeholder { color: color-mix(in srgb, var(--soft) 80%, transparent); }
.demo input:focus, .demo select:focus, .demo textarea:focus { border-color: var(--btn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--btn) 28%, transparent); }
html.dark .demo input:focus, html.dark .demo select:focus, html.dark .demo textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.demo [aria-invalid="true"] { border-color: #B4472B; }
html.dark .demo [aria-invalid="true"] { border-color: #E8907A; }
.demo-err { margin-top: 6px; font-size: 14px; font-weight: 500; color: #A63F25; }
html.dark .demo-err { color: #F0A18D; }
.demo-err[hidden] { display: none; }

/* the choices: radio pills */
.demo-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-pill { position: relative; display: inline-flex; cursor: pointer; }
.demo-pill input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.demo-pill span {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px;
    border: 1px solid var(--edge); background: var(--field); color: var(--ink); font-size: 15px; font-weight: 500;
}
.demo-pill span::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--edge); flex: none; }
.demo-pill:hover span { border-color: var(--soft); }
.demo-pill input:checked + span { border-color: var(--btn); background: var(--tint); font-weight: 600; box-shadow: inset 0 0 0 1px var(--btn); }
.demo-pill input:checked + span::before { border: 4px solid var(--btn); }
html.dark .demo-pill input:checked + span { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
html.dark .demo-pill input:checked + span::before { border-color: var(--accent); }
.demo-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.demo-pill input[aria-invalid="true"] + span { border-color: #B4472B; }
.demo-other { margin-top: 10px; }
.demo-other[hidden] { display: none; }

/* the honeypot: off screen, out of the tab order, hidden from assistive technology */
.demo-hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
/* Turnstile: invisible unless it needs the visitor, then a box above the send row */
.demo-turnstile { margin: 0 0 6px; }

/* the send row, always in view */
.demo-actions { padding: 14px 30px 22px; border-top: 1px solid var(--line); }
.demo-send { width: 100%; min-height: 52px; font-size: 17px; }
.demo-send[disabled] { opacity: 0.75; cursor: progress; }
.demo-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #B4472B 12%, transparent); color: #8F3219; font-size: 15px; font-weight: 500; }
html.dark .demo-error { color: #F4B3A3; background: color-mix(in srgb, #E8907A 16%, transparent); }
.demo-error[hidden] { display: none; }
.demo-fine { margin-top: 10px; text-align: center; color: var(--soft); font-size: 13px; line-height: 1.45; }

/* sent, or handed to the email app */
.demo-done { padding: 48px 32px 36px; text-align: center; overflow-y: auto; }
.demo .demo-done h2 { margin: 0 auto 10px; max-width: 420px; text-wrap: balance; }
.demo-done p { max-width: 420px; margin: 0 auto 26px; color: var(--soft); font-size: 17px; }
.demo-done p b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.demo-mark { display: grid; place-items: center; width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 50%; background: var(--btn); color: var(--on-btn); }
.demo-mark svg { width: 28px; height: 28px; }
.demo-done .btn { min-width: 160px; }
.demo-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* a phone: a sheet from the bottom */
@media (max-width: 640px) {
    dialog.demo { width: 100%; max-height: 94vh; max-height: 94dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; border-bottom: 0; }
    .demo[open] { animation-name: demo-rise; animation-duration: 0.22s; }
    .demo-close { top: 12px; right: 12px; }
    .demo-scroll { padding: 22px 20px 6px; }
    .demo h2 { font-size: 26px; margin-right: 50px; }
    .demo-sub { font-size: 15px; margin-bottom: 18px; }
    .demo-field { margin-bottom: 14px; }
    .demo-actions { padding: 12px 20px calc(14px + env(safe-area-inset-bottom)); box-shadow: 0 -14px 18px -16px var(--shadow); }
    .demo-done { padding: 40px 22px calc(28px + env(safe-area-inset-bottom)); }
}

/* ---------- on a page of its own: a card in the flow, nothing scrolls inside it ---------- */
.demo-inline { position: relative; border: 1px solid var(--line); border-radius: 22px; background: var(--bg-2); box-shadow: 0 30px 60px -34px var(--shadow); scroll-margin-top: 88px; }
.demo-inline .demo-scroll { overflow: visible; padding: 32px 32px 8px; }
.demo-inline h2 { margin-right: 0; }
.demo-inline .demo-actions { padding: 16px 32px 24px; }
.demo-inline .demo-done { padding: 52px 32px 44px; }
@media (max-width: 640px) {
    .demo-inline { border-radius: 18px; }
    .demo-inline .demo-scroll { padding: 24px 18px 6px; }
    .demo-inline .demo-actions { padding: 14px 18px 20px; box-shadow: none; }
    .demo-inline .demo-done { padding: 40px 20px 32px; }
}

/* the film's end card: its button, under the film (above it, beside the close button, on a short screen) */
.film-demo { position: absolute; left: 50%; bottom: -66px; transform: translateX(-50%); white-space: nowrap; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6); animation: demo-pop 0.3s ease; }
.film-demo[hidden] { display: none; }
@media (max-height: 560px) { .film-demo { top: -54px; bottom: auto; left: 0; transform: none; min-height: 42px; padding: 8px 16px; } }
