/* Spendly — design tokens.
   Light theme is the base; dark theme overrides only the semantic layer so
   component CSS never needs to know which theme is active. */

:root {
  /* ---- Brand ---- */
  --purple-50:  #EEE9FF;
  --purple-100: #DED4FF;
  --purple-300: #A992FA;
  --purple-500: #6C4DF6;
  --purple-600: #5B3DE8;
  --purple-700: #4F35C9;
  --purple-900: #2E1E7A;

  /* ---- Status ---- */
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #F59E0B;
  --warning-soft: #FEF3C7;
  --danger:  #EF4444;
  --danger-soft: #FEE2E2;
  --info:    #3B82F6;
  --info-soft: #DBEAFE;

  /* ---- Neutrals ---- */
  --gray-50:  #F7F7FB;
  --gray-100: #F1F1F6;
  --gray-200: #E5E5EE;
  --gray-300: #D3D3DF;
  --gray-400: #A0A0B2;
  --gray-500: #71718A;
  --gray-600: #55556B;
  --gray-700: #3C3C4E;
  --gray-800: #26263A;
  --gray-900: #16162A;

  /* ---- Semantic (light) ---- */
  --bg:            #F7F7FB;
  --bg-elevated:   #FFFFFF;
  --surface:       #FFFFFF;
  --surface-alt:   #F1F1F6;
  --surface-sunken: #ECECF3;
  --border:        #E5E5EE;
  --border-strong: #D3D3DF;

  --text:        #16162A;
  --text-muted:  #55556B;
  --text-subtle: #8A8AA0;
  --text-invert: #FFFFFF;

  --accent:        var(--purple-500);
  --accent-hover:  var(--purple-600);
  --accent-soft:   var(--purple-50);
  --accent-text:   var(--purple-700);
  --on-accent:     #FFFFFF;

  --gradient-brand: linear-gradient(135deg, #7C5BFF 0%, #6C4DF6 45%, #4F35C9 100%);
  --gradient-cta:   linear-gradient(135deg, #7C5BFF 0%, #5B3DE8 100%);

  --scrim: rgba(15, 16, 32, 0.45);
  --glass: rgba(255, 255, 255, 0.72);

  /* Decorative backdrop artwork (login + dashboard hero). --backdrop-1 is the
     colour painted into the phone status bar, so it must match the SVG's top. */
  --backdrop-1: #7C5BFF;
  --backdrop-2: #6242EE;
  --backdrop-3: #4F35C9;
  --on-backdrop: #FFFFFF;
  --on-backdrop-muted: rgba(255, 255, 255, 0.76);

  /* ---- Elevation ---- */
  --shadow-xs: 0 1px 2px rgba(16, 16, 40, 0.05);
  --shadow-sm: 0 2px 8px rgba(16, 16, 40, 0.06);
  --shadow-md: 0 8px 24px rgba(16, 16, 40, 0.08);
  --shadow-lg: 0 16px 40px rgba(16, 16, 40, 0.12);
  --shadow-accent: 0 10px 28px rgba(108, 77, 246, 0.32);

  /* ---- Radii ---- */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* ---- Spacing (4pt scale) ---- */
  --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;

  /* ---- Typography ---- */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --font-num: "Inter", ui-sans-serif, system-ui, sans-serif;

  --fs-xs: 0.75rem;    /* 12 */
  --fs-sm: 0.8125rem;  /* 13 */
  --fs-base: 0.9375rem;/* 15 */
  --fs-md: 1rem;       /* 16 */
  --fs-lg: 1.125rem;   /* 18 */
  --fs-xl: 1.375rem;   /* 22 */
  --fs-2xl: 1.75rem;   /* 28 */
  --fs-3xl: 2.25rem;   /* 36 */
  --fs-4xl: 2.75rem;   /* 44 */

  /* ---- Motion (§37: 150–350ms) ---- */
  --t-fast: 150ms;
  --t-base: 220ms;
  --t-slow: 320ms;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out-back: cubic-bezier(0.34, 1.4, 0.64, 1);

  /* ---- Layout ---- */
  --nav-h: 64px;
  --sidebar-w: 248px;
  --content-max: 1200px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --z-nav: 40;
  --z-fab: 50;
  --z-sheet: 60;
  --z-modal: 70;
  --z-toast: 80;

  color-scheme: light;
}

/* ---- Semantic (dark) — a designed theme, not an inversion (§31) ---- */
:root[data-theme="dark"] {
  --bg:            #0F1020;
  --bg-elevated:   #191A2E;
  --surface:       #191A2E;
  --surface-alt:   #21223A;
  --surface-sunken: #131425;
  --border:        #2A2B45;
  --border-strong: #3A3B58;

  --text:        #F2F2F8;
  --text-muted:  #A6A7C0;
  --text-subtle: #7A7B96;
  --text-invert: #16162A;

  --accent:       #8468FF;
  --accent-hover: #9781FF;
  --accent-soft:  #241F45;
  --accent-text:  #B7A5FF;
  --on-accent:    #FFFFFF;

  --success-soft: #10301E;
  --warning-soft: #33260A;
  --danger-soft:  #3A1618;
  --info-soft:    #12233F;

  --gradient-brand: linear-gradient(135deg, #7C5BFF 0%, #6042E0 48%, #3B269E 100%);
  --gradient-cta:   linear-gradient(135deg, #7F62FF 0%, #5B3DE8 100%);

  --scrim: rgba(5, 5, 14, 0.62);
  --glass: rgba(25, 26, 46, 0.72);

  --backdrop-1: #4B33B8;
  --backdrop-2: #35237F;
  --backdrop-3: #21174F;
  --on-backdrop: #F4F1FF;
  --on-backdrop-muted: rgba(244, 241, 255, 0.72);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 10px 28px rgba(108, 77, 246, 0.4);

  color-scheme: dark;
}
