/*
 * survey.css — PelicanCFO research v2 pilot.
 *
 * Mobile-first. System fonts only: no Google Fonts, no remote CSS, no remote
 * anything. Restrained, high-contrast, generous spacing. Nothing decorative.
 */

:root {
  --navy: #16202b;
  --ink: #1b2530;
  --ink-2: #46535f;
  --muted: #6b7885;
  --line: #d5dbe0;
  --line-soft: #e7ebee;
  --paper: #ffffff;
  --ground: #f4f6f7;
  --accent: #26645f;
  --accent-soft: #e2eeec;
  --error: #a12c2c;
  --error-soft: #fbeaea;
  --focus: #26645f;
  --measure: 34rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  /* 17px base: comfortably above the mobile zoom threshold for inputs. */
  font: 400 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: break-word;
}

/* ---------- shell ---------- */

.site-head {
  background: var(--navy);
  padding: 14px 20px;
}
.brand {
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
}

.wrap {
  max-width: 44rem;
  margin: 0 auto;
  padding: 28px 20px 64px;
}
.wrap.narrow { max-width: 38rem; }

.site-foot {
  border-top: 1px solid var(--line);
  padding: 20px;
  text-align: center;
}
.site-foot p { margin: 0; font-size: 0.9rem; }

h1 {
  font-size: 1.55rem;
  line-height: 1.25;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 0 6px;
  letter-spacing: -0.005em;
}
h2:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
h2:focus:not(:focus-visible) { outline: none; }

p { margin: 0 0 14px; max-width: var(--measure); }
.lede { color: var(--ink-2); }
.lede.small, .small { font-size: 0.92rem; color: var(--muted); }
.section-intro { color: var(--ink-2); font-size: 0.95rem; margin-bottom: 22px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

a { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- progress ---------- */

.progress {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 20px;
}

/* ---------- questions ---------- */

.step { margin: 0; }

.q {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 18px 16px;
}
.q[hidden] { display: none; }
.q fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.q-inner { min-width: 0; }

.q-text {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 0 0 4px;
  padding: 0;
  max-width: var(--measure);
}

.q-hint {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 12px;
  max-width: var(--measure);
}
.q-hint.standalone { margin: 0 0 16px; }

.q.has-error { border-color: var(--error); background: var(--error-soft); }
.q-error, .form-error {
  font-size: 0.9rem;
  color: var(--error);
  font-weight: 500;
  margin: 10px 0 0;
}
.q-error[hidden], .form-error[hidden] { display: none; }
.form-error { margin-top: 16px; }

.q.now-required .q-text::after {
  content: " Required";
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 3px;
  padding: 2px 6px;
  margin-left: 8px;
  white-space: nowrap;
}

/* ---------- options ---------- */

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  /* 44px minimum tap target including padding. */
  padding: 11px 10px;
  border-radius: 6px;
  border: 1px solid transparent;
  /* Anchors the label's hit area below. */
  position: relative;
}
/*
 * The visible row is 44px+ high, but the label only ever covered its own text,
 * so the padding and the gap beside the control were dead. Stretching the
 * label's own hit area over the whole row makes what you can see the thing you
 * can press. It stays a real <label for>, so semantics, keyboard operation and
 * focus are untouched, and no JavaScript click proxy is involved.
 *
 * Safe here because no option label contains a link or any other interactive
 * element; source QA asserts that, so this cannot silently start covering one.
 */
.opt label::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.opt + .opt { margin-top: 2px; }
.opt:hover { background: var(--ground); }
.opt input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}
.opt label {
  flex: 1 1 auto;
  cursor: pointer;
  line-height: 1.45;
  min-height: 22px;
}
.opt input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.opt:focus-within { border-color: var(--line); background: var(--ground); }
.opt input:disabled + label { color: var(--muted); cursor: not-allowed; }

.opt.consent { align-items: flex-start; padding: 12px 10px; }

/* ---------- text inputs ---------- */

input[type="text"], input[type="email"], input[type="tel"], textarea {
  display: block;
  width: 100%;
  max-width: var(--measure);
  font: inherit;
  /* Never below 16px, or iOS zooms on focus. */
  font-size: 17px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 46px;
}
textarea { resize: vertical; line-height: 1.55; }
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* ---------- automation matrix ---------- */

.matrix-scroll { margin: 0; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { text-align: left; }

/* Mobile-first: the table is restyled as stacked rows, so each row is a
   readable group of four full-width options rather than four microscopic
   columns. Each cell keeps its own radio bound to the row's stable field ID. */
.matrix thead { display: none; }
.matrix, .matrix tbody, .matrix tr, .matrix th, .matrix td { display: block; }
.matrix tr {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  margin: 0 0 12px;
}
.matrix tr th[scope="row"] {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.4;
  padding: 0 0 8px;
}
.matrix td { padding: 0; margin: 2px 0; }
.matrix-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 10px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
  line-height: 1.4;
}
.matrix-cell:hover { background: var(--ground); }
.matrix td input {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}
.matrix td input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (min-width: 46rem) {
  .matrix-scroll { overflow-x: auto; }
  .matrix { min-width: 34rem; }
  .matrix thead { display: table-header-group; }
  .matrix, .matrix tbody { display: table; width: 100%; }
  .matrix tbody { display: table-row-group; }
  .matrix tr { display: table-row; border: 0; padding: 0; margin: 0; }
  .matrix th, .matrix td { display: table-cell; vertical-align: middle; }
  .matrix thead th {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--ink-2);
    padding: 8px 6px;
    border-bottom: 1px solid var(--line);
    text-align: center;
  }
  .matrix thead th.matrix-corner { text-align: left; width: 40%; }
  .matrix tbody th[scope="row"] {
    font-weight: 400;
    font-size: 0.94rem;
    padding: 12px 10px 12px 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .matrix tbody td {
    text-align: center;
    padding: 12px 6px;
    border-bottom: 1px solid var(--line-soft);
  }
  .matrix-cell {
    display: inline-flex;
    justify-content: center;
    padding: 0;
    min-height: 0;
    gap: 0;
  }
  .matrix-cell:hover { background: transparent; }
  /* On wide screens the column header names the option, so the in-cell label
     is visually hidden rather than removed — it stays the control's accessible
     name for assistive technology. */
  .matrix-col {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
}

/* ---------- navigation ---------- */

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0 0;
}
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 13px 22px;
  min-height: 48px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn.secondary { color: var(--accent); background: transparent; }
.btn[hidden] { display: none; }

/* ---------- honeypot and screen-reader-only ---------- */

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

.share { font-size: 0.95rem; }

/* ---------- privacy: layer 1 note, layer 2 page ---------- */

/* Set off from the questions without shouting. This is context for a decision
   the respondent is about to make, not a warning. */
.privacy-note {
  background: var(--accent-soft);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 14px 16px;
  margin: 0 0 20px;
}
.privacy-note p {
  margin: 0;
  max-width: none;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink-2);
}
.privacy-note .privacy-note-link { margin-top: 10px; }
.privacy-note .privacy-note-link a { font-weight: 600; }

.legal h2 {
  margin: 32px 0 10px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.legal h2:first-of-type { padding-top: 0; border-top: 0; }
.legal ul {
  margin: 0 0 16px;
  padding-left: 1.15rem;
  max-width: var(--measure);
}
.legal li { margin-bottom: 8px; line-height: 1.6; }
.legal li:last-child { margin-bottom: 0; }

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