/* jobhunt: the nullsutra palette (parchment and ink, gold thread) as a working tool.
   Every colour is a token; dark mode is the void. */
@font-face { font-family: Plex; src: url(/fonts/sans.woff2) format('woff2'); font-weight: 100 700; font-display: swap; }
@font-face { font-family: Serif; src: url(/fonts/serif.woff2) format('woff2'); font-weight: 200 900; font-display: swap; }

:root {
  --ground: #EDE6D6;        /* the page */
  --paper: #F6F2E8;         /* panes, cards, inputs */
  --ink: #15172A;
  --ink-72: rgb(21 23 42 / .72);
  --ink-64: rgb(21 23 42 / .64);
  --edge: rgb(21 23 42 / .12);
  --edge-strong: rgb(21 23 42 / .28);
  --shade: rgb(21 23 42 / .04);
  --thread: #9a7d1f;        /* the gold thread: selection, the fit of a strong match */
  --thread-soft: rgb(154 125 31 / .14);
  --rubric: #b8361c;        /* what needs him: questions only he answers, open issues */
  --rubric-soft: rgb(184 54 28 / .09);
  --good: #1E6E5C;          /* applied and onwards */
  --good-soft: rgb(30 110 92 / .12);
  --focus: #3457C9;
  --on-ink: #EDE6D6;
  --sheet: #ffffff;         /* the PDF page */
  --sans: Plex, system-ui, sans-serif;
  --serif: Serif, Georgia, serif;
  --radius: 10px;
  --ease: cubic-bezier(.23, 1, .32, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #15172A; --paper: #1c1f37; --ink: #EDE6D6;
    --ink-72: rgb(237 230 214 / .74); --ink-64: rgb(237 230 214 / .64);
    --edge: rgb(237 230 214 / .13); --edge-strong: rgb(237 230 214 / .32); --shade: rgb(237 230 214 / .05);
    --thread: #D4AF37; --thread-soft: rgb(212 175 55 / .16);
    --rubric: #ef6a4c; --rubric-soft: rgb(239 106 76 / .13);
    --good: #5fb89f; --good-soft: rgb(95 184 159 / .14);
    --focus: #8ea6ff; --on-ink: #15172A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground); color: var(--ink); font: 400 0.9375rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; text-size-adjust: 100%;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration-color: var(--thread); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.boot { padding: 2rem; color: var(--ink-64); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ buttons and fields */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 .95rem;
  border: 1px solid var(--edge-strong); border-radius: 999px; background: transparent; cursor: pointer;
  font-weight: 500; font-size: .875rem; white-space: nowrap; text-decoration: none; user-select: none;
  transition: transform 160ms var(--ease), background-color 160ms var(--ease);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.quiet { border-color: transparent; color: var(--ink-72); padding: 0 .6rem; }
.btn.small { min-height: 32px; padding: 0 .7rem; font-size: .8125rem; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--shade); }
  .btn.primary:hover { background: var(--ink); opacity: .9; }
}
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; border: 1px solid var(--edge-strong); border-radius: 8px; background: var(--paper);
  padding: .55rem .7rem; font-size: 1rem; line-height: 1.5;
}
textarea { resize: vertical; min-height: 5.5rem; field-sizing: content; }
input[type=text] { field-sizing: fixed; }
textarea.tall { min-height: 26rem; font-family: var(--serif); font-size: 1.0625rem; line-height: 1.6; }
label.field { display: block; margin: 0 0 1rem; }
label.field > span { display: block; font-size: .8125rem; color: var(--ink-64); margin-bottom: .3rem; }
.count { font-size: .8125rem; color: var(--ink-64); font-variant-numeric: tabular-nums; }
.count.over { color: var(--rubric); }

/* ------------------------------------------------------------ sign in */
.login { min-height: 100%; display: grid; place-items: center; padding: 1.5rem; }
.login form { width: min(100%, 22rem); }
.login h1 { font: 600 2rem/1.1 var(--serif); margin: 0 0 .4rem; }
.login p { color: var(--ink-64); margin: 0 0 1.5rem; }
.login .err { color: var(--rubric); min-height: 1.5rem; margin: .6rem 0 0; font-size: .875rem; }

/* ------------------------------------------------------------ frame */
.app { height: 100%; display: grid; grid-template-rows: auto 1fr; }
.top {
  display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; border-bottom: 1px solid var(--edge);
  padding-top: max(.6rem, env(safe-area-inset-top));
}
.mark { font: 600 1.25rem/1 var(--serif); letter-spacing: -.01em; }
.tally { display: flex; gap: 1rem; color: var(--ink-64); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.tally b { color: var(--ink); font-weight: 600; }
.top .grow { flex: 1; }
.top .run { font-size: .8125rem; color: var(--ink-64); }
.shell { display: grid; grid-template-columns: 340px 1fr; min-height: 0; }
.queue { border-right: 1px solid var(--edge); overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.pane { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

/* ------------------------------------------------------------ the queue */
.search { position: sticky; top: 0; z-index: 2; padding: .75rem; background: var(--ground); border-bottom: 1px solid var(--edge); }
.group > h2 {
  display: flex; justify-content: space-between; align-items: baseline; margin: 0; padding: .9rem .9rem .35rem;
  font-size: .8125rem; font-weight: 600; color: var(--ink-64); cursor: pointer; user-select: none;
}
.group > h2 .n { font-weight: 400; font-variant-numeric: tabular-nums; }
.group.shut > .rows { display: none; }
.row {
  display: grid; grid-template-columns: 2.4rem 1fr; gap: .1rem .7rem; padding: .6rem .9rem; text-decoration: none;
  border-left: 3px solid transparent;
}
.row[aria-current=page] { background: var(--thread-soft); border-left-color: var(--thread); }
@media (hover: hover) and (pointer: fine) { .row:hover { background: var(--shade); } }
.row .fit { grid-row: span 2; align-self: start; margin-top: .1rem; }
.row .co { font-weight: 600; display: flex; justify-content: space-between; gap: .5rem; min-width: 0; }
.row .co span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { font-weight: 400; font-size: .8125rem; color: var(--ink-64); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .role { font-size: .875rem; color: var(--ink-72); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .flag { color: var(--rubric); font-size: .8125rem; }
.row .meta .old { color: var(--rubric); }
.empty { padding: .3rem .9rem .8rem; color: var(--ink-64); font-size: .875rem; }

.fit {
  display: inline-grid; place-items: center; width: 2.4rem; height: 1.7rem; border-radius: 6px;
  font-weight: 600; font-size: .8125rem; font-variant-numeric: tabular-nums; border: 1px solid var(--edge-strong); color: var(--ink-72);
}
.fit[data-v=strong] { background: var(--thread); border-color: var(--thread); color: var(--on-ink); }
.fit[data-v=good] { border-color: var(--thread); color: var(--ink); }
.fit[data-v=poor], .fit[data-v=no] { color: var(--ink-64); border-style: dashed; }

/* ------------------------------------------------------------ a job */
.job { max-width: 1240px; padding: 1.25rem 1.5rem 4rem; }
.back { display: none; }
.job h1 { font: 600 1.75rem/1.15 var(--serif); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
.job .company { font: 400 1.125rem/1.3 var(--serif); color: var(--ink-72); margin: .2rem 0 .7rem; }
.facts { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; margin-bottom: 1rem; }
.chip { font-size: .8125rem; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--edge); color: var(--ink-72); }
.chip.warn { border-color: var(--rubric); color: var(--rubric); }
.chip.ok { border-color: var(--good); color: var(--good); }
.bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--edge); border-bottom: 1px solid var(--edge); }
.bar .state { font-weight: 600; margin-right: .4rem; }
.bar .grow { flex: 1; }
.bar select { width: auto; min-height: 40px; padding: 0 .6rem; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--edge-strong); border-top-color: var(--thread); animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs {
  display: flex; gap: .2rem; margin: 1rem 0 1.25rem; overflow-x: auto; scrollbar-width: none;
  position: sticky; top: 0; z-index: 3; background: var(--ground); padding: .4rem 0; border-bottom: 1px solid var(--edge);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: .45rem .8rem; border-radius: 999px; text-decoration: none; font-size: .875rem; color: var(--ink-72); white-space: nowrap;
  display: inline-flex; gap: .35rem; align-items: center;
}
.tabs a[aria-current=page] { background: var(--ink); color: var(--on-ink); }
.tabs .dot { min-width: 1.2rem; height: 1.2rem; border-radius: 999px; background: var(--rubric); color: var(--paper); font-size: .6875rem; font-weight: 600; display: inline-grid; place-items: center; padding: 0 .3rem; }

.prose { max-width: 44rem; }
.prose p { margin: 0 0 .9rem; }
.angle { font: 400 1.1875rem/1.5 var(--serif); margin: 0 0 1.25rem; max-width: 44rem; text-wrap: pretty; }
h3 { font-size: .8125rem; font-weight: 600; color: var(--ink-64); margin: 1.75rem 0 .6rem; }
ul.needs { margin: 0; padding-left: 1.1rem; max-width: 44rem; }
ul.needs li { margin-bottom: .3rem; }
.posting { white-space: pre-wrap; max-width: 44rem; font-size: .9375rem; color: var(--ink-72); overflow-wrap: anywhere; }

.callout { border-left: 3px solid var(--rubric); background: var(--rubric-soft); padding: .7rem .9rem; border-radius: 0 8px 8px 0; margin: 0 0 1.25rem; max-width: 44rem; }

/* the checklist */
.checks { list-style: none; margin: 0; padding: 0; max-width: 48rem; }
.checks li { display: grid; grid-template-columns: 1.6rem 1fr; gap: .6rem; padding: .7rem 0; border-bottom: 1px solid var(--edge); }
.checks input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: .2rem 0 0; accent-color: var(--good); }
.checks .done { color: var(--ink-64); text-decoration: line-through; text-decoration-color: var(--edge-strong); }
.checks .sub { display: block; font-size: .875rem; color: var(--ink-64); margin-top: .2rem; }
.checks .rubric { color: var(--rubric); }
.applyrow { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }

/* ------------------------------------------------------------ documents: preview beside editor */
.doc { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.viewer { position: sticky; top: 4rem; background: var(--shade); border-radius: var(--radius); padding: .75rem; max-height: calc(100vh - 8rem); overflow-y: auto; }
.viewer .page { display: block; width: 100%; height: auto; background: var(--sheet); box-shadow: 0 1px 3px rgb(0 0 0 / .18); border-radius: 2px; }
.viewer .pno { text-align: center; font-size: .75rem; color: var(--ink-64); margin: .35rem 0 .9rem; font-variant-numeric: tabular-nums; }
.viewer .vhead { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; font-size: .8125rem; color: var(--ink-64); }
.switch { display: none; }
.editor .save { position: sticky; bottom: 0; display: flex; gap: .6rem; align-items: center; padding: .8rem 0; background: var(--ground); border-top: 1px solid var(--edge); margin-top: 1rem; }
.editor .save .note { font-size: .8125rem; color: var(--ink-64); }

/* the CV editor */
.entry { border-top: 1px solid var(--edge); padding: .9rem 0 .4rem; }
.entry > header { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.entry > header b { font-family: var(--serif); font-size: 1.0625rem; }
.entry > header span { font-size: .8125rem; color: var(--ink-64); }
.entry.off .bullet, .entry.off .bullets { display: none; }
.bullet { display: grid; grid-template-columns: 1.5rem 1fr auto; gap: .5rem; margin-bottom: .6rem; align-items: start; }
.bullet input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin-top: .65rem; accent-color: var(--thread); }
.bullet textarea { min-height: 3rem; font-size: .9375rem; }
.bullet.off textarea { opacity: .45; }
.bullet .moves { display: flex; flex-direction: column; gap: .2rem; }
.bullet .moves .btn { min-height: 28px; padding: 0 .45rem; }
.bullet .tag { grid-column: 2; font-size: .75rem; color: var(--thread); margin-top: -.4rem; }
.skillrow { margin-bottom: .8rem; }
.skillrow b { display: block; font-size: .8125rem; margin-bottom: .3rem; }
.pills { display: flex; flex-wrap: wrap; gap: .3rem; }
.pill { font-size: .8125rem; padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--edge-strong); background: transparent; cursor: pointer; }
.pill[aria-pressed=true] { background: var(--thread-soft); border-color: var(--thread); }
.pill[aria-pressed=false] { color: var(--ink-64); text-decoration: line-through; text-decoration-color: var(--edge-strong); }

/* form answers */
.q { border: 1px solid var(--edge); border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: .8rem; background: var(--paper); max-width: 48rem; }
.q.you { border-color: var(--rubric); }
.q > header { display: flex; justify-content: space-between; gap: .75rem; align-items: start; margin-bottom: .35rem; }
.q .label { font-weight: 600; }
.q .req { color: var(--rubric); }
.q .desc { font-size: .875rem; color: var(--ink-64); margin: 0 0 .5rem; white-space: pre-wrap; }
.q .opts { font-size: .8125rem; color: var(--ink-64); margin: 0 0 .5rem; }
.q .kind { font-size: .75rem; font-weight: 600; white-space: nowrap; padding: .1rem .5rem; border-radius: 999px; background: var(--shade); color: var(--ink-72); }
.q .kind[data-k=you] { background: var(--rubric-soft); color: var(--rubric); }
.q .kind[data-k=draft] { background: var(--thread-soft); color: var(--ink); }
.q .why { font-size: .8125rem; color: var(--rubric); margin: 0 0 .5rem; }
.q .row2 { display: flex; gap: .5rem; align-items: center; margin-top: .45rem; }
.q .row2 .grow { flex: 1; }
.q .src { font-size: .75rem; color: var(--ink-64); }

/* notes and history */
.history { list-style: none; padding: 0; margin: 0; font-size: .875rem; max-width: 48rem; }
.history li { display: grid; grid-template-columns: 8.5rem 1fr; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--edge); }
.history time { color: var(--ink-64); font-variant-numeric: tabular-nums; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; max-width: 64rem; }

#toast {
  position: fixed; left: 50%; bottom: max(1.25rem, env(safe-area-inset-bottom)); transform: translate(-50%, 1rem); opacity: 0;
  background: var(--ink); color: var(--on-ink); padding: .6rem 1rem; border-radius: 999px; font-size: .875rem; pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease); max-width: calc(100% - 2rem); z-index: 10;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--rubric); color: var(--paper); }

/* ------------------------------------------------------------ laptop: tighten */
@media (max-width: 1200px) {
  .shell { grid-template-columns: 300px 1fr; }
  .job { padding: 1rem 1.1rem 4rem; }
}

/* ------------------------------------------------------------ phone: one column at a time */
@media (max-width: 860px) {
  .tally, .top .run { display: none; }
  .shell { grid-template-columns: 1fr; }
  .shell[data-view=job] .queue { display: none; }
  .shell[data-view=list] .pane { display: none; }
  .queue { border-right: 0; }
  .job { padding: .75rem 1rem 5rem; }
  .back { display: inline-flex; margin: 0 0 .5rem -.6rem; }
  .job h1 { font-size: 1.5rem; }
  .doc { grid-template-columns: 1fr; }
  .switch { display: flex; gap: .3rem; margin-bottom: 1rem; }
  .doc[data-show=edit] .viewer, .doc[data-show=view] .editor { display: none; }
  .viewer { position: static; max-height: none; padding: .5rem; }
  .cols2 { grid-template-columns: 1fr; }
  .history li { grid-template-columns: 1fr; gap: 0; }
  .bar { gap: .4rem; }
  .bar .state { flex: 1 1 100%; }
  .bar .grow { display: none; }
  .bar .btn { justify-content: center; }
  .bar .btn.primary { flex: 1 1 100%; }
  .bar .btn:not(.primary):not(.quiet) { flex: 1 1 0; }
  .facts .chip:last-child { display: none; }
  .bullet { grid-template-columns: 1.5rem 1fr; }
  .bullet .moves { grid-column: 2; flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
  .spin { animation: spin 1600ms linear infinite !important; }
}
