/* ==========================================================================
   Application wizard — extends the landing design tokens
   ========================================================================== */

.app-body {
  min-height: 100svh;
  min-width: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 80% 70% at 18% 42%, rgba(0, 105, 218, 0.22), transparent 58%),
    radial-gradient(ellipse 60% 50% at 8% 18%, rgba(26, 179, 166, 0.14), transparent 52%),
    radial-gradient(ellipse 55% 45% at 38% 28%, rgba(11, 122, 36, 0.12), transparent 55%),
    var(--bg);
}

.app-page {
  min-height: calc(100svh - 160px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 128px 0 64px;
  min-width: 0;
}

.app-wrap,
.app-form,
.app-step,
.app-head,
.app-fields {
  min-width: 0;
}

.app-form { display: flex; flex-direction: column; }
.app-form[hidden] { display: none !important; }

.app-step {
  display: none;
}

.app-step.is-active {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.app-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.app-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.app-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 8vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.app-lede,
.app-fee {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.app-head .app-lede + .app-lede { margin-top: 4px; }

.app-fee {
  color: var(--ink);
  font-weight: 700;
  font-size: 22px;
}

.app-lede-tight { margin-bottom: 8px; }

.app-legal {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  max-width: 36rem;
}

.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 128px;
  padding: 24px 16px;
  border-radius: 16px;
  border: 1.5px dashed rgba(229, 229, 229, 0.38);
  background: rgba(255, 255, 255, 0.10);
  cursor: pointer;
  text-align: center;
  color: var(--ink);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-drop:hover,
.file-drop.is-dragover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(229, 229, 229, 0.55);
}

.file-drop:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.file-drop[aria-invalid="true"] {
  border-color: #f2a1a1;
}

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.file-drop-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 6px;
}

.file-drop-title {
  font-size: 16px;
  line-height: 1.375;
}

.app-form label.file-drop {
  font-size: 16px;
}

.file-drop-hint {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.grant-set {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 0;
  margin: 0;
}

.grant-option {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.grant-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grant-detail[hidden],
.js-school-fund[hidden] {
  display: none !important;
}

.grant-copy,
.grant-hint {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.team-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.team-detail[hidden] {
  display: none !important;
}

.check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.375;
  width: fit-content;
  max-width: 100%;
}

.check input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.check-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid rgba(229, 229, 229, 0.7);
  background: transparent;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.check-box::after {
  content: "";
  width: 5px;
  height: 9px;
  margin-top: -1px;
  border: solid var(--ink-dark);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  opacity: 0;
}

.check input:checked + .check-box {
  background: var(--light);
  border-color: var(--light);
}

.check input:checked + .check-box::after {
  opacity: 1;
}

.check:has(input:focus-visible) .check-box {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.req { color: #e25c5c; font-weight: 700; }

.app-form .input-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-form label,
.app-form legend {
  font-size: 16px;
  line-height: 1.375;
}

.app-form input:not([type="file"]),
.app-form select,
.app-form textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid #363030;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.375;
  transition: border-color 0.25s ease, background 0.25s ease;
  appearance: none;
  -webkit-appearance: none;
}

.app-form input:not([type="file"]),
.app-form select { height: 52px; }

.app-form textarea {
  min-height: 120px;
  resize: vertical;
}

.app-form input::placeholder,
.app-form textarea::placeholder { color: rgba(229, 229, 229, 0.55); }
.app-form select:invalid { color: rgba(229, 229, 229, 0.55); }
.app-form select option { color: var(--ink-dark); background: var(--light); }
.app-form input:not([type="file"]):focus,
.app-form select:focus,
.app-form textarea:focus {
  outline: none;
  border-color: rgba(229, 229, 229, 0.7);
  background: rgba(255, 255, 255, 0.22);
}

.app-form input:not([type="file"])[aria-invalid="true"],
.app-form select[aria-invalid="true"],
.app-form textarea[aria-invalid="true"] {
  border-color: #f2a1a1;
}

.choice-set {
  border: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice-set legend {
  margin-bottom: 8px;
  padding: 0;
}

.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 1px solid #363030;
  background: rgba(255, 255, 255, 0.10);
  cursor: pointer;
  font-size: 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.choice:hover { background: rgba(255, 255, 255, 0.16); }
.choice:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.choice:has(input:checked) {
  border-color: rgba(229, 229, 229, 0.55);
  background: rgba(255, 255, 255, 0.18);
}

.choice input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.choice-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(229, 229, 229, 0.7);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.choice input:checked + .choice-dot {
  border-color: var(--ink);
  background: radial-gradient(circle, var(--ink) 45%, transparent 48%);
}

.char-count {
  align-self: flex-end;
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
}

.app-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  align-self: flex-start;
  min-height: 48px;
  padding: 12px 36px;
  margin-top: 8px;
  border: none;
  border-radius: 999px;
  background: var(--light);
  color: var(--ink-dark);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-btn:hover { transform: translateY(-1px); }
.app-btn:active { transform: scale(0.98); }
.app-btn:disabled { opacity: 0.6; cursor: wait; transform: none; }

.app-step .btn { margin-top: 8px; align-self: flex-start; }

.app-thanks.is-active {
  gap: 28px;
}

.thanks-img {
  width: 100%;
  aspect-ratio: 362 / 343;
  object-fit: cover;
  border-radius: 24px;
}

.app-thanks .app-fields {
  gap: 0;
}

.step-error,
.field-error,
.app-form .form-error { color: #f2a1a1; font-size: 14px; font-weight: 500; }
.app-form .form-error a { color: inherit; }

.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-step[hidden] { display: none !important; }

.app-body .nav { width: 100%; }
.app-body .nav-cta .btn-chip { display: none; }

@media (min-width: 961px) {
  .app-page { min-height: calc(100svh - 180px); padding: 132px 0 48px; }
  .app-title { font-size: clamp(56px, 5.2vw, 80px); line-height: 1.02; }
  .app-head { gap: 32px; padding-top: 8px; }
  .app-lede { font-size: 16px; max-width: 28rem; }
  .app-form label,
  .app-form legend { font-size: 14px; }
  .app-form input:not([type="file"]),
  .app-form select { height: 48px; padding: 12px 16px; }
  .app-step.is-active {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 1fr);
    column-gap: clamp(32px, 5vw, 88px);
    align-items: start;
  }
  .app-fields { gap: 16px; }
  .app-thanks.is-active {
    grid-template-areas:
      "head img"
      "fields img";
    align-items: start;
  }
  .app-thanks .thanks-img {
    grid-area: img;
    max-height: min(520px, 62vh);
    aspect-ratio: 1 / 1;
  }
  .app-thanks .app-head { grid-area: head; }
  .app-thanks .app-fields { grid-area: fields; align-self: end; }
}

@media (max-width: 960px) {
  .app-page { padding-top: 112px; padding-bottom: 40px; }
  .app-title { font-size: clamp(36px, 7vw, 48px); }
  .app-step.is-active { gap: 24px; }
  .app-head { gap: 12px; }
  .app-btn {
    width: 100%;
    align-self: stretch;
  }
  .app-step .btn { align-self: stretch; }
  .app-step .btn .btn-pill { flex: 1; justify-content: center; }
}

@media (max-width: 640px) {
  .app-body { --gutter: 16px; }
  .app-page { padding-top: 96px; }
  .app-title { font-size: 36px; line-height: 1.08; }
  .app-lede,
  .app-fee { font-size: 16px; }
  .app-form input:not([type="file"]),
  .app-form select { height: 48px; }
  .app-body .nav-inner { gap: 8px; }
  .app-body .brand img {
    height: 24px;
    max-width: min(124px, 42vw);
  }
  .app-body .nav-cta .btn-pill {
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.2;
  }
}

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