/* ═══════════════════════════════════════════════════════
   Pyng — Design Tokens
   Single source of truth for all color, radius, spacing,
   and easing values. Import before any other stylesheet.
═══════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  /* Ink scale */
  --ink:        #0e0e0c;
  --ink-2:      #3a3936;
  --ink-3:      #6b6661;              /* WCAG AA: 5.1:1 on --paper, 5.7:1 on --surface */
  --ink-4:      #a09a95;              /* placeholder / disabled text */

  /* Paper scale */
  --paper:      #f5f3ee;
  --paper-rgb:  245, 243, 238;         /* RGB variant for rgba() transparency in HTML inline styles */
  --paper-2:    #eceae4;
  --surface:    #ffffff;
  --surface-alt: #faf9f6;              /* subtle tinted surface — card insets, zebra rows */

  /* PyngOS dark canvas (OS-mode backgrounds) */
  --os-deep:    #0a0a09;               /* primary page bg — deepest black */
  --os-dark:    #0e0e0c;               /* standard dashboard pages (= --ink) */
  --os-black:   #000000;               /* camera / video panels only */
  /* sidebar #111110 is hardcoded in app.css — not a token (see BRANDING.md) */

  /* Font families */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui:      'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Gold accent. --gold is 3.6:1 on --paper — large text (>=18.66px bold / 24px),
     decorative, and non-text (icons, borders, focus rings) ONLY. For small/body
     text use --gold-dark (#846a37, AA-compliant). */
  --gold:       #9a7a40;              /* brand accent — large/decorative/non-text only */
  --gold-light: #c9a970;              /* updated to match new gold scale */
  --gold-hover: #7d6332;              /* gold pressed / hover state */
  --gold-dim:   rgba(154,122,64,0.15);
  --gold-focus: rgba(154,122,64,0.10); /* focus ring alpha */

  /* Dark canvas — auth/onboarding page backgrounds */
  --canvas-dark:   #1a1a18;
  --canvas-dark-2: #2d2d2a;

  /* Borders */
  --border:       rgba(14,14,12,0.10);
  --border-md:    rgba(14,14,12,0.16);
  --border-solid: #e8e4d8;              /* solid border — inputs, rule lines, email cards */
  --border-dark:    rgba(255,255,255,0.07);
  --border-dark-md: rgba(255,255,255,0.14);

  /* Status & Intent (light bg) */
  --success:    #2d6a4f;
  --success-bg: #edf7f2;
  --error:             #c0392b;
  --error-bg:          #fdf0ef;
  --error-bg-hover:    #f9d9d6;    /* danger button :hover bg */
  --error-border-hover: #d9726b;   /* danger button :hover border */
  --warning:           #d97706;
  --warning-bg: #fef3e2;
  --info:       #0c5ba3;
  --info-bg:    #f0f7ff;

  /* Toast Intent (dark bg for notifications) */
  --toast-default-bg:  #1c1b18;
  --toast-default-fg:  #f0ede6;
  --toast-success-bg:  #12271c;
  --toast-success-fg:  #8fd4a8;
  --toast-error-bg:    #2e100d;
  --toast-error-fg:    #f5b3ae;
  --toast-warning-bg:  #2a1c04;
  --toast-warning-fg:  #f0d08a;
  --toast-info-bg:     #0c1d30;
  --toast-info-fg:     #9ecef5;

  /* Status Badge Colors */
  --badge-type-property-bg:  #e8f4f0;
  --badge-type-property-fg:  #1a6e53;
  --badge-type-insurance-bg: #e8eef8;
  --badge-type-insurance-fg: #2a4e8a;
  --badge-type-mlm-bg:       #f5eefc;
  --badge-type-mlm-fg:       #6e2aad;
  --badge-type-b2b-bg:       #fdf4e7;
  --badge-type-b2b-fg:       #8a5200;
  --badge-warmth-hot:        #e8297a;
  --badge-warmth-cold:       #4a9eff;

  /* Warmth aliases — used in pipeline, dashboard, tasks */
  --hot:        #e8297a;                /* alias: --badge-warmth-hot */
  --hot-bg:     rgba(232, 41, 122, 0.08);
  --hot-bg-hover: #fae0de;             /* hover state for danger/hot buttons */
  --warm:   #b89a6a;                    /* borders / backgrounds ONLY — 2.4:1, never use as text */
  --warm-bg: rgba(184, 154, 106, 0.12); /* warm tinted surface */
  --cold:   #4a9eff;                    /* alias: --badge-warmth-cold */
  --cold-bg: rgba(74, 158, 255, 0.08);

  /* Semantic shorthand aliases — used in tasks */
  --red:    #c0392b;                    /* alias: --error */
  --red-bg: #fdf0ef;                    /* alias: --error-bg */
  --green:  #2d6a4f;                    /* alias: --success */
  --green-bg: #edf7f2;                  /* alias: --success-bg */
  --ink-1: var(--ink);                  /* alias — corrects off-by-one naming in older files */

  /* Gold extended palette */
  --gold-bg:       #fdf5e8;             /* light gold tinted surface — intel cards, badges, buttons */
  --gold-dark:     #846a37;             /* AA gold text — 4.6:1 on --paper, 4.7:1 on --gold-bg, 5.1:1 on --surface */
  --gold-bg-hover: #f5ecd9;             /* hover state for gold-bg elements */

  /* Purple (proposal stage, MLM badge, etc.) */
  --purple:        #5c40a8;
  --purple-bg:     #f0ecfc;
  --purple-border: #c9bef2;

  /* Status border colors — used on badges, stage pills, rec items */
  --success-border: #9dd5be;
  --hot-border:     #f0c8c5;
  --warm-border:    #e8c99a;
  --cold-border:    #b3d0e8;
  --gold-border:    #e8d9bc;            /* warm gold rule — pyng notes, warm surfaces */

  /* Typography scale */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;
  --text-md:   14px;
  --text-lg:   16px;

  /* Font weights (Instrument Sans ships 400/500/600) */
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Control heights (4px grid) */
  --ctrl-xs: 26px;
  --ctrl-sm: 32px;
  --ctrl-md: 36px;
  --ctrl-lg: 40px;

  /* Radius — canonical set */
  --r:          14px;
  --r-sm:       9px;
  --r-xs:       6px;
  /* DEPRECATED: legacy radius set — do not use in new code. */
  --radius:     12px;
  --radius-sm:  8px;
  --radius-xs:  6px;

  /* Easing */
  --ease-spring: cubic-bezier(.22,.68,0,1.15);
  --ease-out:    cubic-bezier(0.34, 1.0, 0.64, 1);

  /* Layout */
  --max-page-width: 1100px;

  /* Spacing (4px grid) */
  --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-18: 72px;
  --space-20: 80px;
}

/* ── Global reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Utility classes ── */
.hidden { display: none !important; }

.flex-row   { display: flex; align-items: center; }
.flex-col   { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Typography utilities */
.font-mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }  /* IDs, hashes, timestamps */
.font-display { font-family: 'Cormorant Garamond', Georgia, serif; }   /* headings, card titles */

/* Logo mark — two-tone rule (single source of truth, per BRANDING.md)
   Light bg: Py = --ink (#0e0e0c),  ng = --gold (#b89a6a)   → .nav-logo
   Dark bg:  Py = --gold (#b89a6a), ng = --gold (#b89a6a) italic → .nav-logo--dark  */
.nav-logo, .sb-logo-text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500; letter-spacing: 0.04em;
  text-decoration: none;
}
.nav-logo    { color: var(--ink); }
.nav-logo em { font-style: italic; color: var(--gold); }

.nav-logo--dark    { color: var(--gold); }              /* Py = gold on dark bg */
.nav-logo--dark em { font-style: italic; color: var(--gold); }  /* ng = gold italic */

/* Focus Rings — visible focus indicator for keyboard navigation */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(154,122,64,0.2);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(154,122,64,0.2);
}

/* Screen reader only — visually hidden but accessible to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

