/* ════════════════════════════════════════════════════════════════════════
   UBILD · shared design system
   calm professional · skilled-trade staffing · primary #25A74E
   Linked on every page; page CSS layers the rest on top.
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* surfaces, a cool light scheme that reads trustworthy and clean */
  --bg: #eef3f7;
  --bg-2: #e4ecf1;
  --surface: #ffffff;
  --surface-2: #f4f8fb;
  --surface-3: #eaf1f6;

  /* ink, high contrast on light for AA body text */
  --text: #0e2a38;
  --text-soft: #2c4756;
  --muted: #4f6776;
  --faint: #5f7884;

  --line: #d9e4ec;
  --line-strong: #c4d4df;

  /* brand. --primary is the brand green used for glows, rings, accents and the
     headline gradient. --primary-ink is a touch deeper so white text on it
     passes WCAG AA (4.5:1); buttons use it. */
  --primary: #25A74E;
  --primary-ink: #1c8340;
  --primary-deep: #14672f;
  --primary-soft: #5fc47f;
  --primary-wash: rgba(37, 167, 78, 0.10);
  --primary-wash-2: rgba(37, 167, 78, 0.16);

  /* a warm hi-vis accent, used very sparingly (dots, tiny highlights) */
  --accent: #ef8e3b;

  --ok: #1f9d6b;
  --ok-bg: #e6f6ee;
  --bad: #d6453b;
  --bad-bg: #fbeae8;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow-sm: 0 1px 2px rgba(14, 42, 56, 0.06), 0 4px 14px -8px rgba(14, 42, 56, 0.18);
  --shadow-md: 0 10px 30px -14px rgba(14, 42, 56, 0.28);
  --shadow-pop: 0 26px 60px -24px rgba(14, 42, 56, 0.38);
  --ring: 0 0 0 4px rgba(37, 167, 78, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--primary-wash-2); color: var(--text); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}
h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }

.grad { color: var(--primary); }
.grad-em {
  background: linear-gradient(108deg, var(--primary-soft), var(--primary) 45%, var(--primary-deep));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ── background atmosphere ───────────────────────────────────────────────── */

.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #ffffff 0%, var(--bg) 46%, var(--bg-2) 100%);
}
.bg-aurora {
  position: absolute; width: 60vmax; height: 60vmax;
  top: -26vmax; left: -14vmax;
  background: radial-gradient(circle at 40% 40%, rgba(37, 167, 78, 0.16), transparent 62%);
  filter: blur(38px);
  animation: drift 40s var(--ease-out) infinite alternate;
}
.bg-aurora--2 {
  top: auto; left: auto; bottom: -30vmax; right: -18vmax;
  background: radial-gradient(circle at 60% 60%, rgba(95, 196, 127, 0.18), transparent 64%);
  animation-duration: 48s; animation-delay: -14s;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(8vmax, 5vmax, 0) scale(1.14); }
}
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(14, 42, 56, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 42, 56, 0.04) 1px, transparent 1px);
  background-size: 58px 58px;
  mask-image: radial-gradient(72% 60% at 50% 20%, rgba(0, 0, 0, 0.6), transparent 80%);
}

/* ── nav ─────────────────────────────────────────────────────────────────── */

.nav {
  position: sticky; top: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 16px clamp(18px, 4vw, 40px);
  background: linear-gradient(rgba(238, 243, 247, 0.92), rgba(238, 243, 247, 0.66) 70%, transparent);
  backdrop-filter: blur(10px);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-family: var(--font-display); font-size: 1.32rem; font-weight: 800;
  letter-spacing: -0.03em;
}
.wordmark .mark { width: 30px; height: 30px; flex: none; }
.wordmark b { color: var(--primary); font-weight: 800; }
.brand-logo { height: 30px; width: auto; display: block; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.nav-auth { display: flex; align-items: center; gap: 10px; }

/* ── buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 11px 22px; font-size: 0.95rem; font-weight: 600;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s, background 0.22s, border-color 0.22s, color 0.22s;
}
.btn .arrow { transition: transform 0.22s var(--ease-out); }
.btn:hover .arrow { transform: translateX(4px); }

.btn--primary {
  background: var(--primary-ink);
  color: #ffffff;
  box-shadow: 0 10px 24px -12px rgba(28, 131, 64, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -12px rgba(28, 131, 64, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn--primary:active { transform: translateY(0); }
.btn--primary:disabled { opacity: 0.62; cursor: wait; transform: none; }

.btn--ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn--ghost:hover { border-color: var(--primary-soft); color: var(--primary-deep); transform: translateY(-1px); }

.btn--quiet {
  background: transparent; border-color: transparent; color: var(--muted);
}
.btn--quiet:hover { color: var(--text); background: var(--surface-3); }

.btn--xl { font-size: 1.08rem; padding: 16px 32px; }
.btn--block { width: 100%; }
.btn--link {
  background: transparent; border-color: transparent; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px; padding: 4px 8px;
}
.btn--link:hover { color: var(--text); }
.btn--danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn--danger:hover { filter: brightness(0.95); }

/* ── reveal on scroll ────────────────────────────────────────────────────── */

.reveal-io {
  opacity: 0; transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}
.reveal-io.is-in { opacity: 1; transform: none; }

/* entrance reveal (no scroll trigger) */
.reveal { animation: rise 0.8s var(--ease-out) both; animation-delay: var(--d, 0s); }
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}

/* ── footer ──────────────────────────────────────────────────────────────── */

.foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap;
  padding: 26px clamp(18px, 4vw, 40px);
  border-top: 1px solid var(--line);
  font-size: 0.84rem; color: var(--faint);
}
.foot-links { display: flex; gap: 20px; flex-wrap: wrap; }
.foot-links a { color: var(--muted); text-decoration: none; }
.foot-links a:hover { color: var(--primary-deep); }

/* ── auth modal (the veil) ───────────────────────────────────────────────── */

.veil {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(14, 42, 56, 0.42); backdrop-filter: blur(7px);
  animation: veil-in 0.28s ease both;
}
.veil[hidden] { display: none; }
@keyframes veil-in { from { opacity: 0; } }

.auth {
  position: relative; width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 34px 32px 28px;
  box-shadow: var(--shadow-pop);
  animation: auth-in 0.4s var(--ease-out) both;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
@keyframes auth-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } }

.auth-x {
  position: absolute; top: 14px; right: 14px;
  background: none; border: 0; color: var(--faint); font-size: 1rem;
  padding: 6px; border-radius: 8px; line-height: 1;
}
.auth-x:hover { color: var(--text); background: var(--surface-3); }

.auth h3 { font-size: 1.5rem; }
.auth-sub { color: var(--muted); font-size: 0.92rem; margin: 8px 0 22px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; text-align: left; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--text-soft); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  padding: 11px 13px; font: inherit; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); background: var(--surface); box-shadow: var(--ring);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .field-row { grid-template-columns: 1fr; } }

.form-err {
  color: var(--bad); background: var(--bad-bg); border: 1px solid rgba(214, 69, 59, 0.25);
  border-radius: var(--r-sm); padding: 9px 12px; font-size: 0.86rem; margin: 0 0 14px;
}
.form-err[hidden] { display: none; }

/* alternative sign-in methods (Google / SMS code) inside the auth veil */
.auth-alt { display: grid; gap: 10px; }
.auth-alt .form-err { margin: 0; }
.btn--google {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn--google:hover { border-color: var(--primary-soft); transform: translateY(-1px); }
.btn--google:disabled { opacity: 0.62; cursor: wait; transform: none; }
.g-logo { width: 18px; height: 18px; flex: none; }
.btn .btn-ic { width: 18px; height: 18px; flex: none; }
.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; color: var(--faint); font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ""; height: 1px; flex: 1; background: var(--line);
}
.otp-input {
  text-align: center; font-size: 1.2rem; font-weight: 700; letter-spacing: 0.4em;
}
.auth-link {
  display: block; width: 100%; margin-top: 12px; padding: 4px;
  background: none; border: 0; color: var(--primary-deep);
  font: inherit; font-size: 0.88rem; font-weight: 600; text-align: center;
}
.auth-link:hover { text-decoration: underline; }
.auth-link:disabled { opacity: 0.6; }

/* ── toasts ──────────────────────────────────────────────────────────────── */

.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 1300; display: grid; gap: 8px; width: max-content; max-width: 92vw;
}
.toast {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-sm); padding: 11px 18px; font-size: 0.9rem;
  color: var(--text); box-shadow: var(--shadow-md);
  animation: toast-in 0.32s var(--ease-out) both;
}
.toast.bad { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }
.toast.out { animation: toast-out 0.32s ease both; }
.toast-action {
  margin-left: 12px; padding: 3px 10px; border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); background: none; color: var(--text);
  font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.toast-action:hover { border-color: var(--primary); color: var(--primary); }
.toast-action:disabled { opacity: 0.6; cursor: default; }
/* After a call to a worker: "Didn't reach them? Send text" - stays until used. */
.toast.call-after { display: flex; align-items: center; gap: 4px; }
.toast-close {
  margin-left: 6px; padding: 0 4px; border: 0; background: none; color: var(--muted);
  font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ── tiny spinner ────────────────────────────────────────────────────────── */

.spin {
  display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal-io { opacity: 1; transform: none; }
}

/* ── address autocomplete (shared: job location + worker service area) ─────── */
.ac-wrap { position: relative; display: block; }
.ac-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
  overflow: hidden; max-height: 280px; overflow-y: auto;
}
.ac-item {
  display: block; width: 100%; text-align: left;
  padding: 11px 14px; border: 0; background: transparent;
  color: var(--text); font: inherit; line-height: 1.35; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.is-active { background: var(--primary-wash); color: var(--text); }

/* group headers + saved-site rows in the location dropdown */
.ac-group {
  padding: 7px 14px 5px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--faint); background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.ac-item--site { display: flex; align-items: flex-start; gap: 9px; }
.ac-item--site .ac-pin { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--primary-ink); }
.ac-site-txt { display: flex; flex-direction: column; min-width: 0; }
.ac-site-txt b { font-weight: 600; }
.ac-site-txt span { color: var(--muted); font-size: 0.88em; }
.ac-loading { display: flex; align-items: center; gap: 9px; padding: 11px 14px; color: var(--muted); font-size: 0.88rem; }
.ac-spin { width: 14px; height: 14px; flex: none; border: 2px solid var(--line-strong); border-top-color: var(--primary-ink); border-radius: 50%; animation: spin 0.7s linear infinite; }

/* ── shift schedule: time window + calendar (shared: post wizard + editors) ── */
.shift-times { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.shift-times label { display: grid; gap: 7px; font-size: 0.84rem; font-weight: 600; color: var(--text-soft); }
.shift-times input[type="time"] {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text);
  padding: 12px 14px; font: inherit; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.shift-times input[type="time"]:focus { border-color: var(--primary); background: var(--surface); box-shadow: var(--ring); }

.cal { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--surface); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-title { font-weight: 700; color: var(--text); font-size: 0.98rem; }
.cal-nav {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--text-soft); font-size: 1.2rem; line-height: 1; cursor: pointer;
  transition: all 0.18s;
}
.cal-nav:hover:not(:disabled) { border-color: var(--primary-soft); background: var(--primary-wash); color: var(--primary-deep); }
.cal-nav:disabled { opacity: 0.35; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell { display: grid; place-items: center; height: 40px; font-size: 0.9rem; }
.cal-wd { color: var(--faint); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-empty { visibility: hidden; }
.cal-day {
  border: 1px solid transparent; border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
  transition: all 0.15s;
}
.cal-day:hover:not(:disabled) { border-color: var(--primary-soft); background: var(--primary-wash); }
.cal-day.is-sel { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.cal-day.is-sel:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.cal-day:disabled { color: var(--faint); background: transparent; cursor: default; opacity: 0.5; }
.cal ~ .field-note { font-size: 0.84rem; color: var(--faint); margin: 10px 0 0; }
@media (max-width: 520px) { .shift-times { grid-template-columns: 1fr; } .cal-cell { height: 36px; } }
