/* Load after the page styles. Preferences improve the existing view; they do not
   replace keyboard support, readable defaults or an accessibility audit. */
.a11yPanel {
  width: min(22rem, calc(100vw - 2rem));
  min-width: 0;
  max-height: min(38rem, calc(100dvh - 7rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.a11yOption, .a11yResizeBtn {
  font: inherit;
  font-size: .875rem;
  line-height: 1.4;
  min-height: 44px;
  overflow-wrap: anywhere;
}
.a11yToggle, .navToggle { min-height: 44px; }
.a11yScaleHint { line-height: 1.5; }
.a11yPanel :focus-visible,
:where(a, button, summary, input, textarea, select, [tabindex]):focus-visible,
.contactForm .field input:focus-visible,
.contactForm .field textarea:focus-visible {
  outline: 3px solid #0b6b70;
  outline-offset: 3px;
  box-shadow: 0 0 0 3px #fff;
}
.contactForm .field input:focus,
.contactForm .field textarea:focus {
  outline-color: #0b6b70;
  border-color: #0b6b70;
}
/* Increasing text must allow the existing card grids to reflow. */
html[data-a11y-text="step-2"] .reviewsGrid,
html[data-a11y-text="step-3"] .reviewsGrid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
}
html[data-a11y-text="step-3"] :is(.reviewTop, .sourceRow, .heroPhotoCard figcaption) {
  flex-wrap: wrap;
}
html[data-a11y-text="step-3"] :is(.heroPanel h1, .heroStrong, .heroAccent) {
  overflow-wrap: anywhere;
}
@media (max-width: 900px) {
  .a11yPanel { width: auto; max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 110px); }
}
@media (min-width: 961px) {
  html:is([data-a11y-text="step-2"], [data-a11y-text="step-3"]) .nav {
    display: grid;
    grid-template-columns: 364px minmax(0, 1fr) auto;
  }
  html:is([data-a11y-text="step-2"], [data-a11y-text="step-3"]) .navlinks {
    min-width: 0;
    max-width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
  html:is([data-a11y-text="step-2"], [data-a11y-text="step-3"]) .navlinks a {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* Use actual palettes instead of filtering the document. In particular the
   photos, diagrams and original brochure artwork retain their original colors.
   System forced colors take precedence over both optional website palettes. */
@media (forced-colors: none) {
  html[data-a11y-invert="on"] {
    color-scheme: dark;
    --bg: #11161b;
    --surface: #1b242c;
    --ink: #f5f7fa;
    --muted: #d4dde5;
    --line: #8d9caa;
    --teal-700: #b3e6ec;
    --teal-600: #b3e6ec;
    --mint-500: #b3e6ec;
    --mint-200: #26343f;
    --sky-200: #26343f;
    --sun-200: #26343f;
    --a11y-selected: #344956;
    --a11y-focus: #fff;
    --shadow: none;
  }
  html[data-a11y-contrast="high"] {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --ink: #000;
    --muted: #000;
    --line: #000;
    --teal-700: #000;
    --teal-600: #000;
    --mint-500: #000;
    --mint-200: #fff;
    --sky-200: #fff;
    --sun-200: #fff;
    --a11y-selected: #e8e8e8;
    --a11y-focus: #000;
    --shadow: none;
  }
  html[data-a11y-invert="on"] .brand {
    background: #fff !important;
    border: 1px solid #fff;
    border-radius: 8px;
    padding: 6px;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) body {
    color: var(--ink);
    background: var(--bg) !important;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) body :where(
    h1, h2, h3, h4, h5, h6, p, li, dt, dd, span, strong, small, label,
    summary, output, blockquote, figcaption, a, button, input, textarea, select,
    .heroPanel, .heroMeta, .heroMini, .eyebrow, .accent, .sub, .small,
    .reviewMeta, .policyCompactBody,
    .a11yLabel, .a11yScaleHint, .doctor .name, .doctor .title,
    .breadthBreadcrumb, .breadthEyebrow, .breadthSmall, .breadthSource
  ) {
    color: var(--ink) !important;
    text-shadow: none !important;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    header, footer, .navlinks, .navMoreMenu, .a11yPanel, .a11yToggle,
    .a11yToggleMark, .a11yResizeBtn, .a11yScaleValue, .a11yOption,
    .heroFull, .heroPhotoCard figcaption, .pillTop, .metaIcon,
    .card, .asideCard, .badge, .chip, .avatar, .sourceRow, .reviewSummary,
    .faqItem, .ctaCard, .mapCard, .mapConsentPlaceholder, .widgetConsentPlaceholder,
    .contactFormCard, .contactFormStatus, .contactForm .field input,
    .contactForm .field textarea, .contactTurnstile,
    .cookieCard, .cookieCategory, .cookieMark, .cookieClose, .cookieSwitchTrack,
    .policyCompactDetails, .policyBtn, .policyCompact,
    .stopBangCard, .stopBangResult, .stopBangChoice, .airQualityPanel,
    .airQualityMeter, .airScalePanel, .airTipsPanel, .pmGuideCard,
    .breadthDialog, .breadthHero, .breadthFacts, .breadthNotice,
    .breadthContact, .breadthEntry, .breadthClose, .breadthTranscript,
    .reviewArrow, .airQualityFloat, .airQualityFloatIcon
  ) {
    color: var(--ink) !important;
    background: var(--surface) !important;
    border-color: var(--line) !important;
    box-shadow: none !important;
    backdrop-filter: none;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(.band, .policySection)::before {
    background: var(--bg) !important;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) .band::after,
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(.heroFull, .card)::before,
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(.ringA, .ringB, .ringC) {
    display: none !important;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .cta, .ctaWide, .btnHero, .stopBangBtn, .cookieActionBtn, .cookieInlineBtn,
    .navToggle, .navContact, .navMore summary, .floatCallBtn, .floatCallIcon,
    .breadthSecondary, .policyBtn, .reviewArrow
  ) {
    color: var(--ink) !important;
    background: var(--surface) !important;
    border: 2px solid var(--line) !important;
    box-shadow: none !important;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .a11yOption[aria-pressed="true"], .a11yStep[aria-pressed="true"],
    button[aria-current="page"], .reviewArrow:hover:not([aria-disabled="true"]),
    .navMoreMenu a:hover
  ) {
    background: var(--a11y-selected) !important;
    border-color: var(--ink) !important;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .breadthDialog, .breadthHero, .breadthFacts, .breadthNotice,
    .breadthContact, .breadthEntry, .card, .a11yPanel, .cookieCard
  ) { border: 1px solid var(--line) !important; }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .breadthNotice, .contactForm .field input, .contactForm .field textarea
  ) { border-color: var(--line) !important; }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .a11yToggleMark svg, .metaIcon svg, .avatar svg, .floatCallIcon svg,
    .mapConsentIcon svg, .cookieMark svg, .stars svg, .starsInline svg
  ) { color: var(--ink) !important; stroke: currentColor !important; }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :where(
    .stars svg path, .starsInline svg path
  ) { fill: var(--ink) !important; }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) input::placeholder,
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) textarea::placeholder {
    color: var(--muted) !important;
    opacity: 1;
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) .cookieSwitchTrack::after {
    background: var(--ink) !important;
    border: 1px solid var(--bg);
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) .cookieSwitch input:checked + .cookieSwitchTrack {
    background: var(--a11y-selected) !important;
    outline: 1px solid var(--ink);
  }
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) :focus-visible,
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) .contactForm .field input:focus,
  :is(html[data-a11y-invert="on"], html[data-a11y-contrast="high"]) .contactForm .field textarea:focus {
    outline: 3px solid var(--a11y-focus) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 3px var(--bg) !important;
  }
}

/* Honor the device preference even before someone opens the settings panel. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
html[data-a11y-motion="reduce"] { scroll-behavior: auto !important; }
html[data-a11y-motion="reduce"] .reveal { opacity: 1; transform: none; }
@media (forced-colors: active) {
  /* Keep Windows/browser user-selected colors instead of replacing them. */
  html { color-scheme: light dark; }
  body { color: CanvasText; background: Canvas; }
  header, .a11yPanel, .cookieCard, .breadthDialog { border: 1px solid CanvasText; }
  .a11yOption[aria-pressed="true"] { outline: 2px solid Highlight; outline-offset: -3px; text-decoration: underline; }
  :focus-visible, .contactForm .field input:focus, .contactForm .field textarea:focus {
    outline: 3px solid Highlight !important;
    outline-offset: 3px;
    box-shadow: none !important;
  }
  .cookieSwitchTrack { border: 1px solid ButtonText; }
  .cookieSwitch input:checked + .cookieSwitchTrack { outline: 2px solid Highlight; }
  .cookieSwitch input:focus-visible + .cookieSwitchTrack { outline: 3px solid Highlight; outline-offset: 3px; }
}

/* Keep the settings unobscured by floating shortcuts while the panel is open. */
body:has(.a11yPanel:not([hidden])) :is(.airQualityFloat, .floatCall) { visibility: hidden; }
.a11yResizeBtn { white-space: nowrap; }
.a11yResize { grid-template-columns: auto minmax(0, 1fr) auto; }
html[data-a11y-text] :is(h1, h2, h3, h4, p, li, .name, .title, .footerLinks a) { overflow-wrap: anywhere; }
html[data-a11y-text] .doctor > div { min-width: 0; }
@media (max-width: 680px) {
  html[data-a11y-text="step-2"] .doctor.hasPhoto,
  html[data-a11y-text="step-3"] .doctor.hasPhoto { grid-template-columns: minmax(0, 1fr); }
}
