/* ---------- start: the audit request, over a calm live berth ---------- */

.start {
  position: relative;
  isolation: isolate;
  padding: var(--section-y) 0;
  background-color: var(--bg);
  /* The berth standing still: the sounding grid as a static field. It shows
     without JS or WebGL, and until the live field (same 20px pitch, same
     dots) has drawn its first frame. */
  background-image: radial-gradient(rgba(233, 234, 234, 0.1) 1px, transparent 1.3px);
  background-size: 20px 20px;
  border-top: 1px solid var(--line);
}
.start.is-live { background-image: none; }
.start-gl { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.start.no-webgl .start-gl { display: none; }

.start-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(64px, 7vw, 112px);
  align-items: start;
}
.start h2 { font-size: clamp(2.5rem, 5vw, 4.5rem); letter-spacing: -0.045em; }
.start-copy .lead { max-width: 25em; }

/* ---------- the panel ---------- */

.start-panel { container-type: inline-size; padding: clamp(22px, 3vw, 36px); overflow-anchor: none; }
.start-panel.is-folding { overflow: hidden; transition: height 0.7s var(--ease-out); }
.intake-note-form { margin: 0 0 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.intake-note-form[hidden] { display: none; }

/* ---------- fields ---------- */

.field-row { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 16px; }
.field { min-width: 0; margin-bottom: 20px; }
.field label,
.goals legend { display: block; margin-bottom: 8px; font-size: 14.5px; font-weight: 560; line-height: 1.35; color: var(--fg); }
.optional { margin-left: 6px; font-weight: 400; color: var(--fg-3); }
.field input,
.field select,
.field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 0;
  background-color: var(--bg);
  color: var(--fg);
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
}
.field input { text-overflow: ellipsis; }
.field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 40px;
  text-overflow: ellipsis;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%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.5 11 1.5' fill='none' stroke='%23e9eaea' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
/* "Choose" reads as a prompt, not an answer, until a size is picked */
.field select:invalid { color: var(--fg-3); }
.field select option { background: var(--bg-1); color: var(--fg); }
.field textarea { min-height: 78px; resize: vertical; }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--line-3); }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible { outline: 1px solid var(--fg); outline-offset: 0; border-color: var(--fg); }
.field ::placeholder { color: var(--fg-3); opacity: 1; }
.field [aria-invalid="true"] { border-color: var(--alert); }
/* Browser autofill keeps the instrument palette instead of its own tint */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--fg);
  caret-color: var(--fg);
  -webkit-box-shadow: inset 0 0 0 100px var(--bg-2);
  transition: border-color 0.2s ease, background-color 0s 600000s;
}
.field-hint { font-size: 14px; line-height: 1.45; color: var(--fg-3); font-variant-numeric: tabular-nums; }
.field-error { margin-top: 8px; font-size: 14px; font-weight: 500; line-height: 1.45; color: var(--alert); overflow-wrap: anywhere; }
.field-error:empty { display: none; }

/* ---------- goals: pick up to three ---------- */

.goals { min-width: 0; margin: 8px 0 24px; padding: 0; border: 0; }
.goals legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; }
.goals .field-hint { clear: both; }
.chips { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 14px; }
.chip { position: relative; display: flex; min-width: 0; }
.chip input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 10px 14px 10px 12px;
  border: 1px solid var(--line-2);
  color: var(--fg-2);
  font-size: 14px;
  line-height: 1.4;
  text-wrap: pretty;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
/* the pick mark: an open square that fills once picked */
.chip span::before { content: ""; flex: none; width: 9px; height: 9px; margin-top: 5px; border: 1px solid currentColor; transition: background-color 0.2s ease; }
.chip input:hover + span { border-color: var(--line-3); color: var(--fg); }
.chip input:checked + span { background-color: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip input:checked + span::before { background-color: currentColor; }
.chip input:focus-visible + span { outline: 1px solid var(--fg); outline-offset: 2px; }
.chip input:disabled { cursor: not-allowed; }
.chip input:disabled + span { opacity: 0.38; }
.goals[aria-invalid="true"] .chip span { border-color: var(--alert); }

/* touch: every chip is at least 44px tall (narrow screens count as touch,
   as in base.css, because emulators do not report a coarse pointer) */
@media (pointer: coarse), (max-width: 860px) {
  .chip span { padding-block: 12px; }
}

/* ---------- send ---------- */

.btn-submit { width: 100%; justify-content: center; margin-top: 4px; }
.btn-submit[aria-disabled="true"] { cursor: progress; opacity: 0.7; }
.btn-submit[aria-disabled="true"]:hover { background: var(--fg); }
.btn-submit[aria-disabled="true"] .i { display: none; }
.form-status { margin-top: 14px; font-size: 14.5px; font-weight: 500; line-height: 1.45; color: var(--alert); }
.form-status:empty { display: none; }

/* ---------- done: the request is in ---------- */

.intake-done { padding: 2px 0; }
.intake-done:focus { outline: none; }
.intake-done:not([hidden]) { animation: start-done-in 0.8s var(--ease-out) both; }
.done-state { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--fg); color: var(--bg); font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.05em; line-height: 1.45; text-transform: uppercase; }
.done-state svg { width: 13px; height: 13px; flex: none; }
.intake-done h3 { margin-top: 24px; font-size: clamp(1.75rem, 2.6vw, 2.25rem); font-weight: 500; letter-spacing: -0.03em; overflow-wrap: anywhere; }
.intake-done p:last-child { margin-top: 12px; max-width: 34em; color: var(--fg-2); overflow-wrap: anywhere; }

@keyframes start-done-in {
  from { opacity: 0; transform: translateY(10px); }
}

/* ---------- the panel's own width decides its columns ---------- */

@container (min-width: 420px) {
  .field-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@container (min-width: 500px) {
  .chips { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* ---------- responsive ---------- */

@media (max-width: 1099px) {
  .start-inner { grid-template-columns: minmax(0, 1fr); gap: clamp(48px, 7vw, 64px); }
  .start-copy .lead { max-width: 34em; }
  .start-panel { max-width: 720px; }
}
