/* ==========================================================================
   Application form — /apply
   ========================================================================== */

.apply-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 980px) { .apply-shell { grid-template-columns: 1fr; } }

/* --- progress ----------------------------------------------------------- */
.progress { margin-bottom: 2.5rem; }

.progress__track {
  position: relative;
  height: 3px;
  background: var(--hairline);
  border-radius: 999px;
  overflow: hidden;
}
.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 33.33%;
  background: linear-gradient(90deg, var(--emerald-deep), var(--emerald-bright));
  transition: width 0.45s var(--ease);
}

.progress__steps {
  display: flex;
  justify-content: space-between;
  margin-top: 0.9rem;
  gap: 1rem;
}
.progress__steps li {
  flex: 1;
  list-style: none;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}
.progress__steps li[data-state='active'] { color: var(--emerald-deep); }
.progress__steps li[data-state='done'] { color: var(--text); }
.progress__steps li:nth-child(2) { text-align: center; }
.progress__steps li:nth-child(3) { text-align: right; }

/* --- panels ------------------------------------------------------------- */
.fstep { display: none; }
.fstep[data-active='true'] { display: block; animation: rise 0.45s var(--ease); }

.fstep__title { margin-bottom: 0.4rem; }
.fstep__sub { color: var(--muted); margin-bottom: 2.25rem; }

/* --- fields ------------------------------------------------------------- */
.field { margin-bottom: 1.4rem; }
.field--half { margin-bottom: 0; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem;
  margin-bottom: 1.4rem;
}
@media (max-width: 620px) { .row { grid-template-columns: 1fr; } }

.field label,
.fieldset__legend {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.field .hint {
  display: block;
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  margin-top: 0.45rem;
}

.field input[type='text'],
.field input[type='email'],
.field input[type='tel'],
.field input[type='number'],
.field input[type='date'],
.field select,
.field textarea {
  width: 100%;
  padding: 0.95rem 1rem;
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--body);
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field textarea { resize: vertical; min-height: 110px; }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23536473' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.75rem;
  cursor: pointer;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

.field input::placeholder, .field textarea::placeholder { color: rgba(10, 27, 42, 0.36); }

.field[data-invalid='true'] input,
.field[data-invalid='true'] select,
.field[data-invalid='true'] textarea {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.field__error {
  display: none;
  margin-top: 0.45rem;
  font-size: 0.83rem;
  font-weight: 500;
  color: #b91c1c;
}
.field[data-invalid='true'] .field__error { display: block; }

/* --- choice tiles ------------------------------------------------------- */
.choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  border: 0;
  padding: 0;
  margin: 0 0 1.9rem;
}
@media (max-width: 700px) { .choices { grid-template-columns: 1fr; } }

.choices legend { padding: 0; }

.choice { position: relative; }
.choice input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.choice span {
  display: block;
  padding: 1.15rem 1.15rem 1.2rem;
  height: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  transition: all 0.22s var(--ease);
  pointer-events: none;
}
.choice b {
  display: block;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}
.choice small { display: block; font-size: 0.83rem; line-height: 1.45; color: var(--muted); }
.choice input:hover + span { border-color: var(--hairline-strong); }
.choice input:checked + span {
  border-color: var(--emerald);
  background: rgba(16, 185, 129, 0.1);
  box-shadow: 0 0 0 1px var(--emerald);
}
.choice input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 3px; }

/* --- amount picker ------------------------------------------------------ */
.amount-box {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  margin-bottom: 1.9rem;
}
.amount-box__value {
  font-family: var(--display);
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink-900);
  margin-bottom: 1.25rem;
}
.amount-box__value sup { font-size: 0.36em; vertical-align: super; color: var(--emerald-deep); margin-right: 0.08em; }

/* --- below-minimum notice ----------------------------------------------- */
.notice {
  display: none;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.09);
  font-size: 0.92rem;
  line-height: 1.55;
  margin-bottom: 1.6rem;
}
.notice[data-show='true'] { display: flex; }
.notice svg { flex-shrink: 0; color: #b45309; margin-top: 2px; }
.notice b { display: block; margin-bottom: 0.2rem; }
.notice a { color: #92400e; }

/* --- consent ------------------------------------------------------------ */
.consent {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  margin-bottom: 1.6rem;
  font-size: 0.87rem;
  line-height: 1.6;
  color: var(--muted);
  cursor: pointer;
}
.consent input {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--emerald);
  cursor: pointer;
}
.consent a { color: var(--emerald-deep); }
.consent[data-invalid='true'] { border-color: #dc2626; }

/* honeypot — never visible, never announced */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* --- nav buttons -------------------------------------------------------- */
.fnav {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  padding-top: 1.9rem;
  border-top: 1px solid var(--hairline);
  margin-top: 0.5rem;
}
.fnav .btn--back { margin-right: auto; }

.btn[data-busy='true'] { pointer-events: none; opacity: 0.7; }

.form-error {
  display: none;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.35);
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.92rem;
}
.form-error[data-show='true'] { display: block; }

/* --- summary rail ------------------------------------------------------- */
.rail-card {
  position: sticky;
  top: 100px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
}
@media (max-width: 980px) { .rail-card { position: static; } }

.rail-card h4 {
  font-family: var(--body);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.2rem;
}
.rail-card dl { margin: 0 0 1.5rem; display: grid; gap: 0.75rem; }
.rail-card dl > div { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; }
.rail-card dt { color: var(--muted); }
.rail-card dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.rail-card__assure { border-top: 1px solid var(--hairline); padding-top: 1.35rem; display: grid; gap: 0.75rem; }
.rail-card__assure div { display: flex; gap: 0.65rem; align-items: flex-start; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }
.rail-card__assure svg { flex-shrink: 0; margin-top: 3px; color: var(--emerald-deep); }

/* --- thank you ---------------------------------------------------------- */
.thanks {
  max-width: 62ch;
  margin-inline: auto;
  text-align: center;
}
.thanks__seal {
  width: 88px;
  height: 88px;
  margin: 0 auto 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: var(--emerald-deep);
  animation: rise 0.7s var(--ease);
}
.thanks .steps { text-align: left; margin-top: 3rem; }
.ref-code {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  font-weight: 600;
  font-size: 0.9rem;
}

/* --- application card --------------------------------------------------- */
.apply-page {
  padding-block: clamp(0.9rem, 1.4vw, 1.25rem) clamp(3rem, 6vw, 4.5rem);
  background:
    radial-gradient(900px 480px at 80% 0%, rgba(16, 185, 129, 0.1), transparent 60%),
    var(--bg-soft);
}
.apply-page .rail-card { top: 90px; }

/* The form is the page, so it is framed to stand out: emerald edge, top accent, lifted shadow. */
.apply-card {
  position: relative;
  background: var(--surface);
  border: 1px solid rgba(16, 185, 129, 0.45);
  border-radius: 14px;
  box-shadow:
    0 0 0 5px rgba(16, 185, 129, 0.08),
    0 2px 4px rgba(10, 27, 42, 0.04),
    0 28px 60px -28px rgba(10, 27, 42, 0.3);
  padding: clamp(1.4rem, 3vw, 2.4rem);
  overflow: hidden;
}
.apply-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--emerald-deep), var(--emerald-bright));
}

.apply-card { padding: clamp(1rem, 1.8vw, 1.3rem) clamp(1.2rem, 2.6vw, 2rem); }
.apply-card__head { margin-bottom: 0.75rem; }
.apply-card__head h1 { font-size: clamp(0.95rem, 1.7vw, 1.3rem); margin-bottom: 0.25rem; }
.apply-card__head p { font-size: 1rem; margin: 0; }

/* Vertical compaction: the whole first step sits above the fold on a laptop screen. */
.apply-card .progress { margin-bottom: 0.85rem; }
.apply-card .progress__steps { margin-top: 0.55rem; }
.apply-card .fstep__title { font-size: clamp(0.75rem, 1.2vw, 0.95rem); margin-bottom: 0.2rem; }
.apply-card .fstep__sub { font-size: 1rem; margin-bottom: 0.9rem; }
.apply-card .fieldset__legend { margin-bottom: 0.45rem; }
.apply-card .choices { margin-bottom: 0.9rem; gap: 0.65rem; }
.apply-card .choice span { padding: 0.7rem 0.9rem 0.75rem; }
.apply-card .choice b { margin-bottom: 0.15rem; }
.apply-card .amount-box { padding: 0.9rem 1.25rem; margin-bottom: 0.9rem; }
.apply-card .amount-box__value { font-size: clamp(2rem, 3.6vw, 2.5rem); }
.apply-card .amount-box > p:last-child { margin-top: 0.4rem !important; }
/* Wide screens: the amount sits beside its slider instead of above it. */
@media (min-width: 700px) {
  .apply-card .amount-box { display: grid; grid-template-columns: auto 1fr; column-gap: 1.75rem; align-items: center; }
  .apply-card .amount-box > .calc__label,
  .apply-card .amount-box > p:last-child { grid-column: 1 / -1; }
  .apply-card .amount-box__value { margin-bottom: 0; min-width: 6.2ch; }
}
.apply-card .row { gap: 1rem; margin-bottom: 0.9rem; }
.apply-card .row .field { margin-bottom: 0; }
.apply-card .field select { padding-block: 0.75rem; }
.apply-card .field input[type='text'],
.apply-card .field input[type='email'],
.apply-card .field input[type='tel'],
.apply-card .field input[type='number'] { padding-block: 0.75rem; }
.apply-card .field { margin-bottom: 1rem; }
.apply-card .fnav { padding-top: 0.8rem; margin-top: 0; }
.apply-card .fnav .btn--lg { padding-block: 0.8rem; }

/* "Optional" tag beside a label, set lighter than the label itself. */
.field label .optional {
  margin-left: 0.4rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--muted);
}
