/* =====================================================================
   Alix study design system
   Warm-accessible (GOV.UK-leaning) palette tuned for UK tenants.
   Single file, no build step, no dependencies.
   ===================================================================== */

:root {
  /* palette */
  --bg: #f5f1ea;
  --bg-deep: #ede5d5;
  --card: #ffffff;
  --card-border: #e3dccb;
  --ink: #1d1d1b;
  --ink-soft: #5b5b58;
  --ink-faint: #8a8a85;
  --brand: #1e6e63;
  --brand-hover: #185b52;
  --brand-soft: #e7f3ef;
  --amber: #b87f12;
  --amber-bg: #fdf3df;
  --success: #1f7a3a;
  --success-bg: #e6f3eb;
  --error: #a8231a;
  --error-bg: #fbe8e6;

  /* type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Source Serif 4", "Source Serif Pro", Georgia, "Iowan Old Style", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  /* shadow */
  --shadow-card: 0 1px 2px rgba(20, 20, 18, 0.04), 0 4px 16px rgba(20, 20, 18, 0.04);
  --shadow-hover: 0 2px 6px rgba(20, 20, 18, 0.06), 0 8px 24px rgba(20, 20, 18, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --------- Layout --------- */

.shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px 18px;
  color: var(--ink);
}
.header__mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  flex: 0 0 36px;
}
.header__wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.header__tag {
  display: block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 3px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 26px 22px;
  box-shadow: var(--shadow-card);
}

/* --------- Typography --------- */

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin: 0 0 8px;
}
h1, .h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 14px;
}
h2, .h2 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
  margin: 26px 0 10px;
}
p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

ul.bullets {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
ul.bullets li {
  position: relative;
  padding-left: 22px;
  margin: 8px 0;
}
ul.bullets li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.muted { color: var(--ink-soft); font-size: 14px; }
.muted-strong { color: var(--ink-soft); font-size: 15px; }

/* --------- Stepper --------- */

.stepper {
  display: flex;
  gap: 6px;
  margin: 0 0 22px;
}
.stepper__pill {
  flex: 1;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 999px;
  transition: background 200ms ease;
}
.stepper__pill.done { background: var(--brand); }
.stepper__pill.now { background: var(--brand); }
.stepper__label {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

/* --------- PID chip --------- */

.pid-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  word-break: break-all;
}
.pid-chip__label {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.field { margin: 20px 0; }
.field__q {
  display: block;
  font-weight: 600;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 10px;
  line-height: 1.4;
}
.field__hint {
  font-size: 14px;
  color: var(--ink-soft);
  margin: -4px 0 10px;
}

.input,
.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

/* radio "cards" */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--card-border);
  border-radius: var(--r-md);
  background: var(--card);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
  min-height: 48px;
}
.choice:hover {
  border-color: var(--brand);
  background: #fcfaf6;
}
.choice input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 2px 0 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  background: #fff;
  flex: 0 0 20px;
  position: relative;
  cursor: pointer;
}
.choice input[type="radio"]:checked {
  border-color: var(--brand);
}
.choice input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}
.choice.checked,
.choice:has(input[type="radio"]:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.choice__text {
  font-size: 16px;
  line-height: 1.4;
  color: var(--ink);
}

/* checkbox row */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-deep);
  border-radius: var(--r-md);
  margin: 16px 0;
  cursor: pointer;
}
.checkbox-row input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  border: 1.5px solid var(--ink-faint);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
}
.checkbox-row input[type="checkbox"]:checked {
  background: var(--brand);
  border-color: var(--brand);
}
.checkbox-row input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.checkbox-row__text {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}

/* --------- Buttons --------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, transform 80ms ease;
  width: 100%;
  min-height: 52px;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  background: var(--ink-faint) !important;
  border-color: var(--ink-faint) !important;
  color: #fff !important;
  cursor: progress;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }

.btn-secondary {
  background: var(--card);
  border-color: var(--brand);
  color: var(--brand);
}
.btn-secondary:hover:not(:disabled) { background: var(--brand-soft); }

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 0;
}
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.btn-row .btn { width: auto; flex: 1; }
.btn-row .btn-secondary { flex: 0 0 auto; padding-inline: 18px; }

/* spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}
.btn-secondary .spinner {
  border-color: var(--brand-soft);
  border-top-color: var(--brand);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --------- Banners --------- */

.banner {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.5;
  margin: 16px 0;
  border: 1px solid transparent;
}
.banner__icon { flex: 0 0 22px; font-size: 18px; line-height: 1.2; }
.banner__body strong { font-weight: 600; }

.banner-info {
  background: var(--brand-soft);
  border-color: #c5e0d8;
  color: #134f47;
}
.banner-warn {
  background: var(--amber-bg);
  border-color: #f0d997;
  color: #6a4a05;
}
.banner-success {
  background: var(--success-bg);
  border-color: #b7dec5;
  color: #0f5024;
}
.banner-error {
  background: var(--error-bg);
  border-color: #efbab5;
  color: #7d1813;
  display: none;
}
.banner-error.visible { display: flex; }

/* --------- Hero code box (completion code) --------- */

.code-hero {
  text-align: center;
  background: var(--success-bg);
  border: 1.5px dashed var(--success);
  border-radius: var(--r-lg);
  padding: 24px 18px;
  margin: 22px 0 12px;
}
.code-hero__label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: 8px;
}
.code-hero__value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #0f5024;
}
.copy-btn {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--brand);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r-sm);
}
.copy-btn:hover { background: var(--brand-soft); }

/* --------- QR hero --------- */

.qr-hero {
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: var(--r-lg);
  padding: 22px 18px;
  text-align: center;
  margin: 16px 0;
}
.qr-hero__img {
  display: inline-block;
  width: 240px;
  height: 240px;
  max-width: 100%;
  border: 1px solid var(--card-border);
  border-radius: var(--r-md);
  background: #fff;
  padding: 8px;
}
.qr-hero__hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 10px;
}
.url-display {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-deep);
  color: var(--ink-soft);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  word-break: break-all;
  text-align: left;
  margin: 12px 0;
  line-height: 1.5;
}

/* --------- Step transitions --------- */
.step { display: none; }
.step.active {
  display: block;
  animation: fade-in 240ms ease;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* --------- Misc --------- */

.callout-box {
  background: var(--brand-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin: 16px 0;
}
.callout-box h2 { margin-top: 0; }

footer.legal {
  text-align: center;
  padding: 18px 12px 28px;
  font-size: 12px;
  color: var(--ink-faint);
}

a { color: var(--brand); }
a:hover { color: var(--brand-hover); }

/* iOS Safari prevents zoom on input focus when font-size >= 16px (already set). */
