/* The application form.
 *
 * Shared by careers.html and every job posting, which is why it is here rather
 * than in either page: the speculative form and the per-role forms are the
 * same form asking different questions, and a candidate who looks at both
 * should not be able to tell they were built separately.
 *
 * Both host sections are dark (#1d1d1f) with the same green accent, so the
 * form sits in a translucent panel like the panels already on those pages.
 * The controls themselves are white with dark text rather than dark-on-dark:
 * this is the one thing on the site a person has to fill in accurately, often
 * on a phone, and legibility beats mood.
 */

.apply-form {
    max-width: 880px;
    margin: 0 auto;
    padding: clamp(1.5rem, 3vw, 2.25rem);
    border: 1px solid rgba(255, 255, 255, .17);
    background: rgba(255, 255, 255, .06);
    /* careers.html centres its CTA section; a centred form is unreadable. */
    text-align: left;
}

.apply-progress {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin: 0 0 .8rem;
    padding: 0;
    list-style: none;
}
.apply-progress li {
    display: flex;
    align-items: center;
    gap: .55rem;
    color: #d8d8db;
    font: 500 .72rem 'IBM Plex Mono', monospace;
    line-height: 1.35;
}
.apply-progress li::after {
    content: "";
    flex: 1;
    height: 1px;
    margin-left: .2rem;
    background: rgba(255, 255, 255, .2);
}
.apply-progress li:last-child::after { display: none; }
.apply-progress span,
.apply-step legend > span {
    display: inline-grid;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    place-items: center;
    border: 1px solid rgba(195, 221, 138, .55);
    border-radius: 50%;
    color: #d7ef9f;
    font: 600 .72rem 'IBM Plex Mono', monospace;
}
.apply-required-note {
    margin: 0 0 2rem !important;
    color: #b9b9bd !important;
    font-size: .78rem;
}
.apply-required-note span { color: #ffb4ab; }

.apply-step {
    min-width: 0;
    margin: 0;
    padding: 0 0 2rem;
    border: 0;
}
.apply-step + .apply-step {
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, .14);
}
.apply-step legend {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .08rem .75rem;
    width: 100%;
    margin: 0 0 1.35rem;
    padding: 0;
    color: #fff;
}
.apply-step legend > span { grid-row: 1 / 3; }
.apply-step legend b {
    font: 600 1rem 'Space Grotesk', Inter, sans-serif;
    letter-spacing: -.01em;
}
.apply-step legend small { color: #b9b9bd; font-size: .78rem; }

.apply-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.apply-field { display: flex; flex-direction: column; min-width: 0; }
/* A paragraph answer gets the full width; at 240px it is a slot, not a box. */
.apply-field--wide { grid-column: 1 / -1; }

.apply-field label {
    margin-bottom: .45rem;
    color: #fff;
    font: 500 .78rem 'IBM Plex Mono', monospace;
    letter-spacing: .04em;
}

.apply-req { color: #ffb4ab; }
.apply-optional { color: #a9a9ae; font-weight: 400; }

.apply-field input,
.apply-field select,
.apply-field textarea {
    width: 100%;
    padding: .75rem .9rem;
    /* Tokens, not literals, even though this whole section sits on a slab
       that is dark in both schemes. The field is the exception: a white input
       reads as paper against the slab on a white page, and as the only lit
       object in the room on a dark one -- and the quotation form on the
       contact page, which is the same form in a different colour, had already
       gone dark. In the light scheme these resolve to the values that were
       here, so nothing moves. */
    border: 1px solid var(--c-line-firm);
    border-radius: 8px;
    background: var(--c-surface);
    color: var(--c-ink);
    font-family: Inter, Arial, sans-serif;
    font-size: .95rem;
}
.apply-field textarea { resize: vertical; min-height: 6.5rem; }
.apply-field select { appearance: none; padding-right: 2.4rem;
    /* The arrow is a data: URI so the page still has nothing to fetch. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236e6e73' stroke-width='1.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .95rem center;
    background-size: .7rem;
}

.apply-field input:focus,
.apply-field select:focus,
.apply-field textarea:focus {
    outline: 2px solid #a7c46a;
    outline-offset: 2px;
    border-color: #a7c46a;
}

.apply-hint { margin-top: .4rem; color: #b9b9bd; font-size: .78rem; line-height: 1.5; }
.apply-error:empty { display: none; }
.apply-error { display: block; margin-top: .4rem; color: #ffb4ab; font-size: .78rem; line-height: 1.5; }
.apply-field.is-invalid input,
.apply-field.is-invalid select,
.apply-field.is-invalid textarea {
    border-color: #ffb4ab;
    box-shadow: 0 0 0 3px rgba(255, 180, 171, .22);
}
.apply-field.is-invalid label { color: #ffb4ab; }

/* --- The CV ---------------------------------------------------------------
   Its own block above the consent line rather than a twelfth cell in the grid.
   It is the one thing the hiring team cannot work without, and a file input
   sitting among ten text boxes is the one people scroll past. */
.apply-cv {
    margin-top: 1.5rem;
    padding: 1.25rem;
    border: 1px dashed rgba(255, 255, 255, .28);
    border-radius: 10px;
}
.apply-cv .apply-field label { font-size: .82rem; }
.apply-cv input[type="file"] {
    padding: .6rem;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .22);
    color: #fff;
    font-size: .88rem;
}
/* The button inside the control is a shadow-DOM part in every engine that has
   one; without this it renders as a grey system button on a dark panel. */
.apply-cv input[type="file"]::file-selector-button {
    margin-right: .9rem;
    padding: .5rem 1rem;
    border: 0;
    border-radius: 6px;
    background: #a7c46a;
    color: #1d1d1f;
    font: 600 .74rem 'IBM Plex Mono', monospace;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}
.apply-cv input[type="file"]::file-selector-button:hover { background: #bcd484; }

/* Off-screen rather than hidden: display:none is the first thing a bot checks
   for, and it would also drop the field from the submitted form on some
   browsers. */
.apply-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.apply-consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .6rem .75rem;
    align-items: start;
    margin-top: 1.75rem;
}
.apply-consent input { width: 20px; height: 20px; margin-top: .15rem; accent-color: #a7c46a; }
.apply-consent label { color: #e8e8ea; font-size: .9rem; line-height: 1.6; }
.apply-consent .apply-error { grid-column: 1 / -1; }
.apply-consent.is-invalid label { color: #ffb4ab; }

.apply-privacy { max-width: 680px; margin: 1rem 0 0 !important; color: #b9b9bd !important; font-size: .82rem; line-height: 1.7; }
.apply-privacy a { color: #c3dd8a; }

.apply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; margin-top: 2rem; }
.apply-submit {
    padding: .95rem 2rem;
    border: 0;
    border-radius: 6px;
    background: #a7c46a;
    color: #1d1d1f;
    font: 600 .8rem 'IBM Plex Mono', monospace;
    letter-spacing: .1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease;
}
.apply-submit:hover:not(:disabled) { background: #bcd484; }
.apply-submit:disabled { opacity: .6; cursor: progress; }
.apply-alt { color: #b9b9bd; font-size: .88rem; line-height: 1.7; }
.apply-alt a { color: #c3dd8a; overflow-wrap: anywhere; }

.apply-status:empty { display: none; }
.apply-status {
    margin: 1.5rem 0 0 !important;
    padding: 1rem 1.25rem;
    border-radius: 10px;
    font-size: .95rem;
    line-height: 1.6;
}
.apply-status.is-ok { border-left: 4px solid #a7c46a; background: rgba(167, 196, 106, .14); color: #fff !important; }
.apply-status.is-error { border-left: 4px solid #ffb4ab; background: rgba(255, 180, 171, .14); color: #fff !important; }

@media (max-width: 600px) {
    .apply-form { padding: 1.25rem 1rem; }
    .apply-grid { grid-template-columns: 1fr; }
    .apply-progress { gap: .35rem; }
    .apply-progress li { display: grid; justify-items: center; text-align: center; font-size: .65rem; }
    .apply-progress li::after { display: none; }
    .apply-required-note { margin-bottom: 1.5rem !important; }
    .apply-step { padding-bottom: 1.6rem; }
    .apply-step + .apply-step { padding-top: 1.6rem; }
}
