/**
 * Public website contrast guardrails.
 * Keep secondary copy and icons readable across light/dark tenant themes.
 * Synced with frontend/src/styles/contrast-fixes.css token targets.
 *
 * Load order: after theme-core.css (bundled route theme).
 */

:root {
    --mtec-text-muted: #3f5060;
    --mtec-text-subtle: #475569;
    --mtec-on-dark: #ffffff;
    --mtec-on-dark-muted: rgba(255, 255, 255, 0.92);
    --mtec-on-dark-subtle: rgba(255, 255, 255, 0.82);
    --mtec-on-dark-body: rgba(255, 255, 255, 0.9);
    --mtec-placeholder: #5a6577;
    --mtec-icon-muted: #526173;
}

html:not(.dark):not([data-theme="dark"]) .mtec-site {
    --mtec-text-secondary: #243b5a;
    --mtec-text-muted: #3f5060;
}

.dark,
[data-theme="dark"] {
    --mtec-text-muted: var(--mtec-on-dark-muted);
    --mtec-text-subtle: var(--mtec-on-dark-subtle);
    --mtec-placeholder: #8b9aab;
    --mtec-icon-muted: var(--mtec-on-dark-subtle);
}

.mtec-site {
    color: #334155;
}

html:not(.dark):not([data-theme="dark"]) .mtec-site {
    color: #334155;
}

/* ── Light mode: muted copy & icons on pale / white surfaces ── */
.mtec-site :is(
    .mtec-text-muted,
    .text-\[\#64748b\],
    .text-\[\#94a3b8\],
    .text-slate-400,
    .text-slate-500,
    .text-gray-400,
    .text-gray-500
) {
    color: var(--mtec-text-muted) !important;
}

.mtec-site :is(.text-slate-600, .text-gray-600) {
    color: var(--mtec-text-subtle) !important;
}

.mtec-site :is(.mtec-form-label, .careers-form-field .hint) {
    color: var(--mtec-text-subtle) !important;
}

.mtec-site :is(
    [class^="ri-"],
    [class*=" ri-"]
):is(
    .text-\[\#94a3b8\],
    .text-slate-400,
    .text-slate-500,
    .text-gray-400,
    .text-gray-500
) {
    color: var(--mtec-primary, #00298e) !important;
}

.mtec-site .mtec-footer__contact-link i,
.mtec-site .mtec-footer__pill i {
    color: var(--mtec-icon-muted) !important;
}

.mtec-site .mtec-footer__contact-link:hover i,
.mtec-site .mtec-footer__pill:hover i {
    color: var(--mtec-primary, #00298e) !important;
}

.mtec-site .mtec-footer__credit-label {
    color: var(--mtec-text-subtle) !important;
}

.mtec-site input::placeholder,
.mtec-site textarea::placeholder {
    color: var(--mtec-placeholder) !important;
    opacity: 1 !important;
}

.mtec-site :is([style*="opacity: 0.5"], [style*="opacity:.5"], [style*="opacity:0.5"]) {
    opacity: 0.82 !important;
}

/* Muted copy on soft tinted page backgrounds (hero, cards) */
html:not(.dark):not([data-theme="dark"]) .mtec-site :is(
    .mtec-hero-bg,
    .mtec-page-main,
    [class*="hero"],
    [class*="__card"]:not([class*="form-card__aside"]):not(.mtec-contact-hero__card)
) :is(.text-slate-400, .text-slate-500, .text-gray-400, .text-gray-500, .mtec-text-muted) {
    color: var(--mtec-text-muted) !important;
}

/* ── Inverted / dark gradient panels ──
   Global `.mtec-site h1–h6 { color: var(--mtec-deep) }` must not apply here. */
.mtec-site :is(
    .mtec-surface-dark,
    [data-mtec-surface="dark"],
    .careers-form-card__aside,
    .mtec-contact-cta,
    .reviews-hero,
    .form-card-header
) :is(h1, h2, h3, h4, h5, h6) {
    color: var(--mtec-on-dark) !important;
}

.mtec-site :is(
    .mtec-surface-dark,
    [data-mtec-surface="dark"],
    .careers-form-card__aside,
    .mtec-contact-cta,
    .reviews-hero,
    .form-card-header
) :is(p, span, small, label, li, strong, em):not([class*="btn"]) {
    color: var(--mtec-on-dark-muted);
}

.mtec-site :is(
    .mtec-surface-dark,
    [data-mtec-surface="dark"],
    .careers-form-card__aside
) :is(
    .careers-form-card__text,
    .careers-form-card__badge,
    .careers-form-card__checks span
) {
    color: var(--mtec-on-dark-subtle) !important;
}

.mtec-site :is(
    .mtec-surface-dark,
    [data-mtec-surface="dark"],
    .careers-form-card__aside,
    .mtec-contact-cta,
    .reviews-hero,
    .form-card-header
) :is(i, [class^="ri-"], [class*=" ri-"]) {
    color: inherit;
}

.mtec-site .careers-form-card__aside .careers-form-card__title {
    color: var(--mtec-on-dark) !important;
}

.mtec-site .careers-form-card__aside .careers-form-card__checks span {
    color: #fff !important;
}

.mtec-site .careers-form-card__aside .careers-form-card__checks i {
    color: #fff !important;
}

/* Dark mode: muted utilities on dark surfaces */
.mtec-surface-dark :is(.mtec-text-muted, .text-\[\#64748b\], .text-\[\#94a3b8\], .text-slate-400, .text-slate-500),
.dark .mtec-site :is(.mtec-text-muted, .text-\[\#64748b\], .text-\[\#94a3b8\], .text-slate-400, .text-slate-500),
[data-theme="dark"] .mtec-site :is(.mtec-text-muted, .text-\[\#64748b\], .text-\[\#94a3b8\], .text-slate-400, .text-slate-500) {
    color: var(--mtec-on-dark-muted) !important;
}

.dark .mtec-site :is(.text-slate-600, .text-gray-600),
[data-theme="dark"] .mtec-site :is(.text-slate-600, .text-gray-600) {
    color: var(--mtec-on-dark-subtle) !important;
}

.mtec-surface-dark,
.dark .mtec-site,
[data-theme="dark"] .mtec-site {
    color: var(--mtec-on-dark-body);
}

/* Opacity utility floor on marketing copy */
.mtec-site [class*="opacity-"] :is(p, span, small, li),
.mtec-site p[class*="text-white/"],
.mtec-site span[class*="text-white/"] {
    opacity: max(0.78, var(--tw-opacity, 1)) !important;
}

@media (forced-colors: active) {
    .mtec-site {
        color: CanvasText;
    }

    .mtec-site :is(.mtec-text-muted, .text-slate-400, .text-slate-500) {
        color: CanvasText !important;
        opacity: 0.85;
    }
}
