/* BrainMesh Design Tokens
   Custom palette: deep ink/navy, warm off-white, electric teal accent */

:root {
  /* Type scale (fluid) */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.5rem);
  --text-3xl: clamp(2.5rem, 1rem + 4vw, 5rem);
  --text-hero: clamp(2.75rem, 0.5rem + 6.5vw, 7.25rem);

  /* Spacing (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Transition */
  --transition-interactive: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 500ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Content widths */
  --content-narrow: 680px;
  --content-default: 1080px;
  --content-wide: 1280px;

  /* Fonts */
  --font-display: 'Cabinet Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'General Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* LIGHT MODE — warm off-white surface, deep ink text, electric teal accent */
:root,
[data-theme='light'] {
  --color-bg: #f5f1ea;             /* warm off-white */
  --color-surface: #fbf8f2;
  --color-surface-2: #efeae0;
  --color-surface-offset: #e7e1d3;
  --color-surface-dynamic: #ddd6c5;
  --color-divider: #d6cfbf;
  --color-border: #c8c0ad;

  --color-text: #0c1620;            /* near-black ink with cool undertone */
  --color-text-muted: #4a5568;
  --color-text-faint: #8a8478;
  --color-text-inverse: #fbf8f2;

  --color-ink: #0c1620;             /* deep navy/ink — used for inverse panels */
  --color-ink-2: #131f2c;
  --color-ink-stable: #0c1620;      /* always-dark for inverse panels (does not flip) */
  --color-ink-stable-text: #ece6d9; /* text on always-dark panel */

  --color-primary: #00b3c7;         /* electric teal */
  --color-primary-hover: #0095a8;
  --color-primary-active: #007987;
  --color-primary-soft: rgba(0, 179, 199, 0.12);
  --color-primary-on: #03171b;      /* text on teal */

  --color-success: #2f7a3f;
  --color-warning: #b86617;
  --color-error: #b3294e;

  /* Mesh / grid motif colors */
  --mesh-line: rgba(12, 22, 32, 0.08);
  --mesh-node: rgba(12, 22, 32, 0.55);
  --mesh-glow: rgba(0, 179, 199, 0.55);

  --shadow-sm: 0 1px 2px rgba(12, 22, 32, 0.06);
  --shadow-md: 0 8px 24px rgba(12, 22, 32, 0.08);
  --shadow-lg: 0 24px 60px rgba(12, 22, 32, 0.14);
}

/* DARK MODE — ink/navy primary surface, warm-toned text, brighter teal */
[data-theme='dark'] {
  --color-bg: #0a121b;
  --color-surface: #0f1b27;
  --color-surface-2: #142231;
  --color-surface-offset: #19293a;
  --color-surface-dynamic: #213447;
  --color-divider: #1e2d3f;
  --color-border: #28394d;

  --color-text: #ece6d9;            /* warm cream */
  --color-text-muted: #9aa6b3;
  --color-text-faint: #5a6776;
  --color-text-inverse: #0a121b;

  --color-ink: #ece6d9;
  --color-ink-2: #fbf8f2;
  --color-ink-stable: #060c13;      /* still always-dark in dark mode (a touch deeper than bg) */
  --color-ink-stable-text: #ece6d9;

  --color-primary: #2dd4e4;         /* brighter teal in dark */
  --color-primary-hover: #6ee5f0;
  --color-primary-active: #98efef;
  --color-primary-soft: rgba(45, 212, 228, 0.16);
  --color-primary-on: #03171b;

  --color-success: #6dba7f;
  --color-warning: #e0a35a;
  --color-error: #e8678a;

  --mesh-line: rgba(236, 230, 217, 0.08);
  --mesh-node: rgba(236, 230, 217, 0.55);
  --mesh-glow: rgba(45, 212, 228, 0.65);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* Respect system preference when no manual toggle has been made */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0a121b;
    --color-surface: #0f1b27;
    --color-surface-2: #142231;
    --color-surface-offset: #19293a;
    --color-surface-dynamic: #213447;
    --color-divider: #1e2d3f;
    --color-border: #28394d;
    --color-text: #ece6d9;
    --color-text-muted: #9aa6b3;
    --color-text-faint: #5a6776;
    --color-text-inverse: #0a121b;
    --color-ink: #ece6d9;
    --color-ink-2: #fbf8f2;
    --color-ink-stable: #060c13;
    --color-ink-stable-text: #ece6d9;
    --color-primary: #2dd4e4;
    --color-primary-hover: #6ee5f0;
    --color-primary-active: #98efef;
    --color-primary-soft: rgba(45, 212, 228, 0.16);
    --color-primary-on: #03171b;
    --color-success: #6dba7f;
    --color-warning: #e0a35a;
    --color-error: #e8678a;
    --mesh-line: rgba(236, 230, 217, 0.08);
    --mesh-node: rgba(236, 230, 217, 0.55);
    --mesh-glow: rgba(45, 212, 228, 0.65);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  }
}
