/********** Theme (Light / Dark) ************/
/* Light is the existing site look; everything below only applies when
   <html data-theme="dark"> is set by js/theme.js. */

:root {
  --theme-bg: #fff;
  --theme-surface: #F4F5F8;
  --theme-text: #686A6F;
  --theme-heading: #222429;
  --theme-border: #dee2e6;
}

html[data-theme="dark"] {
  --theme-bg: #121318;
  --theme-surface: #1b1d24;
  --theme-surface-2: #23262f;
  --theme-text: #c3c6cd;
  --theme-muted: #8d929c;
  --theme-heading: #f1f2f5;
  --theme-border: #2f333d;
  --theme-accent: #F47820;
  --theme-purple: #a99cff;
  color-scheme: dark;
}

/* ---- Toggle button ---- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--theme-border);
  border-radius: 50%;
  background: transparent;
  color: var(--theme-heading);
  font-size: 17px;
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
}

.theme-toggle:hover,
.theme-toggle:focus {
  color: #F47820;
  border-color: #F47820;
  outline: none;
}

.theme-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(244, 120, 32, .35);
}

.theme-toggle .fa-sun,
.theme-toggle .theme-label-light { display: none; }
html[data-theme="dark"] .theme-toggle .fa-sun,
html[data-theme="dark"] .theme-toggle .theme-label-light { display: inline-block; }
html[data-theme="dark"] .theme-toggle .fa-moon,
html[data-theme="dark"] .theme-toggle .theme-label-dark { display: none; }

/* Fixed tab on the right edge of the screen */
.theme-ticker {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 1040;
  flex-direction: column;
  gap: 8px;
  width: 42px;
  height: auto;
  padding: 14px 0;
  border: 0;
  border-radius: 8px 0 0 8px;
  background: #3b2f90;
  color: #fff;
  box-shadow: -2px 2px 12px rgba(0, 0, 0, .25);
  transform: translateY(-50%);
}

.theme-ticker:hover,
.theme-ticker:focus {
  width: 48px;
  background: #F47820;
  color: #fff;
}

.theme-ticker-label {
  writing-mode: vertical-rl;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

html[data-theme="dark"] .theme-ticker {
  background: #F47820;
  color: #fff;
}

html[data-theme="dark"] .theme-ticker:hover,
html[data-theme="dark"] .theme-ticker:focus {
  background: #3b2f90;
}

@media (max-width: 767.98px) {
  .theme-ticker {
    width: 36px;
    padding: 10px 0;
    font-size: 15px;
  }
  .theme-ticker-label { display: none !important; }
}

/* ---- Base ---- */
html[data-theme="dark"] body {
  background-color: var(--theme-bg);
  color: var(--theme-text);
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6 {
  color: var(--theme-heading);
}

/* Site-wide h5 is brand purple (#3b2f90), too dark on a dark background */
html[data-theme="dark"] h5:not([class*="text-"]) {
  color: var(--theme-purple) !important;
}

html[data-theme="dark"] a:not(.btn):not([class*="fx-"]) {
  color: var(--theme-heading);
}

html[data-theme="dark"] .btn-light {
  color: #222429;
}

html[data-theme="dark"] .content-box {
  background: var(--theme-surface);
  color: var(--theme-text);
}

html[data-theme="dark"] hr {
  border-color: var(--theme-border);
}

html[data-theme="dark"] .text-dark,
html[data-theme="dark"] .bold-text,
html[data-theme="dark"] [style*="color:#000"] {
  color: var(--theme-heading) !important;
}

html[data-theme="dark"] .text-muted {
  color: var(--theme-muted) !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-light {
  background-color: var(--theme-surface) !important;
  border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-right,
html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-left {
  border-color: var(--theme-border) !important;
}

/* Section backgrounds are white line-art images; tint them dark */
html[data-theme="dark"] .bg-amgs {
  background-image: linear-gradient(rgba(18, 19, 24, .93), rgba(18, 19, 24, .93)), url(../img/sectionbg.png);
}

html[data-theme="dark"] .bg-secondary {
  background-image: linear-gradient(rgba(27, 29, 36, .93), rgba(27, 29, 36, .93)), url(../img/tech_bg.png);
  border-color: var(--theme-border);
}

html[data-theme="dark"] .bg-activeminds {
  border-bottom-color: var(--theme-border);
}

html[data-theme="dark"] .bg-footer {
  background: #0b0c10;
  border-color: var(--theme-border);
}

/* ---- Navbar ---- */
/* Swap to the inverse logo (white "Minds" and tagline) */
.logo-dark { display: none; }
html[data-theme="dark"] .logo-light { display: none; }
html[data-theme="dark"] .logo-dark { display: inline-block; }

html[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
  color: var(--theme-text);
}

html[data-theme="dark"] .navbar-light .navbar-nav .nav-link:hover,
html[data-theme="dark"] .navbar-light .navbar-nav .nav-link.active {
  color: var(--theme-accent);
}

html[data-theme="dark"] .navbar-light .navbar-toggler {
  border-color: var(--theme-border);
}

html[data-theme="dark"] .navbar-light .navbar-toggler-icon {
  filter: invert(1);
}

html[data-theme="dark"] .dropdown-menu {
  background-color: var(--theme-surface);
  border-color: var(--theme-border);
}

html[data-theme="dark"] .dropdown-item {
  color: var(--theme-text);
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
  background-color: var(--theme-surface-2);
  color: var(--theme-accent);
}

/* ---- Page header ---- */
html[data-theme="dark"] .page-header {
  background: var(--theme-surface-2);
  border-bottom-color: var(--theme-border) !important;
}

/* ---- Cards & service tiles ---- */
html[data-theme="dark"] .service-item {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}

html[data-theme="dark"] .service-item:hover {
  background: #0b0c10;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .list-group-item {
  background-color: var(--theme-surface);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
  background-color: var(--theme-surface-2);
  border-color: var(--theme-border);
}

/* ---- Tables ---- */
html[data-theme="dark"] .table {
  color: var(--theme-text);
  --bs-table-bg: transparent;
  --bs-table-color: var(--theme-text);
}

html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .table-bordered,
html[data-theme="dark"] .table-bordered th,
html[data-theme="dark"] .table-bordered td {
  border-color: var(--theme-border);
}

/* ---- Forms ---- */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .custom-select {
  background-color: var(--theme-surface-2);
  border-color: #474c58;
  color: var(--theme-heading);
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
  background-color: var(--theme-surface-2);
  color: var(--theme-heading);
}

/* Contact & careers inputs use "bg-light border-0" (both !important) */
html[data-theme="dark"] .form-control.bg-light {
  background-color: var(--theme-surface-2) !important;
  box-shadow: inset 0 0 0 1px #474c58;
}

html[data-theme="dark"] .form-control.bg-light:focus {
  box-shadow: inset 0 0 0 1px var(--theme-accent);
}

html[data-theme="dark"] .form-control::placeholder {
  color: var(--theme-muted);
}

html[data-theme="dark"] .form-control:disabled,
html[data-theme="dark"] .form-control[readonly] {
  background-color: var(--theme-surface);
}

html[data-theme="dark"] .btn-dark {
  background-color: var(--theme-surface-2);
  border-color: var(--theme-border);
}

html[data-theme="dark"] .btn-outline-dark,
html[data-theme="dark"] .btn-outline-secondary {
  color: var(--theme-heading);
  border-color: var(--theme-muted);
}

/* ---- Google Maps embeds ----
   Basic embeds can't be restyled, so invert and rotate the hue back */
html[data-theme="dark"] iframe[src*="google.com/maps"] {
  filter: invert(90%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* ---- Clientele slider / image scroller ---- */
html[data-theme="dark"] .wrapper {
  border-bottom-color: var(--theme-border);
}

html[data-theme="dark"] .scroller-dot { background: #4a4f5a; }
html[data-theme="dark"] .scroller-dot.active { background: var(--theme-heading); }

/* ---- Case study layout ---- */
html[data-theme="dark"] .placeholder-banner {
  background: #33290a;
  color: #f5d77a;
  border-color: #5c4a12;
}

html[data-theme="dark"] .cs-title,
html[data-theme="dark"] .cs-section-title,
html[data-theme="dark"] .cs-meta dd,
html[data-theme="dark"] .cs-quote p {
  color: var(--theme-heading);
}

html[data-theme="dark"] .cs-summary,
html[data-theme="dark"] .cs-body p,
html[data-theme="dark"] .cs-body li {
  color: var(--theme-text);
}

html[data-theme="dark"] .cs-eyebrow,
html[data-theme="dark"] .cs-stat .label,
html[data-theme="dark"] .cs-meta dt,
html[data-theme="dark"] .cs-quote .attribution {
  color: var(--theme-muted);
}

html[data-theme="dark"] .cs-stats,
html[data-theme="dark"] .cs-meta {
  border-color: var(--theme-border);
}

html[data-theme="dark"] .cs-stat .num { color: #6ea8fe; }
html[data-theme="dark"] .cs-quote { border-left-color: #6ea8fe; }

html[data-theme="dark"] .cs-vertical-nav .nav-link {
  background: var(--theme-surface);
  color: var(--theme-text);
}

html[data-theme="dark"] .cs-vertical-nav .nav-link:hover {
  background: var(--theme-surface-2);
}

html[data-theme="dark"] .cs-vertical-nav .nav-link.active {
  background: var(--theme-accent);
  color: #fff;
}

/* ---- Careers form ---- */
html[data-theme="dark"] .career-form label { color: var(--theme-heading); }

html[data-theme="dark"] .career-form .required-hint,
html[data-theme="dark"] .career-form .form-text,
html[data-theme="dark"] .wizard-step-label,
html[data-theme="dark"] .resume-drop-hint,
html[data-theme="dark"] .resume-drop .fa-file-upload,
html[data-theme="dark"] .resume-file .file-size,
html[data-theme="dark"] .resume-file .file-remove {
  color: var(--theme-muted);
}

html[data-theme="dark"] .career-form .form-control:focus { background-color: var(--theme-surface-2); }
html[data-theme="dark"] .career-form.was-validated .form-control:invalid { background-color: #2a1619; }

html[data-theme="dark"] .resume-drop {
  background: var(--theme-surface);
  border-color: #4a4f5a;
}

html[data-theme="dark"] .resume-drop.is-dragover { background: #172238; }

html[data-theme="dark"] .resume-file {
  background: var(--theme-surface);
  border-color: var(--theme-border);
}

html[data-theme="dark"] .resume-file .file-icon { color: var(--theme-text); }
html[data-theme="dark"] .resume-file .file-name { color: var(--theme-heading); }
html[data-theme="dark"] .resume-file .file-state.attached { color: #75b798; }
html[data-theme="dark"] .resume-file .file-state.rejected,
html[data-theme="dark"] .resume-file .file-remove:hover { color: #ea868f; }

html[data-theme="dark"] .resume-progress,
html[data-theme="dark"] .wizard-progress { background: var(--theme-surface-2); }

html[data-theme="dark"] .form-note.ok { background: #0f2a1e; color: #75b798; }
html[data-theme="dark"] .form-note.err { background: #2c0b0e; color: #ea868f; }

/* ---- Contact / careers success modal ---- */
html[data-theme="dark"] .amg-modal-box { background: var(--theme-surface); }
html[data-theme="dark"] .amg-modal-box p { color: var(--theme-text); }
html[data-theme="dark"] .amg-modal-close:hover { color: var(--theme-heading); }

/* ---- Knowledge center ---- */
html[data-theme="dark"] .main-content { background-color: var(--theme-bg); }

html[data-theme="dark"] .section-title,
html[data-theme="dark"] .article-title,
html[data-theme="dark"] .support-box h3,
html[data-theme="dark"] .quick-links-box h3 {
  color: var(--theme-heading);
}

html[data-theme="dark"] .article-title:hover { color: #6ea8fe; }

html[data-theme="dark"] .links-grid a,
html[data-theme="dark"] .support-box p { color: var(--theme-text); }

html[data-theme="dark"] .links-grid a:hover { color: var(--theme-accent); }

html[data-theme="dark"] .support-box {
  background-color: #2a2614;
  border-color: #4d4520;
}

html[data-theme="dark"] .quick-links-box { border-color: var(--theme-border); }

html[data-theme="dark"] .tag {
  background: var(--theme-surface);
  border-color: var(--theme-border);
  color: var(--theme-text);
}

html[data-theme="dark"] .tag:hover { background: var(--theme-surface-2); }

/* ---- Privacy policy ---- */
html[data-theme="dark"] .policy h3 { color: var(--theme-purple); }
html[data-theme="dark"] .policy li { color: var(--theme-text); }
html[data-theme="dark"] .policy .meta { color: var(--theme-muted); }
html[data-theme="dark"] .policy .toc { background: var(--theme-surface); border-left-color: var(--theme-purple); }
html[data-theme="dark"] .policy table th { background: var(--theme-surface-2); }

/* Smooth switch (skipped on first paint, see js/theme.js) */
html.theme-ready body,
html.theme-ready .bg-white,
html.theme-ready .service-item,
html.theme-ready .dropdown-menu {
  transition: background-color .3s ease, color .3s ease;
}
