/* ===================================================================
   Umbrella Yoga registration form

   Design notes
   ------------
   Audience: adults across a wide age range in Kirklees and Calderdale.
   The health section asks about dementia, arthritis, recent fractures and
   pregnancy, so a meaningful share of users will be older, on a phone, and
   possibly not confident with online forms. British Sign Language appears in
   the language list. That audience sets every decision below.

   Palette is a cool, inky neutral rather than the warm cream that yoga
   branding usually reaches for; the single accent is a deep petrol green,
   chosen for calm and for contrast (7.4:1 on white) rather than for prettiness.

   The one place boldness is spent is the health checklist: large tappable
   rows rather than small checkboxes, because that is the section where a
   mis-tap has real consequences for a person's safety in a class.

   Everything is in normal flow. Nothing is sticky or fixed: the page is
   embedded in an iframe, where fixed positioning behaves unpredictably and
   can trap content out of reach.
   =================================================================== */

:root {
  --ink: #17211f;
  --body: #2e3a38;
  --muted: #5a6866;
  --line: #d9e0de;
  --line-strong: #b6c2bf;
  --surface: #ffffff;
  --canvas: #f4f6f5;
  --accent: #12665f;
  --accent-dark: #0d4b46;
  --accent-soft: #e7f0ee;
  --error: #a3231c;
  --error-soft: #fcf0ef;
  --success: #1a5c39;

  --radius: 10px;
  --measure: 40rem;

  /* 17px base: larger than the usual 16 because a good share of this
     audience will be reading it on a phone without adjusting text size. */
  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

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

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

body {
  margin: 0;
  padding: 1.5rem 1.25rem 4rem;
  background: var(--canvas);
  color: var(--body);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  /* Long-form reading; hyphenation off so postcodes and names stay intact. */
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: var(--measure); margin: 0 auto; }

/* --------------------------------------------------------------- headings */

.masthead { margin-bottom: 2rem; }

.masthead h1 {
  font-size: var(--step-3);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.masthead p { margin: 0; color: var(--muted); max-width: 34rem; }

.required-note {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* --------------------------------------------------------------- sections */

.section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  margin: 0 0 1.25rem;
}

.section > legend,
.section-heading {
  font-size: var(--step-2);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  padding: 0;
  margin: 0 0 0.25rem;
}

/* Section counters carry real information here: the form is long, and knowing
   there are six parts is the difference between persevering and abandoning. */
.section-count {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.375rem;
}

.section-intro {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.9688rem;
}

/* ----------------------------------------------------------------- fields */

.field { margin-bottom: 1.5rem; }
.field:last-child { margin-bottom: 0; }

.field > label,
.group-label {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.375rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.9375rem;
}

.help {
  display: block;
  color: var(--muted);
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}

input[type="text"], input[type="email"], input[type="tel"],
input[type="date"], input[type="search"], select, textarea {
  width: 100%;
  /* 16px minimum: anything smaller makes iOS Safari zoom on focus, which in an
     iframe leaves the user stranded mid-page. */
  font: inherit;
  font-size: max(1rem, var(--step-0));
  color: var(--body);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  padding: 0.6875rem 0.75rem;
  min-height: 2.875rem;
}

textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, [role="combobox"]:focus-visible, .opt:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

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

.error {
  display: block;
  color: var(--error);
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 0.375rem;
}

/* ------------------------------------------------- checkbox / radio groups */

.options { display: grid; gap: 0.5rem; }
.options.columns { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

/* The signature element. Full-width rows with a 44px+ target rather than a
   bare checkbox: this is the health section, where a mis-tap on a phone has
   consequences for what a teacher knows about someone in their class. */
.opt {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

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

.opt input { margin: 0; width: 1.375rem; height: 1.375rem; flex: none; accent-color: var(--accent); }

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

.opt span { line-height: 1.4; }

/* ------------------------------------------------------------- combobox */

.combo { position: relative; }

.combo-list {
  position: absolute;
  z-index: 20;
  inset-inline: 0;
  top: calc(100% + 4px);
  max-height: 15rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(23 33 31 / 0.12);
}

.combo-list[hidden] { display: none; }

.combo-list li {
  padding: 0.5rem 0.625rem;
  border-radius: 6px;
  cursor: pointer;
}

.combo-list li[aria-selected="true"] { background: var(--accent); color: #fff; }
.combo-list li.is-chosen::after { content: " ✓"; color: var(--accent); }
.combo-list li[aria-selected="true"].is-chosen::after { color: #fff; }
.combo-empty { color: var(--muted); padding: 0.5rem 0.625rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.625rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 0.25rem 0.375rem 0.25rem 0.75rem;
  font-size: 0.9375rem;
}

.chip button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.375rem;
  border-radius: 999px;
  min-width: 1.75rem;
  min-height: 1.75rem;
}

.chip button:hover { background: rgb(18 102 95 / 0.14); }

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

.actions { margin-top: 2rem; }

.btn {
  font: inherit;
  font-weight: 600;
  font-size: var(--step-1);
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  padding: 0.875rem 1.75rem;
  min-height: 3rem;
  width: 100%;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.btn:hover { background: var(--accent-dark); }
.btn[disabled] { background: var(--muted); cursor: not-allowed; }

@media (min-width: 30rem) { .btn { width: auto; min-width: 16rem; } }

/* --------------------------------------------------------- notifications */

.summary {
  border: 1.5px solid var(--error);
  background: var(--error-soft);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.summary h2 { margin: 0 0 0.5rem; font-size: var(--step-1); color: var(--error); }
.summary ul { margin: 0; padding-left: 1.25rem; }
.summary a { color: var(--error); font-weight: 500; }

.notice {
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.notice.is-error { border-color: var(--error); background: var(--error-soft); color: var(--error); }

.done {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--success);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
}

.done h2 { margin: 0 0 0.75rem; color: var(--ink); font-size: var(--step-3); font-weight: 600; }
.done p { margin: 0 0 0.75rem; }
.done p:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- utils */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

@media (min-width: 40rem) {
  body { padding: 2.5rem 2rem 5rem; }
  .section { padding: 2rem 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (prefers-contrast: more) {
  :root { --line: #6b7a77; --line-strong: #3d4a47; --muted: #3d4a47; }
}
