/* The booking quiz (2026-11-03), the flow StoneSystems runs before its
   calendar: four taps, then phone, email, name and company, one per screen.
   Used inline on /book and as a dialog over /calls. The tokens fall back to
   site.css values so the card looks the same on both pages, whichever of the
   two stylesheets defined them. */

.quiz {
  --q-paper: var(--paper, #FCFCFB);
  --q-card: var(--card, #FFFFFF);
  --q-ink: var(--ink, #101211);
  --q-muted: var(--muted, #6B716E);
  --q-line: var(--line, #E4E5E2);
  --q-accent: var(--accent, #14503C);
  --q-wash: rgba(20, 80, 60, 0.07);
  --q-ring: rgba(20, 80, 60, 0.28);
  --q-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --q-sans: var(--sans, 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif);

  position: relative;
  background: var(--q-card);
  color: var(--q-ink);
  border: 1px solid var(--q-line);
  border-radius: 10px;
  box-shadow: 0 24px 48px -34px rgba(16, 18, 17, 0.22);
  font-family: var(--q-sans);
  padding: 1.25rem 1.25rem 1.5rem;
}

.quiz-top { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.quiz-back, .quiz-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--q-muted);
  cursor: pointer; flex: none;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--q-ease);
}
.quiz-back { margin-left: -0.6rem; }
.quiz-close { margin-right: -0.6rem; }
/* Hidden on the first question but still holding its place, so the bar
   does not jump when it appears. */
.quiz-back[data-hide] { visibility: hidden; }
.quiz-back svg, .quiz-close svg { width: 20px; height: 20px; }
.quiz-back:active, .quiz-close:active { transform: scale(0.94); }

.quiz-bar {
  flex: 1; height: 8px; border-radius: 999px; overflow: hidden;
  background: #EEF0ED;
}
.quiz-bar i {
  display: block; height: 100%; width: 100%;
  background: var(--q-accent); border-radius: inherit;
  transform-origin: left center;
  transform: scaleX(var(--q-progress, 0.5));
  transition: transform 280ms var(--q-ease);
}

.quiz-step { margin-top: 1rem; }
.quiz-step[data-enter] { animation: quiz-in 220ms var(--q-ease) both; }
@keyframes quiz-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}
.quiz-step[data-enter="back"] { animation-name: quiz-back; }
@keyframes quiz-back {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

.quiz-q {
  margin: 0; font-size: 1.25rem; font-weight: 500; line-height: 1.25;
  letter-spacing: -0.018em; text-wrap: balance;
}
.quiz-hint { margin: 0.4rem 0 0; color: var(--q-muted); font-size: 0.875rem; }

.quiz-options { display: grid; gap: 0.6rem; margin: 1.1rem 0 0; padding: 0; list-style: none; }
.quiz-option {
  display: flex; align-items: center; width: 100%; min-height: 52px;
  margin: 0; padding: 0.75rem 1rem;
  border: 1px solid var(--q-line); border-radius: 8px;
  background: var(--q-card); color: var(--q-ink);
  font: 500 0.9375rem / 1.35 var(--q-sans); text-align: left; letter-spacing: -0.006em;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--q-ease);
  -webkit-tap-highlight-color: transparent;
}
.quiz-option:active { transform: scale(0.98); }
.quiz-option[aria-pressed="true"] {
  border-color: var(--q-accent); background: var(--q-wash);
  box-shadow: inset 0 0 0 1px var(--q-accent);
}
@media (hover: hover) and (pointer: fine) {
  .quiz-option:hover { border-color: #C9CBC7; background: #FAFAF9; }
  .quiz-option[aria-pressed="true"]:hover { border-color: var(--q-accent); background: var(--q-wash); }
  .quiz-back:hover, .quiz-close:hover { background: #F2F3F1; color: var(--q-ink); }
}

.quiz-field { margin-top: 1.1rem; }
.quiz-input {
  width: 100%; min-height: 52px; margin: 0; padding: 0.7rem 0.9rem;
  border: 1px solid var(--q-line); border-radius: 8px;
  background: var(--q-card); color: var(--q-ink);
  font: 16px / 1.4 var(--q-sans);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.quiz-input::placeholder { color: #9A9F9C; }
.quiz-input:focus { outline: none; border-color: var(--q-accent); box-shadow: 0 0 0 3px var(--q-ring); }
.quiz-input[aria-invalid="true"] { border-color: #8F2D2D; }
.quiz-error { margin: 0.5rem 0 0; min-height: 1.2em; color: #8F2D2D; font-size: 0.8125rem; }

.quiz-next {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: 52px; margin: 0.9rem 0 0; padding: 12px 22px;
  border: 0; border-radius: 8px; background: var(--q-ink); color: var(--q-paper);
  font: 500 1rem / 1.2 var(--q-sans); letter-spacing: -0.006em; cursor: pointer;
  transition: background-color 160ms ease, transform 160ms var(--q-ease);
}
.quiz-next:active { transform: scale(0.98); }
.quiz-next:disabled { opacity: 0.55; cursor: wait; transform: none; }
@media (hover: hover) and (pointer: fine) { .quiz-next:hover { background: #232725; } }

.quiz-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.quiz :focus-visible { outline: 2px solid var(--q-accent); outline-offset: 2px; }
.quiz-input:focus-visible { outline: none; }

/* The dialog version, over /calls: a pop-up card on top of the page, the
   page dimmed behind it, like StoneSystems' (Reid, 2026-11-04: "It doesn't
   take them to a whole new page. It just opens up as a pop-up"). Centred on
   a wide screen; on a phone it sits near the top, so the keyboard covers the
   dimmed page instead of the field being typed in. */
.quiz-dialog {
  width: min(480px, calc(100vw - 2rem)); max-width: none; max-height: calc(100dvh - 2rem);
  margin: auto; padding: 0; border: 0; background: transparent; overflow: visible;
  transition: opacity 200ms var(--q-ease), transform 240ms var(--q-ease), overlay 160ms allow-discrete, display 160ms allow-discrete;
}
.quiz-dialog:not([open]) { opacity: 0; transform: translateY(8px); transition-duration: 140ms; }
.quiz-dialog .quiz { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 34px 64px -30px rgba(16, 18, 17, 0.45); }
.quiz-dialog::backdrop {
  background: rgba(14, 16, 15, 0.5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  transition: opacity 200ms ease, overlay 160ms allow-discrete, display 160ms allow-discrete;
}
.quiz-head { margin-top: 0.5rem; text-align: center; }
.quiz-head-title { font-size: 1.0625rem; font-weight: 500; line-height: 1.3; letter-spacing: -0.015em; color: var(--q-accent); text-wrap: balance; }
.quiz-head-price { margin-top: 2px; font-size: 0.9375rem; font-weight: 500; color: var(--q-ink); font-variant-numeric: tabular-nums; }
@starting-style {
  .quiz-dialog[open] { opacity: 0; transform: translateY(16px) scale(0.98); }
  .quiz-dialog[open]::backdrop { opacity: 0; }
}
@media (max-width: 560px) {
  .quiz-dialog { width: calc(100vw - 1.5rem); max-height: calc(100dvh - 1.5rem); margin: 0.75rem auto auto; }
  .quiz-dialog .quiz { max-height: calc(100dvh - 1.5rem); padding: 0.75rem 1.125rem 1.25rem; }
}
body.quiz-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .quiz-step[data-enter] { animation: quiz-fade 160ms ease both; }
  @keyframes quiz-fade { from { opacity: 0; } to { opacity: 1; } }
  .quiz-bar i { transition: none; }
  .quiz-dialog { transition: opacity 160ms ease, overlay 160ms allow-discrete, display 160ms allow-discrete; }
  @starting-style { .quiz-dialog[open] { transform: none; } }
}
