/* Tessellate Labs — careers portal
   Mobile-first. 16px base. No framework, no CDN (the CSP only allows 'self').
   Palette and type follow the Tessellate Labs brand: ink #111111 on a pale
   grey-green page, deep green primary, yellow accent for focus and
   highlights (always with #111 text on yellow). Inter for body, Space
   Grotesk for headings, both self-hosted latin subsets with system-ui
   fallbacks. */

@font-face { font-family: "Inter"; src: url("/fonts/inter-latin.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }

:root {
  --ink: #111111;
  --ink-soft: #4A524F;
  --page: #F1F4F3;
  --card: #FFFFFF;
  --primary: #043F35;
  --secondary: #0F6B52;
  --yellow: #FFF850;
  --line: #D4D6D4;
  --line-soft: #E4E7E5;
  --ok: #0F6B52;
  --ok-bg: #E2F1EB;
  --error: #A3261B;
  --error-bg: #FBE7E4;
  --accent: var(--secondary);
  --bg: var(--page);
  --bg-soft: var(--card);
  --radius: 10px;
  --tap: 44px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
/* Any element can set its own `display`, including .capture-stage below
   (display:flex) — which otherwise silently overrides the browser's default
   [hidden]{display:none} and leaves a full-bleed, invisible, click-eating
   overlay sitting on top of the whole page. Found by actually clicking the
   rendered page in a real browser, not by reading the code: a real tap on
   "Start" hit this instead of the button. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--secondary); text-underline-offset: 2px; }
a:hover { color: var(--primary); }
/* Yellow focus ring with an ink edge so it stays visible on light and dark
   backgrounds alike. */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 0;
  box-shadow: 0 0 0 5px var(--ink);
}
::selection { background: var(--yellow); color: var(--ink); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 1000;
  background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

.wrap { max-width: 640px; margin: 0 auto; padding: 0 20px; }
.wrap.narrow { max-width: 480px; }

/* ---- top bar / step indicator (portal stages) ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 640px; margin: 0 auto; padding: 10px 20px; }
.topbar-step {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  letter-spacing: .02em; text-transform: uppercase;
}
.topbar-name { font-size: 17px; font-weight: 700; margin-top: 2px; }
.topbar-track { height: 4px; background: var(--line-soft); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.topbar-fill { height: 100%; background: var(--secondary); border-radius: 2px; transition: width .3s ease; }

/* ---- application section nav (one application, free navigation, no locks) ----
   One row that scrolls sideways on phones: wrapping seven links onto four
   lines inside a sticky bar ate almost half the screen. */
.app-nav {
  position: relative; display: flex; flex-wrap: nowrap; gap: 18px; margin: 8px -20px 0; padding: 0 20px;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav-link {
  font-size: 13px; color: var(--ink-soft); text-decoration: none; padding: 6px 0;
  border-bottom: 2px solid transparent; white-space: nowrap; flex: none;
}
@media (min-width: 720px) {
  .app-nav { flex-wrap: wrap; overflow-x: visible; gap: 6px 16px; margin: 8px 0 0; padding: 0; }
}
.app-nav-link.current { color: var(--ink); font-weight: 700; border-bottom-color: var(--primary); }
.app-nav-link:hover { color: var(--ink); }

/* ---- page chrome ---- */
header.site-header { background: var(--primary); color: #fff; padding: 14px 0; }
header.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
header.site-header a { color: #fff; }
.brand-mark { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.brand-mark .brand-logo { height: 34px; width: auto; aspect-ratio: 126 / 40; flex: none; display: block; }
.brand-sub {
  font: 600 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: var(--yellow); padding: 5px 7px; border-radius: 4px;
}
.brand-nav { display: flex; align-items: center; gap: 18px; font: 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.brand-nav a { text-decoration: none; }
.brand-nav a:hover { color: var(--yellow); }
main { padding: 24px 0 56px; }
h1, h2, h3, legend { font-family: var(--font-display); letter-spacing: -.015em; color: var(--ink); }
h1 { font-weight: 700; }
h2, h3 { font-weight: 600; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 20px; line-height: 1.25; margin: 28px 0 8px; }
h3 { font-size: 17px; margin: 20px 0 6px; }
p { margin: 0 0 16px; }
.lede { font-size: 17px; color: var(--ink-soft); }
.small { font-size: 14px; color: var(--ink-soft); }
.hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

/* ---- forms ---- */
fieldset { border: 0; padding: 0; margin: 0 0 24px; }
legend { font-weight: 600; font-size: 18px; padding: 0; margin-bottom: 10px; }
.field { margin-bottom: 20px; }
.field > label, .field > .label {
  display: block; font: 12px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 8px;
}
.field .helper { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.field > label.question-label {
  font: 600 16px/1.4 var(--font); letter-spacing: 0; text-transform: none; margin-bottom: 10px;
}
/* Date fields (public/js/date-input.js): text input + calendar button. */
.date-field { position: relative; display: block; }
.date-field.has-picker input[data-date] { padding-right: 52px; }
.date-pick {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer;
}
.date-pick:hover { background: var(--page); }
.date-native {
  position: absolute; right: 6px; bottom: 0; width: 40px; height: 1px;
  opacity: 0; pointer-events: none; border: 0; padding: 0; min-height: 0;
}
input[type="file"] { display: block; width: 100%; font: 15px/1.4 var(--font); color: var(--ink-soft); }
input[type="file"]::file-selector-button {
  margin-right: 12px; padding: 10px 18px; border: 1px solid var(--ink); border-radius: 999px;
  background: var(--card); color: var(--ink); cursor: pointer;
  font: 12px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
}
input[type="file"]::file-selector-button:hover { background: var(--yellow); color: var(--ink); }
.field .error-text, .error-text {
  font-size: 14px; color: var(--error); margin-top: 6px; font-weight: 600;
}
/* No text-transform here deliberately: .mono is used to display the actual
   decrypted candidate password (admin-applicant.ejs #cred-password) —
   forcing uppercase would visually lie about the password's real case and
   could get it relayed wrong over the phone. Brand-style all-caps mono
   labels use .label-mono instead, below. */
.mono { font-family: var(--font-mono); letter-spacing: 0.04em; }
.label-mono { font: 12px/1.2 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--error);
  background: var(--error-bg);
}
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input[type="url"], input[type="number"], select, textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  min-height: var(--tap);
  border: 1px solid #9AA29E;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
textarea { min-height: 110px; resize: vertical; }
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='9'><path d='M1 1l6 6 6-6' stroke='%23454955' stroke-width='2' fill='none' fill-rule='evenodd'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.char-count { font-size: 13px; color: var(--ink-soft); text-align: right; margin-top: 4px; }
.char-count.near-limit { color: var(--error); font-weight: 600; }

label.check, label.radio {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px; border: 1.5px solid var(--line); border-radius: var(--radius);
  margin-bottom: 10px; min-height: var(--tap); cursor: pointer; background: var(--card);
}
label.check input, label.radio input { margin-top: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--primary); }
label.radio:has(input:checked), label.check:has(input:checked) {
  border-color: var(--secondary); background: #F6FFF9; box-shadow: inset 4px 0 0 var(--yellow);
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 13px 24px;
  font: 600 15px/1 var(--font); letter-spacing: .01em;
  border-radius: 8px; border: 1px solid var(--primary);
  background: var(--primary); color: #fff;
  text-decoration: none; cursor: pointer; width: 100%;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.btn:active { background: var(--yellow); color: var(--ink); }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.secondary { background: var(--card); color: var(--ink); border-color: var(--ink); }
.btn.secondary:hover { background: var(--yellow); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--yellow); border-color: var(--ink); color: var(--ink); }
.btn.danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn.danger:hover { background: var(--error); color: #fff; }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1 1 auto; }
.auth-tabs { margin-bottom: 28px; }
.auth-tabs .btn { flex: 1 1 0; min-width: 0; padding-left: 12px; padding-right: 12px; }
.auth-tabs .btn[aria-selected="true"] { background: var(--primary); color: #fff; border-color: var(--primary); }
.auth-tabs .btn[aria-selected="true"]:hover { background: var(--primary); color: #fff; }

/* ---- messages ---- */
.msg { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 15px; }
.msg.error { background: var(--error-bg); color: var(--error); border: 1px solid #F0C3BD; }
.msg.error ul { margin: 8px 0 0; padding-left: 20px; }
.msg.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #B9DCCD; }
.msg.info { background: var(--bg-soft); color: var(--ink); border: 1px solid var(--line); }

/* ---- cards / sections ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.card + .card { margin-top: -6px; }
.summary-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.summary-row:last-child { border-bottom: 0; }
.summary-row dt { color: var(--ink-soft); font-size: 14px; flex: 0 0 42%; }
.summary-row dd { margin: 0; font-size: 15px; text-align: right; flex: 1; word-break: break-word; }

/* ---- footer / save-and-come-back ---- */
footer.site-footer {
  border-top: 1px solid var(--line); padding: 20px 0 40px; margin-top: 32px;
  font-size: 14px; color: var(--ink-soft);
}
.save-link { display: block; margin-bottom: 10px; font-weight: 600; }

/* ---- repeating blocks (address history, referees) ---- */
.repeat-block { border: 1.5px dashed #B8BDBA; border-radius: var(--radius); padding: 16px; margin-bottom: 16px; position: relative; background: var(--card); }
.repeat-block .remove-block {
  position: absolute; top: 10px; right: 10px; min-height: 36px; padding: 6px 14px;
  font: 14px/1 var(--font); border-radius: 8px; border: 1.5px solid var(--line); background: var(--page); color: var(--ink); cursor: pointer;
}

/* ---- document upload guide ---- */
.upload-guide { border: 2px dashed #B8BDBA; border-radius: 12px; padding: 24px; text-align: center; margin-bottom: 16px; background: var(--card); }
.doc-list { list-style: none; margin: 0 0 8px; padding: 0; }
.doc-item { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 15px; }
.doc-item:last-child { border-bottom: 0; }
.upload-guide svg { margin: 0 auto 10px; display: block; }
.upload-preview { border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 12px; max-height: 260px; object-fit: contain; width: 100%; background: var(--bg-soft); }

/* ---- identity verification (stage 5) ----
   The live camera itself is the face guide's own full-screen overlay
   (public/css/face-capture.css + public/js/face-capture/); these style the
   page around it: the intro, the three-step explainer and the chooser. */
.capture-steps { list-style: none; margin: 20px 0; padding: 0; display: grid; gap: 10px; counter-reset: cstep; }
.capture-steps li {
  position: relative; padding: 14px 16px 14px 58px; min-height: 56px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; counter-increment: cstep;
}
.capture-steps li::before {
  content: counter(cstep); position: absolute; left: 14px; top: 14px; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; background: var(--yellow); color: var(--ink);
  font: 700 15px/1 var(--font-display); border: 1.5px solid var(--ink);
}
.capture-steps strong { display: block; font-family: var(--font-display); font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--ink); }
.capture-steps span { display: block; margin-top: 2px; font-size: 15px; color: var(--ink-soft); }
.capture-tip { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 20px; padding: 12px 14px; border-radius: 12px; background: var(--ok-bg); color: var(--primary); font-size: 15px; }
.capture-tip svg { flex: none; width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.capture-loading { margin-top: 10px; min-height: 21px; }
.capture-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0 20px; padding: 0; border: 0; min-width: 0; }
.capture-thumbs label {
  position: relative; display: flex; flex-direction: column; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 0 0 0 transparent; transition: box-shadow .15s ease, border-color .15s ease;
}
.capture-thumbs label:has(input:checked) { border-color: var(--ink); box-shadow: 0 0 0 3px var(--yellow), 0 0 0 4.5px var(--ink); }
.capture-thumbs label:has(input:focus-visible) { outline: 3px solid var(--yellow); outline-offset: 2px; }
.capture-thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: #0d1412; transform: scaleX(-1); }
.capture-thumbs input { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; accent-color: var(--primary); margin: 0; }
.capture-thumb-label { padding: 8px 8px 10px; font-size: 13px; line-height: 1.3; }
.capture-thumb-label b { display: block; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--ink); }
.capture-thumb-reason { display: block; color: var(--ink-soft); }
.capture-thumb-reason:empty { display: none; }
.capture-thumb-badge { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 999px; background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 700; border: 1px solid var(--ink); }
@media (max-width: 400px) { .capture-thumb-label { font-size: 12px; } .capture-thumb-badge { font-size: 11px; padding: 2px 6px; } }

/* Tessellate brand on the face guide overlay (tokens from face-capture.css).
   `html .fc` outranks the module's own `.fc` token block, including its
   dark-mode one, so only brand tokens are set here; the module keeps its
   own light/dark card colours. Light: deep green button, white text. Dark:
   brand yellow with ink text (yellow always gets #111 text). */
html .fc {
  --fc-font: var(--font);
  --fc-font-display: var(--font-display); /* card title, prompt text */
  --fc-font-label: var(--font);
  --fc-focus: var(--yellow);
  --fc-accent: #043F35;
  --fc-accent-ink: #ffffff;
  --fc-good: #3ddc97;
}
@media (prefers-color-scheme: dark) {
  html .fc { --fc-accent: #FFF850; --fc-accent-ink: #111111; }
}
/* The portal's global h1-h3 rule sets color: var(--ink); inside the overlay
   headings must take the card's own (light/dark) ink instead, or the dark
   card's title renders near-black on near-black. */
html .fc h2, html .fc h3 { color: inherit; }
html .fc .fc-card-title, html .fc .fc-prompt-text { font-family: var(--font-display); letter-spacing: -.015em; }
html .fc .fc-btn-primary { box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
html .fc .fc-btn-primary:hover { filter: none; background: var(--yellow); color: var(--ink); }
html .fc :focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; box-shadow: 0 0 0 5px var(--ink); }
/* the overlay itself takes focus when it opens: no ring around the whole screen */
html .fc:focus-visible { outline: none; box-shadow: none; }

@media (min-width: 560px) {
  h1 { font-size: 30px; }
  .btn { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---- utility classes replacing what would otherwise be inline styles ----
   CSP here has no 'unsafe-inline' for style-src, so dynamic values (meter
   and upload-progress widths) are swapped between pre-generated
   bucketed classes instead of ever touching element.style. */
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.is-hidden { display: none; }
.relative { position: relative; }
.visually-hidden { position: absolute; left: -9999px; top: auto; }
.fill-box { width: 100%; }

/* bucketed width percentages, step 5 */
.w-pct-0 { width: 0%; }
.w-pct-5 { width: 5%; }
.w-pct-10 { width: 10%; }
.w-pct-15 { width: 15%; }
.w-pct-20 { width: 20%; }
.w-pct-25 { width: 25%; }
.w-pct-30 { width: 30%; }
.w-pct-35 { width: 35%; }
.w-pct-40 { width: 40%; }
.w-pct-45 { width: 45%; }
.w-pct-50 { width: 50%; }
.w-pct-55 { width: 55%; }
.w-pct-60 { width: 60%; }
.w-pct-65 { width: 65%; }
.w-pct-70 { width: 70%; }
.w-pct-75 { width: 75%; }
.w-pct-80 { width: 80%; }
.w-pct-85 { width: 85%; }
.w-pct-90 { width: 90%; }
.w-pct-95 { width: 95%; }
.w-pct-100 { width: 100%; }

/* password strength meter colour states (discrete, class-based, no inline style) */
.meter-weak { background: #A3261B; }
.meter-okay { background: #B07A12; }
.meter-strong { background: var(--secondary); }

.ref-big { font-size: 20px; font-weight: 700; margin: 0; }

.mt-0 { margin-top: 0; }
.summary-row-list { margin: 0; }

/* ---- admin views ---- */
.admin-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.admin-topbar > .small:last-child { margin-left: auto; }
.admin-wide { max-width: 1000px; }
.admin-filter-row { align-items: flex-end; flex-wrap: wrap; }
.field-inline { margin-bottom: 0; }
.field-w-sm { min-width: 160px; }
.field-w-md { min-width: 200px; }
.btn-auto { width: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { font-weight: 700; background: var(--page); }
.admin-table { background: var(--card); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
.table-scroll .admin-table { min-width: 640px; }
.admin-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.admin-thumb { max-width: 220px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 8px 4px 0; }

/* ---- application-received confirmation: three tiles settling into place ---- */
.received-wrap { text-align: center; padding-top: 24px; }
.received-mark { width: 120px; height: 120px; margin: 0 auto 16px; background: var(--yellow); border-radius: 12px; padding: 8px; }
.received-svg { width: 100%; height: 100%; display: block; }
.hex { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linejoin: round; }
.hex-c { fill: var(--ink); }
.hex-a { animation: hex-settle .7s ease-out both; }
.hex-b { animation: hex-settle .7s .15s ease-out both; }
.hex-c { animation: hex-settle .7s .3s ease-out both; }
@keyframes hex-settle {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .hex-a, .hex-b, .hex-c { animation: none; }
}

/* Consent line on the face-scan intro (stage 5). Nothing on screen signals
   recording during the scan, so this notice appears before the camera opens. */
.idv-consent {
  margin: 20px 0 8px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(17, 17, 17, 0.05);
  border-radius: 8px;
  font-size: 15px;
  line-height: 1.5;
}
.idv-consent strong { font-weight: 600; }
