/* =========================================================
   Dark mode overrides for the public website.
   Activated by toggling `dark` class on <html>.
   Overrides common Tailwind utility surfaces so existing
   markup adapts without per-page dark: variants.
   ========================================================= */

html.dark { color-scheme: dark; }

/* Base */
html.dark body {
    background-color: #0b1220;
    color: #e2e8f0;
}

/* White surfaces -> dark slate */
html.dark .bg-white { background-color: #111c30 !important; }
html.dark .bg-white\/5,
html.dark .bg-white\/10,
html.dark .bg-white\/15,
html.dark .bg-white\/20,
html.dark .bg-white\/25,
html.dark .bg-white\/30,
html.dark .bg-white\/40,
html.dark .bg-white\/50,
html.dark .bg-white\/60,
html.dark .bg-white\/70,
html.dark .bg-white\/75,
html.dark .bg-white\/80,
html.dark .bg-white\/85,
html.dark .bg-white\/90,
html.dark .bg-white\/95 { background-color: rgba(17, 28, 48, 0.82) !important; backdrop-filter: blur(12px); }

/* Slate surfaces */
html.dark .bg-slate-50 { background-color: #0f172a !important; }
html.dark .bg-slate-100 { background-color: #1e293b !important; }
html.dark .bg-slate-200 { background-color: #334155 !important; }
html.dark .bg-slate-800 { background-color: #1e293b !important; }

/* Gray / neutral surfaces */
html.dark .bg-gray-50,
html.dark .bg-gray-100 { background-color: #1e293b !important; }
html.dark .bg-gray-200 { background-color: #334155 !important; }
html.dark .bg-stone-50,
html.dark .bg-stone-100 { background-color: #1e293b !important; }
html.dark .bg-zinc-50,
html.dark .bg-zinc-100 { background-color: #1e293b !important; }
html.dark .bg-neutral-50,
html.dark .bg-neutral-100 { background-color: #1e293b !important; }

/* Light text-on-dark sections keep working; dark text flips */
html.dark .text-gray-800,
html.dark .text-gray-900,
html.dark .text-stone-800,
html.dark .text-stone-900 { color: #f1f5f9 !important; }
html.dark .text-gray-600,
html.dark .text-gray-500,
html.dark .text-stone-600,
html.dark .text-stone-500 { color: #94a3b8 !important; }

/* Text */
html.dark .text-slate-900,
html.dark .text-slate-800 { color: #f1f5f9 !important; }
html.dark .text-slate-700 { color: #cbd5e1 !important; }
html.dark .text-slate-600,
html.dark .text-slate-500 { color: #94a3b8 !important; }
html.dark .text-slate-400 { color: #64748b !important; }

/* Borders */
html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-300 { border-color: #334155 !important; }
html.dark .divide-slate-100 > * + *,
html.dark .divide-slate-200 > * + * { border-color: #334155 !important; }

/* Light tinted backgrounds -> dark translucent tints */
html.dark .bg-orange-50  { background-color: rgba(249, 115, 22, 0.12) !important; }
html.dark .bg-amber-50   { background-color: rgba(245, 158, 11, 0.12) !important; }
html.dark .bg-yellow-50  { background-color: rgba(234, 179, 8, 0.12) !important; }
html.dark .bg-blue-50    { background-color: rgba(59, 130, 246, 0.12) !important; }
html.dark .bg-indigo-50  { background-color: rgba(99, 102, 241, 0.12) !important; }
html.dark .bg-purple-50  { background-color: rgba(168, 85, 247, 0.12) !important; }
html.dark .bg-pink-50    { background-color: rgba(236, 72, 153, 0.12) !important; }
html.dark .bg-rose-50    { background-color: rgba(244, 63, 94, 0.12) !important; }
html.dark .bg-green-50   { background-color: rgba(34, 197, 94, 0.12) !important; }
html.dark .bg-emerald-50 { background-color: rgba(16, 185, 129, 0.12) !important; }
html.dark .bg-teal-50    { background-color: rgba(20, 184, 166, 0.12) !important; }
html.dark .bg-cyan-50    { background-color: rgba(6, 182, 212, 0.12) !important; }

/* Gradient card endpoints (from-X-50 to-white) */
html.dark .to-white {
    --tw-gradient-to: #111c30 !important;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(17, 28, 48, 0)) !important;
}
html.dark .from-orange-50  { --tw-gradient-from: rgba(249,115,22,.14) !important; --tw-gradient-to: rgba(249,115,22,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-amber-50   { --tw-gradient-from: rgba(245,158,11,.14) !important; --tw-gradient-to: rgba(245,158,11,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-blue-50    { --tw-gradient-from: rgba(59,130,246,.14) !important; --tw-gradient-to: rgba(59,130,246,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-indigo-50  { --tw-gradient-from: rgba(99,102,241,.14) !important; --tw-gradient-to: rgba(99,102,241,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-purple-50  { --tw-gradient-from: rgba(168,85,247,.14) !important; --tw-gradient-to: rgba(168,85,247,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-green-50   { --tw-gradient-from: rgba(34,197,94,.14) !important; --tw-gradient-to: rgba(34,197,94,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-emerald-50 { --tw-gradient-from: rgba(16,185,129,.14) !important; --tw-gradient-to: rgba(16,185,129,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-teal-50    { --tw-gradient-from: rgba(20,184,166,.14) !important; --tw-gradient-to: rgba(20,184,166,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .from-rose-50    { --tw-gradient-from: rgba(244,63,94,.14) !important; --tw-gradient-to: rgba(244,63,94,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }

/* Inputs & selects */
html.dark input,
html.dark select,
html.dark textarea {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: #64748b; }

/* Cards & shadows soften */
html.dark .shadow-lg,
html.dark .shadow-xl,
html.dark .shadow-2xl { box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6) !important; }

/* ---- Typography plugin (prose) dark flip ---- */
html.dark .prose {
    --tw-prose-body: #cbd5e1;
    --tw-prose-headings: #f1f5f9;
    --tw-prose-lead: #94a3b8;
    --tw-prose-links: #60a5fa;
    --tw-prose-bold: #f1f5f9;
    --tw-prose-counters: #94a3b8;
    --tw-prose-bullets: #64748b;
    --tw-prose-hr: #334155;
    --tw-prose-quotes: #e2e8f0;
    --tw-prose-quote-borders: #334155;
    --tw-prose-captions: #94a3b8;
    --tw-prose-code: #f1f5f9;
    --tw-prose-pre-code: #e2e8f0;
    --tw-prose-pre-bg: #0f172a;
    --tw-prose-th-borders: #334155;
    --tw-prose-td-borders: #1e293b;
}
html.dark .prose-headings\:text-slate-800 { color: #f1f5f9 !important; }
html.dark .prose-p\:text-slate-700 { color: #cbd5e1 !important; }

/* ---- CMS page content (admin-managed HTML) ---- */
html.dark .cms-content {
    color: #cbd5e1;
}
html.dark .cms-content h1,
html.dark .cms-content h2,
html.dark .cms-content h3,
html.dark .cms-content h4 { color: #f1f5f9; }
html.dark .cms-content p,
html.dark .cms-content li,
html.dark .cms-content td,
html.dark .cms-content blockquote { color: #cbd5e1; }
html.dark .cms-content a { color: #60a5fa; }
html.dark .cms-content table {
    border-color: #334155;
    background-color: transparent;
}
html.dark .cms-content th,
html.dark .cms-content td {
    border-color: #334155;
    background-color: transparent;
}
html.dark .cms-content img {
    border-radius: 0.75rem;
}
html.dark .cms-content pre,
html.dark .cms-content code {
    background-color: #0f172a;
    color: #e2e8f0;
}

/* ---- Primary/accent gradient stops (cms_page wrapper etc.) ---- */
html.dark .from-primary-50 { --tw-gradient-from: rgba(59,130,246,.14) !important; --tw-gradient-to: rgba(59,130,246,0) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .to-accent-50  { --tw-gradient-to: rgba(217,70,239,.14) !important; }
html.dark .via-white,
html.dark .to-white,
html.dark .from-white  { --tw-gradient-to: #111c30 !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
html.dark .via-white    { --tw-gradient-stops: var(--tw-gradient-from), #111c30, var(--tw-gradient-to) !important; }

/* ---- Generic light surfaces missed above ---- */
html.dark .bg-primary-50 { background-color: rgba(59,130,246,.12) !important; }
html.dark .bg-accent-50  { background-color: rgba(217,70,239,.12) !important; }
html.dark .border-amber-200 { border-color: rgba(245,158,11,.35) !important; }
html.dark .bg-amber-50   { background-color: rgba(245,158,11,.12) !important; }
html.dark .text-amber-800 { color: #fcd34d !important; }

/* Images keep natural colors */
html.dark img { filter: none; }

/* Theme toggle icons */
.theme-icon-sun { display: none; }
html.dark .theme-icon-sun { display: inline-block; }
html.dark .theme-icon-moon { display: none; }

/* =========================================================
   Variable-driven theme (web/assets/css/style.css pages)
   Those pages consume --bg-light, --bg-white, --text-dark etc.
   Overriding the variables re-themes the whole page.
   ========================================================= */
html.dark {
    --bg-light: #0f172a;
    --bg-white: #16213a;
    --bg-card: #1e293b;
    --text-dark: #e2e8f0;
    --text-muted-dark: #94a3b8;
    --border-dark: #334155;
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
}
