/* styles.css — the whole look of the client intake page.
 *
 * One file, no web fonts, no images. Colours and typefaces are Estate HQ's
 * brand tokens (README.md -> Brand): the one :root block below is the only
 * place a colour is written. Spectral and Archivo are named first but never
 * downloaded; the system faces after them are what most people will see.
 *
 * Built for a phone held by someone who may be elderly and is certainly tired:
 * 18px text, 48px touch targets, strong focus rings, nothing that moves.
 * Works from 320px wide; light and dark.
 */

:root {
  --brand-ink: #101C26;
  --brand-brass: #B08A4A;            /* accent only — never text (3.2:1 on white) */
  --brand-brass-text: #8A6A2F;
  --brand-parchment: #F5F1E8;
  --brand-white: #FFFFFF;
  --brand-ink-70: #3D4C58;
  --brand-ink-50: #6B7B87;
  --brand-hairline: rgba(16, 28, 38, 0.12);

  --font-doc: Spectral, "Iowan Old Style", Palatino, Georgia, serif;
  --font-ui: Archivo, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;

  /* What the page uses. Light scheme. */
  --ground: var(--brand-parchment);
  --surface: var(--brand-white);
  --text: var(--brand-ink);
  --text-quiet: var(--brand-ink-70);
  --line: var(--brand-hairline);
  --line-strong: var(--brand-ink-50);      /* input borders: 4.4:1 on white */
  --accent: var(--brand-brass);
  --accent-text: var(--brand-brass-text);
  --focus: var(--brand-brass-text);
  --button: var(--brand-ink);
  --button-text: var(--brand-white);
  --selected: var(--brand-parchment);
  --problem: #8B2020;
  --problem-ground: #FBF1EF;
  --ok: #1F5C3A;                           /* "Saved securely": 7.4:1 on parchment */
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: var(--brand-ink);
    --surface: #17252F;
    --text: var(--brand-parchment);
    --text-quiet: #C3CBD1;
    --line: rgba(245, 241, 232, 0.16);
    --line-strong: #8F9CA6;
    --accent: #D8B472;                     /* the reversed mark's brass, for ink grounds */
    --accent-text: #D8B472;
    --focus: #D8B472;
    --button: var(--brand-parchment);
    --button-text: var(--brand-ink);
    --selected: #223440;
    --problem: #F4B4AB;
    --problem-ground: #3A2424;
    --ok: #A9D8B8;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 112.5%;                       /* 18px */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 6rem;                /* keeps a focused field clear of the sticky bar */
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.55;
  overflow-wrap: break-word;
}

/* Form controls do not inherit the page's typeface unless told to. */
input, textarea, button, select { font: inherit; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── The firm's name: the headline of the page ───────────────────────────── */

.masthead {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 1rem;
}

.firm {
  margin: 0;
  font-family: var(--font-doc);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.firm::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.6rem;
  background: var(--accent);
}

.form-title {
  margin: 0.6rem 0 0;
  color: var(--text-quiet);
}

/* ── Where you are, and whether it is saved ──────────────────────────────── */

.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ground);
  border-bottom: 1px solid var(--line);
}

.bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 0.6rem 1.25rem 0.7rem;
}

.step-text, .save-status {
  margin: 0;
  font-size: 0.89rem;                      /* 16px */
}

.step-text { font-weight: 600; }
.save-status { color: var(--text-quiet); text-align: right; }
.save-retrying, .save-paused, .save-too_large { color: var(--problem); font-weight: 600; }

.steps {
  display: flex;
  flex-basis: 100%;
  gap: 4px;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  border: 1px solid var(--line-strong);
}

.steps li.done { background: var(--text-quiet); border-color: var(--text-quiet); }
.steps li.current { background: var(--accent); border-color: var(--accent-text); }

/* ── The sheet the form sits on ──────────────────────────────────────────── */

.sheet {
  max-width: 42rem;
  margin: 1rem auto 0;
  padding: 1.5rem 1.25rem 2rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 44rem) {
  .sheet {
    margin-top: 1.5rem;
    padding: 2.5rem 3rem 3rem;
    border: 1px solid var(--line);
    border-radius: 6px;
  }
  .masthead { padding-top: 2.5rem; }
}

h1, h2 {
  font-family: var(--font-doc);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { margin: 0 0 0.75rem; font-size: 1.7rem; }
h2 { margin: 2rem 0 0.5rem; font-size: 1.25rem; }

/* Headings receive focus when the screen changes, so that a screen reader
   starts reading there. They are not controls, so they show no ring. */
h1:focus, h2:focus, .needs:focus { outline: none; }

p { margin: 0 0 1rem; }

.lead { color: var(--text-quiet); }
.quiet { color: var(--text-quiet); }
.loading { color: var(--text-quiet); }

.points {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.points li { margin-bottom: 0.6rem; }
.points li::marker { color: var(--accent-text); }

.privacy {
  padding: 0.85rem 1rem;
  background: var(--selected);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

.notice {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  background: var(--problem-ground);
  border: 1px solid var(--problem);
  border-radius: 6px;
}

.notice p { margin: 0; }
.notice button { margin-top: 0.75rem; }

/* ── Questions ───────────────────────────────────────────────────────────── */

form { margin: 1.5rem 0 0; }

.field { margin: 0 0 1.75rem; }

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.field { margin-bottom: 1.75rem; }

label, legend {
  display: block;
  width: 100%;
  padding: 0;
  font-weight: 600;
  line-height: 1.35;
}

legend { margin-bottom: 0.35rem; }
.field > label { margin-bottom: 0.35rem; }

.needed {
  font-weight: 400;
  color: var(--text-quiet);
  white-space: nowrap;
}

.help {
  margin: 0 0 0.5rem;
  font-size: 0.89rem;
  color: var(--text-quiet);
}

input[type="text"], input[type="tel"], input[type="email"], textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  appearance: none;
  -webkit-appearance: none;
}

textarea { min-height: 7rem; resize: vertical; }

input.short { max-width: 8rem; }

input[aria-invalid="true"] { border-color: var(--problem); border-width: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.problem {
  margin: 0.5rem 0 0;
  padding: 0.6rem 0.8rem;
  color: var(--problem);
  background: var(--problem-ground);
  border-left: 3px solid var(--problem);
  border-radius: 0 4px 4px 0;
  font-size: 0.94rem;
}

/* Money: a dollar sign in front of the box. */
.money { position: relative; max-width: 14rem; }
.money-sign {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-quiet);
}
.money input { padding-left: 1.7rem; }

/* A date: three small boxes side by side, at every width. */
.date-row { display: flex; gap: 0.6rem; }
.date-part label { font-weight: 400; font-size: 0.89rem; margin-bottom: 0.2rem; }
.date-part .date-short { width: 4rem; }
.date-part .date-year { width: 5.5rem; }
.date-row + .help { margin: 0.4rem 0 0; }

/* An address: one column on a phone. */
.address-grid { display: grid; gap: 0.75rem; }
.address-part label { font-weight: 400; font-size: 0.89rem; margin-bottom: 0.2rem; }

@media (min-width: 34rem) {
  .address-grid { grid-template-columns: 2fr 1fr 1fr; }
  .address-street, .address-city { grid-column: 1 / -1; }
}

/* Choices: each answer is a large target. */
.options { display: grid; gap: 0.5rem; }

.option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  font-weight: 400;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

.option input {
  flex: none;
  width: 1.35rem;
  height: 1.35rem;
  margin: 0.1rem 0 0;
  accent-color: var(--button);
}

.option:has(input:checked) {
  background: var(--selected);
  border-color: var(--text);
  box-shadow: inset 0 0 0 1px var(--text);
}

.option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.option.confirm { font-weight: 600; }

/* Lists the person adds to. */
.rows { display: grid; gap: 1.25rem; margin: 0.75rem 0; }

.row {
  padding: 1rem 0 0.25rem 1rem;
  border-left: 3px solid var(--accent);
}

.row > legend {
  float: left;                             /* lets the legend sit inside the padding */
  margin-bottom: 1rem;
  font-family: var(--font-doc);
  font-size: 1.1rem;
}

.row > legend + * { clear: both; }
.row .field { margin-bottom: 1.25rem; }

.row-actions, .remove-ask {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

/* ── The locked questions: Social Security number and documents ──────────── */

/* The question's label when there is no box to tie it to (a saved number). */
.field-label { margin: 0 0 0.35rem; font-weight: 600; line-height: 1.35; }

.secret-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }

input.secret-box {
  flex: 0 1 11rem;
  width: 11rem;
  min-width: 9.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
}

.locked-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.ask-text { flex-basis: 100%; font-weight: 600; }

.locked-box {
  padding: 0.9rem 1rem;
  background: var(--selected);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

.locked-box:focus { outline: none; }
.locked-box .help { margin: 0.5rem 0 0; }

.locked-value {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.9rem;
  margin: 0;
}

.locked-number {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.tag { font-size: 0.94rem; color: var(--text-quiet); }
.tag-ok { font-weight: 600; color: var(--ok); }
.tag-ok::before { content: "\2713\00a0"; }
.tag-warn { font-weight: 600; color: var(--problem); }

/* Documents */
.file-count { margin: 0 0 0.5rem; font-weight: 600; }

.file-list { margin: 0; padding: 0; list-style: none; }

.file-row {
  margin: 0 0 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.file-row[data-state="done"] { background: var(--selected); border-color: var(--line); }
.file-row[data-state="failed"] { border-color: var(--problem); }

.file-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 0.75rem;
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-size { font-weight: 400; font-size: 0.89rem; color: var(--text-quiet); white-space: nowrap; }
.file-status { margin: 0.35rem 0 0; font-size: 0.94rem; color: var(--text-quiet); }
.file-row .problem { margin-top: 0.6rem; }
.problem p { margin: 0; }
.problem p + p { margin-top: 0.5rem; }

.file-progress { margin-top: 0.6rem; }

progress {
  display: block;
  width: 100%;
  height: 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);                      /* the bar's colour where no pseudo-element applies */
  accent-color: var(--text);
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

progress::-webkit-progress-bar { background: var(--surface); }
progress::-webkit-progress-value { background: var(--text); }
progress::-moz-progress-bar { background: var(--text); }

/* "Add a file or take a photo": the label is the button; the real file box
   sits behind it, still reachable with the keyboard. */
.file-add-wrap { position: relative; margin-top: 0.25rem; }

.file-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 60px;
  padding: 0.8rem 1rem;
  font-weight: 600;
  text-align: center;
  border: 2px dashed var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
}

.file-add-mark { font-size: 1.5rem; line-height: 1; font-weight: 400; color: var(--accent-text); }
.file-add:hover { background: var(--selected); }

.file-input:focus-visible + .file-add {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  background: var(--selected);
}

.file-add-wrap .help { margin: 0.5rem 0 0; }

/* "If you change this answer, what you added will be removed." */
.ask-panel {
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--problem-ground);
  border: 1px solid var(--problem);
  border-radius: 6px;
}

.ask-panel p { margin: 0; }
.ask-panel p:focus { outline: none; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */

button {
  min-height: 48px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
}

button.primary {
  color: var(--button-text);
  background: var(--button);
  border: 1px solid var(--button);
}

button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line-strong);
}

button.small { min-height: 44px; padding: 0.4rem 0.9rem; font-size: 0.94rem; }

button.link {
  min-height: 44px;
  padding: 0.4rem 0;
  color: var(--text);
  background: none;
  border: 0;
  font-weight: 400;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

button.clear-choice { margin-top: 0.25rem; font-size: 0.89rem; color: var(--text-quiet); }

button:disabled { opacity: 0.55; cursor: default; }

.actions {
  display: flex;
  flex-wrap: wrap-reverse;
  gap: 0.75rem;
  margin-top: 2rem;
}

.actions .primary { flex: 1 1 12rem; }
.actions .secondary { flex: 0 1 auto; }

/* ── Review ──────────────────────────────────────────────────────────────── */

.review-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.review-head h2 { margin: 0; }

dl { margin: 0; }
.review-item { margin-bottom: 0.9rem; }
dt { font-size: 0.89rem; color: var(--text-quiet); }
dd { margin: 0.1rem 0 0; }
.answer { white-space: pre-wrap; }

.review-rows { margin: 0.25rem 0 0; padding-left: 1.4rem; }
.review-rows li { margin-bottom: 0.6rem; }
.review-rows p { margin: 0; }
.sub-label { font-size: 0.89rem; color: var(--text-quiet); }
.review-files { margin: 0.1rem 0 0; padding-left: 1.2rem; }
.review-files li { margin-bottom: 0.25rem; overflow-wrap: anywhere; }
.review-files .not-uploaded .sub-label { color: var(--problem); font-weight: 600; }

.needs {
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  background: var(--problem-ground);
  border: 1px solid var(--problem);
  border-radius: 6px;
}

.needs h2 { margin: 0 0 0.25rem; font-family: var(--font-ui); font-size: 1rem; letter-spacing: 0; }
.needs h2 + ul + h2 { margin-top: 1rem; }
.needs ul { margin: 0; padding-left: 1.25rem; }

.send-box {
  margin-top: 2rem;
  padding-top: 0.5rem;
  border-top: 3px solid var(--accent);
}

.send-status { margin: 1rem 0 0; font-weight: 600; }
.send-status:empty { display: none; }

/* ── Foot of the page ────────────────────────────────────────────────────── */

.colophon {
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
  font-size: 0.83rem;
  color: var(--text-quiet);
  text-align: center;
}

.colophon p { margin: 0; }

@media (max-width: 22rem) {
  .masthead, .bar-inner, .sheet, .colophon { padding-left: 1rem; padding-right: 1rem; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .option { transition: background-color 120ms ease, border-color 120ms ease; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

@media print {
  .bar, .actions, .colophon, .file-add-wrap, .locked-actions { display: none; }
}
