/* The journey to school. Unbranded on purpose: no logo, no product name, no
   colours borrowed from anyone's brand. Single column everywhere, 44px targets,
   visible focus, contrast that survives a phone in daylight. */

:root {
  --ink: #16191d;
  --ink-soft: #4a525c;
  --line: #c9ced6;
  --line-strong: #8a929c;
  --bg: #ffffff;
  --bg-soft: #f4f6f8;
  --accent: #1f4f8f;
  --accent-ink: #ffffff;
  --error: #9b1c1c;
  --focus: #b8560f;
  --radius: 10px;
  --maxw: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef1f4;
    --ink-soft: #b9c1ca;
    --line: #4a525c;
    --line-strong: #8a929c;
    --bg: #14171a;
    --bg-soft: #1d2126;
    --accent: #8fc0ff;
    --accent-ink: #10141a;
    --error: #ff9a9a;
    --focus: #ffb066;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.05rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

main:focus { outline: none; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg);
  color: var(--ink);
  padding: 0.75rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Progress */
.progress-wrap {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 0.6rem 1rem 0.5rem;
  z-index: 5;
}
.progress-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  height: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}
.progress-text {
  max-width: var(--maxw);
  margin: 0.35rem auto 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}

/* Typography */
h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  margin: 0.4rem 0 1rem;
}
h2 {
  font-size: 1.2rem;
  line-height: 1.3;
  margin: 0 0 1rem;
}
p { margin: 0 0 1rem; }

.lede p { font-size: 1.05rem; }

.section-intro {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  margin: 0 0 1.5rem;
}

.concept p { font-size: 1.1rem; }

/* Questions */
.q {
  margin: 0 0 2rem;
  border: 0;
  padding: 0;
}
.q legend,
.q .q-label {
  font-weight: 600;
  padding: 0;
  margin: 0 0 0.6rem;
  display: block;
}
.q .hint,
.q .safety {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: -0.3rem 0 0.7rem;
}
.optional-tag {
  font-weight: 400;
  color: var(--ink-soft);
}

/* Choices */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.choice:hover { border-color: var(--line-strong); }
.choice input {
  width: 22px;
  height: 22px;
  margin: 0.1rem 0 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.choice:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.choice:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* Text and number inputs */
input[type="text"],
input[type="email"],
input[type="number"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.75rem;
  min-height: 44px;
}
textarea {
  min-height: 7rem;
  resize: vertical;
}
.char-count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0.3rem 0 0;
}

.money {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.money .prefix,
.money .suffix {
  color: var(--ink-soft);
  white-space: nowrap;
}
.money input { max-width: 8rem; }

.other-wrap { margin: 0.2rem 0 0.6rem 2.2rem; }

/* Grid question: real table on wide screens, stacked cards on phones */
.grid-rows { display: grid; gap: 0.75rem; }
.grid-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.grid-row .row-label {
  display: block;
  margin: 0 0 0.6rem;
  font-weight: 500;
}
.grid-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.grid-options .choice {
  margin: 0;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

/* Buttons */
.actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
.btn {
  font: inherit;
  font-weight: 600;
  min-height: 48px;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  flex: 1 1 auto;
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn:disabled { opacity: 0.6; cursor: default; }

/* Errors */
.errors {
  color: var(--error);
  font-weight: 600;
  margin: 0;
}
.errors:empty { margin: 0; }
.field-error {
  color: var(--error);
  font-size: 0.9rem;
  margin: 0.3rem 0 0;
}
.q.has-error .choice,
.q.has-error input[type="text"],
.q.has-error input[type="email"],
.q.has-error input[type="number"],
.q.has-error textarea {
  border-color: var(--error);
}

/* Consent and end screens */
.consent-note {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.privacy-link { color: var(--accent); }

.end {
  padding: 2rem 0;
}

.saved-note {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* Honeypot: off screen for people, present for bots. Never display:none. */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.noscript {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}

@media (max-width: 26rem) {
  body { font-size: 1rem; }
  .grid-options { grid-template-columns: 1fr; }
  .grid-options .choice {
    flex-direction: row;
    justify-content: flex-start;
    text-align: left;
  }
}
