/* ============================================================
   Theme colours: light and dark.

   Every colour on the site comes from a variable here. Templates and
   style.css never type a colour (tests/test_theme.py checks).

   Light mode is the default. Dark mode applies when:
     - the page says <html data-theme="dark"> (the user chose Dark), or
     - the device is set to dark and the page has not chosen Light
       (Auto, and every page with no signed-in user).
   The two dark blocks below must stay identical (the test checks).

   Palette names follow the Tailwind scale (gray-500, green-700...).
   Light values are the Tailwind colours, except where a text colour was
   darkened to pass the 4.5:1 contrast guideline (noted on the line).
   Dark values: light tints (50-200)
   become faint washes of the colour, and strong shades (600+) become
   lighter shades, so text stays readable on a dark background.
   "--fixed-*" colours are solid fills under white text (or light text on
   a solid fill) and stay the same in both themes.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #f9fafb;              /* page behind the cards */
  --surface: #ffffff;         /* cards, top bar, inputs, menus */
  --text: #1f2937;            /* body text */
  --on-accent: #ffffff;       /* text on navy, orange or other solid fills */
  --navy: #0f172a;            /* sidebar, dark headers */
  --navy-light: #1e2d4a;
  --orange: #b5521d;          /* DocketForge orange as a fill (buttons, active nav); dark enough for white text at 4.5:1 */
  --orange-hover: #9e4718;
  --accent-text: #b5521d;     /* the same orange as text or links */
  --brand-25: #fffaf7;
  --brand-200: #e7b89c;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;
  --info: #2563eb;
  --success-text: #15803d;   /* green-700: green-600 text is only 3.3:1 on white */
  --danger-text: #dc2626;
  --warning-text: #ca8a04;
  --info-text: #2563eb;
  --sidebar-edge: transparent;
  --shadow: 0 1px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  /* The agency's own colours. base.html (and each public page) sets these
  from the agency's settings; these are the defaults. */
  --brand-primary: #0f172a;
  --brand-secondary: #c2581f;
  /* The secondary colour darkened just enough for 4.5:1 contrast (white text on it,
     or it as text on a light page). Pages set it with the readable_fill filter
     (core/colors.py); a colour that already passes is unchanged. */
  --brand-secondary-strong: #b6531d;
  /* The secondary colour as a button fill under white text, in both themes. */
  --brand-secondary-fill: var(--brand-secondary-strong);
  /* Brand colours used as text. In dark mode they are mixed toward white,
  so a dark brand colour stays readable on a dark page. */
  --brand-primary-text: var(--brand-primary);
  --brand-secondary-text: var(--brand-secondary-strong);
  /* The primary brand colour as a button or tab fill. In dark mode it is
     lifted a little toward white so a navy fill still stands off the page. */
  --brand-fill: var(--brand-primary);

  /* Palette */
  --amber-50: #fffbeb;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-300: #fcd34d;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-700: #b45309;
  --amber-800: #92400e;
  --amber-900: #78350f;
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --cyan-50: #ecfeff;
  --cyan-700: #0e7490;
  --gray-50: #f9fafb;
  --gray-75: #f4f6f8;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #6c7079;         /* darker than Tailwind's #9ca3af so muted text reads at 4.5:1 */
  --gray-500: #656b78;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-300: #86efac;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --purple-50: #faf5ff;
  --purple-700: #7e22ce;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-200: #fecaca;
  --red-300: #fca5a5;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --sky-500: #0ea5e9;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #5f6c82;         /* a shade darker than Tailwind's #64748b for 4.5:1 on slate-100 */
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --violet-50: #f5f3ff;
  --violet-700: #6d28d9;
  --yellow-100: #fef9c3;
  --yellow-600: #ca8a04;
  --yellow-700: #a16207;
  --yellow-900: #713f12;

  /* Same in both themes */
  --fixed-gray-400: #9ca3af;
  --fixed-white: #ffffff;      /* paper behind a signature picture, in both themes */
  --fixed-green-600: #16a34a;
  --fixed-green-700: #15803d;
  --fixed-amber-500: #f59e0b;
  --fixed-orange-500: #f97316;
  --fixed-red-600: #dc2626;
  --fixed-red-700: #b91c1c;
  --fixed-slate-200: #e2e8f0;
  --fixed-yellow-100: #fef9c3;
  --fixed-yellow-200: #fef08a;
  --fixed-yellow-600: #ca8a04;
  --fixed-yellow-800: #854d0e;
  --fixed-yellow-900: #713f12;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0e141e;
    --surface: #161e2b;
    --text: #e3e7ed;
    --navy: #0f172a;
    --accent-text: #f0915c;
    --brand-25: rgba(194, 88, 31, 0.12);
    --brand-200: rgba(194, 88, 31, 0.45);
    --success-text: #4ade80;
    --danger-text: #f87171;
    --warning-text: #facc15;
    --info-text: #60a5fa;
    --sidebar-edge: #253043;
    --shadow: 0 1px 4px rgba(0,0,0,0.45);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.55);
    --brand-primary-text: color-mix(in srgb, var(--brand-primary) 35%, #ffffff);
    --brand-secondary-text: color-mix(in srgb, var(--brand-secondary) 45%, #ffffff);
    --brand-fill: color-mix(in srgb, var(--brand-primary) 78%, #ffffff);

    /* Palette, dark values */
    --amber-50: rgba(245, 158, 11, 0.1);
    --amber-100: rgba(245, 158, 11, 0.16);
    --amber-200: rgba(245, 158, 11, 0.3);
    --amber-300: rgba(251, 191, 36, 0.55);
    --amber-400: #fbbf24;
    --amber-500: #fbbf24;
    --amber-600: #fbbf24;
    --amber-700: #fcd34d;
    --amber-800: #fde68a;
    --amber-900: #fef3c7;
    --blue-50: rgba(59, 130, 246, 0.1);
    --blue-100: rgba(59, 130, 246, 0.16);
    --blue-200: rgba(59, 130, 246, 0.3);
    --blue-600: #60a5fa;
    --blue-700: #93c5fd;
    --cyan-50: rgba(6, 182, 212, 0.1);
    --cyan-700: #67e8f9;
    --gray-50: #111824;
    --gray-75: #111824;
    --gray-100: #202a3a;
    --gray-200: #2b3648;
    --gray-300: #3a475b;
    --gray-400: #8a96a9;
    --gray-500: #a0abbc;
    --gray-600: #b6bfcc;
    --gray-700: #cbd2dd;
    --gray-800: #e3e7ed;
    --gray-900: #f0f3f7;
    --green-50: rgba(34, 197, 94, 0.1);
    --green-100: rgba(34, 197, 94, 0.16);
    --green-200: rgba(34, 197, 94, 0.3);
    --green-300: rgba(74, 222, 128, 0.55);
    --green-600: #4ade80;
    --green-700: #86efac;
    --green-800: #bbf7d0;
    --indigo-50: rgba(99, 102, 241, 0.1);
    --indigo-100: rgba(99, 102, 241, 0.16);
    --indigo-700: #a5b4fc;
    --indigo-800: #c7d2fe;
    --orange-50: rgba(249, 115, 22, 0.1);
    --orange-100: rgba(249, 115, 22, 0.16);
    --orange-200: rgba(249, 115, 22, 0.3);
    --orange-600: #fb923c;
    --orange-700: #fdba74;
    --purple-50: rgba(168, 85, 247, 0.1);
    --purple-700: #d8b4fe;
    --red-50: rgba(239, 68, 68, 0.1);
    --red-100: rgba(239, 68, 68, 0.16);
    --red-200: rgba(239, 68, 68, 0.3);
    --red-300: rgba(248, 113, 113, 0.55);
    --red-600: #f87171;
    --red-700: #fca5a5;
    --sky-500: #38bdf8;
    --slate-50: #111824;
    --slate-100: #202a3a;
    --slate-200: #2b3648;
    --slate-300: #3a475b;
    --slate-400: #8a96a9;
    --slate-500: #a0abbc;
    --slate-600: #b6bfcc;
    --slate-700: #cbd2dd;
    --slate-800: #e3e7ed;
    --slate-900: #f0f3f7;
    --violet-50: rgba(139, 92, 246, 0.1);
    --violet-700: #c4b5fd;
    --yellow-100: rgba(234, 179, 8, 0.16);
    --yellow-600: #facc15;
    --yellow-700: #fde047;
    --yellow-900: #fef9c3;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e141e;
  --surface: #161e2b;
  --text: #e3e7ed;
  --navy: #0f172a;
  --accent-text: #f0915c;
  --brand-25: rgba(194, 88, 31, 0.12);
  --brand-200: rgba(194, 88, 31, 0.45);
  --success-text: #4ade80;
  --danger-text: #f87171;
  --warning-text: #facc15;
  --info-text: #60a5fa;
  --sidebar-edge: #253043;
  --shadow: 0 1px 4px rgba(0,0,0,0.45);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.55);
  --brand-primary-text: color-mix(in srgb, var(--brand-primary) 35%, #ffffff);
  --brand-secondary-text: color-mix(in srgb, var(--brand-secondary) 45%, #ffffff);
    --brand-fill: color-mix(in srgb, var(--brand-primary) 78%, #ffffff);

  /* Palette, dark values */
  --amber-50: rgba(245, 158, 11, 0.1);
  --amber-100: rgba(245, 158, 11, 0.16);
  --amber-200: rgba(245, 158, 11, 0.3);
  --amber-300: rgba(251, 191, 36, 0.55);
  --amber-400: #fbbf24;
  --amber-500: #fbbf24;
  --amber-600: #fbbf24;
  --amber-700: #fcd34d;
  --amber-800: #fde68a;
  --amber-900: #fef3c7;
  --blue-50: rgba(59, 130, 246, 0.1);
  --blue-100: rgba(59, 130, 246, 0.16);
  --blue-200: rgba(59, 130, 246, 0.3);
  --blue-600: #60a5fa;
  --blue-700: #93c5fd;
  --cyan-50: rgba(6, 182, 212, 0.1);
  --cyan-700: #67e8f9;
  --gray-50: #111824;
  --gray-75: #111824;
  --gray-100: #202a3a;
  --gray-200: #2b3648;
  --gray-300: #3a475b;
  --gray-400: #8a96a9;
  --gray-500: #a0abbc;
  --gray-600: #b6bfcc;
  --gray-700: #cbd2dd;
  --gray-800: #e3e7ed;
  --gray-900: #f0f3f7;
  --green-50: rgba(34, 197, 94, 0.1);
  --green-100: rgba(34, 197, 94, 0.16);
  --green-200: rgba(34, 197, 94, 0.3);
  --green-300: rgba(74, 222, 128, 0.55);
  --green-600: #4ade80;
  --green-700: #86efac;
  --green-800: #bbf7d0;
  --indigo-50: rgba(99, 102, 241, 0.1);
  --indigo-100: rgba(99, 102, 241, 0.16);
  --indigo-700: #a5b4fc;
  --indigo-800: #c7d2fe;
  --orange-50: rgba(249, 115, 22, 0.1);
  --orange-100: rgba(249, 115, 22, 0.16);
  --orange-200: rgba(249, 115, 22, 0.3);
  --orange-600: #fb923c;
  --orange-700: #fdba74;
  --purple-50: rgba(168, 85, 247, 0.1);
  --purple-700: #d8b4fe;
  --red-50: rgba(239, 68, 68, 0.1);
  --red-100: rgba(239, 68, 68, 0.16);
  --red-200: rgba(239, 68, 68, 0.3);
  --red-300: rgba(248, 113, 113, 0.55);
  --red-600: #f87171;
  --red-700: #fca5a5;
  --sky-500: #38bdf8;
  --slate-50: #111824;
  --slate-100: #202a3a;
  --slate-200: #2b3648;
  --slate-300: #3a475b;
  --slate-400: #8a96a9;
  --slate-500: #a0abbc;
  --slate-600: #b6bfcc;
  --slate-700: #cbd2dd;
  --slate-800: #e3e7ed;
  --slate-900: #f0f3f7;
  --violet-50: rgba(139, 92, 246, 0.1);
  --violet-700: #c4b5fd;
  --yellow-100: rgba(234, 179, 8, 0.16);
  --yellow-600: #facc15;
  --yellow-700: #fde047;
  --yellow-900: #fef9c3;
}
