/* Shared tokens and chrome for the chat, handbook and evals pages. */

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

:root {
  color-scheme: light;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --surface-3:     #eef2f7;
  --border:        #e2e8f0;
  --border-strong: #cbd5e1;
  --text:          #0f172a;
  --text-2:        #334155;
  --muted:         #64748b;
  --faint:         #8a97ab;
  --accent:        #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft:   rgba(37, 99, 235, .10);
  --on-accent:     #ffffff;
  --header-bg:     #0f2542;
  --highlight:     #fff4c2;
  --highlight-edge:#e0b100;
  /* Status: fixed steps, always shown with an icon and a label. */
  --good:          #0a7d0a;
  --good-soft:     #e7f5e7;
  --bad:           #c22f2f;
  --bad-soft:      #fdecec;
  --warn:          #8a5a00;
  --warn-soft:     #fff4dc;
  --radius:        14px;
  --shadow:        0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --mono:          ui-monospace, 'SF Mono', Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:            #0b1220;
    --surface:       #131c2e;
    --surface-2:     #172136;
    --surface-3:     #1d2940;
    --border:        #26324a;
    --border-strong: #34425f;
    --text:          #e6ebf3;
    --text-2:        #c4cddc;
    --muted:         #9aa7bd;
    --faint:         #7d8aa2;
    --accent:        #6b9bff;
    --accent-strong: #8db2ff;
    --accent-soft:   rgba(107, 155, 255, .14);
    --on-accent:     #0b1220;
    --header-bg:     #0a1630;
    --highlight:     #4a3d0a;
    --highlight-edge:#d9a400;
    --good:          #3fbf3f;
    --good-soft:     rgba(12, 163, 12, .16);
    --bad:           #f07070;
    --bad-soft:      rgba(208, 59, 59, .18);
    --warn:          #f5b83d;
    --warn-soft:     rgba(250, 178, 25, .14);
    --shadow:        0 1px 3px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  }
}

html, body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  position: relative;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; min-width: 0; }
.logo {
  width: 32px; height: 32px; background: #2563eb; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo svg { width: 19px; height: 19px; fill: white; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-size: 15px; font-weight: 700; color: white; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub {
  font-size: 11px; color: rgba(255,255,255,.55); font-weight: 500;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}

.site-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.site-nav a {
  font-size: 13px; font-weight: 500; color: rgba(255,255,255,.72);
  text-decoration: none; padding: 6px 11px; border-radius: 8px;
}
.site-nav a:hover { color: white; background: rgba(255,255,255,.08); }
.site-nav a[aria-current="page"] { color: white; background: rgba(255,255,255,.14); }

.index-badge {
  font-size: 11px; font-weight: 600; color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  padding: 3px 10px; border-radius: 20px; white-space: nowrap; margin-left: 6px;
}
.index-badge.empty { color: #ffd27a; border-color: rgba(255,210,122,.4); }

@media (max-width: 560px) {
  .site-header { padding: 0 14px; gap: 8px; }
  .brand-sub, .index-badge { display: none; }
  .site-nav a { padding: 6px 8px; }
}

/* ── Status chips: colour never carries meaning alone ── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 600; line-height: 1;
  padding: 4px 8px; border-radius: 20px; white-space: nowrap;
  border: 1px solid transparent;
}
.chip.good { color: var(--good); background: var(--good-soft); }
.chip.bad  { color: var(--bad);  background: var(--bad-soft); }
.chip.warn { color: var(--warn); background: var(--warn-soft); }
.chip.neutral { color: var(--muted); background: var(--surface-3); }
.chip svg { width: 12px; height: 12px; flex-shrink: 0; }

.mono { font-family: var(--mono); font-size: .92em; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Segmented toggle ── */
.segmented { display: inline-flex; align-self: flex-start; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.segmented button {
  font: inherit; font-size: 13px; background: var(--surface); color: var(--text-2);
  border: none; padding: 7px 12px; cursor: pointer;
}
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ── Markdown content ── */
.md h1, .md h2, .md h3 { font-weight: 700; line-height: 1.3; margin: 1em 0 .35em; color: var(--text); }
.md h1 { font-size: 1.15em; }
.md h2 { font-size: 1.05em; }
.md h3 { font-size: .95em; }
.md > :first-child { margin-top: 0; }
.md p { margin-bottom: .7em; }
.md p:last-child { margin-bottom: 0; }
.md strong { font-weight: 650; }
.md ul, .md ol { padding-left: 1.4em; margin-bottom: .7em; }
.md li { margin-bottom: .25em; }
.md code {
  font-family: var(--mono); font-size: .85em; background: var(--surface-3);
  border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px;
}
.md table { border-collapse: collapse; width: 100%; font-size: .9em; margin-bottom: .7em; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--muted); margin-bottom: .7em; }

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