/* intake/intake.css — the survey shell.
 *
 * Everything visual comes from the house tokens: the intake must feel like
 * the product it produces. No new colors, no new type scale — only layout
 * for the parts a candidate site does not have (step rail, save state).
 *
 * Mobile-first: the base rules ARE the phone layout. One idea per screen,
 * controls inside thumb reach, nothing below 44px.
 */

/* ── Chrome ─────────────────────────────────────────────────────────── */
.ik-head {
  position: sticky;
  top: 0;
  z-index: var(--z-header, 80);
  background: var(--ink-950);
  min-height: 54px;                 /* min-height, never height: large reader
                                       fonts must grow the bar, not clip it */
}
.ik-head__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  max-width: 40rem;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-4);
}
.ik-brand {
  font: 600 0.9375rem/1 var(--ff-b);
  letter-spacing: .04em;
  color: var(--on-dark-heading);
}
.ik-brand b { color: var(--gold); font-weight: 600; }

.ik-save {
  font: 500 0.8125rem/1.2 var(--ff-b);
  color: var(--on-dark-secondary);
  text-align: right;
}
.ik-save.is-ok  { color: var(--on-dark-secondary); }
.ik-save.is-bad { color: var(--gold-hi); font-weight: 600; }

.ik-progress { height: 3px; background: var(--on-dark-hairline); }
.ik-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
}
@media (prefers-reduced-motion: no-preference) {
  .ik-progress i { transition: width .4s var(--ease, ease); }
}

/* ── Layout ─────────────────────────────────────────────────────────── */
.ik-main {
  max-width: 40rem;                 /* rem, so the measure grows with the
                                       reader's font setting */
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-9);
}

.ik-h1 {
  font: 600 clamp(2rem, 8vw, 2.75rem)/1.05 var(--ff-d);
  letter-spacing: -.022em;
  color: var(--ink-800);
  margin: var(--sp-3) 0 var(--sp-4);
}
.ik-h1 em { color: var(--accent-text); font-style: italic; }

.ik-lede {
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-700);
  max-width: 34rem;
  margin-bottom: var(--sp-6);
}

.ik-fine {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-500);
  margin-top: var(--sp-5);
}

.ik-step__title {
  font: 600 clamp(1.5rem, 6vw, 1.9rem)/1.15 var(--ff-d);
  letter-spacing: -.018em;
  color: var(--ink-800);
  margin: 0 0 var(--sp-5);
}

/* ── Step rail ──────────────────────────────────────────────────────── */
.ik-steps {
  display: flex;
  gap: 6px;
  margin-bottom: var(--sp-5);
}
.ik-steps__dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--paper-400);
}
.ik-steps__dot.is-done { background: var(--accent); }
.ik-steps__dot.is-now  { background: var(--accent-text); }

/* ── Fields ──────────────────────────────────────────────────────────
   components/forms/form.css styles the field chassis for a DARK formcard
   (on-dark label tokens, translucent-white inputs). The intake is a LIGHT
   page, so every field on it needs the light-ground treatment — scoped to
   .ik-main so it covers the magic-link gate as well as the survey steps,
   not just my own .ik-field wrappers. */
.ik-form { max-width: none; }
.ik-field + .ik-field { margin-top: var(--sp-5); }

.ik-main .field__label { color: var(--ink-700); }
.ik-main .field__req { color: var(--accent-text); }
.ik-main .form__note,
.ik-main .form__status { color: var(--ink-500); }
.ik-main input,
.ik-main select,
.ik-main textarea {
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--paper-400);
}
.ik-main input::placeholder,
.ik-main textarea::placeholder { color: var(--ink-500); }
.ik-main .err { color: var(--accent-text); }

.ik-field .field__label {
  /* form.css sets the site-form caption voice: uppercase, letterspaced,
     small. These are QUESTIONS a person reads, not field captions — caps
     shout and wrap badly ("DISTRICT OR WARD NUMBER, IF YOU RUN IN ONE").
     Sentence case, normal tracking, one step up in size. */
  font: 500 1.0625rem/1.35 var(--ff-b);
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink-800);
  margin-bottom: var(--sp-2);
}
.ik-field input,
.ik-field select {
  width: 100%;
  min-height: 52px;                 /* comfortable thumb target */
  padding: 13px 15px;
  font: 400 1.0625rem/1.3 var(--ff-b);
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
}
.ik-field input:focus-visible,
.ik-field select:focus-visible { border-color: var(--accent-text); }

.ik-help {
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--ink-500);
  margin: var(--sp-2) 0 0;
}
.ik-field .err:not(:empty) { margin-top: var(--sp-2); }

/* Yes/No — two real buttons, not a checkbox: the answer is required and a
   checkbox cannot express "not yet answered". */
.ik-yesno { display: grid; gap: var(--sp-2); }
.ik-yes {
  min-height: 52px;
  padding: 12px 16px;
  font: 500 1rem/1.2 var(--ff-b);
  text-align: left;
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
  cursor: pointer;
}
.ik-yes.is-on {
  border-color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-text);
  font-weight: 650;
}

/* ── Nav ────────────────────────────────────────────────────────────── */
.ik-nav {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-7);
}
.ik-nav .btn { flex: 1; justify-content: center; }
.ik-nav--center { justify-content: center; }
.ik-nav--center .btn { flex: 0 1 auto; }
.ik-nav .btn:disabled { opacity: .4; pointer-events: none; }

/* ── Gate ───────────────────────────────────────────────────────────── */
.ik-gate .form { max-width: none; margin-top: var(--sp-5); }

/* ── Wider screens: a bounded card, not text adrift in the page ───────
   Below the breakpoint .ik-main IS the page — full-bleed, edge-padded,
   the phone layout this file started as. Above it, a single 40rem
   column left floating on a 1440px page reads as unfinished (a form
   that looks lost is a form people abandon), so the survey becomes a
   contained card on a receding page ground — the same alt-surface move
   DESIGN.md's neutral scale already uses (`--paper-200` "alternate
   light section"), not a new visual language. The card's own ground
   stays `--paper-100`, matching the page background below the
   breakpoint, so the white field chassis reads exactly the same both
   sides of it. Text measure is held constant across the breakpoint —
   the extra horizontal padding here is added on top of a wider
   max-width, not carved out of the mobile one, so the questions never
   go thin. Applies to every phase in .ik-main alike (gate, survey,
   done, review) — one rule, no per-screen drift.

   768px, not the house system's 860/861: this page is a single-column
   form, not the multi-zone candidate-site nav 860 governs, and an iPad
   in portrait (834px — the narrowest tablet this survey ships to) sits
   BELOW 860. Tested at 860, that width landed the old marooned-column
   bug right back, just less dramatically than at 1440px. 768 is the
   narrowest tablet width in real use and comfortably clears a phone
   held in portrait. */
@media (min-width: 768px) {
  body { background: var(--paper-200); }

  .ik-main {
    max-width: 44rem;
    margin: var(--sp-10) auto var(--sp-11);
    padding: var(--sp-8) var(--sp-7) var(--sp-9);
    background: var(--paper-100);
    border: 1px solid var(--paper-400);
    border-radius: var(--r-surface);
  }
  .ik-yesno { grid-template-columns: 1fr 1fr; }
}

@media print { .ik-head, .ik-nav, .ik-steps { display: none !important; } }

/* ── Photo ───────────────────────────────────────────────────────────
   capture="environment" opens the camera on a phone; the same control is
   a plain picker on a laptop. The frame is a GUIDE drawn over the preview
   — it never crops (faces are never cropped), it just shows the candidate
   roughly where their head should sit. */
.ik-photo .field__label { display: block; }

.ik-vis-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.ik-photo__drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 168px;
  margin-top: var(--sp-3);
  padding: var(--sp-5);
  text-align: center;
  color: var(--ink-700);
  background: var(--paper-200);
  border: 2px dashed var(--paper-400);
  border-radius: var(--r-surface);
  cursor: pointer;
}
.ik-photo__drop b { font: 650 1.0625rem/1.2 var(--ff-b); color: var(--ink-800); }
.ik-photo__sub { font-size: 0.875rem; color: var(--ink-500); }
.ik-photo__icon { color: var(--accent-text); }
.ik-vis-hidden:focus-visible + .ik-photo__drop,
.ik-photo__drop:hover { border-color: var(--accent-text); }

.ik-photo__shot {
  position: relative;
  margin-top: var(--sp-3);
  border-radius: var(--r-surface);
  overflow: hidden;
  background: var(--paper-300);
}
.ik-photo__shot img {
  display: block;
  width: 100%;
  height: auto;               /* never distort a person's face */
}
/* framing guide: head-and-shoulders oval, decorative only */
.ik-photo__frame {
  position: absolute;
  inset: 8% 22%;
  border: 2px dashed rgba(255, 255, 255, .72);
  border-radius: 50% 50% 46% 46%;
  pointer-events: none;
}

.ik-photo__acts {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.ik-photo__dims { font: 500 0.8125rem/1 var(--ff-b); color: var(--ink-500); }
.ik-photo__warn {
  margin-top: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-700);
  background: var(--paper-200);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--r-surface) var(--r-surface) 0;
}
.ik-photo__status:empty { display: none; }
.ik-photo__status { margin-top: var(--sp-2); font-size: 0.9375rem; color: var(--ink-500); }

.ik-check {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  min-height: 44px;
  margin-top: var(--sp-4);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--ink-700);
  cursor: pointer;
}
.ik-check input { flex: none; width: 22px; height: 22px; min-height: 0; margin-top: 1px; accent-color: var(--accent); }

/* buttons.css's ghost variant is dark-ground only (--white text over an
   on-dark ring) — on the light intake page it rendered white-on-cream and
   the Retake control was invisible. Same trap as the field chassis. */
.ik-main .btn--ghost {
  --fg: var(--ink-800);
  box-shadow: inset 0 0 0 2px var(--paper-400);
}
.ik-main .btn--ghost:hover { --bg: var(--paper-200); }

/* A preview that fails to load must hold its shape, not collapse into a
   broken-image row with the alt text lying across the framing guide. */
.ik-photo__shot { min-height: 220px; display: grid; place-items: center; }
.ik-photo__shot img { grid-area: 1 / 1; }
.ik-photo__frame { grid-area: 1 / 1; }
.ik-photo__shot img[data-failed] { visibility: hidden; }
.ik-photo__shot::after {
  content: attr(data-fallback);
  grid-area: 1 / 1;
  align-self: center;
  padding: var(--sp-4);
  font-size: 0.9375rem;
  color: var(--ink-500);
  text-align: center;
}

/* ── Domain step ─────────────────────────────────────────────────────
   Suggestions are generated from the fleet's naming patterns; availability
   comes from the domain-check edge function. Nothing is bought here —
   purchase fires at preview approval, so an abandoned intake costs nothing. */
.ik-dom__go { margin-top: var(--sp-3); }
.ik-dom__chosen {
  margin: var(--sp-3) 0 0;
  font-size: 0.9375rem;
  color: var(--ink-700);
}
.ik-dom__chosen b { color: var(--ink-800); }

.ik-dom__list { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: grid; gap: var(--sp-2); }

.ik-dom__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  width: 100%;
  min-height: 52px;
  padding: 12px 15px;
  font: 400 1rem/1.25 var(--ff-b);
  text-align: left;
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
}
.ik-dom__pick { cursor: pointer; }
.ik-dom__pick.is-on {
  border-color: var(--accent-text);
  box-shadow: inset 0 0 0 1px var(--accent-text);
}
.ik-dom__row.is-taken,
.ik-dom__row.is-unknown { color: var(--ink-500); background: var(--paper-200); }
.ik-dom__name { overflow-wrap: anywhere; }
.ik-dom__tag {
  flex: none;
  font: 500 0.8125rem/1 var(--ff-b);
  color: var(--ink-500);
}
.ik-dom__tag--free { color: var(--accent-text); font-weight: 650; }

.ik-dom__own { margin-top: var(--sp-5); }
.ik-dom__own .field__label { font-size: 0.9375rem; color: var(--ink-700); text-transform: none; letter-spacing: normal; }
.ik-dom__status:empty { display: none; }
.ik-dom__status { margin-top: var(--sp-3); font-size: 0.9375rem; color: var(--ink-500); }

/* ── Preview, revisions and approval (chunk 5b) ──────────────────────
   Everything below sits on the LIGHT page. Nothing borrows a dark-card
   style without an explicit light-ground override — the trap already
   hit three times (form.css field chassis, .btn--ghost, .err). */

/* Status lines: our own class, never .form__status (dark-card voice). */
.ik-status { margin-top: var(--sp-3); font-size: 0.9375rem; line-height: 1.5; color: var(--ink-500); }
.ik-status:empty { display: none; }
.ik-status.is-bad { color: var(--accent-text); font-weight: 600; }

.ik-main .btn:disabled { opacity: .45; pointer-events: none; }

/* form.css's DARK chassis darkens the input ground on focus
   (.field input:focus { background: black-mix }) — on this light page
   a focused field went grey. Higher-specificity light answer, covering
   the tier-1 inputs and the new revision textarea alike. */
.ik-main .field input:focus,
.ik-main .field select:focus,
.ik-main .field textarea:focus {
  background: var(--white);
  border-color: var(--accent-text);
}

/* The revision notes box is the first textarea on the page — give it the
   same light chassis the inputs got (form.css's is white-on-dark-glass). */
.ik-field textarea {
  width: 100%;
  min-height: 132px;
  padding: 13px 15px;
  font: 400 1.0625rem/1.5 var(--ff-b);
  color: var(--ink-800);
  background: var(--white);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
  resize: vertical;
}

/* Panels within the review flow */
.ik-panel { margin-top: var(--sp-7); }
.ik-panel h2 {
  font: 600 clamp(1.35rem, 5.5vw, 1.65rem)/1.2 var(--ff-d);
  letter-spacing: -.014em;
  color: var(--ink-800);
  margin: 0 0 var(--sp-3);
}
.ik-hist__title {
  font: 600 1.0625rem/1.3 var(--ff-b);
  color: var(--ink-700);
  margin: var(--sp-6) 0 0;
}

/* Build progress — an honest timeline, not a fake bar. */
.ik-tl { list-style: none; margin: var(--sp-6) 0 0; padding: 0; display: grid; gap: var(--sp-4); }
.ik-tl li {
  display: flex;
  gap: var(--sp-3);
  align-items: baseline;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-500);
}
.ik-tl li.is-done,
.ik-tl li.is-now { color: var(--ink-800); }
.ik-tl__dot {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper-400);
  position: relative;
  top: 1px;
}
.ik-tl li.is-done .ik-tl__dot { background: var(--accent); }
.ik-tl li.is-now .ik-tl__dot {
  background: var(--white);
  box-shadow: inset 0 0 0 3px var(--accent-text);
}
.ik-tl__when { display: block; font-size: 0.8125rem; color: var(--ink-500); }
@media (prefers-reduced-motion: no-preference) {
  .ik-tl li.is-now .ik-tl__dot { animation: ik-pulse 1.8s var(--ease) infinite; }
  @keyframes ik-pulse {
    0%, 100% { box-shadow: inset 0 0 0 3px var(--accent-text); }
    50%      { box-shadow: inset 0 0 0 5px var(--accent-text); }
  }
}

/* A hand-off / heads-up note (escalation, slow build) */
.ik-hand {
  margin-top: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--ink-700);
  background: var(--paper-200);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-surface) var(--r-surface) 0;
}

/* Phone/desktop toggle — both targets ≥44px. */
.ik-view {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-top: var(--sp-5);
  background: var(--paper-200);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-control);
}
.ik-view__btn {
  min-height: 44px;
  min-width: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink-700);
  font: 600 0.9375rem/1 var(--ff-b);
  cursor: pointer;
}
.ik-view__btn.is-on {
  background: var(--ink-950);      /* a dark chip — on-dark text is correct here */
  color: var(--on-dark-heading);
}

/* The preview frame. The iframe renders at real device width and is
   scaled to fit the column (preview.js sets the numbers); the stage
   clips it so the page itself never scrolls sideways. */
.ik-prev__frame {
  margin-top: var(--sp-3);
  padding: var(--sp-3);
  background: var(--paper-200);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
}
.ik-prev__fit { width: 100%; display: flex; justify-content: center; }
.ik-prev__stage {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--r-surface) * 0.5);
  background: var(--white);
}
.ik-prev__iframe {
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
  background: var(--white);
  transform-origin: 0 0;
}

/* Revision rounds — pips + words, never color alone. */
.ik-rev__rounds {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  margin: 0 0 var(--sp-4);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-700);
}
.ik-pip {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  top: 1px;
}
.ik-pip.is-used { background: var(--paper-400); }
.ik-rev .btn { margin-top: var(--sp-4); }

/* Past rounds */
.ik-hist { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-3); }
.ik-hist li {
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-700);
  background: var(--paper-200);
  border-left: 3px solid var(--paper-400);
  border-radius: 0 var(--r-surface) var(--r-surface) 0;
}
.ik-hist__meta { display: block; font-size: 0.8125rem; color: var(--ink-500); margin-bottom: 4px; }
.ik-hist__notes { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Approve — a light card; the attestation is a real checkbox (.ik-check,
   already light) and the button stays dead until it is ticked. */
.ik-approve {
  padding: var(--sp-5);
  background: var(--paper-200);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
}
.ik-approve__p { margin: 0 0 var(--sp-2); font-size: 1rem; line-height: 1.55; color: var(--ink-700); }
.ik-approve .btn { margin-top: var(--sp-4); }

/* The live address, once launched */
.ik-live {
  display: block;
  margin: var(--sp-5) 0;
  padding: var(--sp-5);
  text-align: center;
  font: 650 clamp(1.2rem, 5vw, 1.5rem)/1.25 var(--ff-b);
  color: var(--accent-text);
  background: var(--white);
  border: 1px solid var(--paper-400);
  border-radius: var(--r-surface);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.ik-live:hover { border-color: var(--accent-text); }

/* What-happens-next lists */
.ik-next {
  margin: var(--sp-5) 0 0;
  padding-left: 1.2em;
  display: grid;
  gap: var(--sp-3);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-700);
}
.ik-next li::marker { color: var(--accent-text); }

/* .kicker is used on this page (gate + review panels) but lives in
   components/section-header/section-header.css, which the intake never
   loads — the class was rendering as unstyled body text. Define the house
   kicker here rather than pulling in a component stylesheet for one rule
   (DESIGN.md: 0.7812rem, .19em, uppercase, Inter 600, 34x2px leading dash),
   in its light-ground colour. */
.ik-main .kicker {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 var(--sp-2);
  font: 600 0.7812rem/1 var(--ff-b);
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--accent-text);
}
.ik-main .kicker::before {
  content: "";
  flex: none;
  width: 34px;
  height: 2px;
  background: currentColor;
}
