/* Capacity Compass, owner pages. Brand: The Fourth Wall (Brand/brand-notes.md).
   Terra-cotta #D48669 is for accents only: it fails contrast for text, labels, and focus
   rings, so those use the darker #BA5935 or charcoal. Fonts: TeX Gyre Adventor (headings)
   and Inter (body), self hosted in fonts/, with close system fonts as fallbacks. */

/* Self hosted web fonts (public/fonts/README.txt). swap shows text at once in the fallback
   font, then the brand match once it loads. */
@font-face { font-family: "TeX Gyre Adventor"; src: url("/fonts/texgyreadventor-regular.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "TeX Gyre Adventor"; src: url("/fonts/texgyreadventor-bold.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --charcoal: #545454;
  --ink: #383838;
  --muted: #5f5f5f;
  --terracotta: #d48669;
  --terracotta-dark: #ba5935;
  --periwinkle: #bdc6d6;
  --periwinkle-soft: #eef1f6;
  --page: #faf9f7;
  --card: #ffffff;
  --line: #e4e1dc;
  --line-strong: #c9c4bc;
  --error: #b3261e;
  --error-soft: #fdecea;
  --ok: #2f6b3a;
  --radius: 14px;
  --head: "TeX Gyre Adventor", "Century Gothic", "Avant Garde", "Futura", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.55 var(--body);
}
h1, h2, h3 { font-family: var(--head); color: var(--charcoal); line-height: 1.2; margin: 0 0 .5em; font-weight: 400; }
h1 { font-size: clamp(1.7rem, 4.5vw, 2.25rem); }
h2 { font-size: clamp(1.35rem, 3.5vw, 1.65rem); }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--terracotta-dark); }
:focus-visible { outline: 3px solid var(--terracotta-dark); outline-offset: 2px; border-radius: 6px; }
/* A heading the page moves focus to (a new screen) is announced, not operated: no ring */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--charcoal); color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 12px; }
/* Shown inside The Fourth Wall Project's own website: her page carries the brand */
.embedded body { background: transparent; }
.embedded .top { display: none; }
.embedded main { padding: 0 8px 24px; }
.status-pill.failed { background: #fbe9e7; color: var(--error); }
.error-summary { border: 2px solid var(--error); border-radius: 12px; padding: 14px 18px; margin: 0 0 16px; background: #fff; }
.error-summary h2 { font-size: 18px; margin: 0 0 8px; color: var(--error); }
.error-summary ul { margin: 0; padding-left: 18px; }
.error-summary li { margin: 4px 0; }
.error-summary .btn.link { text-align: left; white-space: normal; padding: 2px 0; min-height: 0; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.top-inner { max-width: 880px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.logo { height: 40px; width: auto; display: block; }
.top-title { flex: 1; min-width: 0; font-family: var(--head); color: var(--charcoal); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.save-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.save-state[data-state="saved"]::before { background: var(--ok); }
.save-state[data-state="saving"]::before { background: var(--terracotta); }
.save-state[data-state="error"] { color: var(--error); }
.save-state[data-state="error"]::before { background: var(--error); }
.save-state[data-state="elsewhere"] { color: var(--ink); }
.save-state[data-state="elsewhere"]::before { background: var(--periwinkle); }
.save-retry { padding: 4px 10px; min-height: 40px; font-size: 13px; }
/* Phones: the save message wraps beside the logo instead of pushing the page sideways */
@media (max-width: 520px) {
  .top-inner { flex-wrap: wrap; row-gap: 4px; }
  .top-title { display: none; }
  .save-state { white-space: normal; flex: 1 1 0; min-width: 0; justify-content: flex-end; text-align: right; }
}

/* Progress */
.progress-wrap { max-width: 880px; margin: 0 auto; padding: 0 16px 10px; }
.chapters { display: flex; gap: 6px; margin: 2px 0 8px; padding: 0; list-style: none; }
.chapters li { flex: 1; min-width: 0; }
.chapters button {
  width: 100%; min-height: 44px; border: 0; background: none; padding: 6px 0 2px; cursor: pointer; text-align: left;
  font: 12px/1.3 var(--body); color: var(--muted);
}
.chapters button::before { content: ""; display: block; height: 4px; border-radius: 4px; background: var(--line); margin-bottom: 5px; }
.chapters button[data-done="true"]::before { background: var(--terracotta); }
.chapters button[aria-current="step"] { color: var(--ink); font-weight: 600; }
.chapters button[aria-current="step"]::before { background: var(--charcoal); }
.chapters .ch-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-text { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
@media (max-width: 640px) {
  .chapters .ch-label { display: none; }
  .top-title { font-size: 14px; }
  .logo { height: 34px; }
}

/* Layout */
main { max-width: 760px; margin: 0 auto; padding: 22px 16px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; margin-bottom: 18px; }
@media (min-width: 700px) { .card { padding: 30px 32px; } }
.eyebrow { font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--terracotta-dark); margin: 0 0 6px; font-weight: 600; }
.lead-text { font-size: 1.05rem; color: var(--ink); }
.small { font-size: 14px; color: var(--muted); }
.note { background: var(--periwinkle-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.dots { display: flex; gap: 6px; margin: 0 0 14px; }
.dots span { width: 10px; height: 10px; border-radius: 50%; background: var(--terracotta); opacity: .9; }
.dots span:nth-child(2) { background: var(--periwinkle); }
.dots span:nth-child(3) { background: var(--charcoal); opacity: .5; }

/* Questions */
.q { margin: 0 0 28px; padding: 0; border: 0; min-width: 0; }
.q:last-child { margin-bottom: 4px; }
.q-label, .q > legend { display: block; font-weight: 600; color: var(--ink); margin: 0 0 4px; padding: 0; font-size: 1rem; }
.q-num { color: var(--muted); font-weight: 500; margin-right: 4px; }
.q-meta { display: block; font-size: 13px; color: var(--muted); margin: 0 0 10px; font-weight: 400; }
.q-meta .req { color: var(--terracotta-dark); font-weight: 600; }
input[type="text"], input[type="email"], input[type="tel"], input[type="search"], input[type="number"], input[type="date"], textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 12px 13px; min-height: 48px;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--charcoal); outline: none; box-shadow: 0 0 0 3px rgba(186, 89, 53, .35); }
.counter { font-size: 13px; color: var(--muted); text-align: right; margin-top: 4px; }
.err { color: var(--error); font-size: 14px; margin: 6px 0 0; font-weight: 500; }
.q[data-invalid="true"] input, .q[data-invalid="true"] textarea { border-color: var(--error); }

/* Choice rows (radio and checkbox), big tap targets */
.opts { display: grid; gap: 8px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; min-height: 48px; background: #fff;
  transition: border-color .12s, background-color .12s;
}
.opt:hover { border-color: var(--line-strong); }
.opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.opt .mark {
  flex: none; width: 20px; height: 20px; margin-top: 2px; border: 2px solid var(--charcoal); background: #fff;
  border-radius: 50%; display: grid; place-items: center;
}
.opt.box .mark { border-radius: 5px; }
.opt input:checked + .mark { border-color: var(--terracotta-dark); background: var(--terracotta-dark); }
.opt input:checked + .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.opt.box input:checked + .mark::after { width: 10px; height: 6px; border-radius: 0; background: none; border: solid #fff; border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg) translate(1px, -1px); }
.opt:has(input:checked) { border-color: var(--charcoal); background: var(--periwinkle-soft); }
.opt:has(input:focus-visible) { outline: 3px solid var(--terracotta-dark); outline-offset: 2px; }
.opt .txt { flex: 1; }
.other-input { margin-top: 8px; }

/* Rating statements: one card each */
.scale-help { margin: 0 0 14px; }
.stmt { border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px; margin: 0 0 12px; background: #fff; }
.stmt > legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-weight: 600; color: var(--ink); }
.stmt > legend + * { clear: both; }
.stmt .opts { gap: 6px; }
.stmt .opt { padding: 10px 12px; }
.stmt[data-done="true"] { border-color: var(--line-strong); }
@media (min-width: 720px) {
  .stmt .opts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stmt .opt { font-size: 15px; }
}

/* Buttons and navigation */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 16px/1 var(--body); border-radius: 999px; padding: 14px 24px; min-height: 48px; cursor: pointer;
  border: 2px solid var(--charcoal); background: var(--charcoal); color: #fff; text-decoration: none;
}
.btn:hover { background: #3f3f3f; border-color: #3f3f3f; }
.btn.secondary { background: #fff; color: var(--charcoal); }
.btn.secondary:hover { background: var(--periwinkle-soft); }
.btn.link { background: none; border-color: transparent; color: var(--charcoal); text-decoration: underline; padding-left: 8px; padding-right: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.nav-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.nav-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
.nav-inner .btn { flex: 0 1 auto; }
.nav-hint { font-size: 13px; color: var(--muted); text-align: center; flex: 1; }
@media (max-width: 480px) { .nav-hint { display: none; } .nav-inner .btn { flex: 1; } }

/* Review list */
.review-list { list-style: none; margin: 0; padding: 0; }
.review-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-list li:last-child { border-bottom: 0; }
.status-pill { font-size: 13px; padding: 3px 10px; border-radius: 999px; background: var(--periwinkle-soft); white-space: nowrap; }
.status-pill.done { background: #e6f2e8; color: var(--ok); }
.status-pill.open { background: var(--error-soft); color: var(--error); }
.missing-list { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
.banner { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.banner.error { background: var(--error-soft); color: var(--error); }
.banner.info { background: var(--periwinkle-soft); }

.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--terracotta-dark); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation-duration: 0s !important; } }

/* Documents page: the file picker is hidden behind its label button, so the button shows the focus */
.q:has(input[type="file"]:focus-visible) label.btn { outline: 3px solid var(--terracotta-dark); outline-offset: 2px; }
.q label.btn { margin-top: 6px; }

/* "What this means" notes */
details.help { margin: -4px 0 10px; font-size: 14px; }
details.help summary { cursor: pointer; color: var(--terracotta-dark); font-weight: 600; width: max-content; max-width: 100%; }
details.help p { margin: 6px 0 0; padding: 10px 12px; background: var(--periwinkle-soft); border-radius: 8px; color: var(--ink); }
.stmt details.help { margin: -6px 0 10px; }

/* Her own answering guidance, always visible */
.hint { margin: -2px 0 10px; font-size: 14px; color: var(--muted); }
.stmt .hint { margin: -6px 0 10px; }

/* Answers carried from the screening that cannot change here */
.q.locked .locked-answer { margin: 4px 0 2px; padding: 10px 12px; background: var(--periwinkle-soft); border-radius: 10px; color: var(--ink); }

/* Whole numbers (headcounts, household size) */
input.num { width: 8em; max-width: 100%; }

/* The public screening's honeypot: off screen, never announced */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* The public screening */
.part + .part { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.part-title { font-size: 1.15rem; margin: 0 0 14px; }
.plain-list { margin: 8px 0 0; padding-left: 20px; }
.plain-list li + li { margin-top: 6px; }
