/* =========================================================================
   Therapy Care — Lead Flow (static prototype, Milestone 1)
   Brand tokens from reference/brand-tc.md (locked). Mobile-first.
   Matches the TC LP rebuild (build/landers/therapycare/live/) so the flow
   feels like a continuation of those pages.
   ========================================================================= */

:root {
  /* Colours (Emily's 8-colour palette, round-2 TC LP) */
  --tc-orange:     #F2633F;
  --tc-teal:       #48A2B2;
  --tc-sky:        #E7F6FD;
  --tc-navy:       #323B63;
  --tc-body:       #1E201F;
  --tc-grey-300:   #E8E8E8;
  --tc-white:      #FFFFFF;
  --tc-danger:     #EF3750;

  /* Typography */
  --f-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Layout */
  --radius-btn:   10px;
  --radius-card:  20px;
  --radius-input: 8px;
  --t: 160ms ease-in-out;

  /* Flow-specific */
  --stage-max: 640px;
  --header-h: 72px;
  --footer-h: 56px;
}

/* ------- Reset / base ------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--f-body);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.53;
  color: var(--tc-body);
  background: var(--tc-white);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--tc-navy); text-decoration: underline; text-underline-offset: 2px; transition: color var(--t); }
a:hover { color: var(--tc-body); }
h1, h2, h3 { font-family: var(--f-body); font-weight: 700; letter-spacing: -0.02em; color: var(--tc-body); margin: 0 0 .5em; }
p { margin: 0 0 1em; }

.skip-link {
  position: absolute; top: -100px; left: 8px;
  background: var(--tc-navy); color: #fff; padding: 8px 12px; border-radius: 6px; z-index: 999;
  text-decoration: none;
  transition: top var(--t);
}
.skip-link:focus { top: 8px; color: #fff; }

:focus-visible {
  outline: 2px solid var(--tc-navy);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ------- Header ------- */
.flow-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--tc-white);
  border-bottom: 1px solid var(--tc-grey-300);
}
.flow-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  max-width: 1100px; margin: 0 auto;
}
.brand img { height: 42px; width: auto; }
.flow-exit {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: var(--tc-body);
  font-weight: 500; font-size: 14px;
  padding: 6px 10px; border-radius: 6px;
}
.flow-exit:hover { background: var(--tc-sky); color: var(--tc-body); }
.flow-exit span[aria-hidden] { font-size: 22px; line-height: 1; }

/* Progress bar / dots */
.flow-progress {
  display: flex; gap: 6px; justify-content: center;
  padding: 10px 20px 14px;
  max-width: 1100px; margin: 0 auto;
  min-height: 20px;
}
.flow-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tc-grey-300);
  transition: background var(--t), transform var(--t);
}
.flow-dot--done   { background: var(--tc-teal); }
.flow-dot--active { background: var(--tc-orange); transform: scale(1.35); }

/* ------- Main grid (mobile first) ------- */
.flow-main {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 32px;
}

.flow-aside {
  order: -1;
  display: none;              /* hidden on mobile; shown on >=900 */
}

.flow-stage {
  min-height: calc(100dvh - var(--header-h) - var(--footer-h) - 80px);
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 24px 0 40px;
}

/* ------- Screens ------- */
.flow-screen {
  animation: flowFadeIn 240ms ease-out both;
}
@keyframes flowFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flow-eyebrow {
  display: inline-block;
  text-transform: uppercase;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--tc-teal);
  margin: 0 0 10px;
}

.flow-question {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--tc-body);
  margin: 0 0 10px;
}
.flow-sub {
  font-size: 16px; line-height: 1.5; color: var(--tc-body); opacity: .78;
  margin: 0 0 24px;
  max-width: 56ch;
}

/* ------- Buttons (brand-matched to LP) ------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  border: 2px solid transparent;
  border-radius: var(--radius-btn);
  padding: 14px 22px;
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t);
  min-height: 48px;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--tc-orange);
  color: var(--tc-white);
  border-color: var(--tc-orange);
}
.btn-primary:hover:not(:disabled) { background: var(--tc-teal); border-color: var(--tc-teal); }
.btn-secondary {
  background: transparent;
  color: var(--tc-orange);
  border-color: var(--tc-orange);
}
.btn-secondary:hover:not(:disabled) { background: var(--tc-teal); border-color: var(--tc-teal); color: var(--tc-white); }
.btn-ghost {
  background: transparent;
  color: var(--tc-navy);
  border-color: transparent;
  padding: 10px 14px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 15px;
  font-weight: 500;
  min-height: 40px;
}
.btn-ghost:hover:not(:disabled) { background: var(--tc-sky); }
.btn-full { width: 100%; }

/* ------- Option list (single-choice) ------- */
.flow-options {
  display: grid;
  gap: 10px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.flow-option {
  display: flex; align-items: center;
  width: 100%;
  text-align: left;
  background: var(--tc-white);
  border: 2px solid var(--tc-grey-300);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--tc-body);
  font-size: 16px; font-weight: 500; line-height: 1.4;
  transition: border-color var(--t), background var(--t), transform var(--t);
  min-height: 60px;
}
.flow-option:hover:not(:disabled) {
  border-color: var(--tc-teal);
  background: var(--tc-sky);
}
.flow-option:focus-visible {
  border-color: var(--tc-navy);
}
.flow-option-key {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1.5px solid var(--tc-grey-300);
  border-radius: 6px;
  margin-right: 14px;
  flex: 0 0 28px;
  font-size: 13px; font-weight: 600;
  color: var(--tc-body);
  background: var(--tc-white);
  transition: border-color var(--t), background var(--t), color var(--t);
}
.flow-option:hover .flow-option-key { border-color: var(--tc-teal); }
.flow-option--selected {
  border-color: var(--tc-orange);
  background: #FFF4F0;
}
.flow-option--selected .flow-option-key {
  background: var(--tc-orange); color: var(--tc-white); border-color: var(--tc-orange);
}

/* ------- Text / textarea / form fields ------- */
.flow-field {
  display: block;
  margin: 0 0 18px;
}
.flow-field-label {
  display: block;
  font-weight: 600; font-size: 14px;
  color: var(--tc-teal);
  margin: 0 0 6px;
}
.flow-field-required { color: var(--tc-danger); margin-left: 2px; }

.flow-input, .flow-textarea {
  width: 100%;
  font: inherit;
  font-weight: 400; font-size: 16px;
  color: var(--tc-body);
  background: var(--tc-white);
  border: 1px solid var(--tc-body);
  border-radius: var(--radius-input);
  padding: 12px 14px;
  min-height: 48px;
  transition: border-color var(--t), box-shadow var(--t);
}
.flow-input:focus, .flow-textarea:focus {
  outline: none;
  border-color: var(--tc-teal);
  box-shadow: 0 0 0 3px rgba(72, 162, 178, 0.18);
}
.flow-textarea { min-height: 120px; resize: vertical; }
.flow-input--big {
  font-size: 20px;
  padding: 16px 18px;
  min-height: 60px;
}

/* Consent checkbox */
.flow-consent {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0 4px;
  font-size: 14px; line-height: 1.5;
}
.flow-consent input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--tc-orange); flex: 0 0 18px; }

/* Field errors */
.flow-error {
  color: var(--tc-danger);
  font-size: 13px; font-weight: 500;
  margin-top: 6px;
}
.flow-input--error, .flow-textarea--error { border-color: var(--tc-danger); }

/* ------- Nav row (Back / Continue) ------- */
.flow-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.flow-nav .btn-primary { min-width: 160px; }
.flow-hint {
  font-size: 13px; color: var(--tc-body); opacity: .65;
  margin-top: 10px;
}

/* ------- Image placeholders ------- */
.flow-image-placeholder {
  border: 2px dashed #B9D4DB;
  background: var(--tc-sky);
  color: var(--tc-navy);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 20px;
  min-height: 220px;
  font-size: 13px; font-weight: 500; line-height: 1.5;
}
.flow-image-placeholder--primary { min-height: 360px; }
.flow-image-placeholder--badge   { min-height: 90px; max-width: 160px; margin-bottom: 12px; }
.flow-image-placeholder--inline  { min-height: 180px; margin: 0 0 20px; }
.flow-image-placeholder-label { opacity: .9; }

/* ------- Intro screen ------- */
.flow-intro {
  text-align: left;
}
.flow-intro h1 {
  font-size: 36px; line-height: 1.15;
  margin: 10px 0 14px;
}
.flow-intro .flow-sub { font-size: 17px; margin-bottom: 24px; }
.flow-trust {
  list-style: none; padding: 0; margin: 0 0 28px;
  display: grid; gap: 10px;
}
.flow-trust li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 15px; font-weight: 500;
}
.flow-trust li::before {
  content: ""; display: inline-block;
  width: 20px; height: 20px; flex: 0 0 20px;
  background: var(--tc-orange);
  mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='currentColor' d='M9 16.2 4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4z'/></svg>") center / contain no-repeat;
  margin-top: 3px;
}

/* ------- End screens ------- */
.flow-end {
  text-align: left;
}
.flow-end h2 {
  font-size: 32px; line-height: 1.2;
  margin: 10px 0 14px;
}
.flow-end-icon {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
  color: var(--tc-white);
}
.flow-end-icon--check { background: var(--tc-teal); }
.flow-end-icon--info  { background: var(--tc-orange); }
.flow-end-icon svg { width: 28px; height: 28px; }
.flow-end-cta-row {
  display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px;
}
.flow-end-debug {
  margin-top: 32px;
  padding: 14px 16px;
  background: #FFF6E8;
  border: 1px dashed #E0B770;
  border-radius: 8px;
  font-size: 12px;
  color: #6B4A0A;
}
.flow-end-debug summary {
  cursor: pointer; font-weight: 600; margin-bottom: 6px;
}
.flow-end-debug pre {
  white-space: pre-wrap; word-break: break-word;
  margin: 8px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ------- Footer ------- */
.flow-footer {
  flex: 0 0 auto;
  text-align: center;
  padding: 16px 20px;
  background: var(--tc-sky);
  color: var(--tc-navy);
  font-size: 13px;
}
.flow-footer p { margin: 0; }

/* ------- Breakpoints ------- */
@media (min-width: 640px) {
  .flow-question { font-size: 32px; }
  .flow-intro h1 { font-size: 44px; }
  .flow-end h2 { font-size: 36px; }
}

@media (min-width: 900px) {
  .flow-main {
    grid-template-columns: 320px 1fr;
    gap: 48px;
    padding: 32px 20px 48px;
  }
  .flow-aside {
    order: 0;
    display: block;
    position: sticky; top: 110px;
    align-self: start;
  }
  .flow-stage {
    padding: 0 0 40px;
    min-height: auto;
    max-width: var(--stage-max);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .flow-screen { animation: none; }
  * { transition-duration: 0ms !important; }
}
