:root {
  /* Headrick Team brand palette */
  --brand-ink: #1e1e1e;
  --brand-missouri: #2e3242;
  --brand-spearfish: #525f74;
  --brand-sioux-falls: #709fbf;
  --brand-rushmore: #c0c0c0;
  --brand-badlands: #ed835a;
  --brand-white: #ffffff;

  --color-primary: var(--brand-spearfish);
  --color-primary-dark: var(--brand-missouri);
  --color-accent: var(--brand-badlands);
  --color-accent-dark: #d76c42;
  --color-secondary-accent: var(--brand-sioux-falls);
  --color-bg: #f7f7f8;
  --color-panel: var(--brand-white);
  --color-text: var(--brand-ink);
  --color-text-muted: var(--brand-spearfish);
  --color-border: var(--brand-rushmore);
  --color-error: #b3261e;
  --font-heading: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Roboto", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  --radius: 10px;
  --max-width: 720px;
  font-size: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--brand-white);
  border-bottom: 3px solid var(--color-primary);
  padding: 16px 0;
}

.site-header .logo-img {
  display: block;
  height: 48px;
  width: auto;
}

main.wrap {
  padding-top: 40px;
  padding-bottom: 60px;
}

.panel {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 24px;
}

.hidden {
  display: none !important;
}

h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0;
  color: var(--color-primary-dark);
}

h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-primary-dark);
  margin-top: 0;
}

.subhead {
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.intro-points {
  padding-left: 20px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
}

.intro-points li {
  margin-bottom: 6px;
}

.btn {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

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

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  padding: 12px 26px;
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Progress bar */
.progress-wrap {
  position: sticky;
  top: 0;
  background: var(--color-panel);
  padding-bottom: 16px;
  margin-bottom: 8px;
  z-index: 5;
}

.progress-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 0.2s ease;
}

.progress-label {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* Categories & questions */
fieldset.category {
  border: none;
  padding: 0;
  margin: 0 0 32px 0;
}

fieldset.category legend {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--color-border);
  padding-bottom: 8px;
  width: 100%;
}

.question {
  margin-bottom: 8px;
  padding-bottom: 4px;
}

.q-text {
  margin: 0 0 20px 0;
  font-size: 1.25rem;
  line-height: 1.4;
}

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
}

.quiz-nav .btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.quiz-nav .btn-primary:disabled:hover {
  background: var(--color-accent);
}

.scale {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scale-option {
  flex: 1 1 auto;
  min-width: 56px;
}

.scale-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.scale-option .num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.scale-option input[type="radio"]:checked + label {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

.scale-option input[type="radio"]:checked + label .num {
  color: #fff;
}

.scale-option input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.question.unanswered .scale-option label {
  border-color: var(--color-error);
}

.form-error {
  color: var(--color-error);
  font-weight: 600;
  margin-bottom: 16px;
}

/* Lead capture */
.lead-message {
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.required {
  color: var(--color-error);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.privacy-note {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  margin-top: 14px;
}

/* Results */
.results-score {
  text-align: center;
  margin-bottom: 20px;
}

.score-number {
  font-family: var(--font-heading);
  font-size: 4rem;
  font-weight: 800;
  color: var(--color-primary-dark);
  line-height: 1;
}

.score-outof {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

#result-tier-title {
  text-align: center;
  font-size: 1.5rem;
}

#result-tier-text {
  font-size: 1.05rem;
}

.results-actions {
  text-align: center;
  margin-top: 28px;
}

.site-footer {
  padding: 24px 0 40px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0 0 8px 0;
}

.site-footer a {
  color: var(--color-primary-dark);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-links {
  font-weight: 600;
}

/* Housing Cost Worksheet offer page */
.offer-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.offer-copy {
  flex: 1 1 55%;
}

.offer-preview {
  flex: 1 1 40%;
  max-width: 280px;
  width: 100%;
  height: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 20px rgba(30, 30, 30, 0.12);
}

#download-panel h2 {
  margin-bottom: 8px;
}

#download-panel {
  text-align: center;
}

#download-panel .privacy-note {
  margin-top: 18px;
}

@media (max-width: 640px) {
  .offer-layout {
    flex-direction: column;
  }
  .offer-preview {
    max-width: 220px;
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .panel {
    padding: 24px 18px;
  }
  .scale-option {
    min-width: 48px;
  }
  .score-number {
    font-size: 3rem;
  }
}
