/* ==========================================================================
   Application page (apply.html) — styled form that submits to Google Forms
   ========================================================================== */

.apply-page { background: var(--linen); }
.apply-page::after { display: none; } /* no film grain over form fields */

.apply-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(232, 230, 220, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.apply-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  height: 72px;
}
.apply-header .lang { --h-fg: var(--ink); --h-contrast: var(--cream); }
.apply-header__actions { display: flex; align-items: center; gap: 14px; }
.apply-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.apply-back svg { width: 16px; height: 16px; transform: scaleX(-1); }
.apply-back:hover { color: var(--accent); }

.apply {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(32px, 5vw, 88px);
  align-items: start;
  padding-top: clamp(32px, 5vw, 72px);
  padding-bottom: 96px;
}

/* ---------- Aside ---------- */
.apply__aside { position: sticky; top: 112px; }
.apply__aside h1 { margin-top: 18px; font-size: clamp(32px, 3.6vw, 52px); line-height: 1.05; }
.apply__aside h1 em { color: var(--accent); }
.apply__meta {
  margin-top: 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.apply__intro { margin-top: 16px; max-width: 420px; color: var(--ink-soft); }

.steps-nav { list-style: none; margin: 32px 0 0; padding: 0; border-left: 1px solid var(--line); counter-reset: s; }
.steps-nav li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0 11px 22px;
  color: var(--ink-soft);
  font-size: 15px;
  counter-increment: s;
  transition: color 0.3s;
}
.steps-nav li::after {
  content: counter(s, decimal-leading-zero);
  order: -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--straw);
}
.steps-nav li.is-current { color: var(--ink); font-weight: 600; }
.steps-nav li.is-current::after { color: var(--accent); }
.steps-nav li.is-current::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
}
.steps-nav li.is-done { color: var(--olive); }
.steps-nav li.is-done::after { content: "✓"; font-family: var(--font-body); font-size: 15px; color: var(--olive); }

.apply__photo { margin: 36px 0 0; width: 230px; aspect-ratio: 3 / 4; }
.apply__photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Card ---------- */
.form-card {
  position: relative;
  padding: clamp(24px, 4vw, 56px);
  border-radius: var(--radius-lg);
  background: var(--cream);
  box-shadow: 0 50px 90px -60px rgba(28, 33, 29, 0.45);
}
.progress { height: 4px; overflow: hidden; border-radius: 4px; background: var(--sand); }
.progress span { display: block; width: 25%; height: 100%; background: var(--forest); transition: width 0.6s var(--ease); }

.qstep { display: none; }
.qstep.is-active { display: block; animation: step-in 0.5s var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.step-head { margin: 26px 0 30px; }
.step-count {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.step-head h2 { margin-top: 10px; font-size: clamp(24px, 2.4vw, 32px); }
.step-head p { margin-top: 10px; color: var(--ink-soft); font-size: 15px; }

/* ---------- Fields ---------- */
.field { margin-bottom: 30px; }
.field[hidden] { display: none; }
.field__label {
  display: block;
  margin-bottom: 10px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.4;
}
.req { margin-left: 3px; color: var(--accent); }
.field__hint { margin: -4px 0 12px; color: var(--ink-soft); font-size: 14px; line-height: 1.45; }

.input,
.textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(28, 33, 29, 0.18);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: 400 16px/1.5 var(--font-body);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder,
.textarea::placeholder { color: rgba(84, 91, 83, 0.55); }
.input:focus,
.textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(133, 88, 47, 0.12); }
.textarea { min-height: 120px; resize: vertical; }
input[type="date"].input { min-height: 52px; }

.dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dates label > span { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 13px; }

.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choice { position: relative; display: inline-flex; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border: 1px solid rgba(28, 33, 29, 0.2);
  border-radius: 999px;
  background: #fff;
  font-size: 15px;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.choice > span:hover { border-color: var(--ink); }
.choice input:checked + span { background: var(--forest); border-color: var(--forest); color: var(--cream); }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(133, 88, 47, 0.35); }
.choice--box > span::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: none;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  opacity: 0.6;
}
.choice--box input:checked + span::before {
  opacity: 1;
  background: var(--peach) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232d3226' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
  border-color: var(--peach);
}
.choices--cards { flex-direction: column; }
.choices--cards .choice { display: flex; }
.choices--cards .choice > span { width: 100%; padding: 16px 20px; border-radius: 16px; }
.other-input { margin-top: 12px; }

.consent {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--linen);
  cursor: pointer;
  font-size: 15px;
  line-height: 1.5;
}
.consent input { width: 22px; height: 22px; flex: none; margin: 1px 0 0; accent-color: var(--accent); }
.consent a { font-weight: 600; }

.note-box {
  margin-bottom: 28px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--linen);
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
}

.field.has-error .input,
.field.has-error .textarea,
.field.has-error .choice > span,
.field.has-error .consent { border-color: #b23b2b; }
.field__error { margin-top: 8px; color: #a3372a; font-size: 13.5px; font-weight: 500; }

/* ---------- Navigation ---------- */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.form-nav .btn[hidden] { display: none; }
.form-nav .btn--back svg { transform: scaleX(-1); }
.form-nav .btn--back:hover svg { transform: scaleX(-1) translateX(4px); }
.form-nav__spacer { flex: 1; }
.btn[disabled] { opacity: 0.6; pointer-events: none; }
.saved-note { margin-top: 14px; color: var(--ink-soft); font-size: 12.5px; text-align: right; }

/* ---------- Result states ---------- */
.form-state { padding: 32px 0 8px; text-align: center; }
.form-state[hidden] { display: none; }
.form-state h2 { font-size: clamp(26px, 2.6vw, 36px); }
.form-state p { max-width: 520px; margin: 18px auto 0; color: var(--ink-soft); }
.form-state .btn { margin-top: 30px; }
.form-state__icon {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin: 0 auto 26px;
  border-radius: 50%;
  background: var(--olive);
  color: var(--cream);
}
.form-state__icon svg { width: 34px; height: 34px; }
.noscript { padding: 24px 0; }

.apply-footer {
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13.5px;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .apply { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 28px; }
  .apply__aside { position: static; }
  .steps-nav,
  .apply__photo { display: none; }
  .apply__aside h1 { font-size: clamp(30px, 8vw, 40px); }
}
@media (max-width: 600px) {
  .apply-header .lang { display: inline-flex; }
  .apply-back span { display: none; }
  .form-card { padding: 22px 18px 26px; border-radius: 24px; margin-inline: -6px; }
  .dates { grid-template-columns: minmax(0, 1fr); }
  .choice > span { padding: 11px 16px; font-size: 14.5px; }
  .form-nav .btn { padding: 0.95em 1.3em; }
}

fieldset.qstep { min-width: 0; margin: 0; padding: 0; border: 0; }
.step-head h2:focus { outline: none; }

/* narrow phones: the brand stays on one line next to the language switch */
@media (max-width: 420px) {
  .apply-header .brand__sub { display: none; }
  .apply-header .brand__name { white-space: nowrap; }
}
