/* v41: complete theme contrast, resilient header sizing, mobile dark-mode coverage */
:root {
  --aa-v41-dark-bg: #050d20;
  --aa-v41-dark-surface: #0b1b39;
  --aa-v41-dark-surface-2: #10264e;
  --aa-v41-dark-text: #f2f6ff;
  --aa-v41-dark-muted: #c5d2e8;
  --aa-v41-dark-gold: #f2d36f;
  --aa-v41-dark-line: rgba(210, 224, 255, .24);
}

/* Keep the complete name visible without shrinking the whole website. */
#root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child,
.v35-brand { min-width: 0; }
#root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child > div:last-child,
#root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display {
  overflow: visible !important;
  text-overflow: clip !important;
}
#root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display {
  white-space: nowrap !important;
  font-size: 16px !important;
  letter-spacing: 0 !important;
}

/* Explicit header contrast: inline legacy colours must not win in dark mode. */
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 span.font-display,
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 ul a,
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 button[aria-label="Toggle menu"],
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 a[href="/login"] {
  color: var(--aa-v41-dark-gold) !important;
}
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-body,
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-body span {
  color: var(--aa-v41-dark-muted) !important;
}
html[data-theme="dark"] #root nav.fixed.left-0.right-0.z-50 a[href="/login"] {
  background: rgba(12, 31, 66, .92) !important;
  border-color: rgba(242, 211, 111, .52) !important;
}

/* Complete React/static content dark theme. */
html[data-theme="dark"] #root section:not(#home):not(#judgments),
html[data-theme="dark"] #root section:not(#home):not(#judgments) article,
html[data-theme="dark"] #root section:not(#home):not(#judgments) details,
html[data-theme="dark"] #root section:not(#home):not(#judgments) [class*="rounded-"] {
  border-color: var(--aa-v41-dark-line);
}
html[data-theme="dark"] #root section:not(#home):not(#judgments) :is(h1,h2,h3,h4),
html[data-theme="dark"] #client-first-service-standards h2,
html[data-theme="dark"] #senior-citizen-will-assistance h2,
html[data-theme="dark"] .blog-preview-v38 h2,
html[data-theme="dark"] .blog-preview-v38 h3 a,
html[data-theme="dark"] .aa-profile-bridge h2 {
  color: var(--aa-v41-dark-gold) !important;
}
html[data-theme="dark"] #root section:not(#home):not(#judgments) :is(p,li,small,label,legend,summary),
html[data-theme="dark"] #client-first-service-standards p,
html[data-theme="dark"] #senior-citizen-will-assistance p,
html[data-theme="dark"] .blog-preview-v38__copy > p:not(.blog-preview-v38__meta),
html[data-theme="dark"] .aa-profile-bridge p {
  color: var(--aa-v41-dark-text) !important;
}
html[data-theme="dark"] #root section:not(#home):not(#judgments) :is(.text-gold,[class*="text-gold"],.kicker,.standards-kicker,.bail-kicker-v40),
html[data-theme="dark"] .blog-preview-v38__eyebrow,
html[data-theme="dark"] .blog-preview-v38__meta {
  color: var(--aa-v41-dark-gold) !important;
}

/* Correct legacy inline navy and muted colours seen in the supplied screenshot. */
html[data-theme="dark"] #root [style*="color: hsl(var(--navy))"],
html[data-theme="dark"] #root [style*="color: rgb(12, 26, 74)"],
html[data-theme="dark"] #root [style*="color: rgb(30, 58, 138)"] {
  color: var(--aa-v41-dark-gold) !important;
}
html[data-theme="dark"] #root [style*="color: rgb(50, 66, 103)"],
html[data-theme="dark"] #root [style*="color: rgb(71, 82, 107)"],
html[data-theme="dark"] #root [style*="color: rgb(102, 117, 153)"],
html[data-theme="dark"] #root [style*="color: rgb(66, 88, 138)"],
html[data-theme="dark"] #root [style*="color: rgb(92, 106, 138)"],
html[data-theme="dark"] #root [style*="color: rgb(86, 99, 129)"],
html[data-theme="dark"] #root [style*="color: rgb(94, 108, 141)"],
html[data-theme="dark"] #root [style*="color: rgb(123, 133, 157)"],
html[data-theme="dark"] #root [style*="color: rgb(45, 56, 83)"],
html[data-theme="dark"] #root [style*="color: rgb(70, 84, 115)"],
html[data-theme="dark"] #root [style*="color: rgb(75, 99, 155)"] {
  color: var(--aa-v41-dark-muted) !important;
}

html[data-theme="dark"] #root :is(.bg-white,.bg-blue-50,.bg-slate-50,.bg-gray-50),
html[data-theme="dark"] #root [class*="bg-blue-50"],
html[data-theme="dark"] #root [class*="bg-slate-50"],
html[data-theme="dark"] #root [class*="bg-gray-50"],
html[data-theme="dark"] #root [style*="background: rgb(255, 255, 255)"],
html[data-theme="dark"] #root [style*="background: #fff"] {
  background: var(--aa-v41-dark-surface) !important;
  color: var(--aa-v41-dark-text) !important;
  border-color: var(--aa-v41-dark-line) !important;
}
html[data-theme="dark"] #root :is(.text-blue-900,.text-blue-800,.text-slate-900,.text-gray-900) {
  color: var(--aa-v41-dark-gold) !important;
}
html[data-theme="dark"] #root :is(.text-blue-700,.text-blue-600,.text-slate-700,.text-gray-700,.text-gray-600) {
  color: var(--aa-v41-dark-muted) !important;
}
html[data-theme="dark"] #root :is(.border-blue-200,.border-slate-200,.border-gray-200) {
  border-color: var(--aa-v41-dark-line) !important;
}
html[data-theme="dark"] #client-first-service-standards,
html[data-theme="dark"] #senior-citizen-will-assistance,
html[data-theme="dark"] .blog-preview-v38,
html[data-theme="dark"] .aa-profile-bridge,
html[data-theme="dark"] .ai-trust-strip {
  background: var(--aa-v41-dark-bg) !important;
  color: var(--aa-v41-dark-text) !important;
}
html[data-theme="dark"] #client-first-service-standards > *,
html[data-theme="dark"] #senior-citizen-will-assistance > *,
html[data-theme="dark"] .blog-preview-v38__card,
html[data-theme="dark"] .aa-profile-bridge {
  border-color: var(--aa-v41-dark-line) !important;
}

/* Static pages and blog controls. */
html[data-theme="dark"] :is(input,select,textarea) {
  background: #07152f !important;
  color: var(--aa-v41-dark-text) !important;
  border-color: var(--aa-v41-dark-line) !important;
}
html[data-theme="dark"] :is(input,textarea)::placeholder { color: #9fb0ca !important; opacity: 1; }
html[data-theme="dark"] .v35-header,
html[data-theme="dark"] .v35-mobile-panel { background: rgba(5, 17, 42, .97) !important; }
html[data-theme="dark"] .v35-header a,
html[data-theme="dark"] .v35-header button { color: var(--aa-v41-dark-text); }
html[data-theme="dark"] .v35-header .nav-cta { color: #071638 !important; }

@media (min-width: 1024px) {
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child {
    flex: 0 1 clamp(300px, 24vw, 430px) !important;
    min-width: 300px !important;
    overflow: visible !important;
  }
}
@media (min-width: 1024px) and (max-width: 1399px) {
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child {
    flex-basis: 300px !important;
    min-width: 300px !important;
  }
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display {
    font-size: 15px !important;
  }
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-body,
  #root nav.fixed.left-0.right-0.z-50 > div.container > div:last-child > a[href="/login"] {
    display: none !important;
  }
  #root nav.fixed.left-0.right-0.z-50 ul a { font-size: 9px !important; padding-inline: .32rem !important; }
}
@media (min-width: 1600px) {
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display { font-size: 18px !important; }
}
@media (max-width: 1023px) {
  #root nav.fixed.left-0.right-0.z-50 > div.container { padding-inline: 12px !important; }
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child {
    max-width: calc(100vw - 176px) !important;
    overflow: visible !important;
    gap: 8px !important;
  }
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display {
    max-width: calc(100vw - 228px) !important;
    white-space: normal !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
    font-size: clamp(12px, 3.7vw, 15px) !important;
    line-height: 1.08 !important;
  }
  html[data-theme="dark"] #mobile-quick-topics,
  html[data-theme="dark"] #mobile-quick-topics .qt-grid a {
    background: var(--aa-v41-dark-surface) !important;
    color: var(--aa-v41-dark-text) !important;
    border-color: var(--aa-v41-dark-line) !important;
  }
  html[data-theme="dark"] #mobile-quick-topics .qt-title,
  html[data-theme="dark"] #mobile-quick-topics .qt-confidence { color: var(--aa-v41-dark-gold) !important; }
  html[data-theme="dark"] :is(#mobile-appointment-bar,.swipe-book-track,.mobile-consultation-popup,.mobile-consultation-card) {
    background-color: var(--aa-v41-dark-surface) !important;
    color: var(--aa-v41-dark-text) !important;
    border-color: var(--aa-v41-dark-line) !important;
  }
}
@media (max-width: 360px) {
  #root nav.fixed.left-0.right-0.z-50 > div.container > a:first-child span.font-display {
    max-width: 126px !important;
    font-size: 12px !important;
  }
}
