:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #dfe3e8;
  --border-strong: #c3cad3;
  --text: #1b2430;
  --text-muted: #5b6878;
  --accent: #0f7b6c;
  --accent-soft: #e6f2f0;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(21, 32, 46, 0.06), 0 8px 24px rgba(21, 32, 46, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b212a;
    --border: #2c3542;
    --border-strong: #3d4855;
    --text: #e8ecf1;
    --text-muted: #a2aebd;
    --accent: #3ec2ac;
    --accent-soft: #1d2f2d;
    --accent-text: #0b1412;
    --danger: #f2857c;
    --danger-soft: #3a1f1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

.masthead {
  margin-bottom: 2rem;
}

h1 {
  margin: 0 0 0.6rem;
  font-size: 1.7rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.intro {
  margin: 0;
  color: var(--text-muted);
  max-width: 38rem;
}

/* --- sections --- */

.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
}

.section-title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: -0.005em;
}

.section-desc {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.925rem;
}

.section-body {
  margin-top: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* --- questions --- */

/* Conditional questions are toggled with the `hidden` attribute; make sure a
   flex or grid child cannot override it. */
[hidden] {
  display: none !important;
}

.q-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

/* A followup hangs off the question above it. */
.q-followup {
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin-left: 0.1rem;
}

/* Contact details, and the "other, please say more" box. */
.subfield {
  margin-top: 0.75rem;
}

.subfield .q-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.contact {
  display: grid;
  gap: 0.25rem;
}

@media (min-width: 34rem) {
  .contact {
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
  }
}

.q-required {
  color: var(--danger);
  margin-left: 0.15rem;
}

.q-help {
  margin: 0 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.q-error {
  margin: 0.5rem 0 0;
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
}

.q.invalid .q-label {
  color: var(--danger);
}

.q-control {
  margin-top: 0.55rem;
}

input[type="text"],
textarea,
select {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

textarea {
  min-height: 5.5rem;
  resize: vertical;
}

input[type="text"]:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* option lists (radio / checkbox) */

.options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.option {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.option:hover {
  border-color: var(--border-strong);
}

.option input {
  margin: 0.25rem 0 0;
  accent-color: var(--accent);
  flex: none;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* numeric scales */

.scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* Narrow enough that a 1-5 scale stays on one row on a 320px phone, capped so
   it does not stretch into slabs on a desktop. */
.scale-point {
  cursor: pointer;
  flex: 1 1 2rem;
  min-width: 2rem;
  max-width: 3.5rem;
}

.scale-point input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.scale-point span {
  display: block;
  text-align: center;
  padding: 0.5rem 0.2rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  background: var(--bg);
}

.scale-point input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.scale-point input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* likert blocks */

.likert-ends {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.likert-rows {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.likert-row .likert-statement {
  display: block;
  margin-bottom: 0.4rem;
}

/* --- actions --- */

.form-error {
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.925rem;
}

.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.7rem;
}

.submit {
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1.6rem;
  cursor: pointer;
}

.submit:hover {
  filter: brightness(1.08);
}

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

.submit[disabled] {
  opacity: 0.6;
  cursor: progress;
}

.actions-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.825rem;
}

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

/* --- thanks --- */

.thanks {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.thanks-mark {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.5rem;
  line-height: 3rem;
}

.thanks h2 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
}

.thanks p {
  margin: 0;
  color: var(--text-muted);
}
