/* Low Tide Animation — candidate onboarding portal
   Mobile-first. 16px base. No framework, no CDN. Plain CSS, hand-written.
   Palette, fonts and component shapes now match the public marketing site's
   careers-portal theme (assets/css/portal.css in the site repo) exactly —
   this used to run its own unrelated blue theme; re-themed so "Careers" on
   the real site and this app read as one product, not two. */

@font-face { font-family: "m-r"; src: url("/fonts/m-r.woff") format("woff"); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: "m-m"; src: url("/fonts/m-m.woff") format("woff"); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: "m-mono"; src: url("/fonts/m-m-04d32e.woff") format("woff"); font-weight: normal; font-style: normal; font-display: swap; }

:root {
  --ink: #0B1A1F;
  --tide: #12343B;
  --paper: #F3EEE3;
  --card: #FBF8F1;
  --orange: #E8603C;
  --grey: #7C8E8C;
  --sun: #F2C14E;
  --line: rgba(11, 26, 31, .18);
  --line-soft: rgba(11, 26, 31, .10);
  --ok: #2F7D5B;
  --ok-bg: #E3F2EA;
  --error: #A2362A;
  --error-bg: #FBE4E0;
  /* kept so nothing that still references the old names breaks; mapped onto
     the brand palette rather than left pointing at the old blue */
  --accent: var(--orange);
  --accent-dark: #C94B2C;
  --ink-soft: var(--grey);
  --bg: var(--paper);
  --bg-soft: var(--card);
  --radius: 10px;
  --tap: 44px;
  --font: "m-r", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "m-m", "m-r", sans-serif;
  --font-mono: "m-mono", ui-monospace, Menlo, Consolas, 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(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

.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(--bg);
  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(--accent); border-radius: 2px; transition: width .3s ease; }

/* ---- page chrome ---- */
header.site-header { background: var(--tide); color: var(--paper); padding: 16px 0; }
header.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
header.site-header a { color: var(--paper); }
.brandline { font: 20px/1 var(--font-display); letter-spacing: -.01em; color: var(--paper); }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 20px/1 var(--font-display); letter-spacing: -.01em; color: var(--paper); }
.brand-mark svg { width: 30px; height: 30px; flex: none; }
.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(--sun); }
main { padding: 24px 0 56px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.015em; }
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: 700; font-size: 17px; 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 .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 var(--ink);
  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(--accent); }
.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;
}
label.check input, label.radio input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
label.radio:has(input:checked), label.check:has(input:checked) {
  border-color: var(--orange); background: var(--card);
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 13px 24px;
  font: 13px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase;
  border-radius: 999px; border: 1px solid var(--ink);
  background: var(--orange); color: var(--ink);
  text-decoration: none; cursor: pointer; width: 100%;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.btn:hover { background: var(--sun); transform: translateY(-1px); }
.btn:active { background: var(--sun); transform: translateY(0); }
.btn[disabled] { opacity: .55; cursor: wait; transform: none; }
.btn.secondary { background: var(--card); color: var(--ink); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }
.btn.danger { background: transparent; border-color: var(--error); color: var(--error); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1 1 auto; }

/* ---- 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 #f3c6c2; }
.msg.ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe6cd; }
.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: 14px; 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 var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; position: relative; }
.repeat-block .remove-block {
  position: absolute; top: 10px; right: 10px; min-height: 36px; padding: 6px 14px;
  font-size: 14px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--bg);
}

/* ---- upload guide (stage 4) ---- */
.upload-guide { border: 2px dashed var(--line); border-radius: 14px; padding: 24px; text-align: center; margin-bottom: 16px; }
.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); }

/* ---- camera capture (stage 7) ---- */
.capture-stage { position: fixed; inset: 0; background: #000; z-index: 500; display: flex; flex-direction: column; }
.capture-video { flex: 1; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); background: #000; }
.capture-scrim { position: absolute; inset: 0; pointer-events: none; }
.capture-prompt {
  position: absolute; top: 14%; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 22px; font-weight: 700; text-align: center;
  text-shadow: 0 1px 4px rgba(0,0,0,.6); padding: 0 24px; max-width: 90%;
  opacity: 0; transition: opacity .4s ease;
}
.capture-prompt.show { opacity: 1; }
.capture-ring { width: 64px; height: 64px; margin: 14px auto 0; border-radius: 50%; }
.capture-status {
  position: absolute; bottom: 96px; left: 0; right: 0; text-align: center;
  color: #fff; font-size: 15px; padding: 0 24px; text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.capture-attempts { position: absolute; top: 20px; left: 20px; color: #fff; font-size: 14px; font-weight: 700; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.capture-torch {
  position: absolute; top: 16px; right: 16px; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.5); color: #fff;
}
.capture-cancel {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 15px; font-weight: 600; text-decoration: underline;
  background: none; border: 0; min-height: var(--tap); padding: 0 16px;
}
.capture-progress {
  position: absolute; bottom: 0; left: 0; right: 0; height: 56px;
  background: rgba(0,0,0,.6); display: flex; align-items: center; padding: 0 20px; gap: 12px; color: #fff;
}
.capture-progress-track { flex: 1; height: 8px; background: rgba(255,255,255,.2); border-radius: 4px; overflow: hidden; }
.capture-progress-fill { height: 100%; background: var(--accent); width: 0%; transition: width .2s linear; }
.capture-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.capture-thumbs label { position: relative; border-radius: var(--radius); overflow: hidden; border: 3px solid transparent; cursor: pointer; }
.capture-thumbs label:has(input:checked) { border-color: var(--accent); }
.capture-thumbs img { width: 100%; display: block; }
.capture-thumbs input { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; }

@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
   widths, the capture ring's gradient) 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; }
.ring-position { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); }
.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%; }

/* bucketed conic-gradient ring percentages, step 5 */
.ring-pct-0 { background: conic-gradient(#fff 0%, rgba(255,255,255,.25) 0%); }
.ring-pct-5 { background: conic-gradient(#fff 5%, rgba(255,255,255,.25) 5%); }
.ring-pct-10 { background: conic-gradient(#fff 10%, rgba(255,255,255,.25) 10%); }
.ring-pct-15 { background: conic-gradient(#fff 15%, rgba(255,255,255,.25) 15%); }
.ring-pct-20 { background: conic-gradient(#fff 20%, rgba(255,255,255,.25) 20%); }
.ring-pct-25 { background: conic-gradient(#fff 25%, rgba(255,255,255,.25) 25%); }
.ring-pct-30 { background: conic-gradient(#fff 30%, rgba(255,255,255,.25) 30%); }
.ring-pct-35 { background: conic-gradient(#fff 35%, rgba(255,255,255,.25) 35%); }
.ring-pct-40 { background: conic-gradient(#fff 40%, rgba(255,255,255,.25) 40%); }
.ring-pct-45 { background: conic-gradient(#fff 45%, rgba(255,255,255,.25) 45%); }
.ring-pct-50 { background: conic-gradient(#fff 50%, rgba(255,255,255,.25) 50%); }
.ring-pct-55 { background: conic-gradient(#fff 55%, rgba(255,255,255,.25) 55%); }
.ring-pct-60 { background: conic-gradient(#fff 60%, rgba(255,255,255,.25) 60%); }
.ring-pct-65 { background: conic-gradient(#fff 65%, rgba(255,255,255,.25) 65%); }
.ring-pct-70 { background: conic-gradient(#fff 70%, rgba(255,255,255,.25) 70%); }
.ring-pct-75 { background: conic-gradient(#fff 75%, rgba(255,255,255,.25) 75%); }
.ring-pct-80 { background: conic-gradient(#fff 80%, rgba(255,255,255,.25) 80%); }
.ring-pct-85 { background: conic-gradient(#fff 85%, rgba(255,255,255,.25) 85%); }
.ring-pct-90 { background: conic-gradient(#fff 90%, rgba(255,255,255,.25) 90%); }
.ring-pct-95 { background: conic-gradient(#fff 95%, rgba(255,255,255,.25) 95%); }
.ring-pct-100 { background: conic-gradient(#fff 100%, rgba(255,255,255,.25) 100%); }

/* password strength meter colour states (discrete, class-based, no inline style) */
.meter-weak { background: #b3261e; }
.meter-okay { background: #b07a12; }
.meter-strong { background: #1a7f43; }

.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(--bg-soft); }
.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; }
