/* ==========================================================================
   Components — form card, stepper, option cards, fields, CTA
   Depends on: tokens.css, base.css

   Figma nodes: card 0:98 · stepper 0:143 · question+options 0:100 · CTA 0:138
   ========================================================================== */

/* --------------------------------------------------------------------------
   Form card
   -------------------------------------------------------------------------- */
.form-card {
  /* 77px above the stepper, 52px sides, 37px below at 1920 */
  --card-pad-top: clamp(1.25rem, 0.9rem + 2.4vw, 4.813rem);

  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--card-pad-top)
           clamp(1.25rem, 0.9rem + 2.2vw, 3.25rem)
           clamp(1.5rem, 1.1rem + 1.7vw, 2.313rem);
  /* The design card is a fixed 893px at 1920. Holding a minimum keeps the
     card from resizing as steps of different lengths swap in. */
  min-height: clamp(24rem, 46.5vw, 55.813rem);
  background: var(--c-card);
  border-radius: clamp(0.75rem, 0.6rem + 0.8vw, 1.5rem);  /* 24px */
  box-shadow: var(--shadow-card);
  color: var(--c-q-title);
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Card header — stepper on the left, step illustration on the right
   -------------------------------------------------------------------------- */
.form-card__head {
  /* 85px between the stepper and the question in the design */
  margin-block-end: clamp(1.25rem, 0.9rem + 2.2vw, 5.333rem);
}

.form-card__stepper {
  /* Stepper spans 816px of the 1315px card; the illustration sits in the
     remaining top-right corner. */
  max-width: 64%;
  min-width: 0;
}

/* Absolutely placed, exactly as in the design, so it never pushes the
   question down the card. */
.form-card__art {
  position: absolute;
  top: 0;
  inset-inline-end: clamp(0.5rem, 0.3rem + 2.3vw, 2.813rem);  /* 45px */
  width: clamp(4.5rem, 18.65vw, 22.375rem);                   /* 358px */
  pointer-events: none;
  user-select: none;
}

.form-card__art img {
  width: 100%;
  height: auto;
}

/* Steps 6, 8 and 9 have no illustration in the design. */
.form-card__art--empty { display: none; }

@media (max-width: 767.98px) {
  .form-card__stepper { max-width: 100%; }
  .form-card__art { width: 4.5rem; margin-block-start: -0.5rem; }
}

/* --------------------------------------------------------------------------
   Stepper
   -------------------------------------------------------------------------- */
.stepper {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: clamp(0.5rem, 0.4rem + 0.6vw, 1.125rem);
}

.stepper__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.25rem, 0.2rem + 0.3vw, 0.596rem);  /* 9.542 */
  width: clamp(3.75rem, 3rem + 2vw, 6.361rem);    /* 101.782 label width */
}

.stepper__badge {
  display: grid;
  place-items: center;
  width: var(--step-badge);
  height: var(--step-badge);
  border-radius: 50%;
  border: 1px solid transparent;
  font-size: var(--fs-step-num);
  font-weight: var(--fw-semi);
  line-height: 1;
  transition: background-color var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

.stepper__label {
  font-size: var(--fs-step-label);
  font-weight: var(--fw-book);
  line-height: 1.15;
  text-align: center;
}

/* Active stage */
.stepper__stage[data-state="active"] .stepper__badge {
  background: var(--c-step-on);
  color: var(--c-white);
}

.stepper__stage[data-state="active"] .stepper__label {
  color: var(--c-step-on);
}

/* Upcoming stage */
.stepper__stage[data-state="upcoming"] .stepper__badge {
  background: transparent;
  border-color: rgba(71, 71, 71, 0.35);
  color: var(--c-step-off);
}

.stepper__stage[data-state="upcoming"] .stepper__label {
  color: var(--c-step-label);
}

/* Progress track — one segment per step, vertically centred on the badges.
   The design draws a single continuous bar; splitting it into segments lets
   the control show which of the ten steps you are on at a glance. */
.stepper__track {
  display: flex;
  gap: clamp(2px, 0.2vw, 4px);
  height: var(--track-h);
  margin-block-start: calc((var(--step-badge) - var(--track-h)) / 2);
}

.stepper__seg {
  flex: 1 1 0;
  min-width: 0;
  border-radius: var(--r-pill);
  background: var(--c-track);
  transition: background-color var(--dur-base) var(--ease-out);
}

.stepper__seg.is-done {
  background: linear-gradient(90deg, #083783 0%, #0a4ba8 60%, #0a5fd0 100%);
}

/* --------------------------------------------------------------------------
   Question
   -------------------------------------------------------------------------- */
.question {
  margin-block-end: clamp(1.25rem, 1rem + 1.6vw, 3.875rem);
}

.question__title {
  font-size: var(--fs-question);
  font-weight: var(--fw-book);
  line-height: 1.34;                 /* 43px on 32px */
  color: var(--c-q-title);
  text-wrap: balance;
}

.question__sub {
  margin-block-start: clamp(0.375rem, 0.3rem + 0.5vw, 1.188rem);  /* 19 */
  font-size: var(--fs-question-s);
  font-weight: var(--fw-book);
  line-height: 1.35;
  color: var(--c-q-sub);
}

/* --------------------------------------------------------------------------
   Option grid
   -------------------------------------------------------------------------- */
.options {
  display: grid;
  gap: var(--option-gap);
}

/* Two-up on wide screens; the design uses a single column for long labels. */
.options--two {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .options--two { grid-template-columns: 1fr 1fr; }
}

.options--one { grid-template-columns: 1fr; }

/* --------------------------------------------------------------------------
   Option card
   --------------------------------------------------------------------------
   The whole card is the label, so the entire surface is clickable. The real
   input sits visually hidden inside but stays focusable, which keeps keyboard
   and screen-reader behaviour native.
   -------------------------------------------------------------------------- */
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(0.625rem, 0.5rem + 0.8vw, 1.494rem);   /* 23.898 */
  /* Radio cards sit at ~104px in the design; the icon-badge variant below
     takes the taller 124px box. Vertical padding is derived from the box
     rather than the Figma frame padding, which measures an inner group. */
  min-height: clamp(3.5rem, 2.8rem + 1.6vw, 6.5rem);
  padding-block: clamp(0.75rem, 0.65rem + 0.5vw, 1.125rem);
  padding-inline: clamp(0.75rem, 0.6rem + 1.4vw, 2.261rem);  /* 36.17 */
  background: var(--c-navy-900);
  border: 1px solid var(--border-panel);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
  cursor: pointer;
  backdrop-filter: blur(3.229px);
  -webkit-backdrop-filter: blur(3.229px);
  transition: border-color var(--dur-base) var(--ease-out),
              box-shadow   var(--dur-base) var(--ease-out),
              transform    var(--dur-fast) var(--ease-out);
}

.option:hover {
  border-color: rgba(0, 170, 255, 0.55);
  box-shadow: 0 0 0.75rem rgba(7, 171, 217, 0.32);
  transform: translateY(-1px);
}

.option:active { transform: translateY(0); }

.option__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

/* Keyboard focus lands on the hidden input — surface it on the card. */
.option__input:focus-visible ~ .option__ring,
.option__input:focus-visible ~ .option__badge {
  outline: 2px solid var(--c-cyan);
  outline-offset: 3px;
}

.option:has(.option__input:focus-visible) {
  border-color: var(--c-cyan);
  box-shadow: var(--shadow-focus);
}

/* Selected — a 6px cyan edge in the design. Rendered as a 1px border plus an
   inset ring so selecting an option never reflows the grid. */
.option:has(.option__input:checked) {
  border-color: var(--c-cyan);
  box-shadow: inset 0 0 0 5px var(--c-cyan), var(--shadow-panel);
}

.option__label {
  font-size: var(--fs-option);
  font-weight: var(--fw-medium);
  line-height: 1.25;
  letter-spacing: var(--ls-option);
  color: var(--c-white);
}

/* Long, sentence-length labels step down a size, as in the design. */
.options--one .option__label,
.option--long .option__label {
  font-size: var(--fs-option-sm);
  font-weight: var(--fw-medium);
  letter-spacing: 0.01em;
}

/* ---- Icon badge variant (step 1) ---- */
.option--cards {
  min-height: var(--option-h);   /* 124px */
}

.option__badge {
  display: grid;
  place-items: center;
  width: var(--icon-badge);
  height: var(--icon-badge);
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--grad-icon);
}

.option__glyph {
  width: 59%;      /* 43px glyph in a 72.379px badge */
  height: 59%;
  background: var(--c-white);
}

/* ---- Radio ring variant (all other choice steps) ---- */
.option__ring {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(1.125rem, 1rem + 0.5vw, 1.5rem);
  height: clamp(1.125rem, 1rem + 0.5vw, 1.5rem);
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  transition: border-color var(--dur-base) var(--ease-out);
}

.option__ring::after {
  content: "";
  width: 55%;
  height: 55%;
  border-radius: 50%;
  background: var(--c-radio, #ea2e39);
  transform: scale(0);
  transition: transform var(--dur-base) var(--ease-out);
}

.option:has(.option__input:checked) .option__ring {
  border-color: #ea2e39;
}

.option:has(.option__input:checked) .option__ring::after {
  transform: scale(1);
}

/* --------------------------------------------------------------------------
   Rating slider (English ability, design "Option 1")
   -------------------------------------------------------------------------- */
.rating {
  padding: clamp(1rem, 0.8rem + 1.5vw, 2.5rem)
           clamp(1rem, 0.8rem + 1.6vw, 2.75rem);
  background: var(--c-navy-900);
  border: 1px solid var(--border-panel);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-panel);
}

.rating__ends {
  display: flex;
  justify-content: space-between;
  margin-block-end: clamp(0.75rem, 0.6rem + 0.8vw, 1.5rem);
  font-size: var(--fs-option-sm);
  font-weight: var(--fw-medium);
  color: var(--c-white);
}

.rating__control {
  position: relative;
  padding-block: 0.5rem;
}

/* Native range, restyled. Keeping the native input means keyboard, touch and
   screen-reader support come for free. */
.rating__input {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 1.5rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.rating__input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.28);
}

.rating__input::-moz-range-track {
  height: 4px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.28);
}

.rating__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.375rem;
  height: 1.375rem;
  margin-block-start: calc((4px - 1.375rem) / 2);
  border: 0;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

.rating__input::-moz-range-thumb {
  width: 1.375rem;
  height: 1.375rem;
  border: 0;
  border-radius: 50%;
  background: var(--c-white);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.rating__input:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px rgba(0, 170, 255, 0.6);
}

/* Tick marks under the track */
.rating__scale {
  display: flex;
  justify-content: space-between;
  margin-block-start: 0.5rem;
  font-size: var(--fs-hint);
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Text fields (contact step)
   -------------------------------------------------------------------------- */
.form-fields {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 0.85rem + 0.9vw, 1.75rem);
}

.field {
  display: flex;
  flex-direction: column;
  gap: clamp(0.375rem, 0.32rem + 0.35vw, 0.625rem);
}

.field__label {
  font-size: var(--fs-field-lbl);
  font-weight: var(--fw-medium);
  color: var(--c-q-title);
}

.field__label .req { color: var(--c-red); }

.field__input,
.field__select {
  width: 100%;
  padding: clamp(0.625rem, 0.55rem + 0.5vw, 1rem)
           clamp(0.75rem, 0.65rem + 0.6vw, 1.125rem);
  background: transparent;
  border: 1px solid var(--c-field-bd);
  border-radius: var(--r-field);
  font-size: var(--fs-field);
  color: var(--c-q-title);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.field__input::placeholder { color: var(--c-grey-500); }

.field__input:hover,
.field__select:hover { border-color: #8f8f8f; }

.field__input:focus,
.field__select:focus {
  outline: none;
  border-color: var(--c-cyan);
  box-shadow: var(--shadow-focus);
}

.field__select {
  appearance: none;
  padding-inline-end: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23464646' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

/* Phone field: country prefix + number share one bordered box. */
.field__phone {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--c-field-bd);
  border-radius: var(--r-field);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.field__phone:focus-within {
  border-color: var(--c-cyan);
  box-shadow: var(--shadow-focus);
}

.field__phone .field__select {
  width: auto;
  flex: 0 0 auto;
  border: 0;
  border-inline-end: 1px solid var(--c-field-bd);
  border-radius: 0;
  background-color: rgba(0, 0, 0, 0.03);
}

.field__phone .field__input {
  border: 0;
  border-radius: 0;
  flex: 1 1 auto;
}

.field__phone .field__select:focus,
.field__phone .field__input:focus {
  box-shadow: none;
}

.field__hint {
  font-size: var(--fs-hint);
  color: var(--c-q-sub);
}

/* ---- File drop zone ---- */
.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: clamp(1.5rem, 1.2rem + 2vw, 3rem) 1rem;
  border: 1px dashed #a8a8a8;
  border-radius: var(--r-field);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease-out),
              background-color var(--dur-base) var(--ease-out);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--c-cyan);
  background: rgba(0, 170, 255, 0.06);
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: #cfd6de;
  color: #5b6b7d;
}

.dropzone__icon svg { width: 1.5rem; height: 1.5rem; }

.dropzone__text {
  font-size: var(--fs-field);
  color: var(--c-q-sub);
}

.dropzone__text b {
  color: var(--c-cyan);
  font-weight: var(--fw-medium);
}

/* ---- Consent ---- */
.consent__text {
  font-size: var(--fs-field);
  line-height: 1.6;
  color: var(--c-q-title);
}

.choice {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  font-size: var(--fs-field);
  color: var(--c-q-title);
}

.choice input {
  flex-shrink: 0;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--c-cyan);
  cursor: pointer;
}

/* ---- Field error ---- */
.field__error {
  margin: 0;
  font-size: var(--fs-hint);
  font-weight: var(--fw-medium);
  color: var(--c-error);
}

.field__error[hidden] { display: none; }

.field.is-invalid .field__input,
.field.is-invalid .field__select,
.field.is-invalid .field__phone,
.field.is-invalid .dropzone {
  border-color: var(--c-error);
  background-color: var(--c-error-bg);
}

/* --------------------------------------------------------------------------
   Card footer / CTA
   -------------------------------------------------------------------------- */
.form-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* Pinned to the bottom of the fixed-height card, as in the design. */
  margin-block-start: auto;
  padding-block-start: clamp(1.5rem, 1.2rem + 2.2vw, 4.5rem);
}

/* `display: flex` above outranks the UA rule for [hidden], so hiding the
   footer after submission needs to be stated explicitly. */
.form-card__foot[hidden] { display: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: clamp(0.625rem, 0.55rem + 0.4vw, 0.875rem)
           clamp(0.875rem, 0.75rem + 0.7vw, 1.375rem);
  min-height: 2.75rem;
  border-radius: var(--r-cta);
  background: var(--c-red);
  color: var(--c-white);
  font-size: var(--fs-cta);
  font-weight: var(--fw-bold);
  line-height: 1.1;
  text-transform: capitalize;
  white-space: nowrap;
  transition: background-color var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.btn:hover {
  background: #d40001;
  transform: translateY(-1px);
  box-shadow: 0 0.5rem 1.25rem rgba(240, 0, 1, 0.32);
  text-decoration: none;
}

.btn:active { transform: translateY(0); box-shadow: none; }

.btn:disabled,
.btn.is-loading {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn__arrow {
  width: 1.16rem;   /* 18.555 */
  height: 1.16rem;
  background: currentColor;
  /* The design rotates an "arrow-up" glyph 90° to point right. */
  transform: rotate(90deg);
}

/* Back button — not in the Figma, but a multi-step form is unusable without
   one. Styled to recede so it never competes with the primary CTA. */
.btn--back {
  background: transparent;
  color: var(--c-q-sub);
  font-weight: var(--fw-medium);
  text-transform: none;
}

.btn--back:hover {
  background: rgba(2, 13, 33, 0.06);
  color: var(--c-q-title);
  transform: none;
  box-shadow: none;
}

.btn--back .btn__arrow { transform: rotate(-90deg); }

.btn--back[hidden] { display: none; }

.btn__spinner {
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 640ms linear infinite;
}

@keyframes btn-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .btn__spinner { animation-duration: 1600ms; }
}

/* --------------------------------------------------------------------------
   Form-level message
   -------------------------------------------------------------------------- */
.form__message {
  margin-block-end: 1.25rem;
  padding: 0.875rem 1.125rem;
  border: 1px solid transparent;
  border-radius: var(--r-field);
  font-size: var(--fs-hint);
  font-weight: var(--fw-medium);
}

.form__message[hidden] { display: none; }

.form__message--error {
  background: var(--c-error-bg);
  border-color: var(--c-error);
  color: var(--c-error);
}

.form__message--success {
  background: var(--c-success-bg);
  border-color: var(--c-success);
  color: var(--c-success);
}

/* --------------------------------------------------------------------------
   Steps — only the current one is in the document flow
   -------------------------------------------------------------------------- */
.step[hidden] { display: none; }

.step {
  animation: step-in var(--dur-slow) var(--ease-out);
}

@keyframes step-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .step { animation: none; }
}

/* --------------------------------------------------------------------------
   Completion panel
   -------------------------------------------------------------------------- */
.done {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding-block: clamp(2rem, 1.5rem + 3vw, 4.5rem);
  text-align: center;
}

.done__mark {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background: var(--grad-icon);
  color: var(--c-white);
  font-size: 2rem;
}

.done__title {
  font-size: var(--fs-question);
  font-weight: var(--fw-semi);
  color: var(--c-q-title);
}

.done__text {
  max-width: 46ch;
  font-size: var(--fs-question-s);
  color: var(--c-q-sub);
}
