/* The Apply page (templates/public/apply.html, 2026-10-09): one step at a time with a progress bar, the program and
   the steps in an ivory column beside it on wide screens, a sticky Back / Continue bar on phones. Builds on the tx-
   tokens and fields of checkout.css (the website's "Ivy" look); classes are prefixed ap-. Right to left for Yiddish
   products ([dir="rtl"]). */

.ap-page { --ap-head: 0px; }
.ap-backlink { display: inline-block; max-width: min(46vw, 460px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.ap-preview-bar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px clamp(16px, 4vw, 40px); background: var(--tx-navy); color: #fff; font: 500 14px/1.45 var(--tx-sans);
}
.ap-preview-bar .icon { width: 16px; height: 16px; color: var(--ivy-gold-light, #E4C987); }
.ap-preview-bar a { margin-inline-start: auto; color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ layout */
.ap-shell { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); min-height: calc(100vh - 72px); background: #fff; }
.ap-aside { background: var(--tx-ivory); border-inline-end: 1px solid var(--tx-line); }
.ap-aside-inner { position: sticky; top: 0; display: flex; flex-direction: column; gap: 18px; padding: 56px clamp(24px, 3.4vw, 56px) 40px; }
.ap-title { margin: 0; font-family: var(--tx-serif); font-weight: 500; font-size: clamp(30px, 2.6vw, 40px); line-height: 1.08; letter-spacing: -.01em; color: var(--tx-navy); text-wrap: balance; }
.ap-intro { margin: 0; font-size: 16px; line-height: 1.6; color: var(--tx-text-2); white-space: pre-line; text-wrap: pretty; }
.ap-meta { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--tx-text-3); }
.ap-meta .icon { width: 15px; height: 15px; color: var(--tx-gold-text); }
.ap-aside .tx-course { margin: 4px 0 0; background: #fff; }

.ap-steps { list-style: none; margin: 8px 0 0; padding: 6px 0 0; border-top: 1px solid var(--tx-line); counter-reset: none; }
.ap-steps-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 0; border: 0; background: none;
  font: 500 15px/1.35 var(--tx-sans); color: var(--tx-text-3); text-align: start; cursor: default;
}
.ap-steps-btn:disabled { opacity: 1; }
.ap-steps-dot {
  display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 1px solid var(--tx-line-2);
  border-radius: 50%; background: #fff; font: 600 12.5px/1 var(--tx-sans); color: var(--tx-text-3);
  transition: background-color .2s, border-color .2s, color .2s;
}
.ap-steps-item.is-current .ap-steps-dot { background: var(--tx-navy); border-color: var(--tx-navy); color: #fff; box-shadow: 0 0 0 4px rgba(11, 31, 58, .08); }
.ap-steps-item.is-current .ap-steps-name { color: var(--tx-navy); font-weight: 650; }
.ap-steps-item.is-done .ap-steps-dot { background: var(--tx-gold-wash); border-color: rgba(176, 141, 60, .55); color: var(--tx-gold-text); }
.ap-steps-item.is-done .ap-steps-btn { color: var(--tx-text); cursor: pointer; }
.ap-steps-item.is-done .ap-steps-btn:hover .ap-steps-name { text-decoration: underline; text-decoration-color: var(--tx-gold); text-underline-offset: 3px; }
.ap-steps-item.has-error .ap-steps-dot { border-color: var(--tx-red); color: var(--tx-red); background: var(--tx-red-wash); }
.ap-aside-help { margin-top: auto; padding-top: 12px; }
.ap-aside-help .tx-helpline { text-align: start; justify-content: flex-start; }

.ap-main { width: 100%; max-width: 780px; padding: 40px clamp(20px, 5vw, 80px) 72px; }
.ap-progress { position: sticky; top: 0; z-index: 10; margin: -12px 0 8px; padding: 14px 0 14px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); }
.ap-progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--tx-text-3); }
.ap-progress-label { font-weight: 650; letter-spacing: .08em; text-transform: uppercase; font-size: 11.5px; color: var(--tx-gold-text); }
.ap-progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-progress-bar { height: 4px; margin-top: 9px; border-radius: 99px; background: var(--tx-ivory-2); overflow: hidden; }
.ap-progress-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--tx-gold), var(--tx-navy)); transition: width .45s var(--tx-ease); }
[dir="rtl"] .ap-progress-bar span { background: linear-gradient(270deg, var(--tx-gold), var(--tx-navy)); }
.ap-alert { margin: 8px 0 4px; }

/* ------------------------------------------------------------------ steps */
.ap-form { display: block; margin: 0; }
.ap-step { padding-top: 18px; }
.ap-form:not(.is-stepped) .ap-step + .ap-step { margin-top: 44px; padding-top: 36px; border-top: 1px solid var(--tx-line); }
.ap-form.is-stepped .ap-step:not(.is-active) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .ap-form.is-stepped .ap-step.is-active { animation: ap-in .32s var(--tx-ease); }
  .ap-form.is-stepped.is-back .ap-step.is-active { animation-name: ap-in-back; }
}
@keyframes ap-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@keyframes ap-in-back { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
[dir="rtl"] .ap-form.is-stepped .ap-step.is-active { animation-name: ap-in-back; }
[dir="rtl"] .ap-form.is-stepped.is-back .ap-step.is-active { animation-name: ap-in; }
.ap-step-head { margin-bottom: 26px; }
.ap-step-count { margin: 0 0 8px; font: 650 11.5px/1.4 var(--tx-sans); letter-spacing: .12em; text-transform: uppercase; color: var(--tx-gold-text); }
.ap-form.is-stepped .ap-step-count { display: none; }
.ap-step-title { margin: 0; font-family: var(--tx-serif); font-weight: 500; font-size: clamp(28px, 2.6vw, 36px); line-height: 1.12; color: var(--tx-navy); outline: none; text-wrap: balance; }
.ap-step-intro { margin-top: 12px; font-size: 16px; line-height: 1.6; color: var(--tx-text-2); }
.ap-step-intro p { margin: 0 0 8px; }
.ap-about { gap: 20px 16px; }
.ap-questions { display: flex; flex-direction: column; gap: 30px; }
.ap-q { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ap-q[hidden] { display: none; }
.ap-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ap-q-label { display: block; padding: 0; font: 600 16px/1.45 var(--tx-sans); color: var(--tx-navy); text-wrap: pretty; }
.ap-q-help { margin: -4px 0 4px; font-size: 14px; line-height: 1.5; color: var(--tx-text-3); white-space: pre-line; }
.site-body .ap-input-short { max-width: 260px; }

/* choices with a drawn mark (radio dot / check box) */
.ap-choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.ap-choices.is-grid, .ap-choices.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ap-choice {
  position: relative; display: flex; align-items: center; gap: 13px; min-height: 54px; padding: 13px 16px;
  border: 1px solid var(--tx-line-2); border-radius: var(--tx-radius-card); background: #fff; cursor: pointer;
  font-size: 15.5px; line-height: 1.4; color: var(--tx-text); transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.ap-choice:hover { border-color: rgba(11, 31, 58, .45); }
.ap-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ap-choice-mark { position: relative; width: 20px; height: 20px; flex: none; border: 1.5px solid var(--tx-line-2); border-radius: 50%; background: #fff; transition: border-color .15s, background-color .15s; }
.ap-choice-mark.is-box { border-radius: 5px; }
.ap-choice-text { min-width: 0; overflow-wrap: anywhere; }
.ap-choice:has(input:checked) { border-color: var(--tx-navy); box-shadow: inset 0 0 0 1px var(--tx-navy); background: #FBFBFD; }
.ap-choice:has(input:checked) .ap-choice-text { color: var(--tx-navy); font-weight: 600; }
.ap-choice:has(input:checked) .ap-choice-mark { border-color: var(--tx-navy); background: var(--tx-navy); }
.ap-choice:has(input:checked) .ap-choice-mark::after { content: ""; position: absolute; inset: 4.5px; border-radius: 50%; background: #fff; }
.ap-choice:has(input:checked) .ap-choice-mark.is-box::after { inset: 2px 5.5px 5px; border: solid #fff; border-width: 0 2px 2px 0; border-radius: 0; background: none; transform: rotate(45deg); }
.ap-choice:has(input:focus-visible) { outline: 3px solid var(--tx-navy); outline-offset: 2px; }
.ap-q.has-error .ap-choice, .ap-q.has-error .ap-scale-item span { border-color: rgba(180, 35, 24, .55); }
.ap-other { margin-top: 2px; }

/* scale 1–10 */
.ap-scale { display: grid; grid-template-columns: repeat(var(--n, 10), minmax(0, 1fr)); gap: 6px; }
.ap-scale-item { position: relative; cursor: pointer; }
.ap-scale-item input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.ap-scale-item span { display: grid; place-items: center; height: 48px; border: 1px solid var(--tx-line-2); border-radius: var(--tx-radius-card); background: #fff; font: 600 15px/1 var(--tx-sans); color: var(--tx-text-2); transition: background-color .15s, border-color .15s, color .15s; }
.ap-scale-item:hover span { border-color: rgba(11, 31, 58, .45); }
.ap-scale-item input:checked + span { background: var(--tx-navy); border-color: var(--tx-navy); color: #fff; }
.ap-scale-item input:focus-visible + span { outline: 3px solid var(--tx-navy); outline-offset: 2px; }
.ap-scale-ends { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--tx-text-3); }

.ap-file { display: flex; flex-direction: column; gap: 6px; padding: 16px; border: 1px dashed var(--tx-line-2); border-radius: var(--tx-radius-card); background: var(--tx-ivory); }
.ap-file-input { font: 500 14.5px/1.4 var(--tx-sans); color: var(--tx-text-2); max-width: 100%; }
.ap-file-input::file-selector-button { margin-inline-end: 12px; padding: 9px 14px; border: 1px solid var(--tx-line-2); border-radius: var(--tx-radius); background: #fff; font: 600 14px var(--tx-sans); color: var(--tx-navy); cursor: pointer; }

.ap-finish { display: flex; flex-direction: column; gap: 14px; margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--tx-line); }
.ap-finish .tx-small { margin: 0; }

/* ------------------------------------------------------------------ navigation */
.ap-nav { display: flex; align-items: center; gap: 16px; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--tx-line); }
.ap-form:not(.is-stepped) .ap-nav { justify-content: flex-end; }
.ap-back { display: inline-flex; align-items: center; gap: 8px; padding: 10px 4px; border: 0; background: none; font: 600 15px/1 var(--tx-sans); color: var(--tx-navy); cursor: pointer; }
.ap-back:hover span { text-decoration: underline; text-decoration-color: var(--tx-gold); text-underline-offset: 4px; }
.ap-back .icon, .ap-next .icon { width: 17px; height: 17px; }
.ap-back[hidden], .ap-next[hidden], .ap-submit[hidden], .ap-saved[hidden] { display: none; }
.ap-saved { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--tx-text-3); }
.ap-saved .icon { width: 14px; height: 14px; color: var(--tx-green); }
.ap-next, .ap-submit { margin-inline-start: auto; gap: 10px; min-width: 180px; }
[dir="rtl"] .ap-dir { transform: scaleX(-1); }

/* ------------------------------------------------------------------ closed / full, done */
.site-body .ap-wrap { white-space: normal; height: auto; min-height: 48px; padding-block: 12px; line-height: 1.35; text-align: center; max-width: 100%; }
.ap-done-text p { margin: 0 0 10px; }
.ap-closed-note { margin: 16px 0 0; padding: 14px 16px; border-radius: var(--tx-radius-card); background: var(--tx-ivory); font-size: 15px; line-height: 1.55; color: var(--tx-text); white-space: pre-line; }
.ap-closed-cta { margin-top: 22px; }
.ap-waitlist-form { margin-top: 22px; text-align: start; }

/* ------------------------------------------------------------------ Yiddish */
[dir="rtl"] .ap-title, [dir="rtl"] .ap-step-title, [dir="rtl"] .tx-title { font-family: var(--ivy-hebrew, var(--tx-serif)); font-weight: 500; letter-spacing: 0; }
[dir="rtl"] .ap-progress-label, [dir="rtl"] .ap-step-count, [dir="rtl"] .tx-overline { letter-spacing: .02em; }
[dir="rtl"] .ap-page input[type="email"], [dir="rtl"] .ap-page input[type="tel"], [dir="rtl"] .ap-page input[type="url"] { direction: ltr; text-align: right; }

/* ------------------------------------------------------------------ phones and tablets */
@media (max-width: 960px) {
  .ap-shell { grid-template-columns: 1fr; min-height: 0; }
  .ap-aside { background: #fff; border: 0; }
  .ap-aside-inner { position: static; max-height: none; overflow: visible; gap: 12px; padding: 24px 20px 4px; }
  .ap-title { font-size: 30px; }
  .ap-intro { font-size: 15px; }
  .ap-steps, .ap-aside-help, .ap-aside .tx-course { display: none; }
  .ap-title { font-size: 28px; }
  .ap-main { max-width: none; padding: 4px 20px 128px; }
  .ap-progress { margin: 0 -20px 4px; padding: 12px 20px; border-bottom: 1px solid var(--tx-line); }
  .ap-step { padding-top: 22px; }
  .ap-step-title { font-size: 27px; }
  .ap-questions { gap: 26px; }
  .ap-choices.is-grid { grid-template-columns: 1fr; }
  .ap-form.is-stepped .ap-nav {
    position: fixed; inset: auto 0 0 0; z-index: 25; margin: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--tx-line); background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px);
    box-shadow: 0 -8px 24px rgba(11, 31, 58, .06);
  }
  .ap-form.is-stepped .ap-saved { display: none; }
  .ap-next, .ap-submit { flex: 1; min-width: 0; }
  .ap-scale { gap: 4px; }
  .ap-scale-item span { height: 44px; font-size: 14px; }
}
@media (max-width: 960px) {
  body:has(.ap-form.is-stepped) { padding-bottom: 84px; }
  body:has(.ap-form.is-stepped) .lcw { --lcw-lift: 84px; }
}
@media (max-width: 420px) {
  .ap-choices.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ap-scale { grid-template-columns: repeat(min(var(--n, 10), 6), minmax(0, 1fr)); }
}
