/* =============================================================
   Chaotic Cr8ness — colors_and_type.css
   Canonical design tokens. Everything else reads from here.
   ============================================================= */

/* Webfonts: the Portal is self-contained (no CDN). IBM Plex is used when installed
   locally; otherwise the system fallbacks in --font-* apply. Copied from
   docs/design/system/colors_and_type.css (ADR-011) with the Google Fonts @import removed. */

:root {
  /* ============================================================
     COLOUR — Base palette (from docs/design/brand/colors.md)
     ============================================================ */

  /* Primary blue ramp */
  --cc-dark:      #192e61;  /* Primary actions, headers, brand */
  --cc-middle:    #55709b;  /* Secondary, borders, icons */
  --cc-light:     #57aece;  /* Accents, links, focus rings */

  /* Neutral ramp */
  --cc-white:     #ffffff;
  --cc-off-white: #f5f7fa;  /* Canonical light surface */
  --cc-off-white-2:#e8eef5; /* Gradient stop, hover wash */
  --cc-gray-100:  #f3f4f6;  /* Card borders */
  --cc-gray-200:  #e5e7eb;  /* Dividers, progress track */
  --cc-gray-500:  #6b7280;  /* Secondary text */
  --cc-charcoal:  #1f2937;  /* Body text on light */

  /* Semantic (subtle, not distracting per AMMIF UI guidelines) */
  --cc-hit:       #10b981;  /* Soft green */
  --cc-miss:      #ef4444;  /* Soft red */
  --cc-warn:      #f59e0b;
  --cc-info:      #57aece;  /* Same as cc-light */

  /* Dark / field surface */
  --cc-bg-dark:        #0a0a14;
  --cc-panel-dark:     rgba(0, 0, 0, 0.85);
  --cc-panel-border:   #333333;
  --cc-text-dark-1:    #ffffff;
  --cc-text-dark-2:    #cccccc;
  --cc-text-dark-3:    #888888;
  --cc-text-dark-mute: #666666;
  --cc-highlight:      #ffdd44;  /* viz highlight / warning yellow */

  /* Visualisation: Z-score deviation gradient */
  --cc-z-neg: #0066ff;  /* −3σ */
  --cc-z-mid: #ffffff;  /*  0  */
  --cc-z-pos: #ff3333;  /* +3σ */

  /* Visualisation: correlation lines */
  --cc-corr-pos: #64ff96;  /* positive correlation */
  --cc-corr-neg: #ff9664;  /* negative correlation */

  /* Badge palettes (Tailwind-style) */
  --cc-badge-success-bg: #d1fae5;
  --cc-badge-success-fg: #065f46;
  --cc-badge-warn-bg:    #fef3c7;
  --cc-badge-warn-fg:    #92400e;
  --cc-badge-error-bg:   #fee2e2;
  --cc-badge-error-fg:   #991b1b;
  --cc-badge-info-bg:    #dbeafe;
  --cc-badge-info-fg:    #1e40af;
  --cc-badge-neutral-bg: #f3f4f6;
  --cc-badge-neutral-fg: #374151;

  /* ============================================================
     SEMANTIC COLOUR TOKENS
     Use these in components, not the raw palette.
     ============================================================ */

  --fg-1: var(--cc-charcoal);    /* Primary text on light */
  --fg-2: var(--cc-gray-500);    /* Secondary / supporting text */
  --fg-3: var(--cc-middle);      /* Tertiary / nav inactive */
  --fg-brand: var(--cc-dark);    /* Headlines, brand-coloured text */
  --fg-accent: var(--cc-light);  /* Links, accent text */
  --fg-inverse: var(--cc-white); /* Text on dark surfaces */

  --bg-1: var(--cc-off-white);   /* Page surface */
  --bg-2: var(--cc-white);       /* Card surface */
  --bg-3: var(--cc-off-white);   /* Stat box, inset surface */
  --bg-brand: var(--cc-dark);    /* Filled brand surface */
  --bg-field: var(--cc-bg-dark); /* Field / viz surface */

  --border-1: var(--cc-gray-100);
  --border-2: var(--cc-gray-200);
  --border-input: var(--cc-middle);
  --border-focus: var(--cc-light);

  /* ============================================================
     TYPOGRAPHY — Families
     ============================================================ */
  --font-sans:  'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;

  /* Type scale (rem assumes 16px root) */
  --fs-display: 3rem;     /* 48px — hero-level only */
  --fs-h1:      2rem;     /* 32px — page title */
  --fs-h2:      1.5rem;   /* 24px — section heading */
  --fs-h3:      1.125rem; /* 18px — subsection */
  --fs-body:    1rem;     /* 16px — body text */
  --fs-small:   0.875rem; /* 14px — supporting */
  --fs-caption: 0.75rem;  /* 12px — labels, captions */
  --fs-trial:   3.75rem;  /* 60px — intention prompt (HIGH / LOW / NEUTRAL) */
  --fs-result:  3rem;     /* 48px — HIT / MISS */
  --fs-stat:    1.5rem;   /* 24px — stat values */

  /* Weights */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Line heights */
  --lh-tight:   1.2;
  --lh-snug:    1.35;
  --lh-normal:  1.5;
  --lh-relaxed: 1.65;

  /* Letter spacing */
  --tracking-tight:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.025em;
  --tracking-wider:  0.05em;   /* stat labels, section labels */
  --tracking-widest: 0.1em;    /* the intention prompts */

  /* ============================================================
     SHAPE — Radii, shadows, spacing
     ============================================================ */
  --radius-sm:   8px;     /* badges, small chips */
  --radius-md:   12px;    /* inputs, buttons, stat boxes */
  --radius-lg:   16px;    /* admin cards */
  --radius-xl:   20px;    /* trial cards */
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-ring: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--cc-light);

  /* 4-px base spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  --dur-fast:   150ms;
  --dur-normal: 200ms;
  --dur-calm:   300ms;       /* trial UI */
  --dur-progress: 500ms;     /* progress bar fill */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1); /* Tailwind ease-in-out */
}

/* ============================================================
   SEMANTIC TYPE — Composite styles you apply directly
   ============================================================ */

.cc-display {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: var(--fs-display);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--fg-brand);
}

.cc-h1 {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  color: var(--fg-brand);
}

.cc-h2 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-h2);
  line-height: var(--lh-snug);
  color: var(--fg-1);
}

.cc-h3 {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-h3);
  line-height: var(--lh-snug);
  color: var(--fg-1);
}

.cc-body {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--fg-1);
  text-wrap: pretty;
}

.cc-body-muted {
  font-family: var(--font-sans);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--fg-2);
}

.cc-small {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  line-height: var(--lh-normal);
  color: var(--fg-2);
}

.cc-caption {
  font-family: var(--font-sans);
  font-size: var(--fs-caption);
  line-height: var(--lh-normal);
  color: var(--fg-2);
}

/* Long-form research / KB content */
.cc-prose {
  font-family: var(--font-serif);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--fg-1);
  max-width: 65ch;
  text-wrap: pretty;
}

/* Code, device IDs, numeric data */
.cc-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  letter-spacing: var(--tracking-normal);
  color: var(--fg-1);
}

/* Stat label — UPPERCASE w/ tracking */
.cc-stat-label {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--fg-2);
}

/* Stat value — large, semibold, mono for numerics */
.cc-stat-value {
  font-family: var(--font-mono);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-stat);
  line-height: var(--lh-tight);
  color: var(--fg-1);
  font-variant-numeric: tabular-nums;
}

/* Intention prompt — HIGH / LOW / NEUTRAL */
.cc-intention {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: var(--fs-trial);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-widest);
  text-align: center;
}

/* Trial result — HIT / MISS */
.cc-result {
  font-family: var(--font-sans);
  font-weight: var(--fw-bold);
  font-size: var(--fs-result);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-wide);
}

/* Section/nav label in sidebar — uppercase, tracking-wider */
.cc-section-label {
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: var(--fs-caption);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--fg-2);
}

/* Field-surface (dark) heading */
.cc-field-h {
  font-family: var(--font-sans);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-h3);
  color: var(--fg-inverse);
}

/* Field-surface monospace data readout */
.cc-field-mono {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--cc-text-dark-2);
  font-variant-numeric: tabular-nums;
}
