/*
 * Sara App - project questionnaire
 *
 * One HTML file, one stylesheet, no build step. The screen view is a sheet of
 * paper on a desk; the print view is the same sheet on US Letter with the
 * letterhead at the top and the confidentiality line repeated on every page.
 *
 * Brand facts come from the corporate site and the legal bundle:
 *   orange #D45500 (sampled from https://bridgepointe.us/assets/public/weblogo-1.png)
 *   ink    #1B2433 (the wordmark recoloured for paper - see README)
 */

:root {
  --paper:        #ffffff;
  --desk:         #e8f1fa;
  --ink:          #1b2433;
  --ink-soft:     #3d4757;
  --muted:        #6b7484;
  --faint:        #8b94a3;
  --rule:         #e1e5eb;
  --rule-strong:  #cdd3dc;
  --field:        #fbfcfd;
  --accent:       #d45500;
  --accent-soft:  #fbf0e7;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  /* A quiet sky behind the sheet: soft cloud light, not a picture. The paper
     stays the brightest thing on screen; printing drops all of it. */
  background-color: var(--desk);
  background-image:
    radial-gradient(ellipse 34% 13% at 8% 7%, #ffffff 0%, rgba(255, 255, 255, .72) 48%, rgba(255, 255, 255, 0) 78%),
    radial-gradient(ellipse 25% 9% at 24% 12%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, .35) 52%, rgba(255, 255, 255, 0) 80%),
    radial-gradient(ellipse 31% 12% at 96% 5%, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, .45) 50%, rgba(255, 255, 255, 0) 80%),
    radial-gradient(ellipse 38% 13% at 78% 18%, rgba(255, 255, 255, .58) 0%, rgba(255, 255, 255, .16) 56%, rgba(255, 255, 255, 0) 82%),
    radial-gradient(ellipse 52% 17% at 50% 104%, rgba(255, 255, 255, .9) 0%, rgba(255, 255, 255, .28) 52%, rgba(255, 255, 255, 0) 80%),
    linear-gradient(165deg, #dbeaf9 0%, #f0f7fe 46%, #d7e7f6 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--ink-soft);
  font: 400 13px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

/* ---- the sheet ---------------------------------------------------------- */

.sheet {
  width: 8.5in;
  min-height: 11in;
  margin: 34px auto 80px;
  padding: 0.65in 0.72in 0.5in;
  background: var(--paper);
  box-shadow:
    0 1px 2px rgba(28, 45, 66, .09),
    0 26px 60px -26px rgba(28, 45, 66, .34);
  display: flex;
  flex-direction: column;
}

/* ---- letterhead --------------------------------------------------------- */

.letterhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}

.lockup {
  height: 54px;
  width: auto;
  display: block;
  margin-top: 2px;
}

.org {
  font-style: normal;
  text-align: right;
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--muted);
}

.org span { display: block; }

.org strong {
  display: block;
  margin-bottom: 2px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--ink);
}

.letterhead-rule {
  height: 2px;
  margin: 18px 0 0;
  background: linear-gradient(90deg, var(--accent) 0 84px, var(--rule) 84px);
}

/* ---- document head ------------------------------------------------------ */

.eyebrow {
  margin: 26px 0 8px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .17em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ink);
}

.doc-sub {
  margin: 4px 0 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -.005em;
}

.lede {
  margin: 12px 0 0;
  max-width: 66ch;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.purpose {
  margin: 16px 0 0;
  max-width: 72ch;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.purpose p { margin: 0 0 8px; }
.purpose p:last-child { margin-bottom: 0; }

.callout {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.callout strong { color: var(--ink); }

.section-intro {
  margin: 0 0 2px;
  max-width: 74ch;
  font-size: 10.5px;
  font-style: italic;
  line-height: 1.55;
  color: var(--faint);
}

.docmeta {
  display: grid;
  grid-template-columns: 1.1fr 1.2fr .9fr .8fr;
  gap: 0 22px;
  margin: 22px 0 4px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.docmeta dt {
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
}

.docmeta dd {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--ink);
}

.docmeta dd input {
  width: 100%;
  border: 0;
  border-bottom: 1px dotted var(--rule-strong);
  background: transparent;
  padding: 1px 0 2px;
  font: inherit;
  color: var(--ink);
}

/* Print-only mirror of the header and signature fields; inputs clip long
   values, wrapping text does not. */
.print-value { display: none; }

/* ---- sections ----------------------------------------------------------- */

.block { margin-top: 26px; }

.block h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  break-after: avoid;
}

.block h2 .num {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .06em;
  color: var(--accent);
}

.q { margin-top: 13px; break-inside: avoid; }

fieldset.q {
  min-width: 0;
  margin: 13px 0 0;
  padding: 0;
  border: 0;
}

.q > label,
.q .qlabel,
fieldset.q legend {
  display: block;
  width: 100%;
  margin: 0 0 4px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}

.qn {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 600;
  margin-right: 3px;
}

.q.sub {
  margin-left: 16px;
  padding-left: 12px;
  border-left: 2px solid var(--rule);
}

.chips.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
  align-items: start;
}

.stack-label {
  display: block;
  margin-top: 9px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.priority-list {
  margin: 2px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 3px;
}

.priority-list li { padding-left: 2px; }

.priority-list input { width: 100%; }

.thank-you p {
  margin: 8px 0 0;
  max-width: 74ch;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-soft);
}

.hint {
  margin: -1px 0 6px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--faint);
}

input[type="text"],
input[type="email"],
input[type="tel"],
select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule-strong);
  border-radius: 0;
  background: transparent;
  padding: 5px 1px 6px;
  font: 400 12.5px/1.5 var(--font);
  color: var(--ink);
  appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
}

textarea {
  width: 100%;
  min-height: 68px;
  border: 1px solid var(--rule-strong);
  border-radius: 3px;
  background: var(--field);
  padding: 8px 10px;
  font: 400 12.5px/1.6 var(--font);
  color: var(--ink);
  resize: vertical;
}

input::placeholder,
textarea::placeholder { color: #aeb6c2; }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 85, 0, .12);
}

.row { display: grid; gap: 0 24px; }
.row.two { grid-template-columns: 1fr 1fr; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 18px;
  padding-top: 2px;
}

.chips label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 13px;
  height: 13px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}

/* ---- completion --------------------------------------------------------- */

.completion { margin-top: 30px; }

.signature-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1.25fr .9fr;
  gap: 0 20px;
  margin-top: 6px;
}

.note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---- submit and state --------------------------------------------------- */

.submit-block { margin-top: 26px; padding-top: 2px; }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.consent input { margin-top: 1px; }

.submit-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--faint);
  padding-inline: 4px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--ink); }

.form-error,
.submission-banner {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.6;
}

.form-error {
  border: 1px solid #e7b4a8;
  border-left: 3px solid #c2410c;
  background: #fdf3ef;
  color: #7c2d12;
}

.submission-banner {
  border: 1px solid #b7dcc6;
  border-left: 3px solid #15803d;
  background: #f0faf3;
  color: #14532d;
}

.submission-banner strong { display: block; color: #14532d; }

input.invalid,
textarea.invalid {
  border-color: #c2410c;
  box-shadow: 0 0 0 3px rgba(194, 65, 12, .10);
}

body.submitted input,
body.submitted textarea,
body.submitted select { color: var(--ink); opacity: 1; }

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

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  min-width: 210px;
}

.progress-text {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.progress-track {
  display: block;
  flex: 1;
  height: 4px;
  min-width: 70px;
  border-radius: 99px;
  background: var(--rule);
  overflow: hidden;
}

.progress-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width .25s ease;
}

/* ---- footer ------------------------------------------------------------- */

.sheet-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: 8.5px;
  letter-spacing: .04em;
  color: var(--faint);
}

/* ---- screen toolbar ----------------------------------------------------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.toolbar-status {
  margin-right: auto;
  font-size: 11px;
  color: var(--faint);
}

.btn {
  font: 600 11.5px/1 var(--font);
  letter-spacing: .02em;
  padding: 9px 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #2a3648; }

.btn-quiet {
  background: transparent;
  border-color: var(--rule-strong);
  color: var(--muted);
}
.btn-quiet:hover { border-color: var(--muted); color: var(--ink); }

/* ---- small screens ------------------------------------------------------ */

@media screen and (max-width: 900px) {
  .sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 26px 20px 20px;
    box-shadow: none;
  }
  .letterhead { flex-direction: column; gap: 14px; }
  .org { text-align: left; }
  .docmeta { grid-template-columns: 1fr 1fr; gap: 12px 20px; }
  .row.two,
  .signature-grid { grid-template-columns: 1fr; gap: 0; }
  .chips.cols { grid-template-columns: 1fr; }
  .sheet-foot { flex-direction: column; gap: 4px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-status { flex-basis: 100%; margin: 0 0 2px; }
  .progress { flex-basis: 100%; margin: 0 0 4px; }
  .submit-actions .btn { flex: 1 1 auto; }
}

/* ---- print -------------------------------------------------------------- */

@page {
  size: letter;
  margin: 16mm 17mm 20mm;
}

@media print {
  html, body {
    background: #fff;
    background-image: none;
    font-size: 11.5px;
  }

  .screen-only { display: none !important; }

  .sheet {
    width: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-shadow: none;
    display: block;
  }

  .lockup { height: 48px; }
  .letterhead-rule { margin-top: 14px; }
  h1 { font-size: 21px; }
  .doc-sub { font-size: 12px; }
  .lede, .purpose, .thank-you p { font-size: 10.5px; }
  .callout { padding: 7px 10px; font-size: 9.5px; }
  .section-intro { font-size: 10px; }

  .chips.cols { gap: 4px 18px; }
  .q.sub { margin-left: 12px; padding-left: 9px; }
  .q { margin-top: 9px; }
  .priority-list { gap: 2px; }

  .block { margin-top: 16px; }
  .block h2 { break-after: avoid; page-break-after: avoid; }
  .q { margin-top: 10px; }
  .completion { break-inside: avoid; page-break-inside: avoid; }

  textarea {
    min-height: 0;
    padding: 6px 9px;
    line-height: 1.5;
    resize: none;
    background: #fff;
  }

  .note { background: #fff; }

  input, select, textarea, .note, .sheet-foot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .docmeta input,
  .signature-grid input { display: none; }

  .print-value {
    display: block;
    min-height: 1.4em;
    padding-bottom: 2px;
    border-bottom: 1px dotted var(--rule-strong);
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.35;
    color: var(--ink);
  }

  .signature-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
  }

  .signature-grid .print-value { min-height: 1.6em; }

  /* The footnote sits at the end of the document. Chrome does not repeat a
     paged footer from @page margin boxes, and a fixed element printed over the
     section headings on every page. */
  .sheet-foot {
    margin-top: 24px;
    padding-top: 8px;
  }
}
