/* Public admission form — a five-step wizard (schoolops/templates/schoolops/admission_form.html + static/mk/js/admission.js).

   Progressive enhancement: without JavaScript every step is shown one after the other and the form is simply long;
   with JavaScript (form.wiz-ready) one step is shown at a time, with a progress bar, Back / Next and a review step. */

.admit-shell { padding: 0 0 4.5rem; margin-top: -2.2rem; position: relative; z-index: 2; }
.admit-card {
  max-width: 860px; margin: 0 auto; background: #fff; border: 1px solid #ecebf7; border-radius: 28px;
  padding: clamp(1.1rem, 4vw, 2.4rem); box-shadow: 0 28px 64px -30px rgba(45, 33, 128, .45);
}
.admit-card { scroll-margin-top: 84px; }
.admit-card [hidden], .admit-card[hidden] { display: none !important; }
.admit-errors { margin: 0 0 1.2rem; }

/* ── progress ─────────────────────────────────────────────────────────── */
.wiz-progress { margin: 0 0 1.7rem; }
.wiz-count {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .75rem; margin: 0 0 .7rem;
  font-size: .78rem; font-weight: 800; color: var(--purple-600); text-transform: uppercase; letter-spacing: .07em;
}
.wiz-count strong { font-size: 1.08rem; color: var(--gray-900); text-transform: none; letter-spacing: 0; }
.wiz-bar { height: 8px; border-radius: 999px; background: var(--purple-50); overflow: hidden; }
.wiz-bar span {
  display: block; height: 100%; width: 20%; border-radius: inherit;
  background: linear-gradient(90deg, #8f82f7, #4b3cc7); transition: width .35s ease;
}
.wiz-steps { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .25rem; margin: 1.05rem 0 0; padding: 0; }
.wiz-steps li { position: relative; min-width: 0; }
.wiz-steps li + li::before {            /* the line that joins the previous dot to this one */
  content: ""; position: absolute; top: 19px; right: 50%; width: 100%; height: 2px; background: var(--gray-200); z-index: 0;
}
.wiz-steps li.is-done + li::before { background: var(--purple-400); }
.wiz-dot {
  position: relative; z-index: 1; width: 100%; display: grid; justify-items: center; gap: .4rem; padding: .1rem 0;
  background: none; border: 0; cursor: pointer; font: inherit; color: var(--gray-600);
}
.wiz-dot:disabled { cursor: default; }
.wiz-dot:focus-visible { outline: 3px solid rgba(103, 89, 232, .5); outline-offset: 3px; border-radius: 14px; }
.wiz-num {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  background: #fff; border: 2px solid var(--gray-200); color: var(--gray-600); transition: background .2s, color .2s, border-color .2s, box-shadow .2s;
}
.wiz-name { font-size: .74rem; font-weight: 700; line-height: 1.2; text-align: center; }
.wiz-sr, .wiz-dot .wiz-sr {            /* read out by screen readers, never drawn */
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.wiz-steps li.is-done .wiz-num { background: var(--purple-50); border-color: var(--purple-100); color: var(--purple-600); font-size: 0; }   /* the number gives way to a tick */
.wiz-steps li.is-done .wiz-num::before { content: "\2713"; font-size: 1.05rem; font-weight: 800; }
.wiz-steps li.is-current .wiz-num {
  background: linear-gradient(135deg, #7c6ef5, #4b3cc7); border-color: transparent; color: #fff;
  box-shadow: 0 10px 20px -10px rgba(75, 60, 199, .95);
}
.wiz-steps li.is-current .wiz-name { color: var(--purple-600); }

/* ── steps ────────────────────────────────────────────────────────────── */
form:not(.wiz-ready) .wiz-step + .wiz-step { margin-top: 2.2rem; padding-top: 2.2rem; border-top: 1px solid #eeedf4; }
form.wiz-ready .wiz-step { display: none; }
form.wiz-ready .wiz-step.is-current { display: block; animation: wiz-in .28s ease both; }
@keyframes wiz-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
html.js form[data-wizard]:not(.wiz-ready) { visibility: hidden; animation: wiz-reveal 0s 2.5s forwards; }   /* if the script never arrives, show the plain form */
@keyframes wiz-reveal { to { visibility: visible; } }

.wiz-head { display: flex; align-items: center; gap: .9rem; margin: 0 0 1.3rem; }
.wiz-head > i {
  flex: none; width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; font-size: 1.4rem;
  background: linear-gradient(135deg, var(--purple-50), #e2dcfd); color: var(--purple-600);
}
.wiz-head h2 { margin: 0; font-size: clamp(1.18rem, 2.8vw, 1.5rem); font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.wiz-head h2:focus { outline: none; }
.wiz-head p { margin: .2rem 0 0; font-size: .9rem; color: var(--gray-600); line-height: 1.5; }
.wiz-block { margin-top: 1.5rem; padding-top: 1.3rem; border-top: 1px dashed var(--gray-200); }
.wiz-block.is-first { margin-top: 0; padding-top: 0; border-top: 0; }
.wiz-block > h3 { display: flex; align-items: center; gap: .55rem; margin: 0 0 .9rem; font-size: 1rem; font-weight: 700; color: var(--gray-900); }

/* ── fields ───────────────────────────────────────────────────────────── */
.admit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admit-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admit-field { min-width: 0; }
.admit-field.full { grid-column: 1 / -1; }
.admit-field label, .admit-label { display: block; margin-bottom: .4rem; font-weight: 800; font-size: .82rem; color: #4c4a60; }
.admit-field label.is-required::after { content: " *"; color: #b42318; }
.admit-fixed { margin: 0; padding: .75rem .95rem; background: #f5f4ff; border: 1px solid #e5e3f0; border-radius: 14px; color: var(--gray-900); }
.admit-field input:not([type=checkbox]):not([type=file]), .admit-field select, .admit-field textarea {
  width: 100%; border: 1.5px solid #dcdbe7; background: #fff; border-radius: 14px; padding: .72rem .9rem; font: inherit; color: var(--gray-900);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.admit-field input:not([type=checkbox]):not([type=file]), .admit-field select { height: 48px; }
.admit-field textarea { min-height: 96px; resize: vertical; }
.admit-field input:focus, .admit-field select:focus, .admit-field textarea:focus { outline: 0; border-color: #6759e8; box-shadow: 0 0 0 4px rgba(103, 89, 232, .18); }
.admit-field [aria-invalid="true"] { border-color: #b42318; background: #fffafa; }
.admit-field [aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .15); }
.admit-field select:disabled { background: var(--gray-50); color: var(--gray-400); }
.admit-hint { display: block; margin-top: .3rem; font-size: .78rem; color: var(--gray-600); }
.field-error { display: block; margin-top: .3rem; font-size: .8rem; font-weight: 700; color: #b42318; }
.admit-optional {
  display: inline-block; font-size: .66rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; vertical-align: middle;
  padding: .12rem .55rem; border-radius: 999px; background: var(--gray-100); color: #5c5c72;
}
.admit-privacy { display: flex; gap: .7rem; align-items: flex-start; margin-top: 1.4rem; padding: 1rem 1.1rem; border-radius: 18px; background: var(--gray-50); border: 1px solid #ecebf7; color: #5d5b72; font-size: .86rem; }
.admit-privacy input[type=checkbox] { flex: none; width: 22px; height: 22px; margin-top: .1rem; accent-color: var(--purple-500); }
.admit-privacy label { font-weight: 700; }
.admit-privacy small { display: block; margin-top: .25rem; }

/* ── photograph ───────────────────────────────────────────────────────── */
.photo-box { display: flex; align-items: center; gap: 1.1rem; padding: 1rem; border: 2px dashed var(--purple-100); border-radius: 22px; background: var(--gray-50); }
.photo-preview {
  position: relative; flex: none; width: 104px; height: 104px; border-radius: 26px; overflow: hidden; display: grid; place-items: center;
  background: var(--purple-50); color: var(--purple-500); font-size: 2.2rem;
}
.photo-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-ctrl { min-width: 0; display: grid; gap: .5rem; justify-items: start; }
.photo-ctrl input[type=file] { width: 100%; max-width: 100%; height: auto; padding: 0; border: 0; background: none; font-size: .85rem; color: var(--gray-600); }
.photo-ctrl input[type=file]::file-selector-button {
  margin-right: .7rem; padding: .55rem 1rem; border: 0; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 800; font-size: .82rem;
  background: linear-gradient(135deg, #7c6ef5, #4b3cc7); color: #fff;
}
.photo-hint { margin: 0; font-size: .78rem; line-height: 1.5; color: var(--gray-600); }

/* ── review ───────────────────────────────────────────────────────────── */
.wiz-review { display: grid; gap: .9rem; }
.wiz-review:empty { display: none; }
.wiz-review-group { padding: 1rem 1.1rem; border: 1px solid #ecebf7; border-radius: 20px; background: var(--gray-50); }
.wiz-review-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.wiz-review-head h3 { margin: 0; font-size: .98rem; }
.wiz-edit { border: 0; background: none; padding: .25rem .4rem; cursor: pointer; font: inherit; font-weight: 800; font-size: .82rem; color: var(--purple-600); text-decoration: underline; }
.wiz-review-list { display: grid; grid-template-columns: minmax(0, 11.5rem) minmax(0, 1fr); gap: .4rem 1rem; margin: 0; }
.wiz-review-list dt { font-size: .8rem; font-weight: 700; color: var(--gray-600); }
.wiz-review-list dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.wiz-review-empty { margin: 0; font-size: .86rem; color: var(--gray-600); }
.wiz-review-photo { width: 76px; height: 76px; border-radius: 18px; object-fit: cover; display: block; }

/* ── navigation ───────────────────────────────────────────────────────── */
.wiz-nav { display: flex; justify-content: center; gap: .8rem; margin-top: 1.9rem; padding-top: 1.4rem; border-top: 1px solid #eeedf4; }
form.wiz-ready .wiz-nav { justify-content: space-between; }
.wiz-nav .btn { min-width: 8.5rem; }
form.wiz-ready .wiz-nav [data-wiz-next], form.wiz-ready .wiz-nav [data-wiz-submit] { margin-left: auto; }
.wiz-nav [data-wiz-submit]:disabled { opacity: .7; cursor: progress; }

@media (max-width: 720px) {
  .admit-shell { margin-top: -1.6rem; }
  .admit-grid, .admit-grid.three { grid-template-columns: minmax(0, 1fr); }
  .admit-field.full { grid-column: auto; }
  .wiz-review-list { grid-template-columns: minmax(0, 1fr); gap: .05rem; }
  .wiz-review-list dd { margin-bottom: .5rem; }
}
@media (max-width: 560px) {
  .admit-card { border-radius: 22px; }
  .wiz-name {                           /* on phones the step names make way for the "Step X of 5" line, but stay in the accessible name */
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .wiz-num { width: 32px; height: 32px; font-size: .8rem; }
  .wiz-steps li + li::before { top: 16px; }
  .photo-box { flex-direction: column; text-align: center; }
  .photo-ctrl { justify-items: center; }
  .wiz-head { align-items: flex-start; }
  form.wiz-ready .wiz-nav {
    position: sticky; bottom: 0; z-index: 3; margin-inline: calc(-1 * clamp(1.1rem, 4vw, 2.4rem)); padding: .9rem clamp(1.1rem, 4vw, 2.4rem) .9rem;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-radius: 0 0 22px 22px;
  }
  .wiz-nav .btn { flex: 1 1 auto; min-width: 0; padding: 0 1rem; }
  .wiz-nav [data-wiz-back] { flex: 0 0 auto; padding: 0 1.1rem; }
}
.wiz-short { display: none; }
@media (max-width: 420px) { .wiz-full { display: none; } .wiz-short { display: inline; } }
@media (prefers-reduced-motion: reduce) {
  .wiz-bar span, .wiz-num, .admit-field input, .admit-field select, .admit-field textarea { transition: none; }
  form.wiz-ready .wiz-step.is-current { animation: none; }
}
