/* ==========================================================================
   DSB Mentorship Program — public onboarding forms (/apply/mentee, /apply/mentor)
   The HTML is server-rendered in src/survey_render.ts. This file is the whole of
   the look.

   EVERY colour, font and size decision is a custom property at :root. That is
   deliberate: the DSB brand page is being designed in parallel, and re-skinning
   these forms should be an edit to the block below and nothing else.

   Palette: purple #3E1952 primary · #2B0050 depth · gold #C9A227 accent only ·
   cream #FAF7F0 surface. Bebas Neue for subheads, Source Sans 3 for body,
   Georgia-family serif for the formal title.
   ========================================================================== */

:root {
  /* ---- brand ---------------------------------------------------------- */
  --dsb-purple: #3e1952;        /* primary */
  --dsb-depth: #2b0050;         /* depth — masthead, footer */
  --dsb-gold: #c9a227;          /* accent ONLY. Never a background for text. */
  --dsb-gold-ink: #8a6f14;      /* the same gold, darkened to pass contrast as small text */
  --dsb-cream: #faf7f0;         /* surface */
  --dsb-white: #ffffff;

  /* ---- derived, all in-family (no neutral grey anywhere) --------------- */
  --ink: #241733;               /* body text on cream */
  --ink-soft: #574a66;          /* secondary text on cream */
  --on-purple: #f7f2fb;
  --on-purple-soft: #cbb9dd;
  --line: rgba(62, 25, 82, 0.18);
  --line-strong: rgba(62, 25, 82, 0.38);
  --tint: #f4eefa;              /* faint purple wash — chosen choices, help boxes */
  --tint-deep: #e9dcf4;
  --danger: #8f2230;
  --danger-tint: #fbeef0;

  /* ---- type ----------------------------------------------------------- */
  --font-title: Georgia, 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', serif;
  --font-sub: 'Bebas Neue', 'Oswald', 'Haettenschweiler', 'Arial Narrow', sans-serif;
  --font-body: 'Source Sans 3', 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --size-body: 1.0625rem;
  --size-prompt: 1.125rem;
  --size-h1: clamp(1.75rem, 5vw, 2.75rem);

  /* ---- metrics -------------------------------------------------------- */
  --wrap: 46rem;
  --radius: 4px;
  --touch: 44px;                /* the accessibility floor, not a suggestion */
  --gap: 1rem;
  --gap-lg: 2rem;
  --gap-xl: 3rem;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--dsb-cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---- skip link & screen-reader text ---------------------------------- */

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

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

/* The honeypot. Off-screen rather than display:none, because some bots skip
   hidden inputs and the whole point is that they fill this one in. */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

/* ---- masthead --------------------------------------------------------- */

.masthead {
  background: var(--dsb-depth);
  color: var(--on-purple);
  padding-block: 2.5rem 2rem;
  border-bottom: 4px solid var(--dsb-gold);
}
.masthead .eyebrow {
  font-family: var(--font-sub);
  font-size: 1rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dsb-gold);
  margin: 0 0 0.35rem;
}
.masthead h1 {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: var(--size-h1);
  line-height: 1.15;
  margin: 0 0 0.6rem;
  color: var(--dsb-white);
}
.masthead .lede { margin: 0; color: var(--on-purple); }
.masthead .sub {
  margin: 0.6rem 0 0;
  color: var(--on-purple-soft);
  font-size: 0.95rem;
}

/* ---- main / card ------------------------------------------------------ */

main { padding-block: 2rem 4rem; }

.card {
  background: var(--dsb-white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--dsb-purple);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.card .note {
  background: var(--tint);
  border-left: 3px solid var(--dsb-gold);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}
.backlink { margin-top: 1.5rem; }
a { color: var(--dsb-purple); }
a:focus-visible, .skip:focus-visible { outline: 3px solid var(--dsb-gold); outline-offset: 2px; }

/* ---- error summary ---------------------------------------------------- */

.summary {
  background: var(--danger-tint);
  border: 1px solid var(--danger);
  border-left-width: 5px;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.summary h2 {
  font-family: var(--font-sub);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 1.15rem;
  font-weight: 400;
  margin: 0 0 0.4rem;
  color: var(--danger);
}
.summary ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }
.summary li { margin-bottom: 0.25rem; }
.summary a { color: var(--danger); }

/* ---- identity block --------------------------------------------------- */

.identity {
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.identity h2 {
  font-family: var(--font-sub);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 400;
  font-size: 1.25rem;
  margin: 0 0 0.25rem;
  color: var(--dsb-purple);
}
.identity-grid { display: grid; gap: var(--gap); margin-top: 0.75rem; }
@media (min-width: 34rem) {
  .identity-grid { grid-template-columns: 1fr 1fr; }
}

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

.progress {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--dsb-cream);
  padding: 0.75rem 0 0.85rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.progress-text {
  display: block;
  font-family: var(--font-sub);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.95rem;
  color: var(--dsb-purple);
  margin-bottom: 0.4rem;
}
.progress-bar {
  display: block;
  height: 5px;
  background: var(--tint-deep);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  display: block;
  height: 100%;
  background: var(--dsb-gold);
  transition: width 180ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }
}

/* ---- questions -------------------------------------------------------- */

.question {
  position: relative;
  background: var(--dsb-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.35rem;
  margin: 0 0 var(--gap);
  /* fieldset resets */
  min-width: 0;
}
fieldset.question { padding-inline: 1.25rem; }

.question--error {
  border-color: var(--danger);
  border-left-width: 5px;
}

.qnum {
  display: block;
  font-family: var(--font-sub);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--dsb-gold-ink);
  margin-bottom: 0.15rem;
}

.prompt {
  display: block;
  font-size: var(--size-prompt);
  font-weight: 600;
  color: var(--dsb-depth);
  margin: 0 0 0.35rem;
  padding: 0;
}
/* A <legend> sits ON the fieldset's top border by default, which pushes the question
   text outside its own card. float:left puts it back in normal flow; the elements
   after it clear the float so the choices start underneath, not beside. */
legend.prompt { float: left; width: 100%; padding: 0; }
fieldset.question > .help,
fieldset.question > .err,
fieldset.question > .choices { clear: both; }

.req { color: var(--danger); font-weight: 700; }

.help {
  margin: 0 0 0.75rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.err {
  margin: 0 0 0.6rem;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.95rem;
}

/* ---- controls --------------------------------------------------------- */

input[type="text"],
input[type="email"],
textarea {
  display: block;
  width: 100%;
  min-height: var(--touch);
  font: inherit;
  color: var(--ink);
  background: var(--dsb-white);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}
textarea { min-height: 6.5rem; resize: vertical; }

input[type="text"]:focus-visible,
input[type="email"]:focus-visible,
input[type="file"]:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 3px solid var(--dsb-gold);
  outline-offset: 2px;
  border-color: var(--dsb-purple);
}

input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

input[type="file"] {
  font: inherit;
  min-height: var(--touch);
  width: 100%;
}
.filename { margin: 0.5rem 0 0; color: var(--ink-soft); font-size: 0.95rem; }

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

.choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: var(--touch);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.choice:hover { background: var(--tint); }
.choice input { width: 1.25rem; height: 1.25rem; margin: 0; accent-color: var(--dsb-purple); flex: none; }
.choice label { flex: 1 1 12rem; cursor: pointer; padding-block: 0.35rem; }
.choice:focus-within { background: var(--tint); box-shadow: inset 0 0 0 2px var(--dsb-gold); }
.choice--other .other-text { flex: 1 1 100%; margin-top: 0.35rem; }

/* Selected state is a fill AND a left rule — never colour alone. */
.choice:has(input:checked) {
  background: var(--tint);
  box-shadow: inset 3px 0 0 var(--dsb-purple);
}

/* ---- actions ---------------------------------------------------------- */

.actions { margin-top: var(--gap-lg); }

button[type="submit"] {
  font-family: var(--font-sub);
  font-size: 1.35rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dsb-white);
  background: var(--dsb-purple);
  border: 2px solid var(--dsb-purple);
  border-radius: var(--radius);
  min-height: 3.25rem;
  padding: 0.5rem 2rem;
  width: 100%;
  cursor: pointer;
}
button[type="submit"]:hover { background: var(--dsb-depth); border-color: var(--dsb-depth); }
button[type="submit"][disabled] { opacity: 0.6; cursor: progress; }
@media (min-width: 34rem) {
  button[type="submit"] { width: auto; min-width: 16rem; }
}

.fineprint { margin: 0.9rem 0 0; color: var(--ink-soft); font-size: 0.9rem; }

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

.foot {
  background: var(--dsb-depth);
  color: var(--on-purple-soft);
  padding-block: 1.5rem;
  font-size: 0.9rem;
}
.foot p { margin: 0; }

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

@media print {
  .progress, .skip, .actions { display: none; }
  body { background: var(--dsb-white); }
  .question { break-inside: avoid; border-color: #999; }
}
