/* WM Feedback — the job application form ([wm_job_application]).

   A plain look that works on any theme. The site's own look belongs to the
   theme: set the custom properties below, or style the wm-apply-* classes.
   Every rule here is wrapped in :where(), so any theme selector wins without
   a fight. Mobile first; touch targets at least 44px. */

:where(.wm-apply) {
    --wm-apply-gap: 1.5rem;
    --wm-apply-line: #8c8c8c;
    --wm-apply-focus: #2c63ff;
    --wm-apply-error: #b3261e;
    --wm-apply-radius: 0.375rem;
    --wm-apply-field-bg: #fff;
    --wm-apply-button-bg: #222;
    --wm-apply-button-fg: #fff;

    box-sizing: border-box;
    max-width: 40rem;
    margin-inline: auto;
    text-align: start;
}

:where(.wm-apply) *,
:where(.wm-apply) *::before,
:where(.wm-apply) *::after {
    box-sizing: inherit;
}

/* The honeypot: off screen, still sent by bots. Not in :where() — a theme
   must never bring it back. */
.wm-apply-hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

:where(.wm-apply-field) {
    margin: 0 0 var(--wm-apply-gap);
}

:where(fieldset.wm-apply-field) {
    border: 0;
    padding: 0;
    min-width: 0;
}

:where(.wm-apply-label) {
    display: block;
    margin: 0 0 0.4rem;
    padding: 0;
    font-weight: 600;
}

:where(.wm-apply-optional) {
    font-weight: 400;
    opacity: 0.7;
}

:where(.wm-apply-hint) {
    margin: 0 0 0.6rem;
    font-size: 0.875em;
    opacity: 0.8;
}

:where(.wm-apply-input) {
    display: block;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.6rem 0.75rem;
    font: inherit;
    line-height: 1.4;
    color: inherit;
    background: var(--wm-apply-field-bg);
    border: 1px solid var(--wm-apply-line);
    border-radius: var(--wm-apply-radius);
    -webkit-appearance: none;
    appearance: none;
}

:where(.wm-apply-textarea) {
    min-height: 7rem;
    resize: vertical;
}

:where(.wm-apply-input:focus-visible),
:where(.wm-apply-choice input:focus-visible),
:where(.wm-apply-submit:focus-visible),
:where(.wm-apply-file-remove:focus-visible) {
    outline: 2px solid var(--wm-apply-focus);
    outline-offset: 2px;
}

:where(.wm-apply [aria-invalid="true"]) {
    border-color: var(--wm-apply-error);
    outline-color: var(--wm-apply-error);
}

/* Which job */
:where(.wm-apply-choices) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1.5rem;
}

:where(.wm-apply-choice) {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 2.75rem;
    cursor: pointer;
}

:where(.wm-apply-choice input) {
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
    flex-shrink: 0;
}

/* The keeping time: a line of text, then the privacy page's link under it. */
:where(.wm-apply-privacy) {
    display: inline-block;
    margin-top: 0.25rem;
}

/* Files. Without the script the browser's own file field shows; with it
   (.is-enhanced) the field hides behind a button and the chosen files list
   above it, each with a remove button. */
:where(.wm-apply-file-list) {
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
}

:where(.wm-apply-file) {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 2.75rem;
    border-bottom: 1px solid var(--wm-apply-line);
}

:where(.wm-apply-file-name) {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

:where(.wm-apply-file-size) {
    flex-shrink: 0;
    font-size: 0.875em;
    opacity: 0.7;
}

:where(.wm-apply-file-remove) {
    flex-shrink: 0;
    min-height: 2.75rem;
    padding: 0 0.25rem;
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    text-decoration: underline;
    cursor: pointer;
}

:where(.wm-apply-file-button) {
    display: none;
}

:where(.wm-apply.is-enhanced .wm-apply-file-pick) {
    position: relative;
    display: inline-flex;
}

/* Visually hidden, still focusable and announced. */
:where(.wm-apply.is-enhanced .wm-apply-file-input) {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

:where(.wm-apply.is-enhanced .wm-apply-file-button) {
    display: inline-flex;
    align-items: center;
    min-height: 2.75rem;
    padding: 0 1rem;
    border: 1px solid var(--wm-apply-line);
    border-radius: var(--wm-apply-radius);
    background: var(--wm-apply-field-bg);
}

:where(.wm-apply.is-enhanced .wm-apply-file-pick:focus-within .wm-apply-file-button) {
    outline: 2px solid var(--wm-apply-focus);
    outline-offset: 2px;
}

:where(.wm-apply-file-pick[hidden]) {
    display: none;
}

/* Send */
:where(.wm-apply-actions) {
    margin-top: calc(var(--wm-apply-gap) * 1.25);
}

:where(.wm-apply-submit) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
    padding: 0.75rem 2rem;
    font: inherit;
    font-weight: 600;
    color: var(--wm-apply-button-fg);
    background: var(--wm-apply-button-bg);
    border: 1px solid var(--wm-apply-button-bg);
    border-radius: var(--wm-apply-radius);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

:where(.wm-apply-submit[aria-busy="true"]) {
    opacity: 0.6;
    cursor: progress;
}

/* What went wrong, and the thanks */
:where(.wm-apply-errors) {
    margin: 0 0 var(--wm-apply-gap);
    padding: 0.75rem 1rem;
    border: 1px solid var(--wm-apply-error);
    border-radius: var(--wm-apply-radius);
}

:where(.wm-apply-errors ul) {
    margin: 0;
    padding-inline-start: 1.1em;
}

:where(.wm-apply-errors:focus) {
    outline: none;
}

:where(.wm-apply-thanks) {
    padding: 2rem 0;
}

:where(.wm-apply-thanks:focus) {
    outline: none;
}

:where(.wm-apply-thanks-title) {
    margin: 0 0 0.5rem;
}

:where(.wm-apply-thanks-text) {
    margin: 0;
}
