/*
 * Auftrion Modern UI — contrast + navigation guard
 * Release: 7.0.19
 *
 * Additive safety layer loaded AFTER modern-theme.css.
 * It does not replace Classic or the Modern base theme. Its job is to keep
 * foreground/background contrast predictable and keep the design switch out
 * of every navigation layout.
 */

/* --------------------------------------------------------------------------
   Floating controls guard (V7.0.19).
   The outermost right slot belongs exclusively to the back-to-top button.
   The theme dock is offset by button width + a hard safety gap, so neither
   browser zoom nor a wider translated theme label can cover the scroll button.
   -------------------------------------------------------------------------- */
.au-modern-theme-dock {
  position:fixed !important;
  inset-inline-end:max(76px, calc(env(safe-area-inset-right) + 76px)) !important;
  bottom:max(18px, env(safe-area-inset-bottom)) !important;
  z-index:1092 !important;
  pointer-events:none;
}
.au-modern-theme-dock .au-modern-theme-toggle {
  position:static !important;
  inset:auto !important;
  margin:0 !important;
  min-width:0;
  pointer-events:auto;
  box-shadow:0 10px 34px rgba(15,23,42,.16) !important;
}
body > .au-modern-theme-toggle {
  position:fixed !important;
  inset-inline-end:max(76px, calc(env(safe-area-inset-right) + 76px)) !important;
  bottom:max(18px, env(safe-area-inset-bottom)) !important;
  z-index:1092 !important;
}
.au-minimal-theme-toggle .au-modern-theme-toggle { position:static !important; inset:auto !important; margin:0 !important; }

/* Back-to-top owns the right edge and is never allowed underneath the dock. */
.au-scroll-top {
  right:max(18px, env(safe-area-inset-right)) !important;
  bottom:max(18px, env(safe-area-inset-bottom)) !important;
  z-index:1094 !important;
}
body:has(.au-form-status) .au-scroll-top {
  bottom:max(78px, calc(env(safe-area-inset-bottom) + 78px)) !important;
}

/* Cookie notice spans the viewport but only its visible card may capture taps.
   This keeps floating controls in the transparent right-hand area usable. */
#cookie-info { pointer-events:none; }
#cookie-info > .container { pointer-events:auto; }

@media (max-width:575.98px) {
  .au-modern-theme-dock,
  body > .au-modern-theme-toggle {
    inset-inline-end:max(66px, calc(env(safe-area-inset-right) + 66px)) !important;
    bottom:max(10px, env(safe-area-inset-bottom)) !important;
  }
  .au-scroll-top {
    right:max(10px, env(safe-area-inset-right)) !important;
    bottom:max(10px, env(safe-area-inset-bottom)) !important;
  }
  body:has(.au-form-status) .au-scroll-top {
    bottom:max(70px, calc(env(safe-area-inset-bottom) + 70px)) !important;
  }
}
@media print { .au-modern-theme-dock, body > .au-modern-theme-toggle, .au-scroll-top { display:none !important; } }

/* --------------------------------------------------------------------------
   Core readable text defaults for MODERN only.
   -------------------------------------------------------------------------- */
html[data-auftrion-theme="modern"] {
  --au-readable-dark: #1d1d1f;
  --au-readable-body: #3f3f43;
  --au-readable-muted: #626268;
  --au-readable-light: #f7f7f8;
  --au-readable-light-body: #dedee3;
  --au-readable-light-muted: #b8b8c0;
}

html[data-auftrion-theme="modern"] body,
html[data-auftrion-theme="modern"] #main-content,
html[data-auftrion-theme="modern"] .main-content,
html[data-auftrion-theme="modern"] .staff-content-inner {
  color: var(--au-readable-dark) !important;
}

/* Light surfaces: legacy white/light utility text must not disappear. */
html[data-auftrion-theme="modern"] :where(
  .card:not(.bg-dark):not(.bg-primary):not(.bg-secondary):not(.bg-success):not(.bg-danger),
  .card-body,
  .card-header,
  .card-footer,
  .modal-content,
  .offcanvas,
  .dropdown-menu,
  .list-group-item,
  .accordion-item,
  .toast,
  .login-card,
  .auth-card,
  .feature-card,
  .workflow-step,
  .proof-card,
  .pricing-card,
  .portal-entry-card,
  .sales-form-card,
  .demo-industry-picker,
  .interest-option,
  .industry-module-card,
  .industry-related-card,
  .industry-card
) :where(.text-white,.text-light,.text-white-50) {
  color: var(--au-readable-dark) !important;
}

html[data-auftrion-theme="modern"] :where(
  .card:not(.bg-dark):not(.bg-primary):not(.bg-secondary):not(.bg-success):not(.bg-danger),
  .modal-content,
  .offcanvas,
  .dropdown-menu,
  .list-group-item,
  .accordion-item,
  .login-card,
  .auth-card,
  .feature-card,
  .workflow-step,
  .proof-card,
  .pricing-card,
  .portal-entry-card,
  .sales-form-card,
  .demo-industry-picker,
  .interest-option,
  .industry-module-card,
  .industry-related-card,
  .industry-card
) :where(p,li,dd,dt,label,.small,.form-text,.text-muted,.text-body-secondary) {
  color: var(--au-readable-muted) !important;
}

html[data-auftrion-theme="modern"] :where(
  .card:not(.bg-dark):not(.bg-primary):not(.bg-secondary):not(.bg-success):not(.bg-danger),
  .modal-content,
  .offcanvas,
  .dropdown-menu,
  .list-group-item,
  .accordion-item,
  .login-card,
  .auth-card,
  .feature-card,
  .workflow-step,
  .proof-card,
  .pricing-card,
  .portal-entry-card,
  .sales-form-card,
  .demo-industry-picker,
  .interest-option,
  .industry-module-card,
  .industry-related-card,
  .industry-card
) :where(h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6,.card-title,.card-heading,strong,.fw-bold,.fw-semibold) {
  color: var(--au-readable-dark) !important;
}

/* Public nav is light in Modern: fix old white helper classes. */
html[data-auftrion-theme="modern"] .public-nav :where(.text-white,.text-light,.text-white-50,.text-muted) {
  color: var(--au-readable-muted) !important;
}

/* --------------------------------------------------------------------------
   Known dark editorial sections. Keep ALL normal copy readable.
   -------------------------------------------------------------------------- */
html[data-auftrion-theme="modern"] :where(
  .ops-preview,
  .ops-card,
  .autopilot-market-section,
  .autopilot-showcase,
  .modules-section,
  .module-group,
  .ai-copilot-market-section,
  .ai-copilot-market-card,
  .roi-section,
  .roi-card,
  .pulse-market-panel,
  .cta-section,
  .industry-cta
) :where(h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6,.section-title,.card-title,.card-heading,strong,.fw-bold,.fw-semibold,label) {
  color: var(--au-readable-light) !important;
}

html[data-auftrion-theme="modern"] :where(
  .ops-preview,
  .ops-card,
  .autopilot-market-section,
  .autopilot-showcase,
  .modules-section,
  .module-group,
  .ai-copilot-market-section,
  .ai-copilot-market-card,
  .roi-section,
  .roi-card,
  .pulse-market-panel,
  .cta-section,
  .industry-cta
) :where(p,li,dd,dt,.small,.form-text,.text-muted,.text-body-secondary,.section-copy) {
  color: var(--au-readable-light-body) !important;
}

html[data-auftrion-theme="modern"] :where(
  .ops-preview,
  .ops-card,
  .autopilot-market-section,
  .autopilot-showcase,
  .modules-section,
  .module-group,
  .ai-copilot-market-section,
  .ai-copilot-market-card,
  .roi-section,
  .roi-card,
  .pulse-market-panel,
  .cta-section,
  .industry-cta
) :where(.text-dark,.text-body,.text-secondary,.text-black,.text-black-50) {
  color: var(--au-readable-light-body) !important;
}

html[data-auftrion-theme="modern"] :where(
  .ops-preview,
  .ops-card,
  .autopilot-market-section,
  .autopilot-showcase,
  .modules-section,
  .module-group,
  .ai-copilot-market-section,
  .ai-copilot-market-card,
  .roi-section,
  .roi-card,
  .pulse-market-panel,
  .cta-section,
  .industry-cta
) a:not(.btn):not(.autopilot-tab) {
  color: #dbeafe !important;
}

/* Preserve intended coloured micro-copy inside dark sections. */
html[data-auftrion-theme="modern"] .ops-title { color:#f8fafc !important; }
html[data-auftrion-theme="modern"] .ops-meta { color:#b8c2cf !important; }
html[data-auftrion-theme="modern"] .is-green { color:#9cf2b8 !important; }
html[data-auftrion-theme="modern"] .is-blue { color:#b6d5ff !important; }
html[data-auftrion-theme="modern"] .is-amber { color:#ffe69a !important; }
html[data-auftrion-theme="modern"] .autopilot-pill { color:#9cf2b8 !important; }
html[data-auftrion-theme="modern"] .autopilot-benefits { color:#dedee3 !important; }
html[data-auftrion-theme="modern"] .autopilot-market-stat span,
html[data-auftrion-theme="modern"] .roi-disclaimer,
html[data-auftrion-theme="modern"] .pulse-market-alert small { color:#b8c2cf !important; }
html[data-auftrion-theme="modern"] .roi-number { color:#9cf2b8 !important; }
html[data-auftrion-theme="modern"] .ai-copilot-kicker { color:#ddd4ff !important; }

/* --------------------------------------------------------------------------
   Bootstrap semantic backgrounds. The base Modern card rule makes ordinary
   cards white; semantic cards/badges remain semantic and receive safe text.
   -------------------------------------------------------------------------- */
html[data-auftrion-theme="modern"] :where(.bg-dark,.text-bg-dark) {
  background:#1d1d1f !important; color:#fff !important;
}
html[data-auftrion-theme="modern"] :where(.bg-secondary,.text-bg-secondary) {
  background:#5f6368 !important; color:#fff !important;
}
html[data-auftrion-theme="modern"] :where(.bg-success,.text-bg-success) {
  background:#18723a !important; color:#fff !important;
}
html[data-auftrion-theme="modern"] :where(.bg-danger,.text-bg-danger) {
  background:#b4232f !important; color:#fff !important;
}
html[data-auftrion-theme="modern"] :where(.bg-primary,.text-bg-primary) {
  background:var(--au-modern-accent) !important; color:var(--au-modern-accent-text) !important;
}
html[data-auftrion-theme="modern"] :where(.bg-warning,.text-bg-warning) {
  background:#ffd85a !important; color:#242426 !important;
}
html[data-auftrion-theme="modern"] :where(.bg-info,.text-bg-info) {
  background:#bfe8f5 !important; color:#17323b !important;
}
html[data-auftrion-theme="modern"] :where(.bg-light,.bg-white,.text-bg-light) {
  background:#fff !important; color:var(--au-readable-dark) !important;
}

html[data-auftrion-theme="modern"] :where(.bg-dark,.text-bg-dark,.bg-secondary,.text-bg-secondary,.bg-success,.text-bg-success,.bg-danger,.text-bg-danger)
  :where(h1,h2,h3,h4,h5,h6,p,li,label,small,.small,.text-dark,.text-body,.text-muted,.text-secondary,.text-black,.text-black-50,.fw-bold,.fw-semibold,strong,a:not(.btn)) {
  color:#fff !important;
}
html[data-auftrion-theme="modern"] :where(.bg-primary,.text-bg-primary)
  :where(h1,h2,h3,h4,h5,h6,p,li,label,small,.small,.text-white,.text-dark,.text-body,.text-muted,.text-secondary,.fw-bold,.fw-semibold,strong,a:not(.btn)) {
  color:var(--au-modern-accent-text) !important;
}
html[data-auftrion-theme="modern"] :where(.bg-warning,.text-bg-warning,.bg-info,.text-bg-info,.bg-light,.bg-white,.text-bg-light)
  :where(h1,h2,h3,h4,h5,h6,p,li,label,small,.small,.text-white,.text-light,.text-white-50,.text-muted,.text-secondary,.fw-bold,.fw-semibold,strong,a:not(.btn)) {
  color:var(--au-readable-dark) !important;
}

/* Tables: preserve readable semantic/dark rows during hover. */
html[data-auftrion-theme="modern"] .table-dark,
html[data-auftrion-theme="modern"] .table-dark > :not(caption) > * > * {
  --bs-table-color:#fff;
  --bs-table-bg:#262629;
  --bs-table-striped-bg:#313135;
  --bs-table-hover-bg:#3a3a3f;
  color:#fff !important;
  background-color:var(--bs-table-bg) !important;
}
html[data-auftrion-theme="modern"] .table-dark > tbody > tr:hover > * { background:#3a3a3f !important; color:#fff !important; }

/* Form controls and menus: guarantee high-contrast content and placeholders. */
html[data-auftrion-theme="modern"] :where(.form-control,.form-select,.input-group-text,textarea,input) {
  color:var(--au-readable-dark) !important;
}
html[data-auftrion-theme="modern"] :where(.form-control,textarea,input)::placeholder {
  color:#73737a !important; opacity:1 !important;
}
html[data-auftrion-theme="modern"] .dropdown-menu :where(.dropdown-header,.small,.text-muted) { color:#66666c !important; }
html[data-auftrion-theme="modern"] .dropdown-item { color:#252527 !important; }
html[data-auftrion-theme="modern"] .dropdown-item.active,
html[data-auftrion-theme="modern"] .dropdown-item:active { color:#111 !important; }

/* Alerts get explicit readable foregrounds instead of inheriting legacy text. */
html[data-auftrion-theme="modern"] .alert-primary { background:#eef4ff !important; color:#193a73 !important; border-color:#cadcff !important; }
html[data-auftrion-theme="modern"] .alert-success { background:#edf8f0 !important; color:#195b2e !important; border-color:#c9e8d1 !important; }
html[data-auftrion-theme="modern"] .alert-warning { background:#fff8df !important; color:#654d00 !important; border-color:#f1dfa0 !important; }
html[data-auftrion-theme="modern"] .alert-danger { background:#fff0f1 !important; color:#842029 !important; border-color:#f3c2c7 !important; }
html[data-auftrion-theme="modern"] .alert-info { background:#edf8fb !important; color:#19566a !important; border-color:#c4e4ed !important; }

/* Footer credit stays readable in both modes. */
html[data-auftrion-theme="modern"] footer.site-footer .fairwebdesign-credit-label { color:#66666c !important; }
