/* 6.4 Complete your application (join-application.html), inside the public shell (ux §3.1).
   One card, a column 7/12 wide on computers: the notice, then the form (contact details, about you, how you'll help,
   why you're joining) and the two buttons. ICCF rules applied (27 Sep 2026): Inter text, colour tokens only, no
   shadow, 6px corners, field borders at least 3:1 (color/border), a 3px focus ring on every control, option text
   16px with 48px rows, buttons in sentence case.
   Loads after css/app.css, css/shell/public-form.css (container and base text), components/icon.css and
   components/steps.css; the states use components/banner.css and components/field-error.css. */

/* ---------- Section and column ---------- */

.profile_section {
  padding-top: 60px;
  padding-bottom: 60px;
}

@media (min-width: 576px) {
  .profile_section {
    padding-top: 80px;
    padding-bottom: 80px;
  }
}

@media (min-width: 992px) {
  .profile_section {
    padding-top: 120px;
    padding-bottom: 120px;
  }
}

.profile_row,
.profile_grid {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.75rem;
  margin-left: -0.75rem;
}

.profile_row {
  justify-content: center;
}

.profile_row > *,
.profile_grid > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

@media (min-width: 992px) {
  .profile_col {
    flex: 0 0 auto;
    width: 58.3333%;
  }
}

/* Half-width fields from 576px (age, gender, education, occupation) or 768px (country, WhatsApp number);
   thirds from 768px (emergency contact) */
@media (min-width: 576px) {
  .profile_grid > .is_half_sm {
    flex: 0 0 auto;
    width: 50%;
  }
}

@media (min-width: 768px) {
  .profile_grid > .is_half_md {
    flex: 0 0 auto;
    width: 50%;
  }

  .profile_grid > .is_third_md {
    flex: 0 0 auto;
    width: 33.3333%;
  }
}

/* ---------- Card ---------- */

.profile_card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-color: var(--color-bg);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

.profile_card__body {
  flex: 1 1 auto;
  padding: 24px;
  border-radius: var(--radius);
}

/* ---------- The notice at the top ---------- */

.profile_notice {
  position: relative;
  margin: 0 0 1rem;
  padding: 17px 24px;
  font-weight: var(--_font-weight---regular);
  color: var(--color-warning);
  background-color: var(--color-bg);
  border: 1px solid var(--color-warning-bg);
  border-radius: var(--radius);
}

@media screen and (max-width: 991px) {
  .profile_notice {
    padding: 16px;
  }
}

@media screen and (max-width: 575px) {
  .profile_notice {
    padding: 12px;
  }
}

.profile_notice strong {
  font-weight: var(--_font-weight---bold);
}

/* The states (error summary, saved, unsaved work) sit under the notice */
.profile_card__body > .banner {
  margin-bottom: 1rem;
}

/* ---------- Headings ---------- */

.profile_heading {
  margin: 1rem 0;
  font-family: var(--geist);
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: var(--_font-weight---bold);
  letter-spacing: normal;
  color: var(--color-text);
}

.profile_heading.is_first {
  margin-top: 0.5rem;
}

.profile_subheading {
  margin: 0.5rem 0 0.75rem;
  font-family: var(--geist);
  font-size: 1.125rem;
  line-height: 1.4;
  font-weight: var(--_font-weight---bold);
  letter-spacing: normal;
  color: var(--color-text);
}

/* ---------- Fields ---------- */

.profile_group {
  margin-bottom: 1rem;
}

.profile_label {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: var(--_font-weight---regular); /* the shell's base makes labels bold */
}

.profile_input {
  display: inline-block;
  width: 100%;
  padding: 13px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: var(--_font-weight---regular);
  line-height: 1;
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  outline: none;
}

.profile_input:not(textarea):not([type="file"]) {
  height: 47px;
}

.profile_input:focus {
  border-color: var(--color-primary);
}

.profile_input:focus-visible,
.profile_select:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}

.profile_input[aria-invalid="true"],
.profile_select[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.profile_input::placeholder {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.profile_input::-webkit-outer-spin-button,
.profile_input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
}

/* Profile photo: the file field and its blue "Choose file" button, then a preview */
.profile_input[type="file"] {
  position: relative;
  height: auto;
  padding: 0;
  line-height: 47px;
  cursor: pointer;
}

.profile_input[type="file"]::file-selector-button {
  min-height: 36px;
  margin: 0 0.75rem 0 0.5rem;
  padding: 4px 12px;
  font: inherit;
  font-weight: var(--_font-weight---bold);
  line-height: 26px;
  color: var(--color-bg);
  background-color: var(--color-primary);
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

@media (hover: hover) {
  .profile_input[type="file"]:hover::file-selector-button {
    background-color: var(--color-primary-dark);
  }
}

.profile_preview {
  margin-top: 1rem;
}

.profile_preview img {
  width: 200px;
  height: 160px;
  object-fit: cover;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius);
}

/* Long answers */
textarea.profile_input {
  height: 130px;
  line-height: 1.5;
  resize: vertical;
}

/* A native <select> with a small down arrow */
.profile_select_wrap {
  position: relative;
  display: block;
}

.profile_select {
  display: block;
  width: 100%;
  height: 47px;
  padding: 0 20px 0 16px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.profile_select:focus {
  border-color: var(--color-primary);
}

.profile_select_wrap::after {
  content: "";
  position: absolute;
  top: calc(50% + 1px);
  right: 7px;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-style: solid;
  border-width: 5px 4px 0;
  border-color: var(--color-text-muted) transparent transparent;
  pointer-events: none;
}

/* WhatsApp number: the dial code joined to the number field */
.profile_input_group {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  width: 100%;
}

.profile_input_group__code {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: var(--_font-weight---regular);
  line-height: 1.5;
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-right-width: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  transition: border-color 0.15s linear;
}

.profile_input_group > .profile_input {
  position: relative;
  display: block;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
  margin-left: -1px;
  padding-left: 0;
  border-left-width: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.profile_input_group > .profile_input:focus {
  z-index: 5;
}

.profile_input_group:has(.profile_input:focus) .profile_input_group__code {
  border-color: var(--color-primary);
}

/* Hints under a field, and character counts */
.profile_help {
  margin-bottom: 0.25rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.profile_count {
  display: block;
}

.profile_hint {
  margin: 0 0 1rem;
}

/* "… is already used by another account", printed by the server */
.profile_exists {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-danger);
}

.profile_link,
.profile_link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ---------- Choices (radio buttons and tick boxes) ---------- */

.profile_fieldset {
  min-width: 0;
  margin: 0 0 1rem;
  border: 0;
}

.profile_fieldset > .profile_label {
  padding: 0;
}

/* A fieldset holding fields (emergency contact): the fields keep their own spacing */
.profile_fieldset:has(> .profile_grid) {
  margin-bottom: 0;
}

.profile_choices {
  display: flex;
  flex-direction: column;
}

.profile_choices.is_inline {
  flex-direction: row;
  flex-wrap: wrap;
  column-gap: 1.5rem;
}

/* Each option is a row at least 48px tall; the label (the whole text) is the tap target (ux C3) */
.profile_check {
  display: flex;
  align-items: flex-start;
}

.profile_check__input {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 14px 0 0;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.profile_check__input[type="radio"] {
  border-radius: 50%;
}

.profile_check__input:checked[type="checkbox"] {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

/* The tick */
.profile_check__input:checked[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid var(--color-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.profile_check__input:checked[type="radio"] {
  border-color: var(--color-primary);
}

.profile_check__input:checked[type="radio"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  background-color: var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

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

.profile_check__input[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.profile_check__label {
  min-height: var(--tap-min);
  padding: 12px 0 12px 12px;
  font-size: 1rem;
  line-height: 1.5;
  font-weight: var(--_font-weight---semibold);
  color: var(--color-text);
  cursor: pointer;
}

/* The line under a choice's title (join as, membership category) */
.profile_check__detail {
  display: block;
  font-weight: var(--_font-weight---regular);
  color: var(--color-text-muted);
}

/* The policy ticks and the consent tick read as sentences, in normal weight */
#policies .profile_check__label,
.profile_check__label[for="consent"] {
  font-weight: var(--_font-weight---regular);
}

/* ---------- Buttons: Save and finish later, Send my application ---------- */

.profile_actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
}

@media (min-width: 576px) {
  .profile_actions {
    flex-direction: row;
  }

  .profile_actions .profile_submit {
    flex: 1 1 0;
  }
}

.profile_submit {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: 100%;
  min-height: var(--tap-min);
  padding: 19px 29px;
  padding-block: clamp(0.8rem, 0.8862rem + 0.5688vw, 1.3125rem);
  font-family: inherit;
  font-size: 1rem;
  font-weight: var(--_font-weight---bold);
  line-height: 1;
  text-align: center;
  vertical-align: middle;
  color: var(--color-bg);
  background-color: var(--color-primary);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

/* On hover the darker blue slides in from the left */
.profile_submit::after {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  background: var(--color-primary-dark);
  border-radius: var(--radius);
  transform: scaleX(0);
  transform-origin: right bottom;
  transition: transform 0.3s;
}

.profile_submit:hover::after {
  transform: scaleX(1);
  transform-origin: left bottom;
}

.profile_submit:active {
  top: 1px;
}

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

/* Save and finish later: outline; fills with ICCF blue on hover */
.profile_submit.is_outline {
  color: var(--color-primary);
  background-color: var(--color-bg);
  border-color: var(--color-primary);
}

.profile_submit.is_outline::after {
  background: var(--color-primary);
}

.profile_submit.is_outline:hover {
  color: var(--color-bg);
}

@media screen and (max-width: 767px) {
  .profile_submit {
    padding: 14px 25px;
    padding-block: clamp(0.8rem, 0.8862rem + 0.5688vw, 1.3125rem);
  }
}

@media screen and (max-width: 575px) {
  .profile_submit {
    padding: 12px 20px;
    padding-block: clamp(0.8rem, 0.8862rem + 0.5688vw, 1.3125rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .profile_submit,
  .profile_submit::after,
  .profile_input_group__code {
    transition: none;
  }
}
