/*
 * The residency application (apply.html). Loaded after styles.css and
 * site.css, on this page only; tokens from styles.css, nothing new.
 */

.apply {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px 48px;
  align-items: start;
}

@media (min-width: 960px) {
  .apply {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .stepper {
    position: sticky;
    top: 96px;
  }
}

/* ---- Steps ---------------------------------------------------------------- */

.stepper ol {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}

@media (min-width: 960px) {
  .stepper ol {
    flex-direction: column;
    overflow: visible;
  }
}

.stepper button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 12px 6px 6px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.stepper button:hover:not(:disabled) {
  background: var(--surface);
}

.stepper button:disabled {
  color: var(--ink-faint);
  cursor: default;
}

.stepper button[aria-current="step"] {
  border-color: var(--line-strong);
  background: var(--surface);
}

.stepper button:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

.stepper__n {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
}

.stepper button.is-done .stepper__n,
.stepper button[aria-current="step"] .stepper__n {
  border-color: var(--line-strong);
  background: var(--accent);
  color: var(--on-accent);
}

.stepper__bar {
  height: 6px;
  margin-top: 12px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.stepper__bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 300ms ease;
}

/* ---- The form ------------------------------------------------------------- */

.apply__form {
  padding: 28px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
}

@media (max-width: 600px) {
  .apply__form {
    padding: 18px;
  }
}

.apply__step {
  display: grid;
  gap: 20px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  animation: stub-in 240ms ease both;
}

.apply__step > legend {
  float: left;
  width: 100%;
  margin-bottom: 4px;
  padding: 0;
}

.apply__step > legend:focus {
  outline: none;
}

.apply__columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px 32px;
}

@media (min-width: 760px) {
  .apply__columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.apply__columns .t-heading,
.apply__note .t-heading {
  margin-bottom: 4px;
}

.apply__note {
  padding: 18px 20px;
  border-left: 6px solid var(--accent);
  background: var(--paper);
}

/* ---- Choices: every radio and checkbox is a pill -------------------------- */

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choices--stack {
  flex-direction: column;
  align-items: flex-start;
}

.choice {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  transition: background 120ms ease, transform 120ms ease;
}

.choice:hover span {
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.choice input:checked + span {
  background: var(--ink);
  color: var(--on-ink);
}

.choice input[type="checkbox"]:checked + span::before {
  content: "\2713";
  color: var(--on-ink-accent);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

.agree {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: var(--accent-soft);
  font-weight: 600;
  cursor: pointer;
}

.agree input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--ink);
}

.field__input--tall {
  min-height: 170px;
}

.field__input--signature {
  font-family: var(--display);
  font-size: 22px;
  text-transform: uppercase;
}

.apply__date {
  display: flex;
  align-items: center;
  min-height: 48px;
  font-weight: 600;
}

.field.is-invalid .field__input,
.agree.is-invalid,
.field.is-invalid .dropzone,
.field.is-invalid .choice span {
  border-color: var(--danger);
}

.field__error {
  color: var(--danger);
  font-weight: 600;
}

/* ---- Files ---------------------------------------------------------------- */

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 150px;
  padding: 24px;
  border: 2px dashed var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  text-align: center;
  cursor: pointer;
  transition: background 120ms ease;
}

.dropzone:hover,
.dropzone.is-over {
  background: var(--accent-soft);
}

.dropzone:focus-within {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone__title {
  font-family: var(--display);
  font-weight: 900;
  font-size: 20px;
  text-transform: uppercase;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.thumbs--small {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border: 2px solid var(--line-strong);
  background: var(--surface-sunken);
}

/* A portfolio preview is shown whole, never cropped or stretched. */
.thumb img {
  width: 100%;
  height: 100%;
  padding: 4px;
  object-fit: contain;
}

.thumb__n {
  position: absolute;
  left: 4px;
  top: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 11px;
  font-weight: 700;
}

.thumb__remove {
  position: absolute;
  right: -10px;
  top: -10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.thumb__remove:hover {
  background: var(--danger);
  color: var(--on-ink);
}

/* ---- Terms and review ----------------------------------------------------- */

.terms {
  max-height: 420px;
  overflow-y: auto;
  padding: 4px 20px 16px;
  border: 2px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  font-size: 14px;
  line-height: 22px;
}

.terms .t-heading {
  margin-top: 16px;
  font-size: 15px;
}

.terms ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.terms:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 2px;
}

.review {
  display: grid;
  gap: 16px;
}

.review__part {
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 4px;
}

.review__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.review__head .more-link {
  border: 0;
  background: none;
  cursor: pointer;
}

.review__list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
}

.review__list .fact {
  grid-template-columns: 140px minmax(0, 1fr);
}

.apply__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.apply__actions [data-next],
.apply__actions [data-send] {
  margin-left: auto;
}

.apply__done {
  grid-column: 1 / -1;
  max-width: 720px;
  padding: 32px;
  border: 2px solid var(--line-strong);
  border-left: 10px solid var(--accent);
  border-radius: 4px;
  background: var(--surface);
}

.apply__done .t-title {
  margin: 6px 0 12px;
}

.apply__done:focus {
  outline: none;
}

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

/* The board application's consent boxes (board-application.html). */
.apply__consents {
  display: grid;
  gap: 12px;
  margin-top: 32px;
}
