/* Dark mode. Active when <html data-theme="dark"> (set before paint by M30_Theme).
   Only colour tokens and the few hard-coded light colours are overridden, so the
   light design stays untouched. Gold stays the accent; green and red switch to the
   lighter on-dark shades for contrast. */

/* Theme switch (header + mobile drawer + login) */
.m30-theme-item { display: flex; align-items: center; }
.m30-theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 40px; height: 40px; margin: 0 4px 0 10px; padding: 0; border-radius: 999px; border: 1px solid rgba(246, 245, 239, 0.3); background: transparent; color: #f6f5ef; cursor: pointer; transition: border-color 0.15s, color 0.15s, background-color 0.15s; }
.m30-theme-toggle:hover { border-color: #fde463; color: #fde463; background: rgba(246, 245, 239, 0.06); }
.m30-theme-toggle:focus-visible { outline: 3px solid #fde463; outline-offset: 3px; }
.m30-theme-toggle svg { width: 19px; height: 19px; flex: none; }
.m30-theme-toggle .i-sun, [data-theme="dark"] .m30-theme-toggle .i-moon { display: none; }
[data-theme="dark"] .m30-theme-toggle .i-sun { display: block; }
.m30-theme-label { display: none; font-size: 1rem; font-weight: 600; }
#mobile-drawer .m30-theme-item { padding: 14px 0; }
#mobile-drawer .m30-theme-toggle { width: auto; height: 44px; padding: 0 18px; margin: 0; }
#mobile-drawer .m30-theme-label { display: inline; }
.m30l-theme { position: fixed; top: 18px; right: 18px; z-index: 10; margin: 0; border-color: rgba(16, 24, 22, 0.25); color: #101816; background: #fff; }
.m30l-theme:hover { color: #101816; border-color: #d99a12; background: #fff; }
@media (max-width: 900px) { .m30l-theme { border-color: rgba(246, 245, 239, 0.35); color: #f6f5ef; background: rgba(16, 24, 22, 0.5); } }
@media (prefers-reduced-motion: reduce) { .m30-theme-toggle { transition: none; } }

/* ---------- Kadence palette (page backgrounds, body text, buttons, links) ---------- */
html[data-theme="dark"] {
	color-scheme: dark;
	--global-palette1: #d99a12;
	--global-palette2: #fde463;
	--global-palette3: #f6f5ef;
	--global-palette4: #e3e7e4;
	--global-palette5: #b9c2bd;
	--global-palette6: #8a9590;
	--global-palette7: #26302d;
	--global-palette8: #0b0f0e;
	--global-palette9: #141b19;
}
html[data-theme="dark"] body { background: #0b0f0e; color: #b9c2bd; }
html[data-theme="dark"] .entry-content a:not(.m30-btn):not(.m30h-btn):not(.m30j-yt) { color: #fde463; }

/* ---------- Member tools (app.css) ---------- */
html[data-theme="dark"] .m30 {
	--m30-primary: #d99a12;
	--m30-primary-hover: #fde463;
	--m30-text: #f6f5ef;
	--m30-muted: #b9c2bd;
	--m30-bg: #141b19;
	--m30-surface: #1b2421;
	--m30-border: #2a3531;
	--m30-pos: #5fe08f;
	--m30-neg: #ff8a8a;
	--m30-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
html[data-theme="dark"] .m30 .m30-btn, html[data-theme="dark"] .m30 .m30-btn:hover { color: #101816; }
html[data-theme="dark"] .m30 .m30-btn-ghost { color: #d99a12; background: transparent; }
html[data-theme="dark"] .m30 .m30-btn-ghost:hover { color: #fde463; background: #1b2421; }
html[data-theme="dark"] .m30 .m30-btn-long { background: #0a8a3e; border-color: #0a8a3e; color: #fff; }
html[data-theme="dark"] .m30 .m30-btn-long:hover { background: #0c9e48; border-color: #0c9e48; color: #fff; }
html[data-theme="dark"] .m30 .m30-btn-short { background: #c62828; border-color: #c62828; color: #fff; }
html[data-theme="dark"] .m30 .m30-btn-short:hover { background: #d84040; border-color: #d84040; color: #fff; }
html[data-theme="dark"] .m30 .m30-input, html[data-theme="dark"] .m30 select.m30-input { background: #0f1513; border-color: #34403c; color: #f6f5ef; }
html[data-theme="dark"] .m30 .m30-input::placeholder { color: #8a9590; }
html[data-theme="dark"] .m30-side-card-long { background: rgba(95, 224, 143, 0.07); }
html[data-theme="dark"] .m30-side-card-short { background: rgba(255, 138, 138, 0.07); }
html[data-theme="dark"] .m30-badge-halal { background: rgba(95, 224, 143, 0.15); color: #5fe08f; }
html[data-theme="dark"] .m30-badge-haram { background: rgba(255, 138, 138, 0.15); color: #ff8a8a; }
html[data-theme="dark"] .m30-badge-not_found, html[data-theme="dark"] .m30-status-closed { background: rgba(246, 245, 239, 0.08); color: #b9c2bd; }
html[data-theme="dark"] .m30-status-open { background: rgba(217, 154, 18, 0.16); color: #fde463; }
html[data-theme="dark"] .m30 .m30-tab { background: #141b19; }
html[data-theme="dark"] .m30 .m30-tab.is-active { background: #d99a12; border-color: #d99a12; color: #101816; }
html[data-theme="dark"] .m30-notice { background: rgba(217, 154, 18, 0.1); border-color: rgba(217, 154, 18, 0.4); color: #f6f5ef; }
html[data-theme="dark"] .m30-dialog { background: #141b19; color: #f6f5ef; }
html[data-theme="dark"] .m30-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
html[data-theme="dark"] .m30-check-list li.is-done { background: rgba(95, 224, 143, 0.07); border-color: rgba(95, 224, 143, 0.3); }
html[data-theme="dark"] .m30-check-static li::before { color: #101816; }
html[data-theme="dark"] .m30-chips li { background: rgba(95, 224, 143, 0.1); border-color: rgba(95, 224, 143, 0.3); color: #5fe08f; }
html[data-theme="dark"] .m30-toast { color: #101816; }
html[data-theme="dark"] .m30-toast-bad { color: #fff; }

/* ---------- Home page (landing.css) ---------- */
html[data-theme="dark"] .m30h {
	--bg: #0b0f0e;
	--surface: #141b19;
	--ink: #f6f5ef;
	--muted: #b9c2bd;
	--line: #26302d;
	--gain-tint: rgba(95, 224, 143, 0.09);
	--gain-ink: #5fe08f;
}
html[data-theme="dark"] .m30h-steps li::before { box-shadow: inset 0 0 0 1px rgba(217, 154, 18, 0.45); }
html[data-theme="dark"] .m30h-tile-rules { border: 1px solid rgba(95, 224, 143, 0.22); }

/* ---------- Journey page (journey.css) ---------- */
html[data-theme="dark"] .m30j {
	--bg: #0b0f0e;
	--surface: #141b19;
	--ink: #f6f5ef;
	--muted: #b9c2bd;
	--line: #26302d;
	--gain: #5fe08f;
	--loss: #ff8a8a;
}
html[data-theme="dark"] .m30j tr.is-today td { background: rgba(217, 154, 18, 0.1); }
html[data-theme="dark"] .m30j tfoot th, html[data-theme="dark"] .m30j tfoot td { background: rgba(95, 224, 143, 0.09); }
html[data-theme="dark"] .m30j tfoot th { color: #5fe08f; }

/* ---------- Login / register (login.css) ---------- */
html[data-theme="dark"] body.login.m30l { background: #0b0f0e; --ink: #f6f5ef; --muted: #b9c2bd; --line: #2a3531; }
html[data-theme="dark"] .m30l.login form .input,
html[data-theme="dark"] .m30l.login input[type="text"],
html[data-theme="dark"] .m30l.login input[type="email"],
html[data-theme="dark"] .m30l.login input[type="password"] { background: #141b19; border-color: #2a3531; color: #f6f5ef; }
html[data-theme="dark"] .m30l.login .message, html[data-theme="dark"] .m30l.login .notice, html[data-theme="dark"] .m30l.login #login_error, html[data-theme="dark"] .m30l.login .success { background: #141b19; color: #f6f5ef; box-shadow: none; }
html[data-theme="dark"] .m30l.login input[type="checkbox"] { background: #141b19; border-color: #34403c; }
html[data-theme="dark"] .m30l.login input[type="checkbox"]:checked { background: #d99a12; border-color: #d99a12; box-shadow: inset 0 0 0 3px #141b19; }
html[data-theme="dark"] .m30l.login .button.wp-hide-pw { color: #b9c2bd; }
html[data-theme="dark"] .m30l-theme { background: #141b19; color: #f6f5ef; border-color: rgba(246, 245, 239, 0.3); }

/* Visited links: Chrome does not restyle :visited links when the theme attribute changes
   live, so each theme-dependent link colour is pinned per theme for both states. */
html[data-theme="light"] .m30h-steps a, html[data-theme="light"] .m30h-steps a:visited,
html[data-theme="light"] .m30h .m30h-link, html[data-theme="light"] .m30h .m30h-link:visited,
html[data-theme="light"] .m30j td a, html[data-theme="light"] .m30j td a:visited,
html[data-theme="light"] .m30j-vgrid a, html[data-theme="light"] .m30j-vgrid a:visited,
html[data-theme="light"] .m30l.login #nav a, html[data-theme="light"] .m30l.login #nav a:visited { color: #0b0f0e; }
html[data-theme="dark"] .m30h-steps a, html[data-theme="dark"] .m30h-steps a:visited,
html[data-theme="dark"] .m30h .m30h-link, html[data-theme="dark"] .m30h .m30h-link:visited,
html[data-theme="dark"] .m30j td a, html[data-theme="dark"] .m30j td a:visited,
html[data-theme="dark"] .m30j-vgrid a, html[data-theme="dark"] .m30j-vgrid a:visited,
html[data-theme="dark"] .m30l.login #nav a, html[data-theme="dark"] .m30l.login #nav a:visited { color: #f6f5ef; }
html[data-theme="light"] .m30 a:not(.m30-btn), html[data-theme="light"] .m30 a:not(.m30-btn):visited { color: #101816; }
html[data-theme="dark"] .m30 a:not(.m30-btn), html[data-theme="dark"] .m30 a:not(.m30-btn):visited { color: #d99a12; }
html[data-theme="light"] .m30l.login #backtoblog a, html[data-theme="light"] .m30l.login #backtoblog a:visited { color: #4a5652; }
html[data-theme="dark"] .m30l.login #backtoblog a, html[data-theme="dark"] .m30l.login #backtoblog a:visited { color: #b9c2bd; }
html[data-theme="dark"] .entry-content a:not(.m30-btn):not(.m30h-btn):not(.m30j-yt):visited { color: #fde463; }
html[data-theme="dark"] .m30hl { --hl-row: #141d1a; --hl-row-alt: #18221f; --hl-ink: #f0efe8; --hl-ok-bg: rgba(95, 224, 143, 0.12); --hl-ok: #5fe08f; }
html[data-theme="dark"] .m30hl-board { border-color: rgba(217, 154, 18, 0.45); }
html[data-theme="dark"] .m30hl-list li { border-bottom-color: rgba(246, 245, 239, 0.06); }
html[data-theme="dark"] .m30hl-n { background: rgba(217, 154, 18, 0.16); color: #fde463; }
html[data-theme="dark"] .m30hl-tick { background: #0b110f; }
html[data-theme="dark"] .m30hl-ok svg { color: #0b110f; }
html[data-theme="dark"] .m30hl-noname { color: #8a9590; }
