/* Layout and components. Colours and fonts come from theme.css. Mobile-first; works down to 320px. */

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

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

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

h1,
h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-primary);
  margin: 0 0 0.75rem;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; margin-top: 1.5rem; }

p,
ul,
ol {
  margin: 0 0 1rem;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { text-decoration-thickness: 2px; }

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

code {
  font-size: 0.9em;
  background: var(--color-background);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--color-surface);
  color: var(--color-primary);
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* Page chrome */

.test-banner {
  padding: 0.5rem 1rem;
  background: var(--color-warning-bg);
  border-bottom: 2px solid var(--color-warning-border);
  font-size: 0.875rem;
  text-align: center;
}

.site-header {
  display: flex;
  justify-content: center;
  padding: 1.25rem 1rem 1rem;
}
.logo {
  display: block;
  width: 200px;
  max-width: 70%;
  height: auto;
}

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
  background: var(--color-surface);
}
.page:focus { outline: none; }

.lead { font-size: 1.0625rem; }
.meta { color: var(--color-text-muted); font-size: 0.875rem; }
.steps li { margin-bottom: 0.5rem; }

.site-footer {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
}
.site-footer a { color: var(--color-text-muted); }

@media (min-width: 36rem) {
  .page {
    margin-bottom: 1rem;
    padding: 2rem 2rem 2.25rem;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(42, 42, 42, 0.15);
  }
  h1 { font-size: 2rem; }
}

/* Form */

.form { margin-top: 1.5rem; }

.field {
  margin: 0 0 1.25rem;
}
.field--error {
  padding-left: 0.875rem;
  border-left: 4px solid var(--color-error);
}

.label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 700;
}
.optional { font-weight: 400; color: var(--color-text-muted); }

.hint {
  margin: 0 0 0.375rem;
  color: var(--color-text-muted);
  font-size: 0.9375rem;
}

.error-message {
  margin: 0 0 0.375rem;
  color: var(--color-error);
  font-weight: 700;
}

.input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.625rem;
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming on focus */
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
}
.input:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 0;
}
.field--error .input { border-color: var(--color-error); }

.fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}
.fieldset legend { padding: 0; }

.checkbox {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}
.checkbox input {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  margin: 0.125rem 0 0;
  accent-color: var(--color-primary);
}
.checkbox label { cursor: pointer; }

.processing-statement {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.button {
  display: inline-block;
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: var(--color-on-primary);
  background: var(--color-primary);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.button:hover,
.button:active { background: var(--color-primary-dark); }
.button:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }
a.button { color: var(--color-on-primary); }

@media (min-width: 36rem) {
  .button { width: auto; }
}

/* Messages */

.error-summary {
  margin: 0 0 1.5rem;
  padding: 1rem 1.25rem;
  border: 4px solid var(--color-error);
  border-radius: var(--radius);
}
.error-summary h2 { margin-top: 0; color: var(--color-text); font-family: var(--font-body); }
.error-summary ul { margin: 0; padding-left: 1.25rem; }
.error-summary a { color: var(--color-error); font-weight: 700; }

.placeholder-notice {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--color-warning-bg);
  border-left: 4px solid var(--color-warning-border);
}

.back-link { font-size: 0.9375rem; }
