/* Create Wellness Center — intake.css: the site's form vocabulary, loaded by
   /intake/ pages and (since the r11 booking-request form) /book/. site.css
   ships zero input/label/fieldset rules. Tokens come from site.css :root;
   field tokens come from a .intake-page class on the page shell OR the form
   element itself.
   --field-border: sand is too faint for a control boundary (WCAG 1.4.11 wants
   3:1 non-text contrast), so fields get a warm gray that clears 3:1 on both
   white and cream washes. */

.intake-page {
  --field-border: #8a8171;
  --field-radius: var(--radius-sm);
}

/* ── layout ─────────────────────────────────────────────────────────────── */
.intake-shell { max-width: 760px; margin-inline: auto; }

.form-step {
  margin: 0 0 var(--gap);
  padding: clamp(1.25rem, 3vw, 1.9rem);
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: var(--radius);
}
/* float pulls the legend OUT of the fieldset's border notch so the title sits
   fully inside the card instead of straddling the top border */
.form-step legend {
  float: left;
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0;
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  color: var(--green-900);
}
.form-step legend + * { clear: both; }
.form-step > .step-hint { margin: 0 0 1.25rem; font-size: var(--fs-sm); color: var(--ink-soft); max-width: none; }

.form-row { margin-bottom: 1.1rem; }
.form-row:last-child { margin-bottom: 0; }
.form-grid { display: grid; gap: 1.1rem; margin-bottom: 1.1rem; }
@media (min-width: 640px) { .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-grid .form-row { margin-bottom: 0; }

/* ── labels + helper text ───────────────────────────────────────────────── */
.field-label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 650;
  font-size: var(--fs-sm);
  color: var(--ink);
}
.field-label .req { color: var(--clay-700); font-weight: 400; }
.field-hint {
  display: block;
  margin: 0.3rem 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-soft);
  max-width: none;
}
.field-error {
  display: none;
  margin: 0.3rem 0 0;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: var(--clay-700);
}
.form-row.has-error .field-error { display: block; }
.form-row.has-error :is(.field, select.field, textarea.field) { border-color: var(--clay-700); }

/* ── text-ish controls ──────────────────────────────────────────────────── */
.field {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.85rem;
  background: var(--white);
  border: 1px solid var(--field-border);
  border-radius: var(--field-radius);
  font: inherit;
  color: var(--ink);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field::placeholder { color: #9aa4a8; }
/* one ring: the --focus border (green-700, ~7:1 on white) plus a soft halo in the same green */
.field:focus { border-color: var(--focus); outline: 0; box-shadow: 0 0 0 3px rgba(47, 93, 70, 0.25); }
textarea.field { min-height: 96px; resize: vertical; line-height: 1.5; }
select.field {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f5d46' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 16px;
}

/* ── radios + checkboxes (row style) ────────────────────────────────────── */
.choice-list { display: grid; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.choice-list--2col { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: var(--field-radius);
  cursor: pointer;
  font-size: var(--fs-sm);
  line-height: 1.45;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.choice:hover { border-color: var(--green-500); }
.choice input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--green-700);
  cursor: pointer;
}
/* checked rows were signalled by fill + border hue alone. A 3px keyline inside
   the row is the .tcard--raised "this one is marked" idiom moved into the form,
   and it survives a hue-blind read: 6.51:1 on the checked fill (1.4.11 bar 3).
   Matters most on the three required consent rows. */
.choice:has(input:checked) {
  border-color: var(--green-700); background: var(--green-100);
  box-shadow: inset 3px 0 0 var(--green-700);
}
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice__text b { font-weight: 650; }
.choice__text small { display: block; color: var(--ink-soft); font-size: var(--fs-xs); }

/* ── selectable chips (body areas, services) ────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.5rem 1rem;
  background: var(--white);
  border: 1px solid var(--field-border);
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--green-900);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chip input {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}
.chip::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--field-border);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.chip:hover { border-color: var(--green-700); }
.chip:has(input:checked) {
  background: var(--green-700);
  border-color: var(--green-700);
  color: var(--white);
}
.chip:has(input:checked)::before { background: var(--white); border-color: var(--white); }
.chip:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── left/right side pickers (lateral body areas) ───────────────────────── */
.side-rows { display: grid; gap: 0.5rem; }
.side-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; }
.side-row__label { min-width: 6.5rem; font-size: var(--fs-sm); font-weight: 650; color: var(--ink); }
.side-seg {
  display: inline-flex;
  background: var(--white);
  border: 1px solid var(--field-border);
  border-radius: 999px;
  overflow: hidden;
}
.side-seg button {
  min-height: 40px;
  min-width: 3.4rem;
  padding: 0.3rem 0.85rem;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--green-900);
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.side-seg button + button { border-left: 1px solid var(--sand); }
.side-seg button:hover { background: var(--green-100); }
.side-seg button[aria-pressed="true"] { background: var(--green-700); color: var(--white); }
.side-seg button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ── pain slider ────────────────────────────────────────────────────────── */
.pain-scale { display: flex; align-items: center; gap: 0.9rem; }
.pain-scale input[type="range"] { flex: 1; min-height: 44px; margin: 0; background: transparent; accent-color: var(--green-700); -webkit-appearance: none; appearance: none; cursor: pointer; }
/* 6px sand track, 24px white thumb with a green-700 ring; the input keeps its 44px target */
.pain-scale input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: var(--sand); border-radius: 999px; }
.pain-scale input[type="range"]::-moz-range-track { height: 6px; background: var(--sand); border-radius: 999px; }
.pain-scale input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; background: var(--white); border: 2px solid var(--green-700); border-radius: 50%; box-shadow: var(--lift-contact); }
.pain-scale input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; box-sizing: border-box; background: var(--white); border: 2px solid var(--green-700); border-radius: 50%; box-shadow: var(--lift-contact); }
.pain-scale output {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.6rem; height: 2.6rem;
  background: var(--green-100);
  border-radius: 50%;
  font-weight: 650;
  color: var(--green-900);
}
.pain-scale__ends { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--ink-soft); }
/* the step label's digits and the pain output keep one width as they change.
   Figtree ships `tnum` (verified 2026-08-12). */
.intake-progress__label, .pain-scale output { font-variant-numeric: tabular-nums; }
/* full-width rows: site.css caps every <p> at 68ch */
.intake-progress__label, .pain-scale__ends { max-width: none; }

/* ── file upload ────────────────────────────────────────────────────────── */
.file-drop input[type="file"] { font-size: var(--fs-sm); }
.file-drop input[type="file"]::file-selector-button {
  min-height: 44px;
  margin-right: 0.8rem;
  padding: 0.5rem 1rem;
  background: var(--white);
  border: 1px solid var(--green-700);
  border-radius: var(--field-radius);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--green-900);
  cursor: pointer;
}
.file-drop input[type="file"]::file-selector-button:hover { background: var(--green-100); }

/* ── consent blocks ─────────────────────────────────────────────────────── */
.consent-box {
  margin-bottom: 1rem;
  border: 1px solid var(--sand);
  border-radius: var(--field-radius);
  background: var(--cream);
}
.consent-box summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 48px;
  padding: 0.7rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--green-900);
}
.consent-box summary::-webkit-details-marker { display: none; }
.consent-box summary::after {
  content: "";
  flex: none;
  width: 10px; height: 10px;
  border-right: 2px solid var(--clay);
  border-bottom: 2px solid var(--clay);
  transform: rotate(45deg);
  transition: transform 0.35s var(--ease-out);
}
.consent-box[open] summary::after { transform: rotate(-135deg); }
.consent-box__body { padding: 0 1rem 0.9rem; font-size: var(--fs-xs); color: var(--ink-soft); }
.consent-box__body p { max-width: none; margin-bottom: 0.5rem; }
.consent-box__body p:lang(ko) { line-height: 1.7; }

/* ── step controls + progress ───────────────────────────────────────────── */
.intake-progress { margin-bottom: 1.25rem; }
.intake-progress__label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.4rem;
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--green-900);
}
/* four segments (step glide, wow-build-log.md): 1..current are .is-done */
.intake-progress__track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: 4px; }
.intake-progress__track i { overflow: hidden; background: var(--sand); border-radius: 2px; }
.intake-progress__track i::before { content: ""; display: block; height: 100%; background: var(--green-700); transform: scaleX(0); transform-origin: left; }
.intake-progress__track .is-done::before { transform: none; }

.step-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
}
/* THE DOCK (form-dock b, wow-build-log.md): sticky glass bar; last step = plain row */
@media screen {
  .step-controls:has(> [data-step-next]:not([hidden])) { position: sticky; bottom: 0; z-index: 2; margin-inline: calc(-1 * var(--gutter)); padding: 0.6rem var(--gutter) calc(0.6rem + env(safe-area-inset-bottom, 0px)); background: rgba(255, 255, 255, 0.88); -webkit-backdrop-filter: saturate(150%) blur(18px); backdrop-filter: saturate(150%) blur(18px); border-top: 1px solid var(--hair); }
  .js:has(.step-controls) { scroll-padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  @media (pointer: coarse) { form:has(.field:focus) > .step-controls { position: static; } }
  @media (min-width: 720px) {
    .step-controls:has(> [data-step-next]:not([hidden])) { bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px)); margin-inline: 0; padding: 0.6rem; border: 1px solid var(--hair); border-radius: 14px; box-shadow: var(--shadow); }
  }
  /* The Call/Book bar stays up on /intake/ (owner 2026-10-23) and hides only while someone
     types in a field: while it is up, the dock rides just above it (61px = bar height). */
  @media (max-width: 959px) {
    .step-controls:has(> [data-step-next]:not([hidden])) { transition: bottom 0.35s var(--ease); }
    body:has(.action-bar:not(.is-hidden)):not(:has(.nav.is-open, main form :is(input:not([type=radio],[type=checkbox],[type=range],[type=submit],[type=button]),select,textarea):focus)) .step-controls:has(> [data-step-next]:not([hidden])) { bottom: calc(61px + env(safe-area-inset-bottom, 0px)); padding-bottom: 0.6rem; }
    .js:has(.step-controls):has(.action-bar:not(.is-hidden)) { scroll-padding-bottom: calc(5.5rem + 61px + env(safe-area-inset-bottom, 0px)); }
  }
  @media (min-width: 720px) and (max-width: 959px) {
    body:has(.action-bar:not(.is-hidden)):not(:has(.nav.is-open, main form :is(input:not([type=radio],[type=checkbox],[type=range],[type=submit],[type=button]),select,textarea):focus)) .step-controls:has(> [data-step-next]:not([hidden])) { bottom: calc(61px + 0.75rem + env(safe-area-inset-bottom, 0px)); }
  }
}
.step-controls .btn { flex: 0 1 auto; }
.step-controls__spacer { flex: 1; }
@media (max-width: 479px) {
  .step-controls .btn { flex: 1 1 0; }
  .step-controls [data-step-next] { flex-grow: 2; }
  .step-controls__spacer { display: none; }
  .form-row > [data-submit-btn] { width: 100%; }
}

.form-alert {
  display: none;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: var(--clay-100);
  /* .notice is a boxless footnote now (site.css §14, r7); the alert keeps the
     other road — blunt 4px edge, other three edges closed — so severity is
     carried by weight. clay-700 on clay-100 = 5.65:1 (bar 3). */
  border: 1px solid var(--clay-700);
  border-left-width: 4px;
  border-radius: var(--field-radius);
  font-size: var(--fs-sm);
  color: var(--ink);
}
.form-alert.is-visible { display: block; }
.form-alert ul { margin: 0.25rem 0 0; padding-left: 1.1rem; }

/* honeypot — offscreen, never display:none so lazy bots still fill it */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* JS step-mode: hide inactive steps + the no-JS-only bits */
.js .form-step { display: none; }
.js .form-step.is-active { display: block; }
.no-js-note { margin-bottom: var(--gap); }
.js .no-js-note { display: none; }

/* conditional blocks (JS toggles [hidden]; without JS everything shows) */
.subfields {
  margin-top: 0.9rem;
  padding: 0.9rem;
  background: var(--cream);
  border: 1px solid var(--sand);
  border-radius: var(--field-radius);
}
.subfields > .form-row:last-child { margin-bottom: 0; }

/* /book/: the request form sits on one quiet white panel (no resting shadow) */
form.intake-page { padding: var(--pad-card); background: var(--white); border: 1px solid var(--sand); border-radius: var(--radius); }

@media (prefers-reduced-motion: no-preference) {
  .consent-box[open] > .consent-box__body, .js .form-step.is-active { animation: cwc-rise 0.45s var(--ease-out) both; }
  /* dock ease-up: two identical keyframes (odd/even step) restart it with no JS */
  .step-controls { animation: intake-dock 0.35s var(--ease-out) backwards; }
  form:has(> .is-active:is([data-step="2"], [data-step="4"])) > .step-controls { animation-name: intake-dock-2; }
  @keyframes intake-dock { from { transform: translateY(12px); } }
  @keyframes intake-dock-2 { from { transform: translateY(12px); } }
  .intake-progress[data-dir] i::before { transition: transform 0.6s var(--ease-out); }
  /* STEP GLIDE (intake.js go()): root swaps at once; only the live dock shows, on top */
  html[data-dir="b"]::view-transition { --x: -1; }
  html[data-dir]::view-transition-old(root) { display: none; }
  html[data-dir]::view-transition-new(root) { animation: none; }
  html[data-dir] .step-controls { view-transition-name: intake-dock; }
  html[data-dir]::view-transition-group(intake-dock) { animation: none; z-index: 1; }
  html[data-dir]::view-transition-old(intake-dock) { display: none; }
  html[data-dir]::view-transition-new(intake-dock) { animation: none; }
  /* the header holds its old image: WebKit draws a stuck sticky header's live image blank */
  html[data-dir]::view-transition-old(cwc-header) { animation: none; }
  html[data-dir]::view-transition-new(cwc-header) { display: none; }
  ::view-transition-old(intake-out) { animation: intake-out 0.16s var(--ease) both; }
  /* in starts as out is nearly gone (40ms overlap, as page to page): no double form */
  ::view-transition-new(intake-in) { animation: intake-in 0.42s var(--ease-out) 0.12s both; }
  @keyframes intake-out { to { opacity: 0; transform: translateX(calc(var(--x, 1) * -12px)); } }
  @keyframes intake-in { from { opacity: 0; transform: translateX(calc(var(--x, 1) * 16px)); } }
}
