/* ch284: application forms (/apply/student.php, /apply/job.php). Builds on site.css. */
.appform { max-width: 980px; margin: 0 auto; }

/* Cambridge mark in the empty side of the student application banner */
.apply-page .masthead-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(24px, 4vw, 72px);
}
.apply-page .masthead-copy { min-width: 0; max-width: 720px; }
.apply-page .masthead-mark { margin: 0; flex: none; }
.apply-page .masthead-mark img {
  display: block;
  width: clamp(168px, 24vw, 260px);
  height: auto;
  background: #fff;
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .22);
}
@media (max-width: 720px) {
  .apply-page .masthead-split { flex-direction: column; align-items: stretch; gap: 18px; }
  .apply-page .masthead-mark { align-self: flex-end; }
  .apply-page .masthead-mark img { width: min(210px, 64vw); padding: 10px 12px 8px; border-radius: 14px; }
}

/* progress + steps rail */
.app-progress { height: 4px; background: var(--hair); border-radius: 4px; overflow: hidden; margin-bottom: 18px; }
.app-progress span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .4s var(--ease); }
.app-rail { list-style: none; margin: 0 0 30px; padding: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.app-rail::-webkit-scrollbar { display: none; }
.app-rail li { flex: 1 0 auto; }
.app-rail button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--cream-hi);
  font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.app-rail .n {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--hair); color: var(--navy); font-size: 13px; font-weight: 800; flex: none;
}
.app-rail button.is-on { border-color: var(--navy); color: var(--navy); background: #fff; }
.app-rail button.is-on .n { background: var(--navy); color: #fff; }
.app-rail button.is-done .n { background: var(--gold); color: var(--navy); }
.app-rail button.has-err { border-color: #b3261e; }
.app-rail button.has-err .n { background: #b3261e; color: #fff; }

/* steps */
.app-step { border: 0; margin: 0; padding: clamp(18px, 3vw, 34px); min-width: 0; display: none;
  background: #fff; border-radius: 18px; box-shadow: 0 1px 2px rgba(10,27,61,.05), 0 18px 40px rgba(10,27,61,.06); }
.app-step.is-on { display: block; animation: room-in .45s var(--ease) both; }
html:not(.js) .app-step { display: block; margin-bottom: 24px; }
.app-step__title { float: left; width: 100%; padding: 0; margin-bottom: 8px; font-family: var(--f-display); font-size: clamp(24px, 3vw, 32px); font-weight: 400; color: var(--navy); }
.app-step__title span { display: block; font-family: var(--f-ui); font-size: 11px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-ink); margin-bottom: 4px; }
[dir=rtl] .app-step__title, [dir=rtl] .app-step__title span { font-family: var(--f-ar); letter-spacing: 0; }
.app-step__title + * { clear: both; }
.app-step .hint { color: var(--muted); margin: 0 0 6px; font-size: 15px; }
.app-step .hint--req { font-size: 13px; margin-bottom: 20px; }

/* fields */
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fld[hidden] { display: none; }
.fld .lbl { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.fld .req { color: #b3261e; }
.fld input[type=text], .fld input[type=email], .fld input[type=tel], .fld input[type=date], .fld input[type=month], .fld select, .fld textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--cream-hi); color: var(--ink); font: inherit; font-size: 16px; transition: border-color .2s, box-shadow .2s, background .2s;
}
.fld textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: none; border-color: var(--navy); background: #fff; box-shadow: 0 0 0 3px rgba(212,160,23,.35); }
[dir=rtl] .fld input[dir=ltr] { text-align: right; }
.fld .help { margin: 0; font-size: 13px; color: var(--muted); }
.err { margin: 0; font-size: 13.5px; font-weight: 600; color: #b3261e; min-height: 0; }
.err:empty { display: none; }
.fld.is-bad input, .fld.is-bad select, .fld.is-bad textarea { border-color: #b3261e; background: #fff7f6; }
.fld.is-good input, .fld.is-good select { border-color: #2f7d4f; }
.warn { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--gold-ink); background: rgba(212,160,23,.14); padding: 8px 12px; border-radius: 10px; }
.suggest { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; cursor: pointer; font-weight: 700; }

/* choice chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; cursor: pointer; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-flex; align-items: center; min-height: 42px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--cream-hi); font-size: 15px; font-weight: 600; color: var(--ink); transition: all .15s;
}
.chip input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(212,160,23,.5); }
.fld.is-bad .chip span { border-color: #b3261e; }

/* repeat rows (brothers / sisters, jobs) */
.rows { display: grid; gap: 12px; }
.row-card { border: 1px dashed var(--line); border-radius: 14px; padding: 14px; background: var(--cream-hi); }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.row-head b { color: var(--navy); }
.row-del { background: none; border: 0; color: #b3261e; font: inherit; font-weight: 700; cursor: pointer; padding: 6px; }
.row-add { justify-self: start; align-self: flex-start; margin-top: 4px; }

/* review */
.review { display: grid; gap: 14px; margin: 14px 0 6px; }
.review section { border: 1px solid var(--hair); border-radius: 14px; padding: 14px 16px; }
.review h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 8px; font-size: 16px; color: var(--navy); }
.review h3 button { background: none; border: 0; color: var(--gold-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.review dl { margin: 0; display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 6px 14px; font-size: 14.5px; }
.review dt { color: var(--muted); }
.review dd { margin: 0; font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.review .bad { color: #b3261e; }

.app-step .agree span { font-weight: 600; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* done */
.app-done { text-align: center; padding: clamp(30px, 6vw, 60px) 20px; background: #fff; border-radius: 18px; box-shadow: 0 18px 40px rgba(10,27,61,.08); }
.app-done__tick { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; background: #2f7d4f; color: #fff; font-size: 36px; }
.app-done h2 { margin: 0 0 10px; color: var(--navy); }
.app-done .muted { color: var(--muted); max-width: 52ch; margin: 0 auto 22px; }

@media (max-width: 720px) {
  .app-rail .t { display: none; }
  .app-rail button.is-on .t { display: inline; }
  .app-rail li { flex: 0 0 auto; }
  .review dl { grid-template-columns: 1fr; gap: 2px; }
  .review dd { margin-bottom: 8px; }
}
