/* ============================================================================
   POST — Application wizard
   A native, conversational, one-question-at-a-time flow. Mirrors (and exceeds)
   pef.co/apply: eligibility gate → contact → exit → verification → fit → referral.
   ============================================================================ */

.apply {
  --post-bg: var(--post-bone);
  --post-surface: #F3EEE2;
  --post-fg: var(--post-ink);
  --post-fg-muted: color-mix(in srgb, var(--post-ink) 68%, transparent);
  --post-fg-faint: color-mix(in srgb, var(--post-ink) 62%, transparent);
  --post-hairline: color-mix(in srgb, var(--post-ink) 16%, transparent);
  --post-accent: var(--post-oxblood);
  --post-link: var(--post-oxblood);
  position: fixed; inset: 0; z-index: 200;
  display: grid; grid-template-columns: 1fr;
  background: var(--post-bone);
  opacity: 0; visibility: hidden;
  transition: opacity .5s var(--post-ease), visibility .5s var(--post-ease);
}
.apply.is-open { opacity: 1; visibility: visible; }
.apply[hidden] { display: none; }

/* ---- Left rail (ink): brand, context, progress, reassurance ---- */
.apply__rail {
  display: none;
  background: var(--post-ink); color: var(--post-bone);
  padding: clamp(2rem, 4vw, 3.4rem);
  flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.apply__rail-media { position: absolute; inset: 0; z-index: 0; opacity: 0.22; }
.apply__rail-media img { width: 100%; height: 100%; object-fit: cover; }
.apply__rail-media::after { content:""; position:absolute; inset:0; background: linear-gradient(160deg, rgba(20,17,13,0.7), rgba(20,17,13,0.95)); }
.apply__rail > * { position: relative; z-index: 1; }
.apply__rail-word { height: 24px; width: auto; }
.apply__rail-title {
  font-family: var(--post-serif); font-variation-settings:"opsz" 110,"wght" 400;
  font-size: clamp(1.8rem, 2.6vw, 2.6rem); line-height: 1.1; letter-spacing: -0.02em;
  max-width: 16ch; margin-bottom: 1.2rem;
}
.apply__rail-title em { font-style: italic; color: var(--post-bronze); }
.apply__rail-note { color: color-mix(in srgb, var(--post-bone) 64%, transparent); font-size: 0.95rem; max-width: 32ch; line-height: 1.5; }

.apply__steps { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 2rem; }
.apply__step-row { display: flex; align-items: center; gap: 0.8rem; font-size: 0.82rem; color: color-mix(in srgb, var(--post-bone) 46%, transparent); transition: color .4s var(--post-ease); }
.apply__step-row .dot { width: 7px; height: 7px; border-radius: 50%; border: 1px solid currentColor; flex: none; transition: all .4s var(--post-ease); }
.apply__step-row.is-active { color: var(--post-bone); }
.apply__step-row.is-active .dot { background: var(--post-bronze); border-color: var(--post-bronze); }
.apply__step-row.is-done { color: color-mix(in srgb, var(--post-bone) 72%, transparent); }
.apply__step-row.is-done .dot { background: color-mix(in srgb, var(--post-bone) 72%, transparent); border-color: transparent; }

/* ---- Right (form area) ---- */
.apply__main { position: relative; display: flex; flex-direction: column; min-height: 0; }

.apply__top {
  display: flex; align-items: center; justify-content: space-between;
  padding: clamp(1.1rem, 2vw, 1.6rem) clamp(1.4rem, 4vw, 3.4rem);
  border-bottom: 1px solid var(--post-hairline); flex: none;
}
.apply__top-word { height: 20px; }
.apply__progress { flex: 1; max-width: 280px; height: 2px; background: var(--post-hairline); margin: 0 1.5rem; position: relative; border-radius: 2px; overflow: hidden; }
.apply__progress-bar { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--post-accent); transition: width .5s var(--post-ease); }
.apply__close { font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: var(--post-fg-faint); display: inline-flex; align-items: center; gap: 0.5rem; transition: color .3s; }
.apply__close:hover { color: var(--post-fg); }

.apply__viewport {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; align-items: center;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.4rem, 5vw, 4rem);
}
.apply__stepwrap { width: 100%; max-width: 640px; margin-inline: auto; }

/* a step */
.step { display: none; }
.step.is-active { display: block; animation: stepIn .5s var(--post-ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .step.is-active { animation: none; } }

.step__kicker { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 1.4rem; }
.step__kicker .num { font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; color: var(--post-accent); }
.step__kicker .sect { font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 600; color: var(--post-fg-faint); }
.step__q {
  font-family: var(--post-serif); font-variation-settings:"opsz" 80,"wght" 420;
  font-size: clamp(1.7rem, 3.6vw, 2.7rem); line-height: 1.12; letter-spacing: -0.015em;
  color: var(--post-fg); margin-bottom: 0.9rem; text-wrap: balance;
}
.step__q .stop { color: var(--post-accent); }
.step__help { color: var(--post-fg-muted); font-size: 1rem; line-height: 1.55; max-width: 54ch; margin-bottom: 2rem; }
.step__help strong { color: var(--post-fg); font-weight: 600; }

/* text-like inputs */
.field { position: relative; margin-bottom: 1.2rem; }
.field input, .field textarea {
  width: 100%; font-family: var(--post-sans); color: var(--post-fg);
  font-size: clamp(1.2rem, 2.2vw, 1.5rem); line-height: 1.4;
  background: transparent; border: none; border-bottom: 1.5px solid var(--post-hairline);
  padding: 0.6rem 0; caret-color: var(--post-accent);
  transition: border-color .35s var(--post-ease);
}
.field textarea { resize: none; min-height: 3.2rem; }
.field input::placeholder, .field textarea::placeholder { color: color-mix(in srgb, var(--post-fg) 32%, transparent); }
.field input:focus, .field textarea:focus { outline: none; border-bottom-color: var(--post-accent); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--post-fg); transition: background-color 9999s; }

/* choice options (single + multi) */
.options { display: grid; grid-template-columns: 1fr; gap: 0.6rem; margin-bottom: 1.4rem; }
.options.cols-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .options.cols-2 { grid-template-columns: 1fr; } }
.option {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.15rem; border: 1px solid var(--post-hairline); border-radius: 2px;
  background: var(--post-surface); cursor: pointer; text-align: left;
  font-size: 1.02rem; color: var(--post-fg);
  transition: border-color .3s var(--post-ease), background .3s var(--post-ease), transform .2s var(--post-ease);
}
.option:hover { border-color: color-mix(in srgb, var(--post-ink) 40%, transparent); transform: translateX(2px); }
.option__marker { width: 18px; height: 18px; border: 1.5px solid var(--post-hairline); flex: none; display: grid; place-items: center; transition: all .25s var(--post-ease); }
.option--multi .option__marker { border-radius: 2px; }
.option--single .option__marker { border-radius: 50%; }
.option__marker svg { width: 11px; height: 11px; opacity: 0; transform: scale(0.5); transition: all .25s var(--post-ease); color: var(--post-bone); }
.option.is-selected { border-color: var(--post-ink); background: color-mix(in srgb, var(--post-ink) 5%, var(--post-surface)); }
.option.is-selected .option__marker { background: var(--post-ink); border-color: var(--post-ink); }
.option.is-selected .option__marker svg { opacity: 1; transform: scale(1); }
.option__label { flex: 1; }
.option__hint { display: block; font-size: 0.82rem; color: var(--post-fg-faint); margin-top: 0.15rem; }

/* file upload */
.upload {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  border: 1.5px dashed var(--post-hairline); border-radius: 3px;
  padding: clamp(2rem, 5vw, 3.2rem); text-align: center; cursor: pointer;
  transition: border-color .3s var(--post-ease), background .3s var(--post-ease); margin-bottom: 1.4rem;
}
.upload:hover, .upload.is-drag { border-color: var(--post-accent); background: var(--post-surface); }
.upload__icon { color: var(--post-fg-faint); }
.upload__text { color: var(--post-fg-muted); font-size: 0.95rem; }
.upload__text strong { color: var(--post-accent); font-weight: 600; }
.upload input { display: none; }
.upload.has-file { border-style: solid; border-color: var(--post-ink); }
.upload.has-file .upload__text strong { color: var(--post-fg); }

/* statement screens (email-proof) */
.statement {
  border-left: 2px solid var(--post-accent); padding: 0.4rem 0 0.4rem 1.4rem;
  margin-bottom: 1.6rem; color: var(--post-fg-muted); font-size: 1.08rem; line-height: 1.6;
}
.statement a { color: var(--post-link); font-weight: 600; border-bottom: 1px solid currentColor; }

/* validation message */
.step__error { color: var(--post-oxblood); font-size: 0.9rem; min-height: 1.2rem; margin-bottom: 0.6rem; }

/* step controls */
.step__controls { display: flex; align-items: center; gap: 1rem; margin-top: 1.2rem; }
.step__hintkey { font-size: 0.82rem; color: var(--post-fg-faint); }
.step__hintkey kbd { font-family: var(--post-sans); font-weight: 600; background: var(--post-surface); border: 1px solid var(--post-hairline); border-radius: 2px; padding: 0.1em 0.45em; font-size: 0.8em; }
.btn--back { color: var(--post-fg-faint); font-size: 0.86rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.4rem; transition: color .3s; }
.btn--back:hover { color: var(--post-fg); }
.apply .btn--primary { background: var(--post-ink); color: var(--post-bone); border-color: var(--post-ink); }
.apply .btn--primary:hover { background: var(--post-ink-soft); color: var(--post-bone); }

/* gate-fail (ineligible) soft screen */
.gatefail .step__q { color: var(--post-fg); }

/* success screen */
.apply__success { display: none; text-align: center; max-width: 540px; margin-inline: auto; }
.apply__success.is-active { display: block; animation: stepIn .6s var(--post-ease) both; }
.apply__success-mark { width: 56px; height: 56px; margin: 0 auto 2rem; border-radius: 50%; border: 1.5px solid var(--post-accent); display: grid; place-items: center; color: var(--post-accent); }
.apply__success h2 {
  font-family: var(--post-serif); font-variation-settings:"opsz" 110,"wght" 410;
  font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 1.2rem;
}
.apply__success h2 .stop { color: var(--post-accent); }
.apply__success p { color: var(--post-fg-muted); font-size: 1.08rem; line-height: 1.6; margin-bottom: 1rem; }
.apply__success .muted { color: var(--post-fg-faint); font-size: 0.92rem; }
.apply__success a { color: var(--post-link); font-weight: 600; }
.apply__success .btn { margin-top: 1.6rem; }

/* two-panel from md up */
@media (min-width: 920px) {
  .apply { grid-template-columns: 0.82fr 1.18fr; }
  .apply__rail { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .apply { transition: none; }
}
