/*
 * The Console's only stylesheet, in hitroo.com's design language (hitroo-landing/designs.md):
 * one warm paper background, char text, one ember accent, white cards on hairline rings, no shadows
 * or glows, Plus Jakarta Sans headlines and Fustat text. Readable and touch-friendly on an iPad.
 */

@font-face {
  font-family: "Fustat";
  src: url("/static/fonts/Fustat-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/static/fonts/PlusJakartaSans-VF.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #fcf8f6;
  --char: #12110b;
  --ember: #f5502f;
  --ember-dark: #de3f1f;
  --ember-tint: #fff1ec;
  --sand: #f3eee8;
  --stone: #6f6a61;
  --white: #ffffff;
  --ring: rgba(18, 17, 11, 0.06);
  --ring-strong: rgba(18, 17, 11, 0.12);
  --display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Fustat", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--char);
  font: 500 18px/1.5 var(--body);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--char); text-decoration-color: rgba(18, 17, 11, 0.3); text-underline-offset: 5px; }
a:hover { text-decoration-color: var(--char); }

main { max-width: 980px; margin: 0 auto; padding: 24px 24px 72px; }

h1, h2, h3, h4 { font-family: var(--display); color: var(--char); text-wrap: balance; }
h1 { font-size: clamp(30px, 3.6vw, 44px); font-weight: 800; line-height: 1.02; letter-spacing: -0.045em; margin: 14px 0 18px; }
h2 { font-size: clamp(22px, 2vw, 26px); font-weight: 700; line-height: 1.12; letter-spacing: -0.03em; margin: 30px 0 14px; }
h3 { font-size: 1.15rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin: 20px 0 8px; }
h4 { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; margin: 16px 0 6px; }
h2 a, h3 a { text-decoration: none; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

code, pre { font: 0.86em/1.45 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0; }
code { background: var(--sand); padding: 1px 6px; border-radius: 6px; overflow-wrap: anywhere; }
pre { background: var(--sand); padding: 14px 16px; border-radius: 14px; overflow-x: auto; }
pre code { background: none; padding: 0; }

blockquote { margin: 8px 0; padding: 4px 16px; border-left: 3px solid var(--ember); color: var(--stone); }

.muted { color: var(--stone); }
.block { display: block; }

/* Captions: 13px uppercase with a small ember diamond, as on hitroo.com. */
.crumbs {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0; font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--char);
}
.crumbs::before {
  content: ""; width: 10px; height: 10px; flex: none;
  background: var(--ember); border-radius: 2px; transform: rotate(45deg);
}
.crumbs a { text-decoration: none; }

/* top bar: a frosted bar on the paper, wordmark left */

.top {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 24px;
  background: rgba(252, 248, 246, 0.86);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--ring);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--char); white-space: nowrap; }
.brand img { height: 26px; width: auto; display: block; }
.brand span { font: 600 13px/1 var(--body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--stone); padding-top: 3px; }
.top nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.top nav a {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  text-decoration: none; color: var(--char); white-space: nowrap; font-size: 16px;
}
.top nav a:hover { background: var(--sand); }
.top nav a.active { background: var(--white); box-shadow: inset 0 0 0 1px var(--ring-strong); font-weight: 600; }
.count { background: var(--ember); color: var(--white); border-radius: 999px; padding: 0 8px; font-size: 0.78rem; font-weight: 700; line-height: 1.6; }
.logout { margin: 0; }

/* cards and rows: white cards on hairline rings, never shadows */

.card {
  background: var(--white); border: 1px solid var(--ring); border-radius: 24px;
  padding: 22px 26px; margin: 0 0 18px;
}
.card .card { background: var(--paper); border-color: var(--ring); border-radius: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.empty p { margin: 0; color: var(--stone); }

.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 64px; padding: 14px 4px; border-top: 1px solid var(--ring);
  color: var(--char); text-decoration: none;
}
a.row:hover .row-main strong { text-decoration: underline; text-decoration-color: var(--ember); text-underline-offset: 5px; }
.card > .row:first-of-type, h2 + .row { border-top: none; }
a.card.row { padding: 18px 26px; }
.row-main { flex: 1; min-width: 0; }
.row-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

.item { border-top: 1px solid var(--ring); padding: 14px 0; }
.item.urgent .reason { font-weight: 700; }
.item p { margin: 6px 0; }
.item form { margin-top: 8px; }
.end { display: flex; justify-content: flex-end; margin-top: 8px; }

/* chips */

.chip {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  background: var(--sand); color: var(--char); font-size: 0.8rem; font-weight: 600; white-space: nowrap;
  margin-right: 4px;
}
.chip.kind { background: var(--white); box-shadow: inset 0 0 0 1px var(--ring-strong); }
.chip.urgent, .s-failed { background: var(--ember); color: var(--white); }
.s-needs_approval { background: var(--char); color: var(--paper); }
.s-ready_for_qa { background: var(--ember-tint); color: var(--ember-dark); }
.s-in_progress, .s-queued, .s-done { background: var(--sand); }
.s-released { background: var(--white); box-shadow: inset 0 0 0 1px var(--ring-strong); }
.s-rejected { background: var(--sand); color: var(--stone); }

/* forms and buttons: pills, as on hitroo.com */

form { margin: 0; }
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type="password"], input[type="text"], textarea, select {
  width: 100%; font: inherit; color: inherit; background: var(--white);
  border: 1px solid var(--ring-strong); border-radius: 14px; padding: 12px 14px;
}
select { min-height: 48px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--char); color: var(--paper); }
.btn.primary:hover { background: #2a2820; }
.btn.secondary { background: var(--white); color: var(--char); border-color: var(--ring-strong); }
.btn.secondary:hover { background: #fff8f5; }
.btn.danger { background: var(--ember); color: var(--white); }
.btn.danger:hover { background: var(--ember-dark); }
.btn.wide { width: 100%; margin-top: 14px; }
button.link { background: none; border: none; color: var(--stone); font: inherit; font-size: 15px; min-height: 44px; padding: 0 8px; cursor: pointer; }
button.link:hover { color: var(--char); }

.qa-actions form.fail, .decision form + form { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--ring); }

.login { max-width: 460px; margin: 12vh auto 0; }
.login .wordmark { display: block; height: 40px; width: auto; margin: 0 0 22px; }

/* flash messages */

.flash { border-radius: 18px; padding: 14px 18px; margin: 0 0 18px; border: 1px solid var(--ring); }
.flash p { margin: 0; }
.flash p + p { margin-top: 4px; }
.flash.ok { background: var(--white); }
.flash.ok p:first-child::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin: 0 10px 1px 2px;
  background: var(--ember); border-radius: 2px; transform: rotate(45deg);
}
.flash.error { background: var(--ember-tint); color: var(--ember-dark); border-color: rgba(245, 80, 47, 0.25); }

/* conversation */

.chat { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 11px 16px; border-radius: 18px; background: var(--paper); border: 1px solid var(--ring); }
.msg p { margin: 2px 0 0; overflow-wrap: anywhere; }
.msg .who { font-size: 0.78rem; color: var(--stone); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.msg.lead { background: var(--sand); border-color: transparent; }
.msg.owner { background: var(--char); color: var(--paper); align-self: flex-end; border-color: transparent; }
.msg.owner .who { color: rgba(252, 248, 246, 0.7); }
.msg.factory { align-self: center; max-width: 92%; background: none; border: 1px dashed var(--ring-strong); font-size: 0.9rem; }
.waiting { border-style: dashed; }

/* history and QA pack */

.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 10px 0; border-top: 1px solid var(--ring); }
.history li:first-child { border-top: none; }

.markdown h2 { font-size: 1.35rem; }
.markdown h3 { font-size: 1.12rem; border-top: 1px solid var(--ring); padding-top: 16px; }
.markdown ul, .markdown ol { padding-left: 1.4em; }
.markdown li { margin: 4px 0; }
.markdown li::marker { color: var(--ember); }
.markdown li.check { list-style: none; margin-left: -1.4em; display: flex; gap: 10px; align-items: flex-start; }
.markdown li.check input { width: 24px; height: 24px; margin: 2px 0 0; flex: none; accent-color: var(--ember); }
.markdown li.check label { font-weight: 500; margin: 0; }
.markdown img, .markdown video { max-width: 100%; height: auto; border-radius: 14px; border: 1px solid var(--ring); }
.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--ring); vertical-align: top; }
th { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; }
