/* ============================================================
   kyn — design tokens
   ============================================================ */

:root {
  /* — Surfaces (warm-cool dark, near pure-black like relats + peptsight) — */
  --surface-0: #08090A;          /* deepest — page bg */
  --surface-1: #0E0F11;          /* primary panel */
  --surface-2: #14161A;          /* raised card */
  --surface-3: #1B1E23;          /* elevated card / hover */
  --surface-4: #23272E;          /* inputs / wells */
  --surface-line: #2A2E36;       /* hairline */
  --surface-line-soft: #1B1E23;
  --surface-bevel-hi: rgba(255,255,255,0.045); /* top inner highlight */
  --surface-bevel-lo: rgba(0,0,0,0.55);        /* bottom inner shadow */

  /* — Inverse surface (used for marketing / light slabs, like relats catalog cards) — */
  --paper-0: #F4EFE7;            /* warm cream (relats) */
  --paper-1: #ECE6DA;
  --paper-ink: #0E0F11;

  /* — Text — */
  --ink-1: #F4F1EC;              /* primary text, warm white */
  --ink-2: #C7C4BD;              /* secondary */
  --ink-3: #8E8B85;              /* tertiary / meta */
  --ink-4: #5A5853;              /* disabled / quiet */
  --ink-5: #2F2E2B;              /* ambient display type on dark */

  /* — Brand: relats orange. Single accent. — */
  --orange-50:  #FFF3EC;
  --orange-100: #FFD9C2;
  --orange-300: #FF8A4B;
  --orange-500: #FF4D17;         /* primary accent */
  --orange-600: #E63E0A;
  --orange-700: #B5310A;
  --orange-glow: rgba(255, 77, 23, 0.22);

  /* — Status palette (muted on dark, oklch-tuned, share lightness/chroma) — */
  --status-strong:    oklch(0.78 0.13 150);   /* green */
  --status-positive:  oklch(0.80 0.13 150);
  --status-emerging:  oklch(0.74 0.16 295);   /* violet */
  --status-mixed:     oklch(0.78 0.14 70);    /* amber */
  --status-cautious:  oklch(0.78 0.14 70);
  --status-divided:   oklch(0.74 0.15 25);    /* red-orange (distinct from brand) */
  --status-weak:      oklch(0.65 0.01 80);    /* neutral grey */
  --status-stable:    oklch(0.70 0.02 80);
  --status-medium:    oklch(0.74 0.14 230);   /* desaturated steel — used sparingly, NOT cyan */
  --status-orange:    var(--orange-500);

  /* — Radii (peptsight has soft, ~10–14px; relats pill buttons are full) — */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-4: 16px;
  --r-5: 20px;
  --r-pill: 999px;

  /* — Spacing (4px base) — */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;
  --s-20: 80px;
  --s-24: 96px;
  --s-32: 128px;

  /* — Bevel & shadow stack (peptsight cards) — */
  --bevel:
    inset 0 1px 0 0 var(--surface-bevel-hi),
    inset 0 -1px 0 0 var(--surface-bevel-lo);
  --bevel-strong:
    inset 0 1px 0 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 0 rgba(0,0,0,0.7),
    inset 1px 0 0 0 rgba(255,255,255,0.02),
    inset -1px 0 0 0 rgba(0,0,0,0.4);
  --shadow-sm: 0 1px 0 rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.35);
  --shadow-md: 0 1px 0 rgba(0,0,0,0.6), 0 8px 24px -8px rgba(0,0,0,0.55);
  --shadow-lg: 0 1px 0 rgba(0,0,0,0.7), 0 24px 60px -20px rgba(0,0,0,0.7);
  --shadow-orange: 0 8px 24px -8px var(--orange-glow), 0 0 0 1px rgba(255,77,23,0.2);

  /* — Type — */
  --font-display: "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-body:    "Geist", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --tracking-tight: -0.025em;
  --tracking-display: -0.035em;
  --tracking-wide: 0.12em;
  --tracking-mono: 0.04em;

  /* — Motion — */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 600ms;
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--surface-0);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}

/* ============================================================
   Type scale — display draws from relats, UI draws from peptsight
   ============================================================ */

.t-ambient {
  font-family: var(--font-display);
  font-size: clamp(120px, 18vw, 280px);
  line-height: 0.92;
  letter-spacing: var(--tracking-display);
  font-weight: 400;
  color: var(--ink-5);
}

.t-display-xl {
  font-family: var(--font-display);
  font-size: clamp(56px, 7.5vw, 112px);
  line-height: 0.95;
  letter-spacing: var(--tracking-display);
  font-weight: 500;
  color: var(--ink-1);
}
.t-display-lg {
  font-family: var(--font-display);
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1;
  letter-spacing: var(--tracking-display);
  font-weight: 500;
}
.t-display-md {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 48px);
  line-height: 1.05;
  letter-spacing: var(--tracking-display);
  font-weight: 500;
}
.t-h1 { font-size: 32px; line-height: 1.15; letter-spacing: var(--tracking-tight); font-weight: 600; }
.t-h2 { font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; font-weight: 600; }
.t-h3 { font-size: 17px; line-height: 1.3; font-weight: 600; }
.t-body { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.t-body-sm { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.t-meta { font-size: 12px; line-height: 1.4; color: var(--ink-3); }

/* — eyebrows / ALL CAPS mono labels (peptsight) — */
.t-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.t-eyebrow-orange { color: var(--orange-500); }
.t-mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: var(--tracking-mono); }
.t-mono-sm { font-family: var(--font-mono); font-size: 11px; letter-spacing: var(--tracking-mono); }

/* — section number — */
.t-sec-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--tracking-wide);
  color: var(--ink-4);
  font-weight: 400;
}

/* ============================================================
   Layout helpers
   ============================================================ */

.kyn-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--s-12) var(--s-10);
}
.kyn-grid { display: grid; gap: var(--s-6); }
.kyn-row  { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.kyn-col  { display: flex; flex-direction: column; gap: var(--s-3); }

.kyn-divider {
  height: 1px;
  background: var(--surface-line);
  margin: var(--s-12) 0;
}
.kyn-divider-soft {
  height: 1px;
  background: var(--surface-line-soft);
  margin: var(--s-6) 0;
}

/* ============================================================
   Card — the peptsight bevel
   ============================================================ */

.kyn-card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface-1) 100%);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-4);
  padding: var(--s-6);
  box-shadow: var(--bevel), var(--shadow-md);
  position: relative;
}
.kyn-card-flat {
  background: var(--surface-1);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-4);
  padding: var(--s-6);
}
.kyn-well {
  background: var(--surface-0);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-3);
  padding: var(--s-5);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.5);
}

/* ============================================================
   Buttons — pill primary (relats), ghost, icon
   ============================================================ */

.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  padding: 12px 22px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform var(--dur-1) var(--ease-out),
              background var(--dur-2) var(--ease-out),
              box-shadow var(--dur-2) var(--ease-out),
              border-color var(--dur-2) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--orange-500);
  color: #fff;
  box-shadow: var(--bevel), 0 1px 0 rgba(0,0,0,0.5), 0 6px 18px -6px var(--orange-glow);
}
.btn-primary:hover {
  background: var(--orange-600);
  box-shadow: var(--bevel), 0 1px 0 rgba(0,0,0,0.5), 0 10px 24px -6px var(--orange-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-1);
  border-color: var(--surface-line);
}
.btn-ghost:hover { background: var(--surface-2); border-color: #3a3f48; }

.btn-quiet {
  background: var(--surface-2);
  color: var(--ink-1);
  border-color: var(--surface-line);
  box-shadow: var(--bevel);
}
.btn-quiet:hover { background: var(--surface-3); }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 16px 28px; font-size: 15px; }

.btn-icon {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--surface-line);
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: var(--bevel);
  transition: all var(--dur-2) var(--ease-out);
}
.btn-icon:hover { color: var(--ink-1); background: var(--surface-3); }
.btn-icon .i, .btn-icon svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ============================================================
   Status badges — peptsight bordered pills
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-2);
  border: 1px solid currentColor;
  background: color-mix(in oklch, currentColor 8%, transparent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  font-weight: 500;
  line-height: 1;
}
.badge-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-3);
  margin-right: 6px;
  font-weight: 500;
}
.badge-strong   { color: var(--status-strong); }
.badge-positive { color: var(--status-positive); }
.badge-emerging { color: var(--status-emerging); }
.badge-mixed    { color: var(--status-mixed); }
.badge-cautious { color: var(--status-cautious); }
.badge-divided  { color: var(--status-divided); }
.badge-weak     { color: var(--status-weak); }
.badge-stable   { color: var(--status-stable); }
.badge-medium   { color: var(--status-medium); }
.badge-orange   { color: var(--orange-500); }

/* — pill with leading dot (live indicator) — */
.badge-dot {
  border-radius: var(--r-pill);
  padding: 4px 10px 4px 8px;
}
.badge-dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* ============================================================
   Status row — labeled mini grid (signal/consensus/sentiment)
   ============================================================ */

.statgrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-2);
}
.stat-cell {
  border: 1px solid var(--surface-line);
  border-radius: var(--r-2);
  padding: var(--s-3);
  background: var(--surface-1);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================
   Inputs
   ============================================================ */

.kyn-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-3);
  padding: 14px 16px;
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  box-shadow: var(--bevel);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
.kyn-input::placeholder { color: var(--ink-4); }
.kyn-input:focus {
  border-color: var(--orange-500);
  box-shadow: var(--bevel), 0 0 0 3px rgba(255,77,23,0.18);
}

.kyn-search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 18px;
  background: var(--surface-1);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-3);
  box-shadow: var(--bevel);
}
.kyn-search-input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: 14px;
}
.kyn-search-input::placeholder { color: var(--ink-4); }

/* ============================================================
   Log / event stream surface (mono, peptsight Agent Activity)
   ============================================================ */

.kyn-log {
  background: var(--surface-0);
  border: 1px solid var(--surface-line);
  border-radius: var(--r-3);
  padding: var(--s-4);
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.6);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-2);
  overflow: hidden;
}
.kyn-log .row { display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 3px 0; }
.kyn-log .ts { color: var(--ink-4); }
.kyn-log .lvl-ok    { color: var(--status-strong); }
.kyn-log .lvl-info  { color: var(--ink-2); }
.kyn-log .lvl-warn  { color: var(--status-mixed); }
.kyn-log .lvl-err   { color: var(--status-divided); }
.kyn-log .tag       { color: var(--orange-500); }
.kyn-log .dim       { color: var(--ink-4); }

/* ============================================================
   Swatch grid
   ============================================================ */
.swatch {
  border-radius: var(--r-3);
  border: 1px solid var(--surface-line);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--bevel);
}
.swatch-color { aspect-ratio: 16/9; }
.swatch-meta {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  background: var(--surface-1);
  border-top: 1px solid var(--surface-line);
}
.swatch-meta .name { color: var(--ink-1); font-size: 13px; font-weight: 500; }
.swatch-meta .hex  { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }

/* ============================================================
   Section header
   ============================================================ */
.section-header {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: var(--s-4);
  align-items: baseline;
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--surface-line);
  margin-bottom: var(--s-8);
}
.section-header .num { color: var(--ink-4); }
.section-header h2 { margin: 0; }
.section-header .sub { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
