/* Shared, cache-independent browser preference. Light retains the published palette. */
:root { --mec-surface: #fff; --mec-canvas: #f7f8fa; --mec-ink: #19222e; --mec-muted: #596574; --mec-line: #c8d0da; --mec-link: #b9151c; --mec-tint: #fff0f2; color-scheme: light; }
:root[data-mec-theme="dark"] { --mec-surface: #1b2431; --mec-canvas: #111822; --mec-ink: #edf1f7; --mec-muted: #b7c2d1; --mec-line: #465367; --mec-link: #ff9ca4; --mec-tint: #38232d; color-scheme: dark; background-color: var(--mec-canvas); }
.mec-account-controls { position: relative; z-index: 2; display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--mec-ink); font: 13px/1.5 Arial, Helvetica, sans-serif; }
.mec-account-controls :is(a, button) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin: 0; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--mec-ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.mec-account-controls .mec-theme-toggle { min-width: 44px; padding: 9px; }
.mec-account-controls .mec-theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.mec-account-controls [hidden] { display: none; }
.mec-account-controls :is(a, button):hover { background: var(--mec-tint); color: var(--mec-link); }
.mec-account-controls .mec-account-primary { border-color: #d71920; background: #d71920; color: #fff; }
.mec-account-controls .mec-account-primary:hover { border-color: #b9151c; background: #b9151c; color: #fff; }
body.mec-site-ui .mec-account-controls .mec-account-link { color: var(--mec-ink) !important; }
body.mec-site-ui .mec-account-controls .mec-account-link:hover { color: var(--mec-link) !important; }
body.mec-site-ui .mec-account-controls .mec-account-primary,
body.mec-site-ui .mec-account-controls .mec-account-primary:hover { color: #fff !important; }
.mec-account-controls :is(a, button):focus-visible { outline: 3px solid #579de9; outline-offset: 2px; }
.mec-theme-sun, [data-mec-theme="dark"] .mec-theme-moon { display: none; }
[data-mec-theme="dark"] .mec-theme-sun { display: block; }
body.mec-site-ui #header :is(.header_top_phone *, .header_top_socials a) { color: var(--mec-ink) !important; }
@media (min-width: 960px) {
  body.mec-site-ui #header .header_4 .header_top { display: grid; grid-template-columns: minmax(0, 1fr) 88px minmax(0, 1fr); gap: 24px; }
  body.mec-site-ui #header .header_4 .header_top > .logo-unit { width: 88px !important; }
  body.mec-site-ui #header .header_4 .header_bottom { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: 8px; border-top: 1px solid var(--mec-line); }
  body.mec-site-ui #header .header_4 .header_main_menu_wrapper { min-width: 0; border-top: 0; }
  body.mec-site-ui #header #mega-menu-wrap-primary #mega-menu-primary { justify-content: flex-start; }
  body.mec-site-ui #header #mega-menu-primary > li.mega-menu-item > a.mega-menu-link { padding: 0 8px !important; font-size: 13px !important; }
  body.mec-site-ui #header .mec-account-controls { padding-left: 8px; border-left: 1px solid var(--mec-line); }
}
@media (max-width: 959px) {
  body.mec-site-ui #header .header_4 .header_bottom.active { display: flex; flex-direction: column; }
  body.mec-site-ui #header .mec-account-controls { order: -1; justify-content: flex-start; padding: 12px 0; border-bottom: 1px solid var(--mec-line); }
  .mec-account-controls :is(a, button) { padding: 9px 10px; }
}

/* Override saved light colors without filtering photos, logos, videos or payment frames. */
[data-mec-theme="dark"] body.mec-site-ui {
  --mec-ui-text: var(--mec-ink); --mec-ui-muted: var(--mec-muted); --mec-ui-border: var(--mec-line); --mec-ui-focus: #83b8ff;
  background-color: var(--mec-canvas); color: var(--mec-ink);
}
[data-mec-theme="dark"] body.mec-site-ui :is(#wrapper, #main, #header, .header_default, .header_top, .header_main_menu_wrapper, .header-menu, .stm_breadcrumbs_unit, .mobile-menu) { background-color: var(--mec-canvas) !important; color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #header :is(.header_top_phone, .header_top_phone *, .header_top_socials a, .header_top_socials i) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #header .stm_menu_toggler::before,
[data-mec-theme="dark"] body.mec-site-ui #header .stm_menu_toggler::after { background: transparent; color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #header .stm_menu_toggler { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-wrap-primary,
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-primary,
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-primary .mega-sub-menu { background: var(--mec-surface) !important; border-color: var(--mec-line) !important; }
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-primary a.mega-menu-link,
[data-mec-theme="dark"] body.mec-site-ui .mec-mobile-navigation :is(a, summary) { background: transparent !important; color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-primary a.mega-menu-link:is(:hover, :focus-visible),
[data-mec-theme="dark"] body.mec-site-ui #header #mega-menu-primary > li.mega-current-menu-item > a.mega-menu-link,
[data-mec-theme="dark"] body.mec-site-ui .mec-mobile-navigation :is(a, summary):hover { background: var(--mec-tint) !important; color: var(--mec-link) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(h1, h2, h3, h4, h5, h6, p, li, label, blockquote, dt, dd) { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(h1, h2, h3, h4, h5, h6) a { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpb_text_column, .icon_box) :is(span, strong, b) { color: inherit !important; }
[data-mec-theme="dark"] body.mec-site-ui #main .icon_box :is(h1, h2, h3, h4, h5, h6) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(div, section, article, td)[style*="background"],
[data-mec-theme="dark"] body.mec-site-ui #main :is(.icon_box, .icon_box .icon_text) { background-color: var(--mec-surface) !important; color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.entry-header, .vc_row, .vc_column-inner, .vc_tta-panel-heading, .vc_tta-tab a, .panel-heading, .vc_toggle, .wpb_tabs_nav a, .mec-news, .mec-news-image) { background-color: var(--mec-canvas) !important; border-color: var(--mec-line) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpb_tabs_nav a, .vc_tta-tab a, .vc_tta-title-text) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpb_tabs_nav .ui-tabs-active a, .vc_tta-tab.vc_active a, .vc_tta-panel.vc_active .vc_tta-panel-heading) { background-color: var(--mec-tint) !important; color: var(--mec-link) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.entry-header .sub_title, .stm_breadcrumbs_unit *, .woocommerce-breadcrumb, .woocommerce-breadcrumb a, .post_list_cats, .post_list_cats *, .post_list_item_tags *, .post_meta *, .post_list_meta_unit *, .widget_stm_recent_posts .cats_w *, .mec-news-meta, .mec-news-excerpt, .mec-news-date) { color: var(--mec-muted) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpb_text_column, .entry-content, .post-content) a:not([class*="btn"]):not([class*="button"]),
[data-mec-theme="dark"] body.mec-site-ui #main .wpcf7 a,
[data-mec-theme="dark"] body.mec-site-ui #main :is(.woocommerce-LostPassword a, .sidebar-area .widget a, .mec-news a, .mec-mobile-menu-overview) { color: var(--mec-link) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-news-card, .mec-news-sidebar, .mec-program-card-2026, .mec-card-2026, .mec-tabs-2026 label, .mec-news .page-numbers, .tagcloud a, .mec-news-tags a, .wpcf7, .woocommerce form.login, .woocommerce form.register) { background-color: var(--mec-surface) !important; color: var(--mec-ink) !important; border-color: var(--mec-line) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(input:not([type=submit]):not([type=button]):not([type=checkbox]):not([type=radio]), select, textarea, .select2-selection, .woocommerce .input-text) { background-color: var(--mec-surface) !important; color: var(--mec-ink) !important; border-color: var(--mec-line) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(input, textarea)::placeholder { color: var(--mec-muted) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main .select2-selection__rendered { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main .woocommerce :is(th, td) { background-color: var(--mec-surface); color: var(--mec-ink); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpcf7 label, .wpcf7-acceptance, .woocommerce form .form-row label) { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.wpcf7-not-valid-tip, .woocommerce-error, .masterstudy-authorization__form-field-error) { color: #ffadb3; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.woocommerce-info, .woocommerce-message, .woocommerce-error) { background: var(--mec-surface); color: var(--mec-ink); }

/* Programme, tourism, career and Agro components use explicit, legible dark surfaces. */
[data-mec-theme="dark"] body.mec-site-ui #mec-programme { --programme-text: var(--mec-ink); --programme-muted: var(--mec-muted); --programme-border: var(--mec-line); background: var(--mec-canvas); }
[data-mec-theme="dark"] body.mec-site-ui .mec-agro { --agro-ink: var(--mec-ink); --agro-muted: var(--mec-muted); --agro-line: var(--mec-line); --agro-green: #91d5ab; background: var(--mec-canvas); }
[data-mec-theme="dark"] body.mec-site-ui :is(#mec-tourism, #mec-career) { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #mec-career .mec-career-services li strong { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-programme-hero, .mec-tourism-hero, .mec-career-hero, .mec-career-contact, .mec-agro-hero) { background: var(--mec-canvas); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-programme-section, .mec-programme-nav, .mec-programme-toc, .mec-programme-button-secondary, .mec-tourism-list > li, .mec-career-services > ul > li, .mec-agro-card, .mec-agro-interest) { background: var(--mec-surface); color: var(--mec-ink); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-programme-help, .mec-programme-form-note, .mec-programme-copy h6, .mec-programme-nav a:hover, .mec-programme-nav a[aria-current], .mec-agro-related, .mec-agro-related a) { background: var(--mec-tint); color: var(--mec-ink); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-tourism-kicker, .mec-tourism-text-link, .mec-career-kicker, .mec-career-text-link, .mec-career-contact a) { color: var(--mec-link); }
[data-mec-theme="dark"] body.mec-site-ui .mec-agro-actions a { background: #246344; color: #fff; border-color: #91d5ab; }
[data-mec-theme="dark"] body.mec-site-ui .mec-agro-actions a + a { background: var(--mec-surface); color: #91d5ab; }

/* Editor-owned home and catalogue blocks define their own color variables. */
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026,
[data-mec-theme="dark"] body.mec-site-ui #mec-booking { --mec-dark: #edf1f7; --mec-muted: #b7c2d1; --mec-soft: #1b2431; --mec-border: #465367; color: var(--mec-ink); background-color: var(--mec-canvas); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 .mec-highlight-card:not(.mec-highlight-red) { background: var(--mec-surface); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-voucher, .mec-feature, .mec-stat) { background: var(--mec-surface); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-btn-ghost, .mec-voucher-btn-light) { background: var(--mec-surface); color: var(--mec-ink); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-voucher-badge, .mec-kicker) { color: var(--mec-link); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 .mec-voucher-badge { background: var(--mec-tint); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-voucher p, .mec-contact-list, .mec-contact-list b) { color: var(--mec-muted); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 .mec-contact-list a { color: var(--mec-link) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-programs-2026, .mec-programs-interactive, .mec-programs-section-2026) { background: var(--mec-canvas) !important; color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #main :is(.mec-program-meta-2026, .mec-news time, .mec-news-categories) { color: var(--mec-muted); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026 label:hover { background: var(--mec-tint) !important; color: var(--mec-link) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-all:checked) label[for="mec-filter-all"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-beauty:checked) label[for="mec-filter-beauty"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-food:checked) label[for="mec-filter-food"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-business:checked) label[for="mec-filter-business"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-agro:checked) label[for="mec-filter-agro"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-subsidized:checked) label[for="mec-filter-subsidized"],
[data-mec-theme="dark"] body.mec-site-ui #main .mec-tabs-2026:has(#mec-filter-mandatory:checked) label[for="mec-filter-mandatory"] { background: var(--mec-tint) !important; color: var(--mec-link) !important; border-color: var(--mec-link) !important; }

/* Booking controls and shared footer also follow the chosen appearance. */
[data-mec-theme="dark"] body.mec-site-ui #mec-booking :is(.mec-booking-card, .mec-contact-card, .mec-date-slot, .mec-time-slot, .mec-progress-circle, .mec-btn-ghost) { background: var(--mec-surface); color: var(--mec-ink); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #mec-booking :is(.mec-contact-card.selected, .mec-date-slot.selected, .mec-time-slot.selected, .mec-check-item.selected, .mec-error) { background: var(--mec-tint); color: var(--mec-link); border-color: var(--mec-link); }
[data-mec-theme="dark"] body.mec-site-ui #mec-booking :is(.mec-field-label, .mec-check-item, .mec-consent label) { color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui #footer,
[data-mec-theme="dark"] body.mec-site-ui #footer :is(.footer_wrapper, #footer_bottom, .footer_widgets_wrapper, #footer_copyright) { background: var(--mec-surface) !important; border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #footer :is(h1, h2, h3, h4, h5, h6, p, span, strong, b, li) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #footer :is(.textwidget, .copyright_text) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #footer a:not(.btn) { color: var(--mec-link) !important; }

/* LMS authorization is the existing login/register flow, including password recovery. */
[data-mec-theme="dark"] body.mec-site-ui :is(.masterstudy__login-page, .masterstudy-authorization, .masterstudy-authorization__wrapper, .masterstudy-authorization__form, .masterstudy-authorization__restore) { background-color: var(--mec-canvas) !important; color: var(--mec-ink); }
[data-mec-theme="dark"] body.mec-site-ui .masterstudy-authorization :is([class*="title"], [class*="text"], label) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui .masterstudy-authorization :is(a, .masterstudy-authorization__switch-lost-pass) { color: var(--mec-link); }
@media print {
  .mec-account-controls { display: none; }
}
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 .mec-home-card { background: var(--mec-surface); border-color: var(--mec-line); }
[data-mec-theme="dark"] body.mec-site-ui #main .wpb_text_column .mec-home-2026 a:is(.mec-home-card, .mec-home-card-link) { color: var(--mec-ink) !important; }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-home-photo, .mec-home-photo-fallback) { background: var(--mec-canvas); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-home-card time, .mec-home-head .mec-lead) { color: var(--mec-muted); }
[data-mec-theme="dark"] body.mec-site-ui #main .mec-home-2026 :is(.mec-home-more, .mec-home-head .mec-kicker) { color: var(--mec-link); }
