/* Colors used across the whole form (matched to Shane's Typeform) */
:root {
  --ink: #000000;          /* main text */
  --ink-soft: #4a4a4a;     /* hints and secondary text */
  --blue: #0445af;         /* buttons, progress bar, selected answers */
  --blue-dark: #03368a;    /* button hover */
  --blue-mid: #9bb5df;     /* borders on answer boxes */
  --blue-light: #e6ecf7;   /* answer box background */
  --blue-picked: #cddbf3;  /* answer box once picked */
  --white: #ffffff;
  --line: #d9e1ee;         /* field borders and dividers */
  --red: #c62828;          /* required star and missing answers */
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 18px;
  line-height: 1.5;
}

/* Demo warning banner across the top */
.demo-banner {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--white);
  background: var(--blue);
}

/* Progress bar at the top of every screen */
.progress {
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 16px 0;
}

.progress-label {
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  background: var(--blue-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--blue);
  border-radius: 4px;
}

/* The area that holds each screen (plain white, like Shane's Typeform) */
.card {
  max-width: 520px;
  margin: 20px auto;
  padding: 32px 24px;
  background: var(--white);
}

.center {
  text-align: center;
}

/* Make sure hidden screens stay hidden */
[hidden] {
  display: none !important;
}

.logo {
  width: 140px;
  height: auto;
  margin-bottom: 16px;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 16px;
}

.intro {
  color: var(--ink-soft);
  margin: 0 0 16px;
}

/* Privacy promise on the welcome screen */
.privacy-note {
  margin: 0 0 20px;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  color: var(--ink);
  background: var(--blue-light);
  border-radius: 8px;
}

.time {
  font-size: 16px;
  color: var(--blue);
  font-weight: 600;
  margin: 0 0 28px;
}

.btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--white);
  background: var(--blue);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.btn-primary:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
  margin: 0 0 8px;
}

h1:focus,
h2:focus {
  outline: none;
}

/* Form fields */
.field {
  margin-bottom: 18px;
}

label,
legend {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px;
  font-size: 18px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(4, 69, 175, 0.2);
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 4px;
}

legend {
  font-size: 17px;
  margin-bottom: 10px;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

/* Small grey help text under a field */
.hint {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 6px 0 0;
}

/* Help text that sits between a question and its answers */
.hint-above {
  margin: -4px 0 12px;
}

/* Extra questions that appear after an answer, set in slightly so they read as a follow-up */
.reveal {
  padding-left: 14px;
  border-left: 3px solid var(--blue);
  margin-bottom: 18px;
}

/* A field with a small button beside it (SSN + Show) */
.input-with-button {
  display: flex;
  gap: 8px;
}

.btn-small {
  flex: 0 0 auto;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
  background: var(--white);
  border: 1px solid var(--blue);
  border-radius: 8px;
  cursor: pointer;
}

.btn-small:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

/* Radio-button choices shown as light blue tappable boxes, like Shane's Typeform */
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 400;
  color: var(--blue);
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: 8px;
  cursor: pointer;
}

.choice:has(input:checked) {
  font-weight: 600;
  background: var(--blue-picked);
  border-color: var(--blue);
}

.choice input[type="radio"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--blue);
}

/* Beneficiaries */
h3 {
  font-size: 20px;
  margin: 0 0 4px;
}

.optional {
  font-size: 15px;
  font-weight: 400;
  color: var(--ink-soft);
}

.bene-group {
  margin-top: 28px;
}

.bene-group .hint {
  margin-bottom: 14px;
}

.bene-row {
  position: relative;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.bene-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 10px;
}

.btn-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  font-size: 15px;
  color: var(--ink-soft);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

.field-percent input {
  max-width: 120px;
}

.bene-row .field:last-child {
  margin-bottom: 0;
}

.btn-add {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--blue);
  background: none;
  border: 2px dashed var(--blue-mid);
  border-radius: 8px;
  cursor: pointer;
}

.btn-add:focus-visible,
.btn-remove:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

.total {
  font-size: 16px;
  font-weight: 600;
  margin: 10px 0 0;
}

.total.ok {
  color: #2e7d4f;
}

.total.warn {
  color: #b3541e;
}

/* Error message shown above the buttons */
.error {
  margin: 24px 0 0;
  padding: 12px 14px;
  font-size: 16px;
  color: #8a2d12;
  background: #fbeee8;
  border: 1px solid #e8b9a6;
  border-radius: 8px;
}

.error:focus {
  outline: none;
}

/* "Back to review" button, shown once the client has reached Review */
.btn-review {
  width: 100%;
  margin-top: 12px;
  padding: 14px;
  font-size: 17px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: 8px;
  cursor: pointer;
}

/* Review screen */
.review-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.review-header h3 {
  margin: 0;
}

.btn-edit {
  padding: 6px 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--blue);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
}

.review-list {
  margin: 0;
}

.review-list dt {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 10px;
}

.review-list dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  white-space: pre-line; /* keeps line breaks typed into health conditions */
}

.not-answered {
  color: var(--ink-soft);
  font-style: italic;
}

/* The question at the top of each screen, Typeform-style: "3→ What's your date of birth? *" */
.question {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 18px;
}

.q-num {
  margin-right: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--blue);
  vertical-align: 2px;
}

/* Red star = this question must be answered */
.req {
  margin-left: 4px;
  color: var(--red);
}

.question + .intro {
  margin-top: -8px;
}

/* Red outline on anything that still needs an answer */
input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

fieldset.invalid .choice {
  border-color: var(--red);
}

/* Small "or press Enter" hint under OK (only where there's a keyboard) */
.enter-hint {
  display: none;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: right;
}

@media (hover: hover) and (pointer: fine) {
  .enter-hint {
    display: block;
  }
}

.question:focus {
  outline: none;
}

.btn-full {
  width: 100%;
}

.btn-review:focus-visible,
.btn-edit:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

/* Cloudflare Turnstile check on the Review screen */
.turnstile-box {
  margin-top: 24px;
}

/* Thank you screen: test-only data box */
.test-box {
  margin-top: 28px;
  padding: 16px;
  text-align: left;
  border: 2px dashed var(--line);
  border-radius: 8px;
}

.test-box pre {
  margin: 12px 0 0;
  padding: 12px;
  font-size: 13px;
  background: var(--blue-light);
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Two fields side by side (they stack on very small screens) */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* State gets more room than ZIP so long names like "North Carolina" fit */
.row-wide-first {
  grid-template-columns: 2fr 1fr;
}

/* Back and Continue buttons */
.actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.actions .btn-primary {
  flex: 2;
}

.btn-secondary {
  flex: 1;
  padding: 16px;
  font-size: 18px;
  font-weight: 600;
  color: var(--blue);
  background: var(--white);
  border: 1px solid var(--blue);
  border-radius: 8px;
  cursor: pointer;
}

.btn-secondary:focus-visible {
  outline: 3px solid var(--blue-mid);
  outline-offset: 2px;
}

@media (max-width: 360px) {
  .row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Small side margins on phones so the content doesn't touch the edges */
@media (max-width: 560px) {
  .card {
    margin: 16px;
  }
}
