/* ==========================================================================
   Opportineer — /apply form.
   Extends assets/site.css. Consumes ONLY the tokens defined there: no new
   fonts, no new colours, no external requests. Loaded as a separate file
   rather than inlined so the site CSP can stay style-src 'self'.
   ========================================================================== */

/* ---------- layout ---------- */
.applygrid {
  display: grid;
  gap: clamp(1.6rem, 4vw, 3.2rem);
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .8fr);
  align-items: start;
}
@media (max-width: 940px) { .applygrid { grid-template-columns: 1fr; } }

.applygrid > * { min-width: 0; }

/* sidebar sticks next to a long form on desktop only */
@media (min-width: 941px) {
  .aside-sticky { position: sticky; top: 84px; }
}

/* ---------- form shell ---------- */
.form {
  border: 1.5px solid var(--rule-hard);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.form-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap;
  padding: .7rem .85rem;
  border-bottom: 1.5px solid var(--rule-hard);
}
.form-head span:first-child {
  font-family: var(--mono); font-weight: 700; font-size: .72rem; letter-spacing: .12em;
}

fieldset {
  border: 0; margin: 0;
  padding: clamp(1.1rem, 2.6vw, 1.6rem) clamp(.95rem, 2.4vw, 1.5rem);
  border-top: 1px solid var(--rule);
}
fieldset:first-of-type { border-top: 0; }

legend {
  font-family: var(--mono); font-size: .655rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--flag); font-weight: 500;
  padding: 0; margin-bottom: 1.1rem;
}

/* ---------- fields ---------- */
.row { display: grid; gap: 1.05rem; }
@media (min-width: 560px) { .row.two { grid-template-columns: 1fr 1fr; } }
.row + .row { margin-top: 1.05rem; }
.row > * { min-width: 0; }

.f { display: flex; flex-direction: column; gap: .34rem; }

.f > label {
  font-family: var(--mono); font-size: .715rem; letter-spacing: .05em;
  color: var(--ink); font-weight: 700;
}
.f .opt { color: var(--muted); font-weight: 500; letter-spacing: .12em; font-size: .62rem; }

.f .hint {
  font-size: .82rem; color: var(--muted); line-height: 1.45; max-width: 62ch;
}

.f input,
.f select,
.f textarea {
  font-family: var(--mono);
  font-size: .855rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--rule);
  border-radius: 0;
  padding: .62rem .7rem;
  width: 100%;
  transition: border-color .16s ease, background .16s ease;
  -webkit-appearance: none;
  appearance: none;
}
.f textarea { min-height: 8.5rem; resize: vertical; font-family: var(--mono); }

.f select {
  /* caret drawn inline — no image request */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.f input:hover, .f select:hover, .f textarea:hover { border-color: var(--rule-hard); }
.f input:focus, .f select:focus, .f textarea:focus {
  border-color: var(--flag);
  background: var(--panel);
  outline: 2px solid var(--flag);
  outline-offset: 1px;
}
.f input::placeholder, .f textarea::placeholder { color: var(--muted); opacity: .75; }

.f .count {
  font-family: var(--mono); font-size: .65rem; letter-spacing: .06em;
  color: var(--muted); align-self: flex-end;
}

/* error state — colour is never the only signal: the message text carries it */
.f .err {
  font-family: var(--mono); font-size: .7rem; line-height: 1.45;
  color: var(--flag);
  min-height: 0;
}
.f .err:empty { display: none; }
.f.bad input, .f.bad select, .f.bad textarea { border-color: var(--flag); background: var(--flag-wash); }

/* honeypot — off-screen, never focusable, never announced */
.hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* ---------- submit ---------- */
.form-foot {
  border-top: 1.5px solid var(--rule-hard);
  padding: clamp(1rem, 2.4vw, 1.4rem) clamp(.95rem, 2.4vw, 1.5rem);
  display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.2rem;
}
.form-foot .fineprint {
  font-family: var(--mono); font-size: .66rem; letter-spacing: .04em;
  color: var(--muted); line-height: 1.6; max-width: 46ch; margin: 0;
}

button.btn {
  cursor: pointer;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .03em;
  background: var(--flag); border: 1.5px solid var(--flag); color: #FFF7F1;
  padding: .82rem 1.15rem;
  display: inline-flex; align-items: center; gap: .55rem;
  transition: background .18s ease, opacity .18s ease;
}
button.btn:hover:not(:disabled) { background: color-mix(in srgb, var(--flag) 84%, #000); }
button.btn:disabled { opacity: .55; cursor: progress; }

/* ---------- status banner ---------- */
.status {
  border-left: 2.5px solid var(--flag);
  background: var(--flag-wash);
  padding: 1rem 1.2rem;
  margin-bottom: 1.4rem;
}
.status:empty, .status[hidden] { display: none; }
.status p { font-size: .945rem; max-width: none; margin: 0; }
.status .label { display: block; margin-bottom: .35rem; color: var(--flag); }
.status.ok { border-left-color: var(--pine); background: var(--pine-wash); }
.status.ok .label { color: var(--pine); }
.status .ref {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .04em;
  margin-top: .5rem; color: var(--ink-soft);
}

/* ---------- sidebar cards ---------- */
.aside-card {
  border: 1.5px solid var(--rule-hard);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.aside-card + .aside-card { margin-top: 1.3rem; }
.aside-card .ah {
  padding: .7rem .85rem;
  border-bottom: 1.5px solid var(--rule-hard);
  font-family: var(--mono); font-weight: 700; font-size: .72rem; letter-spacing: .12em;
}
.aside-card .ab { padding: 1.05rem .95rem 1.15rem; }
.aside-card .ab p { font-size: .9rem; color: var(--ink-soft); max-width: none; }
.aside-card .ab p + p { margin-top: .7rem; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  display: grid; grid-template-columns: 1.1rem 1fr; gap: .6rem;
  font-size: .89rem; color: var(--ink-soft);
  padding: .5rem 0;
  border-top: 1px solid var(--rule);
}
.checklist li:first-child { border-top: 0; padding-top: 0; }
.checklist .m { font-family: var(--mono); color: var(--flag); font-weight: 700; }

/* ---------- noscript fallback ---------- */
.nojs {
  border-left: 2.5px solid var(--flag);
  background: var(--flag-wash);
  padding: 1rem 1.2rem;
  margin-bottom: 1.4rem;
}
.nojs p { font-size: .945rem; max-width: none; }
