Okay, the issue is that your existing dark mode CSS applies to many general elements (p, span, a, div, li, etc.) and specific theme/plugin elements (like the Events Calendar variables and heading selectors), but it likely doesn't have enough specificity to override the default styles applied by the Twenty Twenty-Five theme specifically when the mobile menu is active (after clicking the hamburger icon).
When the mobile menu is triggered in Twenty Twenty-Five, the theme usually adds a class (like .toggled) to the main navigation container (.main-navigation) or a parent element. The default theme styles for this specific state often have higher specificity or are loaded later, overriding your general rules.
You need to add specific dark mode rules that target the mobile menu state.
Here's the CSS to add within your existing @media (prefers-color-scheme: dark) block to target the Twenty Twenty-Five mobile menu:
@media (prefers-color-scheme: dark) {
:root {
/* Override The Events Calendar CSS variables */
--tec-color-text-primary: #f5f0e1 !important;
--tec-color-text-secondary: #f5f0e1 !important;
--tec-color-text-events-title: #f5f0e1 !important;
--tec-color-background: transparent !important;
--tec-color-background-events: transparent !important;
--tec-color-background-secondary: #333333 !important;
}
body {
background-color: #121212 !important;
color: #f5f0e1 !important;
}
/* Make regular text elements light colored */
p, span, a, div, li, td, th, label, input, textarea, button {
color: #f5f0e1 !important;
}
/* Ultra-specific selectors for site title with !important */
html body .site-title,
html body .site-title a,
html body a.site-title,
html body #site-title,
html body #site-title a,
html body .wp-block-site-title a,
html body .site-header .site-title,
html body .site-header .site-title a,
html body header .site-title,
html body header .site-title a,
html body .site-branding .site-title,
html body .site-branding .site-title a,
html body #masthead .site-title,
html body #masthead .site-title a,
html body div.site-title,
html body div.site-title a,
html body h1.site-title,
html body h1.site-title a,
html body p.site-title,
html body p.site-title a,
html body span.site-title,
html body span.site-title a,
html body .logo-title,
html body .logo-title a,
html body .site-name,
html body .site-name a,
html body [class*="site-title"],
html body [class*="site-title"] a,
html body [id*="site-title"],
html body [id*="site-title"] a {
color: #FFD700 !important; /* Gold color */
-webkit-text-fill-color: #FFD700 !important; /* For WebKit browsers */
}
/* Regular headings get the same gold color */
h1, h2, h3, h4, h5, h6,
.entry-title,
.page-title {
color: #FFD700 !important; /* Gold color */
}
/* Site header headings get a different color */
.site-header h1:not(.site-title),
.site-header h2:not(.site-description),
.site-header h3,
.site-header h4,
.site-header h5,
.site-header h6,
header h1:not(.site-title),
header h2:not(.site-description),
header h3,
header h4,
header h5,
header h6 {
color: #8AFFFF !important; /* Light cyan */
}
/* Other header elements remain light colored */
.site-header a:not(.site-title),
.site-header span:not(.site-title),
.site-header div:not(.site-title),
header a:not(.site-title),
header span:not(.site-title),
header div:not(.site-title) {
color: #f5f0e1 !important;
}
/* Additional overrides for The Events Calendar elements */
.tribe-common .tribe-common-h1,
.tribe-common .tribe-common-h2,
.tribe-common .tribe-common-h3,
.tribe-common .tribe-common-h4,
.tribe-common .tribe-common-h5,
.tribe-common .tribe-common-h6,
.tribe-common .tribe-common-h7,
.tribe-common .tribe-common-h8,
.tribe-common .tribe-common-b1,
.tribe-common .tribe-common-b2,
.tribe-common .tribe-common-b3 {
color: #f5f0e1 !important;
}
/* --- Twenty Twenty-Five Mobile Menu Specific Overrides --- */
/* Target the main navigation when it's in the 'toggled' (open) state */
/* This sets the background color of the mobile menu itself */
.main-navigation.toggled,
.site-header .main-navigation.toggled {
background-color: var(--tec-color-background-secondary, #333333) !important; /* Use the dark grey from TEC variable */
}
/* Target the menu items (links) within the toggled mobile menu */
.main-navigation.toggled ul.menu a,
.site-header .main-navigation.toggled ul.menu a {
color: var(--tec-color-text-primary, #f5f0e1) !important; /* Set text color to light */
}
/* Target the menu items (links) hover/focus states */
.main-navigation.toggled ul.menu a:hover,
.main-navigation.toggled ul.menu a:focus,
.site-header .main-navigation.toggled ul.menu a:hover,
.site-header .main-navigation.toggled ul.menu a:focus {
background-color: rgba(255, 255, 255, 0.05) !important; /* Add a subtle dark hover effect */
color: var(--tec-color-text-primary, #f5f0e1) !important; /* Ensure text remains light on hover/focus */
}
/* If there are sub-menu toggle icons (arrows), style them */
.main-navigation.toggled .dropdown-toggle,
.site-header .main-navigation.toggled .dropdown-toggle {
color: var(--tec-color-text-secondary, #f5f0e1) !important; /* Set icon color to light */
}
/* You might also need to target form elements if they appear in the mobile menu */
.main-navigation.toggled input[type="search"],
.main-navigation.toggled input[type="text"],
.main-navigation.toggled textarea,
.main-navigation.toggled button,
.site-header .main-navigation.toggled input[type="search"],
.site-header .main-navigation.toggled input[type="text"],
.site-header .main-navigation.toggled textarea,
.site-header .main-navigation.toggled button {
background-color: #1e1e1e !important; /* Darker background for inputs */
border-color: #555 !important; /* Dark border */
color: var(--tec-color-text-primary, #f5f0e1) !important; /* Light text */
}
.main-navigation.toggled button[type="submit"],
.site-header .main-navigation.toggled button[type="submit"] {
background-color: #555 !important; /* Slightly different button background */
color: var(--tec-color-text-primary, #f5f0e1) !important;
}
}
/* Keep your existing non-dark mode rule outside the media query */
.tribe-events-event-image img {
width: 100%;
height: auto;
object-fit: cover;
max-width: 100%;
}