/* The web referral form itself.
 *
 * EVERY RULE IS SCOPED UNDER .ff-form, and that is load-bearing rather than
 * tidiness. This stylesheet is loaded by TWO pages: the public form, and the
 * app's designer so its preview is the real thing rather than an impression of
 * it. The app's styles.css owns generic names like .card and .grid, so an
 * unscoped rule here would restyle the referral queue.
 *
 * Light, like the scan page and unlike the rest of Bridge: this is a surface
 * someone outside the practice sees, often on a phone between patients. System
 * fonts only — a webfont that fails to load is a form that looks broken to a
 * referring office. */

.ff-form {
  --ff-line: #e3e7ec;
  --ff-ink: #16202b;
  --ff-ink-2: #5a6672;
  /* 5.2:1 on white (UX-15); it was 3.2:1, under the 4.5:1 small text needs, and
     it carries the consent line and the office's phone number. */
  --ff-faint: #5f6f7d;
  --ff-bad: #a83f39;
  --ff-good: #1b6f47;
  --ff-panel: #fff;
  color-scheme: light;
  color: var(--ff-ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-align: left;
}
.ff-form *, .ff-form *::before, .ff-form *::after { box-sizing: border-box; }

/* --- head --- */
.ff-form .ff-head { margin-bottom: 18px; }
.ff-form .ff-logo { max-height: 46px; max-width: 200px; display: block; margin-bottom: 12px; }
.ff-form .ff-brand { font-size: 15px; font-weight: 650; letter-spacing: -.01em; margin-bottom: 10px; }
.ff-form .eyebrow {
  font-size: 11px; letter-spacing: .11em; text-transform: uppercase;
  /* The DARKENED accent, not the accent: this is type on a white card, and a
     practice that picks a pale yellow would otherwise get a heading nobody can
     read. See accentText(). */
  font-weight: 700; color: var(--ff-accent-text, var(--ff-accent));
}
.ff-form h1 { margin: 4px 0 6px; font-size: 25px; font-weight: 650; letter-spacing: -.02em; }
.ff-form .lede { margin: 0; color: var(--ff-ink-2); font-size: 15px; }

.ff-form .card {
  background: var(--ff-panel);
  border: 1px solid var(--ff-line);
  border-radius: 14px;
  padding: 20px;
}

/* The office a personal link already named. */
.ff-form .known {
  background: #f5f8fb; border: 1px solid var(--ff-line); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 18px; font-size: 14px; color: var(--ff-ink-2);
}
.ff-form .known b { font-weight: 650; color: var(--ff-ink); }

/* --- fields --- */
.ff-form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ff-form .ff.wide, .ff-form .wide { grid-column: 1 / -1; }
@media (max-width: 560px) { .ff-form .grid { grid-template-columns: 1fr; } }

.ff-form label.ff {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 13px; color: var(--ff-ink-2);
}
.ff-form .req { color: var(--ff-bad); }
.ff-form .ff-h {
  margin: 10px 0 0; font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ff-faint);
}
/* A text block: paragraphs, bullets and a bold lead-in, from plain text the
   practice typed. See noteHtml(). */
.ff-form .ff-note { margin: 0; font-size: 13.5px; color: var(--ff-ink-2); }
.ff-form .ff-note p { margin: 0 0 6px; }
.ff-form .ff-note p:last-child, .ff-form .ff-note ul:last-child { margin-bottom: 0; }
.ff-form .ff-note b { color: var(--ff-ink); font-weight: 650; }
.ff-form .ff-note ul { margin: 0 0 8px; padding-left: 20px; }
.ff-form .ff-note li { margin: 2px 0; }

/* A centred logo wants a centred header; a centred logo over left-aligned type
   reads as a mistake. */
.ff-form .ff-head.center { text-align: center; }
.ff-form .ff-head.center .ff-logo { margin-left: auto; margin-right: auto; }

.ff-form input[type=text], .ff-form input[type=date], .ff-form input[type=tel],
.ff-form input[type=email], .ff-form select, .ff-form textarea {
  font: inherit;
  /* 16px, never smaller: anything less makes iOS Safari zoom the page on focus,
     and a form that jumps when you tap it reads as broken. */
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--ff-line); border-radius: 10px;
  background: #fff; color: var(--ff-ink); width: 100%;
}
.ff-form textarea { resize: vertical; min-height: 84px; }
.ff-form :focus-visible { outline: 2px solid var(--ff-accent-text, var(--ff-accent)); outline-offset: 1px; }

.ff-form .ff-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 2px; }
.ff-form .ff-check { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ff-ink); }
.ff-form .ff-check input { width: auto; }

/* --- files --- */
.ff-form .ff-files { margin-top: 16px; }
.ff-form .ff-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 20px 16px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--ff-line); border-radius: 12px; background: #fafcfd;
  transition: border-color .12s, background .12s;
}
.ff-form .ff-drop:hover, .ff-form .ff-drop:focus-within { border-color: var(--ff-accent); }
/* The whole rectangle lights up while a file is over it. Without this there is
   no confirmation that the drop will land, and people let go somewhere else. */
.ff-form .ff-drop.over { border-color: var(--ff-accent); background: #fff6f0; }
.ff-form .ff-drop-cta { font-size: 14.5px; font-weight: 600; color: var(--ff-ink); }
.ff-form .ff-drop-hint { font-size: 12.5px; color: var(--ff-ink-2); }

.ff-form .ff-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.ff-form .ff-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--ff-line); border-radius: 9px; padding: 8px 10px; font-size: 13.5px;
}
/* "Taken on", beside the file. Its own line under the name on a phone, where
   the row is already full. Sized as a small control rather than a form field:
   the 16px rule above stops iOS zooming, and it still applies. */
.ff-form .ff-item-d {
  display: flex; align-items: center; gap: 8px; flex-basis: 100%;
  font-size: 12.5px; color: var(--ff-ink-2);
}
.ff-form .ff-item-d input[type=date] { width: auto; padding: 6px 8px; border-radius: 7px; }
.ff-form .ff-item-ic {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  color: var(--ff-faint); border: 1px solid var(--ff-line); border-radius: 4px; padding: 2px 4px;
}
/* min-width:0 or a long filename pushes the size and the × off the row. */
.ff-form .ff-item-n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ff-form .ff-item-s { color: var(--ff-faint); font-variant-numeric: tabular-nums; }
.ff-form .ff-item-x {
  font: inherit; font-size: 18px; line-height: 1; cursor: pointer;
  background: none; border: 0; color: var(--ff-faint); padding: 0 2px;
}
.ff-form .ff-item-x:hover { color: var(--ff-bad); }

/* --- submit --- */
.ff-form button[type=submit] {
  font: inherit; font-weight: 650; font-size: 16px; cursor: pointer;
  /* Ink is computed from the accent, never chosen — asking a practice to pick a
     background AND a readable foreground is asking them to get contrast right,
     which is our job. See accentInk(). */
  background: var(--ff-accent); color: var(--ff-btn-ink, #fff);
  border: 0; padding: 13px 22px; border-radius: 10px; width: 100%; margin-top: 18px;
}
.ff-form button[type=submit][disabled] { opacity: .6; cursor: default; }
.ff-form .msg { margin: 12px 0 0; font-size: 14px; min-height: 1px; }
.ff-form .msg.err { color: var(--ff-bad); }

/* The refusal, under the field it is about rather than under the Send button a
   screen away. See flagField(). */
.ff-form .ff-inline-err { margin: 5px 0 0; font-size: 13.5px; color: var(--ff-bad); }
.ff-form .ff-bad { border-color: var(--ff-bad); }
.ff-form .ff-bad:focus-visible { outline-color: var(--ff-bad); }

/* Off-screen rather than display:none, which some bots skip. */
.ff-form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- done --- */
.ff-form .done { text-align: center; padding: 36px 16px; }
.ff-form .done .tick {
  width: 52px; height: 52px; border-radius: 50%; background: #e8f6ee; color: var(--ff-good);
  display: grid; place-items: center; font-size: 25px; margin: 0 auto 14px;
}
.ff-form .done h2 { margin: 0 0 8px; font-size: 20px; }
.ff-form .done p { margin: 0 auto; color: var(--ff-ink-2); max-width: 42ch; }
/* Named plainly, in the warning colour: an office that believes three
   radiographs went with a referral, when two did, finds out weeks later. */
.ff-form .ff-gap { color: var(--ff-bad); margin-top: 14px !important; font-size: 14px; }

.ff-form .ff-consent {
  margin: 16px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--ff-faint);
}
.ff-form .ff-consent a { color: inherit; }
/* The office's number, when the form could not send: the one line on the
   page that matters most at that moment, so it reads as a line, not small
   print (UX-15). */
.ff-form #ff-phone { font-size: 15px; color: var(--ff-ink); }
.ff-form #ff-phone a { font-weight: 600; }

/* A file input that a keyboard can reach (Bridge audit UX-8). `hidden` took it
   out of the tab order, so the only way to attach a file was a mouse. Kept in
   the layout's flow at zero size; its label shows where focus is. */
.vh-file {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0;
}
label:has(> .vh-file:focus-visible) { outline: 2px solid currentColor; outline-offset: 2px; }
