/**
 * Ethon brand styling for the embedded Ashby application form.
 *
 * Loaded INSIDE Ashby's iframe. The iframe is served from jobs.ashbyhq.com,
 * so this CSS reaches the form one of two ways:
 *   A. Paste these rules into Ashby admin → Job Boards → Theme → Custom CSS
 *      (global). Applies everywhere incl. localhost, no URL/allowlist needed.
 *      Easiest for testing/iterating.
 *   B. Serve this file and pass it as the embed `customCssUrl`
 *      (see site/templates/job.php). The URL
 *      (https://www.ethon.com/static/ashby-embed.css) must then be added to
 *      the allow list in Ashby admin. localhost URLs won't work.
 *
 * Font: the form uses the site brand face APK Protocol, self-hosted as .ttf
 * under /static and pulled into the iframe via the @font-face rules below.
 * The iframe is cross-origin (jobs.ashbyhq.com), so the font files are served
 * with `Access-Control-Allow-Origin: *` from public/.htaccess. They're
 * referenced by absolute production URL, so they also load on localhost (from
 * prod) once that CORS header is deployed.
 *
 * Ashby exposes a small theming layer of CSS variables (--colorPrimary*,
 * --fontFamily, --borderRadius*, --colorAppBackground). We set those first,
 * then add a few targeted class overrides for typography and the submit
 * button. Tweak freely once you see it rendered live.
 *
 * The submit button uses DM Mono (the site's mono face, also a Google Font)
 * via the @import below — it must remain the very first statement.
 */

@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&display=swap");

@font-face {
  font-family: "APK Protocol";
  src: url("https://www.ethon.com/static/APK-Protocol-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "APK Protocol";
  src: url("https://www.ethon.com/static/APK-Protocol-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --fontFamily: "APK Protocol", ui-sans-serif, system-ui, sans-serif;
  --widthMaxJobBoard: 100%;
  --colorAppBackground: transparent;
  --colorPrimary900: #1c1f29; /* brand-neutral-90 (button base) */
  --colorPrimary600: #0e3ca6; /* brand-blue-base (accent / hover) */
  --borderRadiusContainer: 2px;
  --borderRadiusControl: 2px;
  --borderRadiusButton: 2px;
}

.ashby-application-form-container {
  font-family: "APK Protocol", ui-sans-serif, system-ui, sans-serif;
  color: #090e18; /* brand-neutral-100 */
  max-width: 100%;
}

/* Field labels + descriptions */
.ashby-application-form-question-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: #090e18;
}

.ashby-application-form-question-title::after {
  color: #f54b34; /* brand-red-base — required asterisk */
}

.ashby-application-form-question-description {
  font-size: 0.875rem;
  color: #646978; /* brand-neutral-60 */
}

/* Inputs (Ashby applies no dedicated classes here, so target descendants) */
.ashby-application-form-container input,
.ashby-application-form-container textarea,
.ashby-application-form-container select {
  font-family: inherit;
  font-size: 1rem;
  color: #090e18;
  background-color: #ffffff;
  border: 1px solid #cdd2dc; /* brand-neutral-20 */
  border-radius: 2px;
}

.ashby-application-form-container input:focus,
.ashby-application-form-container textarea:focus,
.ashby-application-form-container select:focus {
  border-color: #0e3ca6; /* brand-blue-base */
  outline: 2px solid #0e3ca6;
  outline-offset: 1px;
}

.ashby-application-form-container input::placeholder,
.ashby-application-form-container textarea::placeholder {
  color: #a2a7b0; /* brand-neutral-40 */
}

/* Section headers */
.ashby-application-form-section-header-title {
  font-family: inherit;
  font-weight: 500;
  color: #090e18;
}

.ashby-application-form-section-header-description {
  color: #646978; /* brand-neutral-60 */
}

/* Ashby's choice / segmented option buttons manage their own selected state
   via hashed module classes (e.g. `_option_…` + `_active_…`). We must NOT
   blanket-style every <button> — that out-specified the active rule and made
   the selection stop sticking. Instead we only pin the *selected* state to
   brand colors:
     - matched via the stable `_option_`/`_active_` class prefixes (substring),
       so it survives Ashby's class-hash changes;
     - forced with !important to beat Ashby's inline admin-theme
       --colorPrimary900 (otherwise the active fill uses that color). */
.ashby-application-form-container button[class*="_option_"][class*="_active_"] {
  background-color: #1c1f29 !important; /* brand-neutral-90 */
  border-color: #1c1f29 !important;
  color: #ffffff !important;
}

/* Native file-input button (e.g. résumé autofill "Upload file") — match the
   secondary style. Kept as separate rules: an unsupported pseudo-element in a
   selector list would invalidate the whole rule. */
.ashby-application-form-container input[type="file"]::file-selector-button {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #090e18; /* brand-neutral-100 */
  background-color: transparent;
  border: 1px solid rgba(162, 167, 176, 0.25); /* brand-neutral-40/25 */
  border-radius: 2px;
  padding: 0.875rem 1.375rem; /* py-3.5 px-5.5 */
  margin-right: 0.75rem;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.ashby-application-form-container input[type="file"]::file-selector-button:hover {
  color: #0e3ca6; /* brand-blue-base */
  background-color: #ffffff;
  border-color: #0e3ca6;
}

/* Legacy WebKit equivalent (older Safari) */
.ashby-application-form-container input[type="file"]::-webkit-file-upload-button {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #090e18;
  background-color: transparent;
  border: 1px solid rgba(162, 167, 176, 0.25);
  border-radius: 2px;
  padding: 0.875rem 1.375rem;
  margin-right: 0.75rem;
  cursor: pointer;
}

/* Links inside the form */
.ashby-application-form-container a {
  color: #0e3ca6; /* brand-blue-base */
  text-decoration: underline;
}

/* Submit button — mirror the site's primary button: DM Mono, uppercase, black, white text, blue on hover */
.ashby-application-form-submit-button {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 0.8125rem;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffffff !important;
  background-color: #1c1f29 !important; /* brand-neutral-90 */
  border: none !important;
  border-radius: 2px !important;
  padding: 0.875rem 1.375rem !important; /* py-3.5 px-5.5 */
  transition: background-color 0.2s ease;
}

.ashby-application-form-submit-button:hover {
  background-color: #0e3ca6 !important; /* brand-blue-base */
}

.ashby-application-form-submit-button:disabled {
  background-color: #a2a7b0 !important; /* brand-neutral-40 */
  cursor: not-allowed;
}
