/* Urgent fixes for visibility and spacing issues */

/* Fix mobile menu hamburger visibility */
@media (max-width: 767px) {
  .mobile-menu-toggle {
    display: flex !important;
  }
  
  .navbar-menu.active {
    transform: translateX(0) !important;
  }
}

/* Fix excessive line height */
p {
  line-height: 1.6 !important; /* Normal readable line height instead of 220-250% */
}

.mil-mb-23 {
  line-height: 1.6 !important;
}

/* Fix navigation visibility on dark backgrounds */
.mil-top-panel[style*="background: #4f4965"] .mil-navigation a,
.mil-top-panel[style*="background: #432d70"] .mil-navigation a,
.mil-top-panel[style*="background: #5d3e95"] .mil-navigation a {
  color: white !important;
}

/* Fix header.html navigation on dark backgrounds */
#header a {
  color: inherit;
}

.mil-top-panel[style*="background: #4"] #header a,
.mil-top-panel[style*="background: #5"] #header a,
.mil-top-panel[style*="background: #6"] #header a {
  color: white !important;
}

/* Fix logo on dark backgrounds */
.mil-top-panel[style*="background: #4"] .mil-logo,
.mil-top-panel[style*="background: #5"] .mil-logo,
.mil-top-panel[style*="background: #6"] .mil-logo {
  filter: brightness(0) invert(1);
}

/* Fix dark titles on dark backgrounds */
section[style*="background: #"] h1,
section[style*="background: #"] h2,
section[style*="background: #"] h3,
section[style*="background: #"] h4 {
  color: white !important;
}

/* Specific fix for "About Us" page title */
.mil-page-title h1,
.mil-banner-title h1,
.banner-title {
  color: white !important;
}

/* Fix dark background sections text color */
section[style*="background: #432d70"] p,
section[style*="background: #4f4965"] p,
section[style*="background: #5d3e95"] p,
.about-doloop[style*="background: #"] p {
  color: white !important;
}

/* Fix navigation menu colors for improved navbar */
.main-header .navbar {
  background-color: white;
}

/* Ensure navigation text is always visible */
.main-header .nav-link {
  color: #333 !important;
}

.main-header .navbar-nav a {
  color: #333 !important;
}

/* On dark backgrounds, override with white */
.main-header.dark-bg .navbar {
  background-color: transparent;
}

.main-header.dark-bg .nav-link,
.main-header.dark-bg .navbar-nav a {
  color: white !important;
}

.main-header.dark-bg .logo img {
  filter: brightness(0) invert(1);
}

/* Fix navigation on pages with inline dark backgrounds */
body:has(.mil-top-panel[style*="background: #4"]) .main-header .nav-link,
body:has(.mil-top-panel[style*="background: #5"]) .main-header .nav-link,
body:has(.mil-top-panel[style*="background: #6"]) .main-header .nav-link,
body:has(section[style*="background: #4"]:first-of-type) .main-header .nav-link,
body:has(section[style*="background: #5"]:first-of-type) .main-header .nav-link,
body:has(section[style*="background: #6"]:first-of-type) .main-header .nav-link {
  color: white !important;
}

/* Mobile menu button on dark backgrounds */
.mil-menu-btn span {
  background-color: currentColor;
}

.mil-top-panel[style*="background: #4"] .mil-menu-btn span,
.mil-top-panel[style*="background: #5"] .mil-menu-btn span,
.mil-top-panel[style*="background: #6"] .mil-menu-btn span {
  background-color: white !important;
}

/* Fix mobile menu toggle on dark backgrounds */
.main-header.dark-bg .mobile-menu-toggle .hamburger-line {
  background-color: white !important;
}

/* Additional fixes for about-us page */
.mil-dark-bg .mil-page-title h1,
.mil-dark-bg .mil-h1,
.mil-dark-bg h1 {
  color: white !important;
}

/* Fix black section text */
section.mil-dark-bg *,
section[style*="background: #000"] *,
.page-header *,
.page-header .page-title,
.page-header .breadcrumb,
.page-header .breadcrumb a {
  color: white !important;
}

/* Preserve link colors where needed */
a.mil-link,
a.mil-button {
  color: inherit !important;
}

/* Additional navigation fixes for timemachine.html and similar pages */
.navbar {
  background-color: white;
}

.navbar .nav-link,
.navbar a {
  color: #333 !important;
}

/* Fix mobile menu visibility */
.mobile-menu-toggle .hamburger-line {
  background-color: #333 !important;
}

/* On purple/dark backgrounds, ensure white text */
body[style*="background: #"] .navbar,
section[style*="background: #"] + .navbar,
.mil-wrapper:has(.mil-top-panel[style*="background: #"]) .navbar {
  background-color: transparent !important;
}

body[style*="background: #"] .navbar .nav-link,
body[style*="background: #"] .navbar a,
section[style*="background: #"] + .navbar .nav-link,
section[style*="background: #"] + .navbar a {
  color: white !important;
}

body[style*="background: #"] .mobile-menu-toggle .hamburger-line,
section[style*="background: #"] + .navbar .mobile-menu-toggle .hamburger-line {
  background-color: white !important;
}

/* Special fix for pages with gradient backgrounds like timemachine.html */
body {
  position: relative;
}

/* Ensure navbar has proper background on pages without explicit dark styling */
.main-header:not(.dark-bg) .navbar {
  background-color: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Fix for pages with custom purple/gradient backgrounds */
body:has(.hero):not(:has(.page-header)) .main-header .navbar,
body[class*="gradient"] .main-header .navbar,
body[style*="background: linear"] .main-header .navbar {
  background-color: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(20px);
}

body:has(.hero):not(:has(.page-header)) .main-header .nav-link,
body:has(.hero):not(:has(.page-header)) .main-header .navbar-nav a,
body[class*="gradient"] .main-header .nav-link,
body[class*="gradient"] .main-header .navbar-nav a,
body[style*="background: linear"] .main-header .nav-link,
body[style*="background: linear"] .main-header .navbar-nav a {
  color: #e2e8f0 !important;
}

body:has(.hero):not(:has(.page-header)) .main-header .logo img,
body[class*="gradient"] .main-header .logo img,
body[style*="background: linear"] .main-header .logo img {
  filter: brightness(0) invert(1) !important;
}

body:has(.hero):not(:has(.page-header)) .mobile-menu-toggle .hamburger-line,
body[class*="gradient"] .mobile-menu-toggle .hamburger-line,
body[style*="background: linear"] .mobile-menu-toggle .hamburger-line {
  background-color: #e2e8f0 !important;
}

/* Fix gray text on dark backgrounds - comprehensive fix */
.section-dark .section-subtitle,
.section-dark .section-lead,
.section-dark .section-content,
.section-dark .service-description,
.section-dark .cta-subtitle,
.section-dark .blog-card-excerpt,
.section-dark p,
.section-dark li {
  color: rgba(255, 255, 255, 0.95) !important;
}

/* Ensure stat labels and numbers are visible on dark backgrounds */
.section-dark .stat-label,
.section-dark .stat-number,
.section-dark .stat-item {
  color: white !important;
}

/* Fix any text using light/muted color variables on dark sections */
.section-dark [class*="text-light"],
.section-dark [class*="text-muted"],
.section-dark .text-gray {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Fix gray text on sections with inline black backgrounds */
section[style*="background: #000"] .section-subtitle,
section[style*="background: black"] .section-subtitle,
section[style*="background-color: #000"] .section-subtitle,
section[style*="background-color: black"] .section-subtitle,
section[style*="background: #000"] .section-content,
section[style*="background: black"] .section-content,
section[style*="background: #000"] .service-description,
section[style*="background: black"] .service-description {
  color: rgba(255, 255, 255, 0.95) !important;
}