/* ---------------------------------------------------------
   RISE — Apply Form
   Near-black premium dark theme, teal-to-forest gradient accent,
   Raleway type, editorial-scale headlines.
--------------------------------------------------------- */

:root {
  /* Palette lifted from the RISE onboarding site (rise-onboarding.netlify.app) */
  --bg: #0A0A0A;
  --bg-vignette: #050505;
  --bg-elevated: #111111;
  --text: #E8EBED;
  --text-muted: #888888;
  --heading-top: #FFFFFF;
  --heading-bottom: #C8D0D8;
  --accent: #34B1A6;
  --accent-2: #2A9189;
  --accent-light: #45C9BC;
  --accent-gradient: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-2) 100%);
  --accent-glow: rgba(52, 177, 166, 0.35);
  --accent-contrast: #000000;
  --border: rgba(255, 255, 255, 0.07);
  --border-hover-bg: #111111;
  --error: #F87171;
  --error-bg: rgba(248, 113, 113, 0.1);
  --radius-pill: 100px;
  --radius-md: 16px;
  --radius-btn: 999px;
  --font: 'Raleway', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 1200px 900px at 12% -10%, rgba(52, 177, 166, 0.28) 0%, transparent 58%),
    radial-gradient(ellipse 1000px 800px at 100% 105%, rgba(52, 177, 166, 0.18) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.02 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: auto, auto, 200px 200px;
  background-repeat: no-repeat, no-repeat, repeat;
  background-attachment: fixed, fixed, scroll;
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
}

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

.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */

.site-header {
  padding: 28px 24px 8px;
  display: flex;
  justify-content: center;
}

.logo {
  height: 26px;
  width: auto;
}

/* ---------- Progress ---------- */

.progress-wrap {
  padding: 20px 24px 0;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
}

/* Numbered stepper, mirroring the onboarding site's progress component */

.progress-track {
  display: flex;
  align-items: center;
  position: relative;
}

.progress-line {
  position: absolute;
  top: 50%;
  left: 18px;
  right: 18px;
  height: 2px;
  margin-top: -1px;
  background: var(--border);
  z-index: 0;
}

.progress-line-fill {
  height: 100%;
  width: 0;
  background: var(--accent-gradient);
  transition: width 600ms var(--ease);
}

.progress-step {
  flex: 1;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.progress-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background-color 250ms var(--ease), border-color 250ms var(--ease), color 250ms var(--ease), box-shadow 250ms var(--ease);
}

.progress-step.active .progress-dot {
  background: var(--accent-gradient);
  border-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 0 20px var(--accent-glow);
}

.progress-step.done .progress-dot {
  background: rgba(52, 177, 166, 0.15);
  border-color: var(--accent);
  color: var(--accent);
}

.progress-label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.progress-label::after {
  content: "";
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Form stage ---------- */

.form-stage {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 48px;
}

#applyForm {
  width: 100%;
}

.question {
  display: none;
  width: 100%;
}

.question.active {
  display: block;
}

.question.entering {
  animation: questionEnter 250ms var(--ease) forwards;
}

.question.leaving {
  display: block;
  animation: questionLeave 150ms var(--ease) forwards;
}

@keyframes questionEnter {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes questionLeave {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-20px); }
}

@media (prefers-reduced-motion: reduce) {
  .question.entering,
  .question.leaving {
    animation: none;
  }
}

fieldset.question {
  border: none;
  margin: 0;
  padding: 0;
}

.question-label {
  display: block;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  background: linear-gradient(180deg, var(--heading-top) 0%, var(--heading-bottom) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Emphasised phrase inside a question headline (mirrors the onboarding
   site's <span class="teal"> treatment), two points larger and underlined */
.question-label .highlight {
  color: var(--accent);
  -webkit-text-fill-color: var(--accent);
  font-size: calc(1em + 2px);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.question-subheading {
  margin: -14px 0 24px;
  font-size: 15px;
  color: var(--text-muted);
}

/* ---------- Text / email / select / textarea ---------- */

.text-input,
.select-input,
.textarea-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 400;
  padding: 10px 2px;
  transition: border-color 200ms var(--ease);
  border-radius: 0;
}

.textarea-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 16px;
  resize: vertical;
  min-height: 110px;
}

.text-input:focus,
.select-input:focus,
.textarea-input:focus {
  border-color: var(--accent);
}

.text-input::placeholder,
.textarea-input::placeholder {
  color: var(--text-muted);
}

.select-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%236B7280' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 4px center;
  padding-right: 28px;
}

.select-input option {
  background: var(--bg-elevated);
  color: var(--text);
}

.select-input:invalid {
  color: var(--text-muted);
}

.select-input option[value=""] {
  display: none;
}

/* ---------- Radio options ---------- */

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  background-color: transparent;
  transition: background-color 200ms var(--ease), border-color 200ms var(--ease), transform 200ms var(--ease);
  font-size: 18px;
  font-weight: 500;
}

.option:hover {
  border-color: transparent;
  border-width: 1.5px;
  background-image: linear-gradient(var(--border-hover-bg), var(--border-hover-bg)), var(--accent-gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  transform: translateY(-1px);
}

.option:has(input:checked) {
  border: 2px solid transparent;
  padding: 19px 23px;
  background-image: linear-gradient(var(--bg), var(--bg)), var(--accent-gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: grid;
  place-content: center;
  margin: 0;
}

.option input[type="radio"]::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 140ms var(--ease);
  background: var(--accent-gradient);
}

.option input[type="radio"]:checked::before {
  transform: scale(1);
}

.option input[type="radio"]:checked {
  border: 1.5px solid transparent;
  background-image: linear-gradient(var(--bg), var(--bg)), var(--accent-gradient);
  background-origin: border-box;
  background-clip: padding-box, border-box;
}

.option span:first-of-type {
  flex: 1;
}

.badge {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-contrast);
  background: var(--accent-gradient);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

/* Inverse of the "Most popular" tag: teal lettering on black */
.badge-invert {
  background: #000000;
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ---------- Errors ---------- */

.field-error {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--error);
}

.field-error:empty {
  display: none;
}

.text-input:invalid.touched,
.select-input:invalid.touched {
  border-color: var(--error);
}

/* ---------- Thank you / error screens ---------- */

.thankyou,
.error-screen {
  width: 100%;
  text-align: center;
}

.thankyou-title {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 16px;
  background: linear-gradient(180deg, var(--heading-top) 0%, var(--heading-bottom) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.thankyou-message {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

.error-screen .error-message {
  font-size: 18px;
  color: var(--text);
  margin: 0 0 24px;
}

.error-screen .btn-primary {
  margin: 0 auto;
}

/* ---------- Nav buttons ---------- */

.form-nav {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.btn-primary,
.btn-secondary {
  border-radius: var(--radius-btn);
  padding: 16px 32px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 200ms var(--ease), color 200ms var(--ease), opacity 200ms var(--ease), border-color 200ms var(--ease), filter 200ms var(--ease), box-shadow 200ms var(--ease), transform 200ms var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--accent-contrast);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: auto;
}

.btn-primary::after {
  content: "→";
}

.btn-primary.is-loading::after {
  content: none;
}

.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary.is-loading {
  opacity: 0.75;
  cursor: progress;
}

.btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 20px 24px 32px;
}

.site-footer p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */

@media (min-width: 640px) {
  .question-label {
    font-size: 36px;
  }

  .form-stage {
    padding-top: 120px;
    padding-bottom: 80px;
  }

  .text-input,
  .select-input {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .btn-primary,
  .btn-secondary {
    padding: 14px 24px;
    font-size: 14px;
  }

  /* Keep all 9 dots on one line on narrow phones */
  .progress-dot {
    width: 26px;
    height: 26px;
    border-width: 1.5px;
    font-size: 11px;
  }

  .progress-line {
    left: 13px;
    right: 13px;
  }
}

/* ---------- Language switch ---------- */

.site-header { position: relative; align-items: center; }

.lang-switch {
  position: absolute;
  right: 20px;
  top: 41px;
  transform: translateY(-50%);
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.lang-switch button {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.lang-switch button.active {
  background: var(--accent-gradient);
  color: var(--accent-contrast);
}

.lang-switch button:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }

.thankyou-link-wrap { margin-top: 24px; }
.thankyou-link { display: inline-block; text-decoration: none; }
