/*
 * style.css — the whole visual system, in one file.
 *
 * ONE FILE AND NO BUILD STEP. A stylesheet that needs compiling is a stylesheet
 * that can be deployed stale, and this site has six pages. The cost is that
 * everything lives here; the benefit is that `asset()` stamps it with its own
 * modification time, so a deploy can never leave a visitor holding the old one.
 *
 * NO EXTERNAL FONTS. The Content-Security-Policy allows `default-src 'self'` and
 * nothing else, so a webfont from anywhere would simply be blocked — and a font
 * that must download before text appears is a page that is blank on a slow
 * connection. The stack below is what the visitor's own system already has.
 *
 * EVERY ANIMATION IS BEHIND prefers-reduced-motion. Motion here is decoration:
 * a card that rises on hover, a figure that counts into place. For somebody with
 * a vestibular disorder it is not decoration, and the site has to work without
 * any of it.
 *
 * COLOUR CARRIES MEANING AND IS NEVER THE ONLY CARRIER. Held money is amber and
 * also says "held"; a rejected task is red and also says "rejected". Roughly one
 * man in twelve cannot separate the red from the green.
 */

/* ---- tokens -------------------------------------------------------------- */

:root {
  color-scheme: dark light;

  /* Surfaces, from furthest back to nearest. Three levels rather than two: a
   * card on a page needs to lift off it, and a nested panel needs to lift off
   * the card without becoming a fourth colour nobody can name. */
  --bg:          #0f1115;
  --bg-elevated: #161920;
  --surface:     #1c1f27;
  --surface-2:   #232733;
  --border:      #2c313d;
  --border-soft: #232733;

  --text:        #e8eaf0;
  --text-dim:    #aab1c0;
  --muted:       #7e879a;

  /* The accent is used for one thing per screen: the action we want taken. A
   * palette where three things are accent-coloured is a palette with no accent. */
  --accent:      #5b8cff;
  --accent-hot:  #7aa2ff;
  --accent-dim:  #2f4d99;

  /* Meaning colours. Deliberately distinct hues rather than shades of one, so
   * they survive being small: a 16px icon in two similar greens is two icons
   * nobody can tell apart. */
  --money:       #34d399;
  --held:        #fbbf24;
  --escrow:      #a78bfa;
  --danger:      #f87171;
  --warn:        #fb923c;
  --info:        #38bdf8;

  --ok:          var(--money);
  --error:       var(--danger);

  --radius:      14px;
  --radius-sm:   9px;
  --radius-pill: 999px;

  /* Two shadows, not five. A shadow scale with many steps is one where every
   * component picks a different step and nothing looks related. */
  --shadow:      0 1px 2px rgb(0 0 0 / .30), 0 8px 24px -12px rgb(0 0 0 / .55);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / .30), 0 20px 40px -18px rgb(0 0 0 / .65);

  --ease:        cubic-bezier(.22, .61, .36, 1);
  --wrap:        1080px;

  /* System stack. San Francisco, Segoe, Roboto — whichever the visitor has. The
   * Devanagari and Cyrillic fallbacks are named explicitly because a stack that
   * ends at a Latin-only font renders Hindi in the browser's last-resort face,
   * which is a different size and ruins every line it appears on. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans",
          "Noto Sans Devanagari", "Inter", Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:          #f7f8fa;
    --bg-elevated: #ffffff;
    --surface:     #ffffff;
    --surface-2:   #f2f4f8;
    --border:      #dfe3ea;
    --border-soft: #eaedf2;

    --text:        #151922;
    --text-dim:    #454c5c;
    --muted:       #6b7386;

    --accent:      #2563eb;
    --accent-hot:  #1d4ed8;
    --accent-dim:  #bfd0ff;

    --money:       #059669;
    --held:        #b45309;
    --escrow:      #6d28d9;
    --danger:      #dc2626;
    --warn:        #c2410c;
    --info:        #0284c7;

    --shadow:      0 1px 2px rgb(16 24 40 / .06), 0 8px 24px -12px rgb(16 24 40 / .18);
    --shadow-lift: 0 2px 4px rgb(16 24 40 / .08), 0 20px 40px -18px rgb(16 24 40 / .25);
  }
}

/* ---- reset --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  /* Two very large, very faint radial washes. They give the page depth without
   * a background image — which would be another request, and one the CSP would
   * allow but the connection would not enjoy. */
  background-image:
    radial-gradient(900px 500px at 12% -8%, color-mix(in oklab, var(--accent) 13%, transparent), transparent 70%),
    radial-gradient(800px 460px at 95% 0%, color-mix(in oklab, var(--escrow) 10%, transparent), transparent 68%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

img, svg { vertical-align: middle; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hot); text-decoration: underline; }

/* Focus is visible and is never removed. A keyboard user who cannot see where
 * they are is a keyboard user who cannot use the site at all — and :focus-visible
 * means a mouse click does not draw a ring nobody asked for. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- layout -------------------------------------------------------------- */

.wrap { width: min(var(--wrap), 100% - 40px); margin-inline: auto; }

main.wrap { padding: 32px 0 72px; }

h1 { font-size: clamp(28px, 4vw, 38px); line-height: 1.2; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 19px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 16px; margin: 0 0 8px; }
p  { margin: 0 0 14px; }

/* ---- top bar ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  /* The blur is what keeps the bar legible over the page scrolling under it.
   * Where it is unsupported the colour-mix above is still 78% opaque, so the
   * fallback is a slightly translucent bar rather than unreadable text. */
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.bar { display: flex; align-items: center; gap: 18px; height: 62px; }

.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), var(--escrow));
  box-shadow: 0 2px 10px -2px color-mix(in oklab, var(--accent) 60%, transparent);
}
.brand .mark svg { width: 16px; height: 16px; stroke: #fff; }

.topbar nav { display: flex; gap: 2px; margin-inline-start: 6px; flex: 1; min-width: 0; overflow-x: auto; }
.topbar nav a {
  position: relative;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14.5px;
  white-space: nowrap;
  transition: color .16s var(--ease), background .16s var(--ease);
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar nav a.active { color: var(--text); }
/* The active marker is a bar under the item, drawn with a pseudo-element so it
 * can animate in without shifting anything around it. */
.topbar nav a.active::after {
  content: "";
  position: absolute; inset-inline: 11px; bottom: -1px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--escrow));
  animation: slide-in .28s var(--ease);
}

.account { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

/* ---- language switcher --------------------------------------------------- */

.lang { position: relative; }
.lang summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 14px; cursor: pointer;
  list-style: none;
  transition: border-color .16s var(--ease), color .16s var(--ease);
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover { border-color: var(--accent-dim); color: var(--text); }
.lang[open] summary { border-color: var(--accent-dim); color: var(--text); }

.lang-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  min-width: 172px;
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lift);
  animation: pop-in .16s var(--ease);
  z-index: 60;
}
.lang-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 14.5px;
}
.lang-menu a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.lang-menu a[aria-current="true"] { color: var(--text); background: var(--surface-2); font-weight: 600; }
.lang-menu .flag { font-size: 17px; line-height: 1; }

/* ---- buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 14.5px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .14s var(--ease), border-color .16s var(--ease),
              background .16s var(--ease), box-shadow .16s var(--ease);
}
.btn:hover { border-color: var(--accent-dim); background: var(--surface-2); text-decoration: none; }
/* Pressed moves down by one pixel. It is the cheapest possible confirmation that
 * a tap registered, and on a slow connection it is the only one for a while. */
.btn:active { transform: translateY(1px); }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(140deg, var(--accent), var(--accent-hot));
  color: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / .2), 0 8px 20px -10px color-mix(in oklab, var(--accent) 75%, transparent);
}
.btn.primary:hover {
  filter: brightness(1.06);
  box-shadow: 0 2px 4px rgb(0 0 0 / .22), 0 14px 28px -12px color-mix(in oklab, var(--accent) 85%, transparent);
}
.btn.big { padding: 13px 24px; font-size: 16px; border-radius: var(--radius); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: color-mix(in oklab, var(--danger) 12%, transparent); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- cards --------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card > :last-child { margin-bottom: 0; }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 20px; }
.grid .card { margin-bottom: 0; }

/* A card that is a link rises slightly. Only interactive cards do this — a
 * static panel that lifts under the cursor promises a click that does nothing. */
.card.interactive { transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease); }
.card.interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--accent-dim); }

/* ---- the balance figures ------------------------------------------------- */

.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label {
  display: flex; align-items: center; gap: 7px;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.stat .value {
  font-size: clamp(26px, 3.4vw, 34px); font-weight: 700; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  animation: rise-in .4s var(--ease) both;
}
.stat .note { color: var(--muted); font-size: 13.5px; line-height: 1.5; }

/* The accent stripe along the top of a figure card, in that figure's colour.
 * It is what makes three cards read as three different things at a glance,
 * before any of the words are read. */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--tint, var(--accent)), transparent 85%);
}
.stat-card.money  { --tint: var(--money); }
.stat-card.held   { --tint: var(--held); }
.stat-card.escrow { --tint: var(--escrow); }
.stat-card.money  .value { color: var(--money); }
.stat-card.held   .value { color: var(--held); }
.stat-card.escrow .value { color: var(--escrow); }

/* ---- hero ---------------------------------------------------------------- */

.hero { padding: 44px 0 26px; text-align: center; }
.hero h1 {
  background: linear-gradient(120deg, var(--text) 30%, var(--accent) 75%, var(--escrow));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: rise-in .5s var(--ease) both;
}
.lede {
  font-size: clamp(16px, 2vw, 19px);
  color: var(--text-dim);
  max-width: 58ch;
  margin-inline: auto;
  animation: rise-in .5s var(--ease) .06s both;
}
.hero-actions {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
  margin-top: 26px;
  animation: rise-in .5s var(--ease) .12s both;
}

.hero-rate {
  display: inline-flex; align-items: baseline; gap: 10px;
  margin-top: 30px; padding: 14px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise-in .5s var(--ease) .18s both;
}
.hero-rate .amount { font-size: 30px; font-weight: 700; color: var(--money); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-rate .label  { color: var(--muted); font-size: 14px; }

/* ---- numbered steps ------------------------------------------------------ */

.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; margin: 8px 0 24px; counter-reset: step; }

.step {
  position: relative;
  padding: 22px 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.step:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.step .n {
  counter-increment: step;
  display: grid; place-items: center;
  width: 30px; height: 30px; margin-bottom: 12px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), var(--escrow));
  color: #fff; font-weight: 700; font-size: 14px;
}
.step .n::before { content: counter(step); }
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-dim); font-size: 14.5px; margin: 0; }

/* ---- pills --------------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}
/* The dot is what carries the state for somebody who cannot separate the hues,
 * together with the word itself. Colour is never alone. */
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok   { color: var(--money);  border-color: color-mix(in oklab, var(--money) 35%, var(--border));  background: color-mix(in oklab, var(--money) 10%, transparent); }
.pill.warn { color: var(--held);   border-color: color-mix(in oklab, var(--held) 35%, var(--border));   background: color-mix(in oklab, var(--held) 10%, transparent); }
.pill.bad  { color: var(--danger); border-color: color-mix(in oklab, var(--danger) 35%, var(--border)); background: color-mix(in oklab, var(--danger) 10%, transparent); }
.pill.info { color: var(--info);   border-color: color-mix(in oklab, var(--info) 35%, var(--border));   background: color-mix(in oklab, var(--info) 10%, transparent); }
/* A state that is actively moving pulses. Only that one: a page where several
 * things pulse is a page where none of them is urgent. */
.pill.live::before { animation: pulse 1.8s ease-in-out infinite; }

/* ---- flashes ------------------------------------------------------------- */

.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 18px;
  font-size: 15px;
  animation: rise-in .3s var(--ease) both;
}
.flash.ok     { border-color: color-mix(in oklab, var(--money) 45%, var(--border));  background: color-mix(in oklab, var(--money) 9%, var(--surface)); }
.flash.notice { border-color: color-mix(in oklab, var(--info) 45%, var(--border));   background: color-mix(in oklab, var(--info) 9%, var(--surface)); }
.flash.warn   { border-color: color-mix(in oklab, var(--held) 45%, var(--border));   background: color-mix(in oklab, var(--held) 9%, var(--surface)); }
.flash.error  { border-color: color-mix(in oklab, var(--danger) 45%, var(--border)); background: color-mix(in oklab, var(--danger) 9%, var(--surface)); }

/* ---- the password block -------------------------------------------------- */

/*
 * Deliberately the loudest thing on the site. It is the one value a worker must
 * copy exactly, and a character read wrong is a task that cannot be paid.
 */
.secret {
  position: relative;
  border: 1px solid color-mix(in oklab, var(--accent) 45%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(140deg, color-mix(in oklab, var(--accent) 10%, transparent), transparent 60%),
    var(--surface);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.secret h2 { display: flex; align-items: center; gap: 9px; }

.credential {
  display: block;
  font-family: var(--mono);
  font-size: clamp(17px, 2.6vw, 22px);
  font-weight: 600;
  letter-spacing: .06em;
  padding: 12px 14px;
  margin: 6px 0 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  /* Letting the browser break this mid-string would put half a password on the
   * next line, which is exactly where a transcription error comes from. */
  word-break: break-all;
  user-select: all;
}

/* ---- forms --------------------------------------------------------------- */

label { display: block; font-size: 14px; font-weight: 600; color: var(--text-dim); margin: 16px 0 6px; }
label:first-of-type { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 15px;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent);
}
input::placeholder { color: var(--muted); }

.check { display: flex; align-items: center; gap: 9px; margin: 16px 0; }
.check input { width: auto; }
.check, .check label { margin: 0; }

.form-narrow { max-width: 460px; margin-inline: auto; }
form .btn { margin-top: 20px; }

/* ---- tables -------------------------------------------------------------- */

.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th, .table td { padding: 11px 14px 11px 0; border-bottom: 1px solid var(--border-soft); text-align: start; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table td { font-variant-numeric: tabular-nums; }
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }

/* A wide table scrolls inside its own box. The alternative is a document that
 * scrolls sideways, which moves the navigation off screen. */
.table-scroll { overflow-x: auto; margin-inline: -24px; padding-inline: 24px; }
.table.wide { min-width: 720px; }

/* ---- text helpers -------------------------------------------------------- */

.muted { color: var(--muted); }
.note  { color: var(--muted); font-size: 14px; }
.hint  { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.mono  { font-family: var(--mono); font-size: 13.5px; word-break: break-all; }
.steps { padding-inline-start: 20px; color: var(--text-dim); }
.steps li { margin-bottom: 7px; }
.inline { display: inline; }

.icon { flex: none; }
.with-icon { display: inline-flex; align-items: center; gap: 8px; }

/* ---- footer -------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--border-soft);
  padding: 26px 0 40px;
  color: var(--muted);
  font-size: 14px;
}
.footer .bar { height: auto; gap: 16px; flex-wrap: wrap; }

/* ---- animation ----------------------------------------------------------- */

@keyframes rise-in  { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes pop-in   { from { opacity: 0; transform: translateY(-5px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/*
 * Everything above, off.
 *
 * `prefers-reduced-motion` is a system setting people turn on because motion
 * makes them ill, not because they dislike it. Honouring it means no animation
 * at all — not a shorter one — so durations go to almost zero rather than the
 * rules being removed, which keeps every animation's final state intact.
 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .card.interactive:hover, .step:hover, .btn:active { transform: none; }
}

/* ---- small screens ------------------------------------------------------- */

@media (max-width: 720px) {
  .wrap { width: min(var(--wrap), 100% - 28px); }
  .bar { height: 56px; gap: 12px; }
  .topbar nav { order: 3; width: 100%; }
  .hero { padding: 30px 0 18px; }
  .card { padding: 18px 16px; }
  .table-scroll { margin-inline: -16px; padding-inline: 16px; }
}

/* ---- print --------------------------------------------------------------- */

/*
 * One case, and it is a real one: a worker printing or saving the page with
 * their account details on it. The chrome goes, the credential stays legible.
 */
@media print {
  .topbar, .footer, .btn, .lang { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .secret { border: 1px solid #999; box-shadow: none; }
  .credential { border: 1px solid #000; background: #fff; color: #000; }
}
