/*
 * Final contrast layer for the user-selectable Light and Dark modes.
 * This file is loaded after every page stylesheet so page-specific colours
 * cannot wash out reading text. Normal mode is intentionally untouched.
 */

body.tma-view-light{
  color-scheme:light;
  --tma-mode-bg:#fff;
  --tma-mode-surface:#eef2f5;
  --tma-mode-input:#fff;
  --tma-mode-text:#001b44;
  --tma-mode-muted:#30475b;
  --tma-mode-border:#71869a;
  --tma-mode-accent:#71480b;
  --tma-mode-button-bg:#001b44;
  --tma-mode-button-text:#fff;
  --tma-mode-watermark:rgba(0,27,68,.055);
}

body.tma-view-dark{
  color-scheme:dark;
  --tma-mode-bg:#071a2d;
  --tma-mode-surface:#102c45;
  --tma-mode-input:#071a2d;
  --tma-mode-text:#f7f5f0;
  --tma-mode-muted:#d0d9e2;
  --tma-mode-border:#70889d;
  --tma-mode-accent:#f2cd91;
  --tma-mode-button-bg:#f2cd91;
  --tma-mode-button-text:#001b44;
  --tma-mode-watermark:rgba(255,255,255,.065);
}

body:is(.tma-view-light,.tma-view-dark),
body:is(.tma-view-light,.tma-view-dark) main,
body:is(.tma-view-light,.tma-view-dark) .tma-home-v140,
body:is(.tma-view-light,.tma-view-dark) .tma-about-v203,
body:is(.tma-view-light,.tma-view-dark) .replica-team-page,
body:is(.tma-view-light,.tma-view-dark) .member-profile-v2,
body:is(.tma-view-light,.tma-view-dark) .contact-page,
body:is(.tma-view-light,.tma-view-dark) .tma-contact-v2020,
body:is(.tma-view-light,.tma-view-dark) .insights-directory-page,
body:is(.tma-view-light,.tma-view-dark) .focus-landing-page,
body:is(.tma-view-light,.tma-view-dark) .focus-single-page,
body:is(.tma-view-light,.tma-view-dark) .tma-project-page{
  background:var(--tma-mode-bg)!important;
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  section,article,aside,
  .elementor-section,.e-con,.elementor-widget-container,
  [class*="-section"],[class*="-hero"],[class*="-newsletter"],[class*="-cta"]
){
  background-color:var(--tma-mode-bg)!important;
  background-image:none!important;
  border-color:var(--tma-mode-border)!important;
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-home-v140 .tma-section{
  --tma-section-bg:var(--tma-mode-bg)!important;
  background:var(--tma-mode-bg)!important;
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-home-v140 .tma-section::before{
  background:var(--tma-mode-bg)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  [class*="-card"],[class*="-panel"],[class*="-rail"],[class*="-stage"],
  [class*="-form"],[class*="-filter"],.practice-card,.home-insight-grid article,
  .values-list article,.expertise-map article,.change-path article
){
  background-color:var(--tma-mode-surface)!important;
  background-image:none!important;
  border-color:var(--tma-mode-border)!important;
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(h1,h2,h3,h4,h5,h6,strong,b),
body:is(.tma-view-light,.tma-view-dark) main :is(h1,h2,h3,h4,h5,h6) :is(span,em,strong,b){
  color:var(--tma-mode-text)!important;
  text-shadow:none!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  p,li,dt,dd,blockquote,figcaption,label,legend,small,span,
  .hero-summary,.section-lede,.team-profile-bio,.member-content,
  [class$="-summary"],[class$="-description"],[class$="-excerpt"],
  [class$="-lede"],[class$="-intro"],[class*="-copy"]
){
  color:var(--tma-mode-muted)!important;
  text-shadow:none!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  [class*="-card"],[class*="-panel"],[class*="-rail"],[class*="-stage"],
  [class*="-form"],[class*="-filter"]
) :is(p,li,dd,figcaption,small,span){
  color:var(--tma-mode-muted)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  [class*="-card"],[class*="-panel"],[class*="-rail"],[class*="-stage"],
  [class*="-form"],[class*="-filter"]
) :is(h1,h2,h3,h4,h5,h6,strong,b){
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  .classic-kicker,.home-kicker,.tma-part-kicker,.tma-side-kicker,
  [class*="eyebrow"],[class*="-meta"],[class*="-category"]
){
  color:var(--tma-mode-accent)!important;
}

body:is(.tma-view-light,.tma-view-dark) main a:not(.gold-button):not(.navy-button):not([class*="button"]):not([class*="btn"]){
  color:var(--tma-mode-accent)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  .gold-button,.navy-button,.tma-global-footer-button,
  .focus-button,.tma-project-button,.tma-custom-button,
  button[type="submit"],input[type="submit"]
){
  background:var(--tma-mode-button-bg)!important;
  border-color:var(--tma-mode-button-bg)!important;
  color:var(--tma-mode-button-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) main :is(
  .gold-button,.navy-button,.tma-global-footer-button,
  .focus-button,.tma-project-button,.tma-custom-button,
  button[type="submit"]
) :is(span,strong,b,em){color:var(--tma-mode-button-text)!important}

/* Editorial card links remain links, rather than becoming thin filled bars. */
body:is(.tma-view-light,.tma-view-dark) main .tma-home-v140 .practice-card .tma-part-button{
  width:auto!important;
  min-height:44px;
  margin-top:18px!important;
  padding:13px 0 0!important;
  border:0!important;
  border-top:1px solid var(--tma-mode-border)!important;
  border-radius:0!important;
  display:flex!important;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  background:transparent!important;
  box-shadow:none!important;
  color:var(--tma-mode-accent)!important;
}

body:is(.tma-view-light,.tma-view-dark) main .tma-home-v140 .practice-card .tma-part-button span{
  color:inherit!important;
  transition:transform .2s ease;
}

body:is(.tma-view-light,.tma-view-dark) main .tma-home-v140 .practice-card .tma-part-button:hover span,
body:is(.tma-view-light,.tma-view-dark) main .tma-home-v140 .practice-card .tma-part-button:focus-visible span{
  transform:translateX(4px);
}

body:is(.tma-view-light,.tma-view-dark) :is(input,select,textarea){
  background:var(--tma-mode-input)!important;
  color:var(--tma-mode-text)!important;
  border-color:var(--tma-mode-border)!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(input,select,textarea)::placeholder{
  color:var(--tma-mode-muted)!important;
  opacity:1!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(
  .tma-global-info-bar,.tma-global-navigation,
  .classic-header,.blog-header,.team-header,.about-header
){
  background:var(--tma-mode-surface)!important;
  color:var(--tma-mode-text)!important;
  border-color:var(--tma-mode-border)!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(
  .tma-global-info-bar,.tma-global-navigation,
  .classic-header,.blog-header,.team-header,.about-header
) :is(a,button,span,strong,small){
  color:var(--tma-mode-text)!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(.tma-global-footer-main,.tma-global-footer-bottom,footer){
  background:var(--tma-mode-surface)!important;
  color:var(--tma-mode-text)!important;
  border-color:var(--tma-mode-border)!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(.tma-global-footer-main,.tma-global-footer-bottom,footer) :is(p,span,small){
  color:var(--tma-mode-muted)!important;
}

body:is(.tma-view-light,.tma-view-dark) :is(.tma-global-footer-main,.tma-global-footer-bottom,footer) :is(a,b,strong){
  color:var(--tma-mode-text)!important;
}

/* About page variables are kept in sync with the selected contrast mode. */
body:is(.tma-view-light,.tma-view-dark) .tma-about-v203 .tma-about-section{
  --tma-about-surface:var(--tma-mode-bg)!important;
  --tma-about-title:var(--tma-mode-text)!important;
  --tma-about-copy:var(--tma-mode-muted)!important;
  --tma-about-kicker:var(--tma-mode-accent)!important;
  --tma-about-crumb:var(--tma-mode-muted)!important;
  --tma-about-line:var(--tma-mode-border)!important;
  --tma-about-soft-panel:var(--tma-mode-surface)!important;
  --tma-about-watermark:var(--tma-mode-watermark)!important;
  --tma-about-gold:var(--tma-mode-accent)!important;
  background:var(--tma-mode-bg)!important;
  color:var(--tma-mode-text)!important;
}

/* Hero photography stays visible but cannot reduce text contrast. */
body:is(.tma-view-light,.tma-view-dark) main :is(
  .replica-hero,.about-hero,.contact-hero,.team-hero,.blog-index-hero,
  .insights-directory-hero,.magazine-hero,.member-hero,
  .focus-landing-hero,.focus-single-hero,.tma-project-hero
) img{opacity:.24!important}

body.tma-view-dark main :is(
  .replica-hero,.about-hero,.contact-hero,.team-hero,.blog-index-hero,
  .insights-directory-hero,.magazine-hero,.member-hero,
  .focus-landing-hero,.focus-single-hero,.tma-project-hero
) img{opacity:.30!important}

/* Profile and article photography is content, so it stays fully visible. */
body:is(.tma-view-light,.tma-view-dark) main.member-profile-v2 :is(.member-hero-photo img,.member-next img),
body:is(.tma-view-light,.tma-view-dark) main.article-page :is(.magazine-hero>img,.related-articles img){
  display:block!important;
  visibility:visible!important;
  opacity:1!important;
}

body:is(.tma-view-light,.tma-view-dark) main.article-page .magazine-hero-shade{
  background:linear-gradient(90deg,rgba(0,27,68,.92),rgba(0,27,68,.68) 48%,rgba(0,27,68,.12) 82%)!important;
}

@media(max-width:600px){
  body:is(.tma-view-light,.tma-view-dark) main.article-page .magazine-hero-shade{
    background:linear-gradient(0deg,rgba(0,27,68,.95),rgba(0,27,68,.64) 48%,rgba(0,27,68,.1) 82%)!important;
  }
}

/* Known display lettering stays intentionally faint in both modes. */
body:is(.tma-view-light,.tma-view-dark) main :is(
  .about-hero-art>b,.member-about-portrait>span,.team-portrait-mark,
  .team-portrait-word,.home-review-mark,.member-hero h1
){color:var(--tma-mode-watermark)!important}

body:is(.tma-view-light,.tma-view-dark) main :is(
  .closing-cta,.team-cta,.team-join-cta,.about-closing,.blog-index-hero,
  .contact-hero,.contact-closing,.insights-directory-newsletter,
  .contact-newsletter,.focus-single-hero-media
)::after{color:var(--tma-mode-watermark)!important}

/* The accessibility control remains visually stable in every page mode. */
body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-launcher{
  background:#005ca8!important;
  color:#fff!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-launcher:hover,
body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-launcher[aria-expanded="true"]{
  background:#001b44!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools,
body:is(.tma-view-light,.tma-view-dark) .tma-display-mode-options{
  background:#fff!important;
  color:#001b44!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools button,
body:is(.tma-view-light,.tma-view-dark) .tma-display-mode-options button{
  background:#fff!important;
  color:#001b44!important;
  border-color:rgba(0,27,68,.22)!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools button:hover,
body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools button[aria-pressed="true"],
body:is(.tma-view-light,.tma-view-dark) .tma-display-mode-options button:hover,
body:is(.tma-view-light,.tma-view-dark) .tma-display-mode-options button[aria-pressed="true"]{
  background:#001b44!important;
  color:#fff!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control{
  background:#fff!important;
  color:#001b44!important;
  border-color:rgba(0,27,68,.22)!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control output{
  color:#001b44!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control button{
  background:#e4e8f6!important;
  color:#001b44!important;
  border:0!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control button:hover,
body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control button:focus-visible{
  background:#001b44!important;
  color:#fff!important;
}

body:is(.tma-view-light,.tma-view-dark) .tma-accessibility-tools .tma-zoom-control button:disabled{
  background:#eef0f5!important;
  color:#74808c!important;
}
