/* The Jutsu client portal. The same palette and type as jutsu.co: paper and ink, vermilion
   accents, and Outfit throughout. Small red text and buttons use a deeper red (#C9361F, 4.9:1 on
   paper), because vermilion itself is only 3.8:1 there. */

@font-face {
  font-family: "Outfit";
  src: url("/fonts/Outfit-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --red: #E5432B; --red-deep: #C9361F; --red-press: #B02E19;
  --ink: #161412; --paper: #fbf8f3; --stone: #e2dacd;
  --bg: var(--paper); --surface: #ffffff; --chip: #f1ece4;
  --text: var(--ink); --muted: #4f4943; --faint: #736b64; --rule: var(--stone);
  --accent: var(--red-deep);
  --waiting: var(--red-deep); --waiting-bg: rgba(229, 67, 43, .1);
  --ok: #2c6a4c; --ok-bg: rgba(44, 106, 76, .1);
  --toast: var(--ink); --toast-text: var(--paper);
  --font: "Outfit", ui-sans-serif, system-ui, sans-serif;
  --gutter: clamp(16px, 5vw, 40px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--ink); --surface: #201d1a; --chip: #2a2622;
    --text: #f3eee6; --muted: #cfc7bd; --faint: #a39b94; --rule: #36312c;
    --accent: var(--red);
    --waiting: #f07a65; --waiting-bg: rgba(229, 67, 43, .16);
    --ok: #8fd0ae; --ok-bg: rgba(143, 208, 174, .12);
    --toast: #f3eee6; --toast-text: var(--ink);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 400 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; height: auto; }
h1, h2, h3 { font-weight: 500; text-wrap: balance; }
h1 { font-size: clamp(34px, 7vw, 52px); line-height: 1.04; letter-spacing: -0.035em; }
h2 { font-size: 24px; line-height: 1.2; letter-spacing: -0.02em; }
h3 { font-size: 19px; line-height: 1.3; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
h1:focus, main:focus { outline: none; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap { width: 100%; max-width: 880px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.fine { margin-top: 16px; font-size: 14px; color: var(--faint); }
.lede { margin-top: 14px; max-width: 36em; font-size: 19px; color: var(--muted); }
.status { margin-top: 10px; color: var(--muted); }
.note { margin-top: 24px; max-width: 40em; white-space: pre-wrap; overflow-wrap: anywhere; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 30; padding: 8px 14px; border-radius: 8px; background: var(--surface); }

/* The mark's viewBox is tight, so let it paint past its box. */
.mark { display: block; height: 28px; width: auto; aspect-ratio: 80 / 97.08; overflow: visible; fill: var(--red); }

/* Header and footer */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 22px; padding-bottom: 28px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 21px; font-weight: 500; letter-spacing: -0.02em; }
.top nav { display: flex; gap: 2px; margin-right: -10px; }
.top nav a { padding: 8px 14px; border-radius: 999px; color: var(--muted); font-size: 16px; text-decoration: none; }
.top nav a:hover { color: var(--text); }
.top nav a[aria-current="page"] { color: var(--text); background: var(--chip); }
main { flex: 1; padding-top: 8px; padding-bottom: 88px; }
.bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
  padding-top: 24px; padding-bottom: max(32px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule); color: var(--faint); font-size: 15px;
}
.bottom a { color: var(--muted); }
.bottom .link { color: var(--muted); font-weight: 400; padding: 0; }

/* Loading: a thin bar along the top while a page takes more than a moment. */
#app[data-loading]::before {
  content: ""; position: fixed; top: 0; left: 0; z-index: 40; height: 3px; width: 40%;
  background: var(--red); animation: loading 1.1s ease-in-out infinite;
}
@keyframes loading { from { translate: -100% 0; } to { translate: 250% 0; } }

/* Buttons and links */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px; border-radius: 999px;
  background: var(--red-deep); color: #fff; font-weight: 500; text-decoration: none;
  transition: background-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--red-press); }
.btn.quiet { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px var(--rule); }
.btn.quiet:hover { box-shadow: inset 0 0 0 1.5px var(--faint); }
.btn.small { min-height: 38px; padding: 7px 18px; font-size: 15px; }
.btn.wide { width: 100%; }
.btn[aria-busy="true"], .link[aria-busy="true"] { opacity: .55; cursor: progress; }
.link {
  color: var(--accent); font-weight: 500; padding: 4px 0;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.link.small { font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; }
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); font-size: 15px; text-decoration: none; }
.back:hover { color: var(--text); }

/* Form fields */
.field { display: grid; gap: 6px; margin-top: 20px; }
.field > span { font-size: 15px; font-weight: 500; }
input, textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--rule); border-radius: 12px;
  background: var(--surface); color: inherit; font: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--red); }
textarea { min-height: 96px; resize: vertical; }
.error { margin-top: 12px; color: var(--accent); font-size: 15px; }

/* Sections, cards and lists */
.block { margin-top: 56px; }
.block > h2 { margin-bottom: 16px; }
.card { display: block; padding: 24px; border-radius: 18px; background: var(--surface); box-shadow: 0 0 0 1px var(--rule); }
a.card { text-decoration: none; transition: box-shadow .15s; }
a.card:hover { box-shadow: 0 0 0 1px var(--faint), 0 20px 40px -28px rgba(0, 0, 0, .4); }

.rows { list-style: none; border-top: 1px solid var(--rule); }
.rows > li { border-bottom: 1px solid var(--rule); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; text-decoration: none; }
.row-main { display: grid; gap: 2px; min-width: 0; }
.row-main strong { font-weight: 500; }
.row-main .muted { font-size: 15px; }
.arrow { flex: none; width: 20px; height: 20px; stroke: var(--faint); transition: translate .15s, stroke .15s; }
.row:hover .arrow { translate: 3px 0; stroke: var(--red); }

.pill {
  flex: none; display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 999px;
  background: var(--chip); color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.pill.waiting { background: var(--waiting-bg); color: var(--waiting); }
.pill.done { background: var(--ok-bg); color: var(--ok); }

/* Projects */
.cards { list-style: none; display: grid; gap: 16px; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
.project-card { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.card-head { display: grid; gap: 2px; }
.project-card h3 { font-size: 22px; letter-spacing: -0.02em; }
.next { margin-top: auto; color: var(--muted); font-size: 15px; }

.stages { list-style: none; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 32px; }
.stages li { color: var(--faint); font-size: 14px; white-space: nowrap; }
.stages li::before { content: ""; display: block; height: 6px; margin-bottom: 8px; border-radius: 3px; background: var(--rule); }
.stages li.done { color: var(--muted); }
.stages li.done::before { background: color-mix(in srgb, var(--red) 40%, var(--rule)); }
.stages li.current { color: var(--text); font-weight: 500; }
.stages li.current::before { background: var(--red); }
.stages.compact { margin-top: 0; }
.stages.compact li { font-size: 13px; }
.stages.compact li::before { height: 5px; }
/* On a phone, a project card names only the stage it's in; the bars show the rest. */
@media (max-width: 540px) {
  .stages.compact li:not(.current) > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stages.compact li.current:last-child { text-align: right; }
}
.stage-note { margin-top: 14px; }

.dates { list-style: none; border-top: 1px solid var(--rule); }
.dates li { display: grid; grid-template-columns: 128px 1fr; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); }
.dates time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Drafts */
.draft-cards { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.draft-card { display: grid; height: 100%; padding: 0; overflow: hidden; }
.thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; background: var(--chip); }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb .kind { color: var(--faint); font-weight: 500; letter-spacing: .02em; }
.draft-body { display: grid; justify-items: start; align-content: start; gap: 8px; padding: 16px 18px 18px; }
.draft-body strong { font-weight: 500; }

.files { display: grid; gap: 28px; margin-top: 32px; }
.file-image img, .file-image video { width: 100%; border-radius: 12px; box-shadow: 0 0 0 1px var(--rule); }
.file-image figcaption { margin-top: 8px; color: var(--faint); font-size: 14px; }
.file-row { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }
.file-row .row-main { flex: 1; }
.file-kind {
  flex: none; display: grid; place-items: center; width: 44px; height: 54px; border-radius: 8px;
  background: var(--chip); color: var(--muted); font-size: 12px; font-weight: 500;
}

/* Proposals and contracts. On touch screens the PDF opens on its own, where it reads better. */
.pdf { margin-top: 32px; overflow: hidden; border-radius: 14px; background: var(--chip); box-shadow: 0 0 0 1px var(--rule); }
.pdf iframe { display: block; width: 100%; height: min(85vh, 1100px); border: 0; }
@media (pointer: coarse) { .pdf { display: none; } }

.decide { margin-top: 40px; }
.decide h2 { margin-bottom: 8px; }
.decide .muted { max-width: 36em; }

/* Comments */
.comment-list { list-style: none; display: grid; gap: 12px; }
.comment { max-width: 40em; padding: 14px 18px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--rule); }
.comment.mine { background: var(--chip); box-shadow: none; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--faint); font-size: 14px; }
.comment-meta strong { color: var(--text); font-weight: 500; }
.comment-body { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment .link { margin-top: 4px; }
.comment-form { max-width: 40em; }

/* Timeline */
.timeline { list-style: none; }
.timeline li { display: grid; grid-template-columns: 128px 1fr; gap: 16px; padding: 9px 0; }
.timeline time { color: var(--faint); font-size: 15px; padding-top: 1px; }
@media (max-width: 540px) {
  .timeline li, .dates li { grid-template-columns: 1fr; gap: 0; }
  .timeline time, .dates time { font-size: 14px; }
}

/* Billing */
.client-name { margin-bottom: 16px; }
.payment h2, .payment h3 { margin-bottom: 6px; }
.method { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.method-icon { flex: none; display: grid; place-items: center; width: 52px; height: 38px; border-radius: 8px; background: var(--chip); color: var(--muted); }
.payment-element { margin-top: 20px; }
.invoices-block { margin-top: 40px; }
.invoices-block h2, .invoices-block h3 { margin-bottom: 12px; }
.invoice { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 16px; padding: 16px 0; }
.invoice-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.invoice-side strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.invoice-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.invoice .error { grid-column: 1 / -1; margin-top: 0; }

/* Signing in */
.sign-in { width: 100%; max-width: 440px; margin: 0 auto; padding: clamp(56px, 14vh, 128px) var(--gutter) 64px; }
.sign-in .mark { height: 56px; margin-bottom: 32px; }
.sign-in h1 { font-size: clamp(34px, 9vw, 44px); }
.code-input { font-size: 28px; font-variant-numeric: tabular-nums; letter-spacing: .3em; text-align: center; }

/* Dialogs and toasts */
.dialog {
  width: min(480px, calc(100vw - 32px)); margin: auto; padding: 28px; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .5);
}
.dialog::backdrop { background: rgba(22, 20, 18, .5); }
.dialog h2 { font-size: 22px; }
.dialog p { margin-top: 8px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 50; translate: -50% 0;
  width: max-content; max-width: calc(100vw - 32px); padding: 12px 22px; border-radius: 20px;
  background: var(--toast); color: var(--toast-text); font-size: 15px;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .5);
  animation: toast-in .2s ease-out; transition: opacity .3s;
}
.toast.leaving { opacity: 0; }
@keyframes toast-in { from { opacity: 0; translate: -50% 8px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
