/* GoWell — client questionnaire (task #10726).
   Scoped under .q. Brand tokens come from tokens.css (teal/sage Stitch system).
   Mobile-first, single column, large tap targets. */

.q {
  --q-gap: var(--space-m, 1rem);
  max-width: 720px;
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 2rem) clamp(1rem, 4vw, 1.5rem) 4rem;
}

/* ---- Progress ---- */
.q-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 0.85rem 0 0.7rem;
  background: linear-gradient(var(--bg, #fff) 70%, transparent);
}
.q-progress__bar {
  height: 8px;
  border-radius: var(--radius-pill, 999px);
  background: var(--surface-container, #e7efec);
  overflow: hidden;
}
.q-progress__fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary, #007872);
  transition: width 0.35s ease;
}
.q-progress__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  font: 500 var(--step--1, 0.85rem) / 1.3 var(--font-sans, sans-serif);
  color: var(--muted, #5b6b66);
}
.q-progress__meta strong { color: var(--primary, #007872); }

/* ---- Steps ---- */
.q-step { display: none; animation: q-fade 0.3s ease; }
.q-step.is-active { display: block; }
@keyframes q-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .q-step, .q-progress__fill { animation: none; transition: none; }
}

.q-step__eyebrow {
  display: inline-block;
  font: 600 var(--step--1, 0.8rem) / 1 var(--font-sans, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary, #007872);
  margin-bottom: 0.4rem;
}
.q-step__title {
  font-family: var(--font-head, serif);
  font-size: var(--step-2, 1.6rem);
  line-height: 1.15;
  margin: 0 0 0.35rem;
  color: var(--text-heading, #14342c);
}
.q-step__intro {
  color: var(--muted, #5b6b66);
  margin: 0 0 1.4rem;
  font-size: var(--step-0, 1rem);
}

/* ---- Fields ---- */
.q-field { margin-bottom: 1.15rem; }
.q-field > label,
.q-fieldset > legend {
  display: block;
  font: 600 var(--step-0, 1rem) / 1.35 var(--font-sans, sans-serif);
  color: var(--ink, #14342c);
  margin-bottom: 0.35rem;
}
.q-field .q-hint {
  display: block;
  font-weight: 400;
  font-size: var(--step--1, 0.85rem);
  color: var(--muted, #5b6b66);
  margin-top: 0.1rem;
  margin-bottom: 0.5rem;
}
.q-req { color: var(--error, #b3261e); font-weight: 700; }

.q input[type=text],
.q input[type=email],
.q input[type=tel],
.q input[type=url],
.q input[type=number],
.q input[type=date],
.q textarea,
.q select {
  width: 100%;
  font: 400 16px/1.4 var(--font-sans, sans-serif); /* 16px = no iOS zoom */
  color: var(--ink, #14342c);
  background: var(--surface, #fff);
  border: 1.5px solid var(--outline-variant, #b6cecd);
  border-radius: var(--radius, 12px);
  padding: 0.7rem 0.85rem;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.q textarea { min-height: 110px; resize: vertical; }
.q select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23006b57'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  padding-right: 2.2rem;
}
.q input:focus,
.q textarea:focus,
.q select:focus {
  outline: none;
  border-color: var(--primary, #007872);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary, #007872) 22%, transparent);
}
.q [data-invalid] {
  border-color: var(--error, #b3261e) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--error, #b3261e) 18%, transparent);
}
.q-error-msg {
  display: none;
  color: var(--error, #b3261e);
  font-size: var(--step--1, 0.85rem);
  margin-top: 0.3rem;
}
.q-error-msg.is-shown { display: block; }

/* ---- Choice groups (radio / checkbox) ---- */
.q-fieldset { border: 0; margin: 0 0 1.15rem; padding: 0; }
.q-choices { display: grid; gap: 0.5rem; }
.q-choices.q-choices--cols { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.q-choice {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--outline-variant, #b6cecd);
  border-radius: var(--radius, 12px);
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: var(--step-0, 1rem);
  line-height: 1.35;
  transition: border-color 0.15s, background 0.15s;
}
.q-choice:hover { border-color: var(--primary-dim, #4f9a8a); }
.q-choice input { margin-top: 0.2rem; width: 1.15rem; height: 1.15rem; accent-color: var(--primary, #007872); flex: none; }
.q-choice:has(input:checked) {
  border-color: var(--primary, #007872);
  background: var(--success-soft, #e3f1ec);
}

/* ---- Repeatable groups (testimonials, FAQs) ---- */
.q-repeat__row {
  position: relative;
  border: 1.5px dashed var(--outline-variant, #b6cecd);
  border-radius: var(--radius-lg, 16px);
  padding: 1rem 1rem 0.4rem;
  margin-bottom: 0.9rem;
  background: var(--surface-low, #f4f8f6);
}
.q-repeat__remove {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  border: 0;
  background: transparent;
  color: var(--muted, #5b6b66);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.4rem;
  border-radius: 8px;
}
.q-repeat__remove:hover { color: var(--error, #b3261e); background: var(--surface-container, #e7efec); }
.q-add {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1.5px solid var(--primary, #007872);
  color: var(--primary, #007872);
  border-radius: var(--radius-pill, 999px);
  padding: 0.5rem 1.1rem;
  font: 600 var(--step-0, 1rem) var(--font-sans, sans-serif);
  cursor: pointer;
}
.q-add:hover { background: var(--success-soft, #e3f1ec); }

/* ---- Nav ---- */
.q-nav {
  display: flex;
  gap: 0.8rem;
  justify-content: space-between;
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line, #d9e4e0);
}
.q-btn {
  font: 600 var(--step-0, 1rem) var(--font-sans, sans-serif);
  border-radius: var(--radius-pill, 999px);
  padding: 0.8rem 1.6rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, opacity 0.15s;
}
.q-btn--primary { background: var(--primary, #007872); color: var(--on-primary, #fff); }
.q-btn--primary:hover { background: var(--brand-dark, #00513f); }
.q-btn--ghost { background: transparent; color: var(--primary, #007872); border-color: var(--outline-variant, #b6cecd); }
.q-btn--ghost:hover { border-color: var(--primary, #007872); }
.q-btn[disabled] { opacity: 0.5; cursor: default; }
.q-btn--hidden { visibility: hidden; }

.q-saved {
  text-align: center;
  font-size: var(--step--1, 0.82rem);
  color: var(--muted, #5b6b66);
  margin-top: 0.9rem;
  min-height: 1.1em;
}

/* ---- Success / error panels ---- */
.q-result { display: none; text-align: center; padding: 2rem 1rem; }
.q-result.is-shown { display: block; }
.q-result__icon {
  font-size: 3.4rem;
  line-height: 1;
  color: var(--primary, #007872);
}
.q-result__icon--err { color: var(--error, #b3261e); }
.q-result h2 { font-family: var(--font-head, serif); margin: 0.6rem 0 0.4rem; }
.q-result p { color: var(--muted, #5b6b66); max-width: 46ch; margin-inline: auto; }
.q-result .q-btn { margin-top: 1.2rem; }

/* ---- "What's on your site now" quote (#1000144, /clarifications/) ----
   Shows Lydia the live wording a question is about, so she can answer without
   opening the page. Not used by /questionnaire/ (intake asks for facts we do
   not have yet; this asks about copy that already exists). */
.q-current {
  border-inline-start: 3px solid var(--primary-dim, #4f9a8a);
  background: var(--band-alt, #f3f7f5);
  border-radius: 0 var(--radius-s, 6px) var(--radius-s, 6px) 0;
  padding: 0.75rem 0.95rem;
  margin: 0 0 1.15rem;
  font-size: var(--step--1, 0.9rem);
  color: var(--on-surface, #1a2320);
}
.q-current__label {
  display: block;
  font-size: var(--step--2, 0.76rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #5b6b66);
  margin-bottom: 0.35rem;
}
.q-current p { margin: 0 0 0.5rem; }
.q-current p:last-child { margin-bottom: 0; }
.q-current cite { font-style: normal; color: var(--muted, #5b6b66); }

@media (max-width: 480px) {
  .q-nav { flex-direction: row; }
  .q-btn { padding: 0.8rem 1.2rem; }
}
