/* ============================================================
   /the-crossing-diagnostic/start — Form interface additions
   Loaded AFTER /crossing-readiness-score/_assets/quiz.css so it
   can override and extend. Holds only the patterns the Score
   form doesn't have: standalone text-input screens, Companies
   House autocomplete dropdown, two-part numeric input, the
   Block 7 entity mini-form, the resume prompt, and the mini-form
   three-button navigation.
   ============================================================ */

/* ============================================================
   STANDALONE TEXT-INPUT QUESTION SCREENS
   Q1.1 first name, Q1.2 company name (autocomplete), Q1.3
   company number, Q1.5 email, Q8.5 free-text closer.
   Visual treatment mirrors .lead-field from quiz.css so the
   single-input screens feel coherent with the (now-unused) lead
   form pattern, just rendered one per screen.
   ============================================================ */

.tcd-input-field {
  margin: 0;
}

.tcd-input-field label {
  display: block;
  font: 500 14px/1.4 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink, #15171B);
  margin-bottom: 8px;
}

.tcd-input-field .req {
  color: #DC2626;
  margin-left: 2px;
}

.tcd-input-field input[type="text"],
.tcd-input-field input[type="email"],
.tcd-input-field input[type="number"],
.tcd-input-field textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid #E5E1D5;
  border-radius: 8px;
  padding: 14px 16px;
  font: 400 16px/1.4 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink, #15171B);
  transition: border-color 150ms ease, box-shadow 150ms ease;
  box-sizing: border-box;
}

.tcd-input-field textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.5;
}

.tcd-input-field input:focus-visible,
.tcd-input-field textarea:focus-visible {
  outline: none;
  border-color: var(--arc, #5B6CF2);
  box-shadow: 0 0 0 3px rgba(91, 108, 242, 0.18);
}

.tcd-input-field .field-helper {
  display: block;
  margin: 8px 0 0;
  font: 400 13px/1.5 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: rgba(21, 23, 27, 0.55);
}

.tcd-input-field .field-error {
  display: block;
  margin: 8px 0 0;
  font: 500 13px/1.5 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: #DC2626;
}

/* The `display: block` above overrides the UA `[hidden]` rule, so the
   hidden attribute alone wouldn't hide the error. Restore it — matches
   the `[hidden]` overrides used elsewhere in this file. */
.tcd-input-field .field-error[hidden] {
  display: none;
}

.tcd-input-field.has-error input,
.tcd-input-field.has-error textarea {
  border-color: #DC2626;
}

/* ============================================================
   COMPANIES HOUSE AUTOCOMPLETE DROPDOWN
   Positioned absolutely beneath Q1.2's input. Populated by JS
   after a 500ms debounced search. Click a row to select.
   ============================================================ */

.tcd-autocomplete {
  position: relative;
}

.tcd-autocomplete__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #ffffff;
  border: 1px solid #E5E1D5;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(21, 23, 27, 0.08);
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.tcd-autocomplete__list[hidden] {
  display: none;
}

.tcd-autocomplete__item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 10px 14px;
  cursor: pointer;
  font: 400 15px/1.4 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink, #15171B);
}

.tcd-autocomplete__item:hover,
.tcd-autocomplete__item:focus-visible {
  outline: none;
  background: rgba(91, 108, 242, 0.06);
}

.tcd-autocomplete__item-name {
  display: block;
  font-weight: 500;
}

/* Non-active Companies House status tag (dissolved, liquidation, etc.).
   Amber signals caution before the founder picks; the submit-time check
   is the actual gate. */
.tcd-autocomplete__item-status {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  text-transform: capitalize;
  color: #B45309;
  background: rgba(180, 83, 9, 0.10);
  vertical-align: middle;
}

.tcd-autocomplete__item-meta {
  display: block;
  margin-top: 2px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 12px;
  color: rgba(21, 23, 27, 0.55);
  letter-spacing: 0.04em;
}

.tcd-autocomplete__status {
  padding: 12px 14px;
  font: 400 13px/1.5 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: rgba(21, 23, 27, 0.55);
}

/* ============================================================
   TWO-PART NUMERIC INPUT — Q4.2 (people count, state count)
   ============================================================ */

.tcd-two-part {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 480px) {
  .tcd-two-part {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.tcd-two-part input[type="number"] {
  -moz-appearance: textfield;
}
.tcd-two-part input::-webkit-outer-spin-button,
.tcd-two-part input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   BLOCK 7 — MINI-FORM (entity screens)
   Four stacked labelled inputs per entity. Reuses .tcd-input-field.
   ============================================================ */

.tcd-entity-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.tcd-entity-form .tcd-input-field {
  margin: 0;
}

/* Select-control styling — matches .quiz-option but for native <select> */
.tcd-select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #E5E1D5;
  border-radius: 8px;
  padding: 14px 40px 14px 16px;
  font: 400 16px/1.4 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink, #15171B);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%2315171B' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
  box-sizing: border-box;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tcd-select:focus-visible {
  outline: none;
  border-color: var(--arc, #5B6CF2);
  box-shadow: 0 0 0 3px rgba(91, 108, 242, 0.18);
}

/* Entity summary line on subsequent mini-form screens */
.tcd-entity-summary {
  margin: 0 0 24px;
  padding: 12px 16px;
  background: rgba(91, 108, 242, 0.06);
  border-left: 3px solid var(--arc, #5B6CF2);
  border-radius: 0 6px 6px 0;
  font: 400 14px/1.55 'Geist', ui-sans-serif, system-ui, sans-serif;
  color: rgba(21, 23, 27, 0.78);
}

.tcd-entity-summary strong {
  color: var(--ink, #15171B);
  font-weight: 500;
}

/* ============================================================
   THREE-BUTTON NAVIGATION (mini-form screens only)
   Standard nav is Back + Next. Mini-form nav is Back + Continue
   (secondary) + Add another (primary, replaces Next).
   The continue button is hidden by default; JS toggles it on
   mini-form screens.
   ============================================================ */

#btn-continue[hidden] {
  display: none;
}

.quiz-nav .nav-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 540px) {
  .quiz-nav .nav-right-group {
    gap: 8px;
  }
  .quiz-nav .nav-right-group .quiz-btn-secondary,
  .quiz-nav .nav-right-group .quiz-btn-primary {
    padding: 12px 16px;
    font-size: 13px;
  }
}

/* ============================================================
   RESUME PROMPT SCREEN (between Block 4 and Block 5)
   Two large buttons stacked on mobile, side by side on desktop.
   ============================================================ */

.tcd-resume-prompt {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 8px 0 0;
}

@media (min-width: 640px) {
  .tcd-resume-prompt {
    flex-direction: row;
    gap: 16px;
  }
  .tcd-resume-prompt > * {
    flex: 1 1 0;
    justify-content: center;
  }
}

/* ============================================================
   TURNSTILE PLACEHOLDER (no script loaded this session)
   ============================================================ */

.tcd-turnstile-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 65px;
  margin: 24px 0;
  background: rgba(91, 108, 242, 0.04);
  border: 1px dashed rgba(91, 108, 242, 0.35);
  border-radius: 8px;
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(91, 108, 242, 0.7);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ============================================================
   OUTRO — async-delivery body, slightly different from Score
   ============================================================ */

.tcd-outro-body {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: rgba(21, 23, 27, 0.78);
  margin: 0 0 48px;
}

.tcd-outro-body p {
  margin: 0 0 20px;
}

.tcd-outro-body p:last-child {
  margin-bottom: 0;
}

.tcd-outro-body strong {
  color: var(--ink, #15171B);
  font-weight: 500;
}

/* ============================================================
   LEGAL DISCLAIMER + CONSENT GATE (final screen q8-5)
   Sits at the bottom of the form, below the Turnstile, above the
   Submit button. A calm, editorial legal block on a tinted cream
   surface so it reads as a distinct closing section. The consent
   row borrows the .quiz-option interactive language (arc accent,
   arc border when checked) so ticking it feels like the rest of
   the form. This form uses Geist for headings (no Fraunces loaded).
   ============================================================ */

.disclaimer-block {
  margin: 32px 0 0;
  padding: 28px 28px 24px;
  background: var(--cream, #F5F1E8);
  border: 1px solid #E5E1D5;
  border-radius: 12px;
}

.disclaimer-block__heading {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink, #15171B);
  margin: 0 0 16px;
}

.disclaimer-block p {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: rgba(21, 23, 27, 0.72);
  margin: 0 0 14px;
}

/* The penultimate paragraph ("By submitting this form…") leads into the
   checkbox — keep it tight to the consent control. */
.disclaimer-block p:last-of-type {
  margin-bottom: 18px;
  color: var(--ink, #15171B);
}

.disclaimer-consent {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: #ffffff;
  border: 1px solid #E5E1D5;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}

.disclaimer-consent:hover {
  border-color: rgba(91, 108, 242, 0.5);
}

.disclaimer-consent input[type="checkbox"] {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  cursor: pointer;
  accent-color: var(--arc, #5B6CF2);
}

.disclaimer-consent span {
  font-family: 'Geist', ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink, #15171B);
  font-weight: 400;
}

.disclaimer-consent:has(input:checked) {
  border-color: var(--arc, #5B6CF2);
  background: rgba(91, 108, 242, 0.04);
}

.disclaimer-consent:has(input:checked) span {
  font-weight: 500;
}

.disclaimer-consent:focus-within {
  outline: none;
  border-color: var(--arc, #5B6CF2);
  box-shadow: 0 0 0 3px rgba(91, 108, 242, 0.18);
}

@media (max-width: 480px) {
  .disclaimer-block {
    padding: 22px 18px 20px;
  }
  .disclaimer-block__heading {
    font-size: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .disclaimer-consent {
    transition: none;
  }
}

/* ============================================================
   PROGRESS LABEL — overrides Score's profile/catalyst etc.
   The Diagnostic uses block names instead.
   ============================================================ */

/* (Visual treatment inherited from .quiz-progress-stage; copy is
   dynamic and set in form.js. No CSS override needed.) */

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 767px) {
  .tcd-input-field input[type="text"],
  .tcd-input-field input[type="email"],
  .tcd-input-field input[type="number"],
  .tcd-input-field textarea {
    font-size: 16px; /* avoid iOS zoom */
  }
  .tcd-select {
    font-size: 16px;
  }
  .tcd-entity-summary {
    font-size: 13px;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .tcd-input-field input,
  .tcd-select {
    transition: none;
  }
}
