/* ============================================================
   INSULARIUS SIGNATURE — DESIGN TOKENS v1.0
   Basado en claude-design-system-architect (modular, premium)
   v3.1.8f: editor tipo Google Docs con 30+ fonts, headings, undo, etc
   ============================================================ */

/* ============================================================
   1. COLOR TOKENS (semantic + ramp)
   ============================================================ */
:root {
  /* Brand: indigo (Insularius) */
  --brand-50:  #eef0fc;
  --brand-100: #dde1f9;
  --brand-200: #bcc3f3;
  --brand-300: #9ba5ed;
  --brand-400: #7a87e7;
  --brand-500: #5e6ad2;     /* primary */
  --brand-600: #4a55b8;
  --brand-700: #3b4596;
  --brand-800: #2d3574;
  --brand-900: #1f2552;

  /* Accent (violeta de fields/grupos) */
  --accent-purple-50:  #f3eefe;
  --accent-purple-100: #e6dafd;
  --accent-purple-500: #7c3aed;
  --accent-purple-700: #5b21b6;

  /* Status */
  --success-50:  #ecfdf5;
  --success-500: #10b981;
  --success-700: #047857;
  --warning-50:  #fffbeb;
  --warning-500: #d97706;
  --warning-700: #b45309;
  --danger-50:   #fef2f2;
  --danger-500:  #ef4444;
  --danger-700:  #b91c1c;

  /* Neutrals */
  --neutral-0:   #ffffff;
  --neutral-50:  #f8f9fc;
  --neutral-100: #f1f3f9;
  --neutral-200: #e4e7ef;
  --neutral-300: #d1d6e0;
  --neutral-400: #9ca3af;
  --neutral-500: #6b7280;
  --neutral-600: #4b5563;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --neutral-900: #111827;

  /* Semantic */
  --bg:        var(--neutral-50);
  --surface:   var(--neutral-0);
  --ink:       var(--neutral-800);
  --ink2:      var(--neutral-600);
  --ink3:      var(--neutral-500);
  --line:      var(--neutral-200);
  --line2:     var(--neutral-300);
  --accent:    var(--brand-500);
  --accent-dark: var(--brand-600);
  --accent-soft: var(--brand-50);

  /* ============================================================
     2. TYPE TOKENS (modular scale, no random px)
     ============================================================ */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-display: 'Inter', -apple-system, system-ui, sans-serif;

  /* Modular scale: 1.125 ratio (Major Third) */
  --text-2xs:  0.6875rem;   /* 11px */
  --text-xs:   0.75rem;     /* 12px */
  --text-sm:   0.8125rem;   /* 13px */
  --text-base: 0.875rem;    /* 14px */
  --text-md:   1rem;        /* 16px */
  --text-lg:   1.125rem;    /* 18px */
  --text-xl:   1.375rem;    /* 22px */
  --text-2xl:  1.75rem;     /* 28px */
  --text-3xl:  2.25rem;     /* 36px */
  --text-4xl:  3rem;        /* 48px */

  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.55;
  --leading-loose:  1.75;

  --tracking-tight:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.025em;

  /* ============================================================
     3. SPACING TOKENS (4px base)
     ============================================================ */
  --space-0:  0;
  --space-1:  0.25rem;     /* 4px */
  --space-2:  0.5rem;      /* 8px */
  --space-3:  0.75rem;     /* 12px */
  --space-4:  1rem;        /* 16px */
  --space-5:  1.25rem;     /* 20px */
  --space-6:  1.5rem;      /* 24px */
  --space-7:  2rem;        /* 32px */
  --space-8:  2.5rem;      /* 40px */
  --space-9:  3rem;        /* 48px */
  --space-10: 4rem;        /* 64px */
  --space-12: 6rem;        /* 96px */

  /* ============================================================
     4. RADIUS / BORDER / ELEVATION
     ============================================================ */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  --border-thin:   1px solid var(--line);
  --border-medium: 1.5px solid var(--line);
  --border-thick:  2px solid var(--line);

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.05);
  --shadow-xl: 0 16px 40px rgba(15, 23, 42, 0.12), 0 8px 16px rgba(15, 23, 42, 0.06);
  --shadow-focus: 0 0 0 3px rgba(94, 106, 210, 0.25);

  /* ============================================================
     5. MOTION TOKENS (premium feel)
     ============================================================ */
  --duration-instant: 80ms;
  --duration-fast:    160ms;
  --duration-base:    240ms;
  --duration-slow:    360ms;
  --duration-slower:  520ms;

  --ease-standard:  cubic-bezier(0.2, 0, 0, 1);
  --ease-decel:     cubic-bezier(0, 0, 0, 1);
  --ease-accel:     cubic-bezier(0.3, 0, 1, 1);
  --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-emphasis:  cubic-bezier(0.2, 0, 0.1, 1.4);

  /* ============================================================
     6. Z-INDEX
     ============================================================ */
  --z-base:    0;
  --z-sticky:  10;
  --z-fixed:   100;
  --z-modal:   1000;
  --z-toast:   2000;
  --z-tooltip: 3000;
}

/* ============================================================
   DARK MODE (opt-in, no forzado — default es light)
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root.theme-auto, :root[data-theme='dark'] {
    --bg:        #0f1117;
    --surface:   #161922;
    --ink:       #e4e7ef;
    --ink2:      #b4b8c5;
    --ink3:      #8a8f9d;
    --line:      #2a2e3a;
    --line2:     #383d4a;
    --accent-soft: rgba(94, 106, 210, 0.15);
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast:    0ms;
    --duration-base:    0ms;
    --duration-slow:    0ms;
    --duration-slower:  0ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
