/* Company Brain design tokens and shared primitives.
 *
 * Extracted from docs/ui/prototype.html, which is the design spec for the
 * workspace. Every page links this file, so a colour or a type step is defined
 * once here and nowhere else -- no page carries its own token block.
 *
 * The base layer (page background, type scale, default weight) is scoped to
 * `body.brand` rather than `body`. Only pages that have been moved onto the new
 * design opt in; the ones still on the old glass styling link this file for the
 * tokens and are left visually untouched until their own restyle lands. Adding
 * the class is what flips a page over.
 */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@200;300;400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

:root {
  /* Surfaces. Ink is the page; the hairline is the only border in the design. */
  --ink-900: #0A1016;
  --ink-800: #11171E;
  --hairline: #272D3B;
  --glass: rgba(255,255,255,0.0253);

  /* Text, in three steps. There is no fourth. */
  --text: #FFFFFF;
  --dim: #CCCCCC;
  --muted: #999999;
  --on-light: #0A1016;   /* text on the one white surface */

  /* Five semantic accents. Each one means a specific thing, everywhere:
   *   lime    won, and fresh
   *   yellow  slipped, and a known limitation
   *   red     a coverage defect -- records missing, not depth missing
   *   cyan    provenance, citations and links
   *   silver  forward pipeline
   * A colour used for anything else is a bug, because the reader has learned it.
   */
  --lime: #A8CD3A;
  --yellow: #E5C53D;
  --red: #E75967;
  --cyan: #33C7E3;
  --silver: #E8EDF2;

  --measure: 68ch;       /* prose line length */
}

/* -- base ------------------------------------------------------------------ */

body.brand {
  background: var(--ink-900);
  background-image: linear-gradient(180deg, #0A1016 0%, #0C1219 55%, #11171E 100%);
  background-attachment: fixed;
  color: var(--dim);
  color-scheme: dark;
  font-family: "Geist", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 26px;
}
/* The reset is wrapped in :where() so it contributes NO specificity of its own.
   Written as `body.brand *` it scored (0,1,1) and beat every single-class rule a
   page could write: `margin: 0` silently killed `.headline { margin-bottom }`
   and `.mast-meta { margin-left: auto }`, so cards sat flush and right-aligned
   metadata did not right-align. A reset must lose to page rules; :where() is how
   it keeps the `body.brand` opt-in without winning the cascade. */
:where(body.brand) * { box-sizing: border-box; margin: 0; }
:where(body.brand) a { color: inherit; text-decoration: none; }
/* Bold is reserved for numbers and named things inside a light sentence. It is
   never how a heading is emphasised -- headings carry weight 400 or 200. */
:where(body.brand) b, :where(body.brand) strong { font-weight: 600; color: var(--text); }
:where(body.brand) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:where(body.brand) :focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }
body.brand [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  :where(body.brand) *, :where(body.brand) *::before, :where(body.brand) *::after {
    transition: none !important; animation: none !important;
  }
}

.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* -- the rule ------------------------------------------------------------- */
/* The hairline-with-bloom is the section separator in this design. Cards do not
   have borders; a rule above the content does the same job with less furniture. */

.rule {
  position: relative; height: 1px; background: var(--hairline); border: 0;
}
.rule::after {
  content: ""; position: absolute; top: -5px; left: 0; width: 190px; height: 11px;
  pointer-events: none;
  background: radial-gradient(ellipse 95px 5px at 50% 50%,
    rgba(51,199,227,0.65), rgba(51,199,227,0) 72%);
}
.rule.wide::after {
  width: 100%;
  background: radial-gradient(ellipse 46% 5px at 34% 50%,
                rgba(47,186,212,0.55), rgba(47,186,212,0) 70%),
              radial-gradient(ellipse 26% 4px at 78% 50%,
                rgba(168,205,58,0.34), rgba(168,205,58,0) 70%);
}

/* -- labels and small type ------------------------------------------------ */

.eyebrow {
  font-size: 10px; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--muted);
}
.sub-head {
  font-size: 10px; letter-spacing: 0.17em; text-transform: uppercase;
  color: var(--muted); font-weight: 500; margin: 22px 0 11px;
}
/* A document-type tag: mono, quiet, bordered rather than filled. */
.tt {
  display: inline-block; font-family: "Geist Mono", monospace; font-size: 9px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  border: 1px solid var(--hairline); border-radius: 4px; padding: 1px 5px;
  line-height: 15px; vertical-align: 1px;
}
.tt.cy { color: var(--cyan); border-color: rgba(51,199,227,0.3); }

/* -- citations ------------------------------------------------------------ */
/* A citation is a quiet inline marker labelled by document type, not a filled
   chip labelled by source. It sits inside the sentence it supports and reads as
   punctuation until you look for it. */

.cite {
  display: inline; margin-left: 5px;
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: 9.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--cyan); border-bottom: 1px solid rgba(51,199,227,0.28);
  white-space: nowrap; cursor: pointer;
  transition: color 140ms, border-color 140ms;
}
.cite::before { content: "·"; margin-right: 4px; color: rgba(51,199,227,0.5); }
.cite:hover { color: #8FE2F2; border-bottom-color: var(--cyan); }
/* A citation the model invented. Red, because it is a defect in the output. */
.cite.bad { color: var(--red); border-bottom-color: rgba(231,89,103,0.4); cursor: help; }
.cite.bad::before { color: rgba(231,89,103,0.55); }

.notfound { color: var(--muted); font-style: italic; }
/* A claim nothing in the corpus is cited for. Deliberately quieter than
   `.cite.bad`: that one means the model named a document it should not have, and
   is red. This one means nobody has checked, which is a weaker statement and gets
   a weaker mark. It has to be visible against prose without competing with the
   citations, so it is the muted colour with a dotted rule rather than a solid. */
.uncited {
  font-size: 10px; letter-spacing: 0.04em; color: var(--muted); cursor: help;
  border-bottom: 1px dotted rgba(255,255,255,0.22); white-space: nowrap;
}
.uncited::before { content: "·"; margin-right: 4px; opacity: 0.55; }

/* -- state dots ----------------------------------------------------------- */
/* Deal and signal states, using the semantic accents. */

.state {
  font-size: 9px; letter-spacing: 0.13em; text-transform: uppercase;
  font-weight: 500; padding-left: 11px; position: relative;
}
.state::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 5px; height: 5px;
  border-radius: 50%; transform: translateY(-50%);
}
.state.won  { color: var(--lime); }    .state.won::before  { background: var(--lime); }
.state.slip { color: var(--yellow); }  .state.slip::before { background: var(--yellow); }
.state.fwd  { color: var(--silver); }  .state.fwd::before  { background: var(--silver); }
.state.off  { color: var(--muted); }   .state.off::before  { background: #4A5364; }

/* A readiness signal, as opposed to a deal state. Same dot, different
   vocabulary: ok / warn / bad / off rather than won / slipped / forward. Kept
   here beside .state because both are the accents doing their semantic job, and
   the client list is not the last page that will need this one. */
.sig {
  font-size: 10px; letter-spacing: 0.11em; text-transform: uppercase;
  font-weight: 500; padding-left: 12px; position: relative; white-space: nowrap;
}
.sig::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 5px; height: 5px;
  border-radius: 50%; transform: translateY(-50%);
}
.sig.ok   { color: var(--lime); }    .sig.ok::before   { background: var(--lime); }
.sig.warn { color: var(--yellow); }  .sig.warn::before { background: var(--yellow); }
.sig.bad  { color: var(--red); }     .sig.bad::before  { background: var(--red); }
.sig.off  { color: var(--muted); }   .sig.off::before  { background: #4A5364; }

.fresh { display: inline-flex; align-items: center; gap: 7px; color: var(--lime); }
.fresh .d {
  width: 5px; height: 5px; border-radius: 50%; background: var(--lime);
  box-shadow: 0 0 0 3px rgba(168,205,58,0.13);
}

/* -- key/value rows ------------------------------------------------------- */

.kv {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 12px; line-height: 22px; color: var(--muted);
  border-top: 1px solid var(--hairline); padding: 3px 0;
}
.kv:first-of-type { border-top: 0; }
.kv b { color: var(--dim); font-weight: 400; font-variant-numeric: tabular-nums; }

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

.btn {
  display: inline-flex; align-items: center; gap: 8px; font-size: 12px;
  padding: 7px 14px; border-radius: 9999px;
  border: 1px solid rgba(51,199,227,0.35); color: var(--cyan);
  transition: background 150ms;
}
.btn:hover { background: rgba(51,199,227,0.1); }
.btn.ghost { border-color: var(--hairline); color: var(--muted); }
.btn.ghost:hover { background: rgba(255,255,255,0.04); color: var(--dim); }

/* -- empty and loading ---------------------------------------------------- */

.empty {
  padding: 64px 20px; text-align: center; color: var(--muted);
  font-size: 13px; line-height: 21px;
  border: 1px solid var(--hairline); border-radius: 12px;
}
.empty b { display: block; font-weight: 300; font-size: 17px; color: var(--dim); margin-bottom: 8px; }
.empty code {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace; font-size: 12px;
  background: rgba(255,255,255,0.05); border-radius: 4px; padding: 2px 6px;
}

.loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 250px; gap: 14px; color: var(--muted); font-size: 12px;
}
.spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--hairline); border-top-color: var(--cyan);
  animation: brand-spin 900ms linear infinite;
}
@keyframes brand-spin { to { transform: rotate(360deg); } }

/* -- evidence drawer ------------------------------------------------------ */
/* Provenance opens over the page rather than navigating away from it, because
   checking a citation is an interruption to reading, not a destination. */

.scrim {
  position: fixed; inset: 0; background: rgba(5,8,11,0.62);
  opacity: 0; pointer-events: none; transition: opacity 200ms; z-index: 40;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
  background: #0C1219; border-left: 1px solid var(--hairline);
  transform: translateX(100%); transition: transform 220ms ease-out;
  z-index: 50; display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.dhead { padding: 22px 24px 16px; border-bottom: 1px solid var(--hairline); position: relative; }
.dhead .k {
  font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--cyan); font-weight: 500;
}
.dhead h3 {
  font-size: 18px; font-weight: 300; color: var(--text); line-height: 26px;
  margin-top: 8px; letter-spacing: -0.3px; word-break: break-word;
}
.dclose {
  position: absolute; top: 18px; right: 20px; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 4px;
}
.dclose:hover { color: var(--text); }
.dbody { padding: 20px 24px 40px; overflow: auto; display: grid; gap: 18px; }
.quote {
  border-left: 1px solid rgba(51,199,227,0.5); padding: 2px 0 2px 14px;
  font-size: 13.5px; line-height: 22px; color: var(--dim);
}
.src { display: flex; gap: 10px; align-items: baseline; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.src .ttl { color: var(--dim); font-size: 12.5px; }
